Pipeline-DHW3SLJM.js 124 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011
  1. import {
  2. c as c5,
  3. r as r4,
  4. v as v2
  5. } from "./chunk-ZELEU5PN.js";
  6. import "./chunk-O7E4VYJT.js";
  7. import "./chunk-AIG57VB7.js";
  8. import {
  9. q as q2
  10. } from "./chunk-C4RSV5VB.js";
  11. import {
  12. t as t4
  13. } from "./chunk-F3LIGR7J.js";
  14. import {
  15. c as c4,
  16. l as l3,
  17. r as r3,
  18. u
  19. } from "./chunk-IY6TL5XB.js";
  20. import {
  21. b as b3
  22. } from "./chunk-PHAKVYRM.js";
  23. import {
  24. s as s7
  25. } from "./chunk-22KBQSDB.js";
  26. import {
  27. n as n4,
  28. s as s6
  29. } from "./chunk-XBFCIW4K.js";
  30. import "./chunk-T2SKWJGU.js";
  31. import "./chunk-UO3LS2M5.js";
  32. import "./chunk-H2VOWDMO.js";
  33. import "./chunk-QISOH77W.js";
  34. import {
  35. o as o3
  36. } from "./chunk-XO5VJRK4.js";
  37. import "./chunk-EQNT4A7P.js";
  38. import "./chunk-4OM3EX6P.js";
  39. import "./chunk-3OFVLRSL.js";
  40. import "./chunk-JK76NUHI.js";
  41. import "./chunk-A6WD5XTM.js";
  42. import {
  43. Y
  44. } from "./chunk-FSIQKOJP.js";
  45. import "./chunk-OQSZOHTF.js";
  46. import "./chunk-OP2HNSVZ.js";
  47. import "./chunk-UVQJ7AVD.js";
  48. import "./chunk-DMVKVC5I.js";
  49. import "./chunk-Y7BZ6TKQ.js";
  50. import {
  51. f as f4,
  52. g as g2
  53. } from "./chunk-VEJPYAE4.js";
  54. import "./chunk-4GGDRIJK.js";
  55. import "./chunk-PZ7XDUL6.js";
  56. import "./chunk-ULSPZIPE.js";
  57. import {
  58. s as s5
  59. } from "./chunk-UMUHMVL4.js";
  60. import "./chunk-FZSI6IGI.js";
  61. import {
  62. d as d3
  63. } from "./chunk-JJ4RRNEA.js";
  64. import {
  65. h as h2
  66. } from "./chunk-NBKUI76A.js";
  67. import {
  68. i as i2
  69. } from "./chunk-QU433TMZ.js";
  70. import {
  71. l as l2
  72. } from "./chunk-QC7NCR5N.js";
  73. import {
  74. h
  75. } from "./chunk-VQXMCZYH.js";
  76. import "./chunk-JQUWFKNU.js";
  77. import "./chunk-RWQH5X3O.js";
  78. import "./chunk-6334AFGG.js";
  79. import "./chunk-CC74Y7ET.js";
  80. import "./chunk-TFHLTN6F.js";
  81. import {
  82. c as c3,
  83. d as d2
  84. } from "./chunk-ISHZAVNR.js";
  85. import "./chunk-OXF7W4BJ.js";
  86. import {
  87. c as c2,
  88. q
  89. } from "./chunk-XJHQZ4NT.js";
  90. import {
  91. n as n3
  92. } from "./chunk-CFVLY6NB.js";
  93. import "./chunk-B5O7N7PM.js";
  94. import "./chunk-KOKTANE6.js";
  95. import "./chunk-OKUFE7TO.js";
  96. import {
  97. J,
  98. M,
  99. X,
  100. _,
  101. at,
  102. ft,
  103. gt,
  104. lt,
  105. pt,
  106. rt,
  107. w as w2
  108. } from "./chunk-JKFWEHNK.js";
  109. import "./chunk-IIAN3QNN.js";
  110. import "./chunk-P24XEEHY.js";
  111. import "./chunk-WOXHUQGM.js";
  112. import "./chunk-FMPQIGFA.js";
  113. import "./chunk-EDHROVWI.js";
  114. import {
  115. o as o2,
  116. s as s4,
  117. t as t3
  118. } from "./chunk-3IRT3YKJ.js";
  119. import "./chunk-SAJAEMIJ.js";
  120. import {
  121. a as a2,
  122. m as m2,
  123. y as y2
  124. } from "./chunk-IEU3AM37.js";
  125. import {
  126. x
  127. } from "./chunk-WD4J43GZ.js";
  128. import "./chunk-JOYXMSKE.js";
  129. import {
  130. g as g3
  131. } from "./chunk-SZFMKPVM.js";
  132. import {
  133. d
  134. } from "./chunk-YZVAB3DF.js";
  135. import "./chunk-JLYTER4T.js";
  136. import "./chunk-ZSW35JPD.js";
  137. import {
  138. r as r2
  139. } from "./chunk-JLSNMUQJ.js";
  140. import {
  141. G
  142. } from "./chunk-ECY35CJI.js";
  143. import "./chunk-PT62335L.js";
  144. import "./chunk-JGBXYDGB.js";
  145. import "./chunk-QEWF7QPH.js";
  146. import "./chunk-FNA5GLRW.js";
  147. import "./chunk-MCWCB5IY.js";
  148. import {
  149. f as f3,
  150. j as j2,
  151. l
  152. } from "./chunk-TJV6ODRM.js";
  153. import {
  154. j as j3
  155. } from "./chunk-YLEVJ6UV.js";
  156. import "./chunk-U2WD23Z5.js";
  157. import {
  158. T
  159. } from "./chunk-VRLXUHP2.js";
  160. import "./chunk-4ONPMX2F.js";
  161. import "./chunk-CRGY2SDS.js";
  162. import "./chunk-4T5ZGMEN.js";
  163. import "./chunk-CZBRZ6SU.js";
  164. import "./chunk-VGWC3IKZ.js";
  165. import "./chunk-2H5MD622.js";
  166. import "./chunk-3RSFVUKZ.js";
  167. import "./chunk-UVVU4UUO.js";
  168. import "./chunk-X4SA4ELJ.js";
  169. import "./chunk-5N7JLUJJ.js";
  170. import "./chunk-ZLNEXZAN.js";
  171. import "./chunk-ZYRIJWLX.js";
  172. import {
  173. a
  174. } from "./chunk-RYY6632W.js";
  175. import "./chunk-DW42UVIT.js";
  176. import "./chunk-YAEIHDJH.js";
  177. import "./chunk-TJNOJH33.js";
  178. import "./chunk-OSHI574D.js";
  179. import "./chunk-ETGAZ7LF.js";
  180. import "./chunk-75U5LM2V.js";
  181. import "./chunk-RMDDCMKS.js";
  182. import {
  183. v2 as v
  184. } from "./chunk-VCH45Q2I.js";
  185. import "./chunk-LBW34VZ2.js";
  186. import "./chunk-GSSTTHIT.js";
  187. import {
  188. n as n2
  189. } from "./chunk-IM3LVQXV.js";
  190. import "./chunk-HZRKBTHJ.js";
  191. import {
  192. U as U2
  193. } from "./chunk-DVUG3KID.js";
  194. import "./chunk-FWSQEIAR.js";
  195. import "./chunk-VEGAOVMY.js";
  196. import {
  197. s as s3,
  198. w2 as w
  199. } from "./chunk-6T6G6LCQ.js";
  200. import "./chunk-YEJL5NEF.js";
  201. import {
  202. E as E2,
  203. R,
  204. k2 as k
  205. } from "./chunk-PQFTYGF5.js";
  206. import {
  207. e,
  208. n5 as n,
  209. y3 as y
  210. } from "./chunk-2Z2TG5CU.js";
  211. import "./chunk-6KZ2LTDA.js";
  212. import "./chunk-U2XHEJM7.js";
  213. import "./chunk-SQOPWYIT.js";
  214. import {
  215. D,
  216. E,
  217. L,
  218. U,
  219. b as b2,
  220. f as f2,
  221. g,
  222. j
  223. } from "./chunk-V6P2MAQQ.js";
  224. import {
  225. s2 as s,
  226. s3 as s2
  227. } from "./chunk-E5O6P5I2.js";
  228. import {
  229. has
  230. } from "./chunk-SPWQ3AWG.js";
  231. import {
  232. t as t2
  233. } from "./chunk-2TIUKVZN.js";
  234. import {
  235. b,
  236. c,
  237. e as e2,
  238. f,
  239. i,
  240. m,
  241. o,
  242. r,
  243. t
  244. } from "./chunk-YXWMMD76.js";
  245. import "./chunk-S5KM4IGW.js";
  246. // node_modules/@arcgis/core/views/2d/layers/features/processors.js
  247. function o4(o7) {
  248. return "heatmap" === o7 ? import("./HeatmapProcessor-ZMETYYQZ.js") : import("./SymbolProcessor-QR2MTX2K.js");
  249. }
  250. // node_modules/@arcgis/core/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js
  251. var r5 = 268435455;
  252. var n5 = class {
  253. constructor() {
  254. this.fieldMap = /* @__PURE__ */ new Map(), this.fields = [], this.hasFeatures = false, this.exceededTransferLimit = false, this.fieldCount = 0, this.featureCount = 0, this.objectIdFieldIndex = 0, this.vertexCount = 0, this.offsets = { attributes: new Array(), geometry: new Array() }, this.centroid = new Array();
  255. }
  256. hasField(e3) {
  257. return this.fieldMap.has(e3);
  258. }
  259. isDateField(e3) {
  260. var _a, _b;
  261. return (_b = (_a = this.fieldMap.get(e3)) == null ? void 0 : _a.isDate) != null ? _b : false;
  262. }
  263. getFieldIndex(e3) {
  264. var _a;
  265. return (_a = this.fieldMap.get(e3)) == null ? void 0 : _a.index;
  266. }
  267. };
  268. function a3(e3) {
  269. const t6 = 1, r6 = 2, n7 = e3.asUnsafe(), a8 = n7.getLength(), i5 = n7.pos() + a8, o7 = { name: "", isDate: false };
  270. for (; n7.pos() < i5 && n7.next(); )
  271. switch (n7.tag()) {
  272. case t6:
  273. o7.name = n7.getString();
  274. break;
  275. case r6:
  276. "esriFieldTypeDate" === c2(n7.getEnum()) && (o7.isDate = true);
  277. break;
  278. default:
  279. n7.skip();
  280. }
  281. return o7;
  282. }
  283. function i3(e3) {
  284. return e3.toLowerCase().trim();
  285. }
  286. function o5(s9, o7, f9 = false) {
  287. const c9 = 1, d9 = 3, u4 = 9, l9 = 12, g6 = 13, p4 = 15, h6 = s9.asUnsafe(), m6 = h6.pos(), b6 = new n5();
  288. let w4 = 0, k3 = 0;
  289. const x4 = 1, y6 = 2, I2 = 4, F5 = 3;
  290. let L3 = null, A3 = null, C = null, S3 = false;
  291. for (; h6.next(); )
  292. switch (h6.tag()) {
  293. case c9:
  294. L3 = h6.getString();
  295. break;
  296. case d9:
  297. A3 = h6.getString();
  298. break;
  299. case l9:
  300. C = h6.processMessage(q);
  301. break;
  302. case u4:
  303. if (b6.exceededTransferLimit = h6.getBool(), b6.exceededTransferLimit) {
  304. b6.offsets.geometry = f9 ? new Float64Array(8e3) : new Int32Array(8e3), b6.centroid = f9 ? new Float64Array(16e3) : new Int32Array(16e3);
  305. for (let e3 = 0; e3 < b6.centroid.length; e3++)
  306. b6.centroid[e3] = r5;
  307. }
  308. break;
  309. case g6: {
  310. const e3 = a3(s9), t6 = e3.name, r6 = i3(e3.name), n7 = { fieldName: t6, index: w4++, isDate: e3.isDate };
  311. b6.fields.push(n7), b6.fieldMap.set(e3.name, n7), b6.fieldMap.set(r6, n7);
  312. break;
  313. }
  314. case p4: {
  315. const e3 = h6.getLength(), t6 = h6.pos() + e3;
  316. if (!b6.exceededTransferLimit) {
  317. const e4 = b6.offsets.geometry, t7 = b6.centroid;
  318. e4.push(0), t7.push(r5), t7.push(r5);
  319. }
  320. !S3 && b6.exceededTransferLimit && (S3 = true, b6.offsets.attributes = f9 ? new Float64Array(8e3 * w4) : new Uint32Array(8e3 * w4));
  321. let s10 = k3 * w4;
  322. for (; h6.pos() < t6 && h6.next(); )
  323. switch (h6.tag()) {
  324. case x4: {
  325. if (S3)
  326. b6.offsets.attributes[s10++] = h6.pos();
  327. else {
  328. b6.offsets.attributes.push(h6.pos());
  329. }
  330. const e4 = h6.getLength();
  331. h6.skipLen(e4);
  332. break;
  333. }
  334. case y6:
  335. if (o7) {
  336. const e4 = h6.getLength(), t7 = h6.pos() + e4;
  337. for (; h6.pos() < t7 && h6.next(); )
  338. switch (h6.tag()) {
  339. case F5: {
  340. h6.getUInt32();
  341. const e5 = h6.getSInt64(), t8 = h6.getSInt64();
  342. b6.centroid[2 * k3] = e5, b6.centroid[2 * k3 + 1] = t8;
  343. break;
  344. }
  345. default:
  346. h6.skip();
  347. }
  348. } else {
  349. b6.offsets.geometry[k3] = h6.pos();
  350. const e4 = h6.getLength();
  351. b6.vertexCount += e4, h6.skipLen(e4);
  352. }
  353. break;
  354. case I2: {
  355. const e4 = h6.getLength(), t7 = h6.pos() + e4;
  356. for (; h6.pos() < t7 && h6.next(); )
  357. switch (h6.tag()) {
  358. case F5: {
  359. h6.getUInt32();
  360. const e5 = h6.getSInt64(), t8 = h6.getSInt64();
  361. b6.centroid[2 * k3] = e5, b6.centroid[2 * k3 + 1] = t8;
  362. break;
  363. }
  364. default:
  365. h6.skip();
  366. }
  367. break;
  368. }
  369. default:
  370. h6.skip();
  371. }
  372. k3++, b6.hasFeatures = true;
  373. break;
  374. }
  375. default:
  376. h6.skip();
  377. }
  378. const M2 = L3 || A3;
  379. if (!M2)
  380. throw new s2("FeatureSet has no objectId or globalId field name");
  381. return b6.featureCount = k3, b6.fieldCount = w4, b6.objectIdFieldIndex = b6.getFieldIndex(M2), b6.transform = C, b6.displayIds = new Uint32Array(b6.featureCount), b6.groupIds = new Uint16Array(b6.featureCount), h6.move(m6), b6;
  382. }
  383. // node_modules/@arcgis/core/views/2d/layers/features/support/FeatureSetReaderPBF.js
  384. var g4 = true;
  385. var l4 = 268435455;
  386. var _2 = 128;
  387. var f5 = 128e3;
  388. var y3 = { small: { delta: new Int32Array(_2), decoded: new Int32Array(_2) }, large: { delta: new Int32Array(f5), decoded: new Int32Array(f5) } };
  389. function I(e3) {
  390. return e3 <= y3.small.delta.length ? y3.small : (e3 <= y3.large.delta.length || (y3.large.delta = new Int32Array(Math.round(1.25 * e3)), y3.large.decoded = new Int32Array(Math.round(1.25 * e3))), y3.large);
  391. }
  392. function p(e3) {
  393. return e3.toLowerCase().trim();
  394. }
  395. function m3(r6) {
  396. try {
  397. const e3 = 2, t6 = new n3(new Uint8Array(r6), new DataView(r6));
  398. for (; t6.next(); ) {
  399. if (t6.tag() === e3)
  400. return x2(t6.getMessage());
  401. t6.skip();
  402. }
  403. } catch (s9) {
  404. const r7 = new s2("query:parsing-pbf", "Error while parsing FeatureSet PBF payload", { error: s9 });
  405. s.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(r7);
  406. }
  407. return null;
  408. }
  409. function x2(e3) {
  410. const t6 = 1;
  411. for (; e3.next(); ) {
  412. if (e3.tag() === t6)
  413. return e3.getMessage();
  414. e3.skip();
  415. }
  416. return null;
  417. }
  418. function S(e3) {
  419. const t6 = 1, r6 = 2, s9 = 3, i5 = 4, n7 = 5, a8 = 6, h6 = 7, o7 = 8, d9 = 9, u4 = e3.getLength(), c9 = e3.pos() + u4;
  420. for (; e3.pos() < c9 && e3.next(); )
  421. switch (e3.tag()) {
  422. case t6:
  423. return e3.getString();
  424. case r6:
  425. return e3.getFloat();
  426. case s9:
  427. return e3.getDouble();
  428. case i5:
  429. return e3.getSInt32();
  430. case n7:
  431. return e3.getUInt32();
  432. case a8:
  433. return e3.getInt64();
  434. case h6:
  435. return e3.getUInt64();
  436. case o7:
  437. return e3.getSInt64();
  438. case d9:
  439. return e3.getBool();
  440. default:
  441. return e3.skip(), null;
  442. }
  443. return null;
  444. }
  445. function F(e3, t6, r6, s9, i5, n7) {
  446. return 0.5 * Math.abs(e3 * s9 + r6 * n7 + i5 * t6 - e3 * n7 - r6 * t6 - i5 * s9);
  447. }
  448. function v3(e3, t6, r6, s9) {
  449. return 0 === e3 * s9 - r6 * t6 && e3 * r6 + t6 * s9 > 0;
  450. }
  451. var G2 = class extends b3 {
  452. constructor(e3, t6, r6, s9) {
  453. super(e3, s9), this._hasNext = false, this._isPoints = false, this._featureIndex = -1, this._featureOffset = 0, this._cache = { area: 0, unquantGeometry: void 0, geometry: void 0, centroid: void 0, legacyFeature: void 0, optFeature: void 0 }, this._geometryType = s9.geometryType, this._reader = t6, this._header = r6, this._hasNext = r6.hasFeatures, this._isPoints = "esriGeometryPoint" === s9.geometryType;
  454. }
  455. static fromBuffer(e3, t6, r6 = false) {
  456. const s9 = t6.geometryType, i5 = m3(e3), n7 = o5(i5, "esriGeometryPoint" === s9, r6), a8 = b3.createInstance();
  457. return new G2(a8, i5, n7, t6);
  458. }
  459. get geometryType() {
  460. return this._geometryType;
  461. }
  462. get _size() {
  463. return this._header.featureCount;
  464. }
  465. get hasZ() {
  466. return false;
  467. }
  468. get hasM() {
  469. return false;
  470. }
  471. get stride() {
  472. return 2 + (this.hasZ ? 1 : 0) + (this.hasM ? 1 : 0);
  473. }
  474. get hasFeatures() {
  475. return this._header.hasFeatures;
  476. }
  477. get hasNext() {
  478. return this._hasNext;
  479. }
  480. get exceededTransferLimit() {
  481. return this._header.exceededTransferLimit;
  482. }
  483. hasField(e3) {
  484. return this._header.hasField(e3) || this._header.hasField(p(e3));
  485. }
  486. getFieldNames() {
  487. return this._header.fields.map((e3) => e3.fieldName);
  488. }
  489. getSize() {
  490. return this._size;
  491. }
  492. getQuantizationTransform() {
  493. return this._header.transform;
  494. }
  495. getCursor() {
  496. return this.copy();
  497. }
  498. getIndex() {
  499. return this._featureIndex;
  500. }
  501. setIndex(e3) {
  502. this._cache.area = 0, this._cache.unquantGeometry = void 0, this._cache.geometry = void 0, this._cache.centroid = void 0, this._cache.legacyFeature = void 0, this._cache.optFeature = void 0, this._featureIndex = e3;
  503. }
  504. getAttributeHash() {
  505. let e3 = "";
  506. return this._header.fields.forEach(({ index: t6 }) => {
  507. e3 += this._readAttributeAtIndex(t6) + ".";
  508. }), e3;
  509. }
  510. getObjectId() {
  511. return this._readAttributeAtIndex(this._header.objectIdFieldIndex);
  512. }
  513. getDisplayId() {
  514. return this._header.displayIds[this._featureIndex];
  515. }
  516. setDisplayId(e3) {
  517. this._header.displayIds[this._featureIndex] = e3;
  518. }
  519. getGroupId() {
  520. return this._header.groupIds[this._featureIndex];
  521. }
  522. setGroupId(e3) {
  523. this._header.groupIds[this._featureIndex] = e3;
  524. }
  525. readLegacyFeature() {
  526. var _a;
  527. if (void 0 === this._cache.legacyFeature) {
  528. const e3 = this.readCentroid(), t6 = { attributes: this.readAttributes(), geometry: this._isPoints ? this.readLegacyPointGeometry() : this.readLegacyGeometry(), centroid: (_a = e3 && { x: e3.coords[0], y: e3.coords[1] }) != null ? _a : null };
  529. return this._cache.legacyFeature = t6, t6;
  530. }
  531. return this._cache.legacyFeature;
  532. }
  533. readOptimizedFeature() {
  534. if (void 0 === this._cache.optFeature) {
  535. const e3 = new s4(this.readGeometry(), this.readAttributes(), this.readCentroid());
  536. return e3.objectId = this.getObjectId(), e3.displayId = this.getDisplayId(), this._cache.optFeature = e3, e3;
  537. }
  538. return this._cache.optFeature;
  539. }
  540. getXHydrated() {
  541. const e3 = this._header.centroid[2 * this._featureIndex], t6 = this.getQuantizationTransform();
  542. return t(t6) ? e3 : e3 * t6.scale[0] + t6.translate[0];
  543. }
  544. getYHydrated() {
  545. const e3 = this._header.centroid[2 * this._featureIndex + 1], t6 = this.getQuantizationTransform();
  546. return t(t6) ? e3 : t6.translate[1] - e3 * t6.scale[1];
  547. }
  548. getX() {
  549. return this._header.centroid[2 * this._featureIndex] * this._sx + this._tx;
  550. }
  551. getY() {
  552. return this._header.centroid[2 * this._featureIndex + 1] * this._sy + this._ty;
  553. }
  554. readLegacyPointGeometry() {
  555. return { x: this.getX(), y: this.getY() };
  556. }
  557. readLegacyGeometry(e3) {
  558. const t6 = this.readGeometry(e3);
  559. return rt(t6, this.geometryType, false, false);
  560. }
  561. readLegacyCentroid() {
  562. const e3 = this.readCentroid();
  563. if (!e3)
  564. return null;
  565. const [t6, r6] = e3.coords;
  566. return { x: t6, y: r6 };
  567. }
  568. readGeometryArea() {
  569. return this._cache.area || this.readGeometry(true), this._cache.area;
  570. }
  571. readUnquantizedGeometry(e3 = false) {
  572. if (void 0 === this._cache.unquantGeometry) {
  573. const t6 = this.readGeometry(e3);
  574. if (!t6)
  575. return this._cache.unquantGeometry = void 0, null;
  576. const r6 = I(t6.coords.length).decoded, s9 = t6.clone(r6), i5 = s9.coords;
  577. let n7 = 0;
  578. for (const e4 of s9.lengths) {
  579. for (let t7 = 1; t7 < e4; t7++) {
  580. const e5 = 2 * (n7 + t7), r7 = 2 * (n7 + t7 - 1);
  581. i5[e5] += i5[r7], i5[e5 + 1] += i5[r7 + 1];
  582. }
  583. n7 += e4;
  584. }
  585. return this._cache.unquantGeometry = s9, s9;
  586. }
  587. return this._cache.unquantGeometry;
  588. }
  589. readHydratedGeometry() {
  590. if (this._isPoints) {
  591. if (this._header.centroid[2 * this._featureIndex] === l4)
  592. return null;
  593. const e4 = this.getXHydrated(), t7 = this.getYHydrated();
  594. return new t3([], [e4, t7]);
  595. }
  596. const e3 = this.readGeometry();
  597. if (!e3)
  598. return null;
  599. const t6 = e3.clone(), r6 = this.getQuantizationTransform();
  600. return r(r6) && pt(t6, t6, this.hasZ, this.hasM, r6), t6;
  601. }
  602. readGeometry(e3 = false) {
  603. if (void 0 === this._cache.geometry) {
  604. let r6 = null;
  605. if (this._isPoints) {
  606. if (this._header.centroid[2 * this._featureIndex] === l4)
  607. return null;
  608. const e4 = this.getX(), t6 = this.getY();
  609. r6 = new t3([], [e4, t6]);
  610. } else {
  611. const s9 = this._header.offsets.geometry[this._featureIndex], i5 = this._reader;
  612. if (0 === s9) {
  613. const e4 = this._readServerCentroid();
  614. if (!e4)
  615. return null;
  616. const [t6, r7] = e4.coords;
  617. return this.createQuantizedExtrudedQuad(t6, r7);
  618. }
  619. i5.move(s9);
  620. try {
  621. if (r6 = e3 ? this._parseGeometryForDisplay(i5) : this._parseGeometry(i5), null === r6) {
  622. const e4 = this._readServerCentroid();
  623. if (!e4)
  624. return null;
  625. const [t6, r7] = e4.coords;
  626. return this.createQuantizedExtrudedQuad(t6, r7);
  627. }
  628. } catch (t6) {
  629. return console.error("Failed to parse geometry!", t6), null;
  630. }
  631. }
  632. return this._cache.geometry = r6, r6;
  633. }
  634. return this._cache.geometry;
  635. }
  636. readCentroid() {
  637. if (void 0 === this._cache.centroid) {
  638. let e3;
  639. return e3 = this._computeCentroid(), e3 || (e3 = this._readServerCentroid()), this._cache.centroid = e3 != null ? e3 : void 0, e3 != null ? e3 : null;
  640. }
  641. return this._cache.centroid;
  642. }
  643. copy() {
  644. const e3 = this._reader.clone(), t6 = new G2(this.instance, e3, this._header, this.fullSchema());
  645. return this.copyInto(t6), t6;
  646. }
  647. next() {
  648. for (this._cache.area = 0, this._cache.unquantGeometry = void 0, this._cache.geometry = void 0, this._cache.centroid = void 0, this._cache.legacyFeature = void 0, this._cache.optFeature = void 0; ++this._featureIndex < this._size && !this._getExists(); )
  649. ;
  650. return this._featureIndex < this._size;
  651. }
  652. _readAttribute(e3, t6) {
  653. const r6 = this._header.hasField(e3) ? e3 : p(e3), s9 = this._header.getFieldIndex(r6);
  654. if (null == s9)
  655. return;
  656. const i5 = this._readAttributeAtIndex(s9);
  657. if (!t6)
  658. return i5;
  659. if (null == i5)
  660. return i5;
  661. return this._header.isDateField(r6) ? new Date(i5) : i5;
  662. }
  663. _readAttributes() {
  664. const e3 = {};
  665. return this._header.fields.forEach(({ fieldName: t6, index: r6 }) => {
  666. e3[t6] = this._readAttributeAtIndex(r6);
  667. }), e3;
  668. }
  669. copyInto(e3) {
  670. super.copyInto(e3), e3._featureIndex = this._featureIndex, e3._featureOffset = this._featureOffset, e3._hasNext = this._hasNext;
  671. }
  672. _readAttributeAtIndex(e3) {
  673. const t6 = this._header.offsets.attributes[this._featureIndex * this._header.fieldCount + e3], r6 = this._reader;
  674. return r6.move(t6), S(r6);
  675. }
  676. _readServerCentroid() {
  677. const e3 = this._header.centroid[2 * this._featureIndex] + this._tx, t6 = this._header.centroid[2 * this._featureIndex + 1] + this._ty;
  678. return e3 === l4 ? null : new t3([], [e3, t6]);
  679. }
  680. _parseGeometry(e3) {
  681. const t6 = 2, r6 = 3, s9 = e3.asUnsafe(), i5 = s9.getLength(), n7 = s9.pos() + i5, a8 = [], h6 = [];
  682. for (; s9.pos() < n7 && s9.next(); )
  683. switch (s9.tag()) {
  684. case t6: {
  685. const e4 = s9.getUInt32(), t7 = s9.pos() + e4;
  686. for (; s9.pos() < t7; )
  687. h6.push(s9.getUInt32());
  688. break;
  689. }
  690. case r6: {
  691. const e4 = s9.getUInt32(), t7 = s9.pos() + e4;
  692. for (a8.push(s9.getSInt32() + this._tx), a8.push(s9.getSInt32() + this._ty), this.hasZ && s9.getSInt32(), this.hasM && s9.getSInt32(); s9.pos() < t7; )
  693. a8.push(s9.getSInt32()), a8.push(s9.getSInt32()), this.hasZ && s9.getSInt32(), this.hasM && s9.getSInt32();
  694. break;
  695. }
  696. default:
  697. s9.skip();
  698. }
  699. return new t3(h6, a8);
  700. }
  701. _parseGeometryForDisplay(e3) {
  702. const t6 = 2, r6 = 3, s9 = e3.asUnsafe(), n7 = s9.getLength(), a8 = s9.pos() + n7, h6 = [], o7 = [];
  703. let u4 = 0, c9 = 0, l9 = null, _4 = 0;
  704. const f9 = "esriGeometryPolygon" === this.geometryType;
  705. for (; s9.pos() < a8 && s9.next(); )
  706. switch (s9.tag()) {
  707. case t6: {
  708. const e4 = s9.getUInt32(), t7 = s9.pos() + e4;
  709. for (; s9.pos() < t7; ) {
  710. const e5 = s9.getUInt32();
  711. h6.push(e5), u4 += e5;
  712. }
  713. l9 = I(2 * u4).delta;
  714. break;
  715. }
  716. case r6: {
  717. s9.getUInt32();
  718. const e4 = 2 + (this.hasZ ? 1 : 0) + (this.hasM ? 1 : 0);
  719. c(l9);
  720. for (const t7 of h6)
  721. if (c9 + e4 * t7 > l9.length)
  722. for (let e5 = 0; e5 < t7; e5++)
  723. s9.getSInt32(), s9.getSInt32(), this.hasZ && s9.getSInt32(), this.hasM && s9.getSInt32();
  724. else if (f9 && g4) {
  725. const e5 = this.getAreaSimplificationThreshold(t7, this._header.vertexCount);
  726. let r7 = 2, i5 = 1;
  727. const n8 = false;
  728. let a9 = s9.getSInt32(), h7 = s9.getSInt32();
  729. l9[c9++] = a9, l9[c9++] = h7, this.hasZ && s9.getSInt32(), this.hasM && s9.getSInt32();
  730. let d9 = s9.getSInt32(), u5 = s9.getSInt32();
  731. for (this.hasZ && s9.getSInt32(), this.hasM && s9.getSInt32(); r7 < t7; ) {
  732. let t8 = s9.getSInt32(), n9 = s9.getSInt32();
  733. this.hasZ && s9.getSInt32(), this.hasM && s9.getSInt32();
  734. const o8 = a9 + d9, g6 = h7 + u5;
  735. F(a9, h7, o8, g6, o8 + t8, g6 + n9) >= e5 ? (_4 += -0.5 * (o8 - a9) * (g6 + h7), i5 > 1 && v3(l9[c9 - 2], l9[c9 - 1], d9, u5) ? (l9[c9 - 2] += d9, l9[c9 - 1] += u5) : (l9[c9++] = d9, l9[c9++] = u5, i5++), a9 = o8, h7 = g6) : (t8 += d9, n9 += u5), d9 = t8, u5 = n9, r7++;
  736. }
  737. i5 < 3 || n8 ? c9 -= 2 * i5 : (_4 += -0.5 * (a9 + d9 - a9) * (h7 + u5 + h7), v3(l9[c9 - 2], l9[c9 - 1], d9, u5) ? (l9[c9 - 2] += d9, l9[c9 - 1] += u5, o7.push(i5)) : (l9[c9++] = d9, l9[c9++] = u5, o7.push(++i5)));
  738. } else {
  739. let e5 = 0, r7 = s9.getSInt32(), i5 = s9.getSInt32();
  740. this.hasZ && s9.getSInt32(), this.hasM && s9.getSInt32(), l9[c9++] = r7, l9[c9++] = i5, e5 += 1;
  741. for (let n8 = 1; n8 < t7; n8++) {
  742. const t8 = s9.getSInt32(), a9 = s9.getSInt32(), h7 = r7 + t8, o8 = i5 + a9;
  743. _4 += -0.5 * (h7 - r7) * (o8 + i5), this.hasZ && s9.getSInt32(), this.hasM && s9.getSInt32(), n8 > 2 && v3(l9[c9 - 2], l9[c9 - 1], t8, a9) ? (l9[c9 - 2] += t8, l9[c9 - 1] += a9) : (l9[c9++] = t8, l9[c9++] = a9, e5 += 1), r7 = h7, i5 = o8;
  744. }
  745. o7.push(e5);
  746. }
  747. break;
  748. }
  749. default:
  750. s9.skip();
  751. }
  752. if (this._cache.area = _4, !o7.length)
  753. return null;
  754. if (this._tx || this._ty) {
  755. let e4 = 0;
  756. c(l9);
  757. for (const t7 of o7)
  758. l9[2 * e4] += this._tx, l9[2 * e4 + 1] += this._ty, e4 += t7;
  759. }
  760. return new t3(o7, l9);
  761. }
  762. };
  763. // node_modules/@arcgis/core/views/2d/layers/features/controllers/support/sourceAdapters.js
  764. var p2 = class {
  765. constructor(e3) {
  766. this.service = e3;
  767. }
  768. destroy() {
  769. }
  770. };
  771. function f6(e3) {
  772. return Array.isArray(e3.source);
  773. }
  774. function l5(e3) {
  775. return "ogc-source" === (e3 == null ? void 0 : e3.type);
  776. }
  777. function y4(e3) {
  778. const { capabilities: t6 } = e3;
  779. return l5(e3.source) ? new q3(e3) : f6(e3) ? new d4(e3) : t6.query.supportsFormatPBF && has("featurelayer-pbf") ? new v4(e3) : new F2(e3);
  780. }
  781. async function h3(e3) {
  782. const t6 = new h2();
  783. return await t6.open(e3, {}), t6;
  784. }
  785. var d4 = class extends p2 {
  786. constructor(e3) {
  787. super(e3), this._portsOpen = h3(e3.source).then((e4) => this.client = e4);
  788. }
  789. destroy() {
  790. this.client.close(), this.client = null;
  791. }
  792. async executeQuery(e3, t6) {
  793. await this._portsOpen;
  794. const r6 = await this.client.invoke("queryFeatures", e3.toJSON(), t6);
  795. return c5.fromFeatureSet(r6, this.service);
  796. }
  797. };
  798. var v4 = class extends p2 {
  799. async executeQuery(e3, t6) {
  800. const { data: r6 } = await d2(this.service.source, e3, t6), s9 = !e3.quantizationParameters;
  801. return G2.fromBuffer(r6, this.service, s9);
  802. }
  803. };
  804. var F2 = class extends p2 {
  805. async executeQuery(r6, o7) {
  806. var _a;
  807. const { source: n7, capabilities: m6, spatialReference: p4, objectIdField: f9, geometryType: l9 } = this.service;
  808. if (r(r6.quantizationParameters) && !m6.query.supportsQuantization) {
  809. const e3 = r6.clone(), m7 = s5(e2(e3.quantizationParameters));
  810. e3.quantizationParameters = null;
  811. const { data: l10 } = await c3(n7, e3, p4, o7), y7 = lt(l10, f9);
  812. return ft(m7, y7), c5.fromOptimizedFeatureSet(y7, this.service);
  813. }
  814. const { data: y6 } = await c3(n7, r6, this.service.spatialReference, o7);
  815. return "esriGeometryPoint" === l9 && (y6.features = (_a = y6.features) == null ? void 0 : _a.filter((t6) => {
  816. if (r(t6.geometry)) {
  817. const e3 = t6.geometry;
  818. return Number.isFinite(e3.x) && Number.isFinite(e3.y);
  819. }
  820. return true;
  821. })), c5.fromFeatureSet(y6, this.service);
  822. }
  823. };
  824. var q3 = class extends p2 {
  825. async executeQuery(e3, r6) {
  826. const { capabilities: i5 } = this.service;
  827. if (e3.quantizationParameters && !i5.query.supportsQuantization) {
  828. const i6 = e3.clone(), n8 = s5(e2(i6.quantizationParameters));
  829. i6.quantizationParameters = null;
  830. const c9 = await q2(this.service.source, e3, r6);
  831. return ft(n8, c9), c5.fromOptimizedFeatureSet(c9, this.service);
  832. }
  833. const n7 = await q2(this.service.source, e3, r6);
  834. return c5.fromOptimizedFeatureSet(n7, this.service);
  835. }
  836. };
  837. // node_modules/@arcgis/core/views/2d/layers/features/support/UpdateToken.js
  838. var t5 = class {
  839. constructor() {
  840. this.version = 0, this.source = false, this.targets = { feature: false, aggregate: false }, this.storage = { filters: false, data: false }, this.mesh = false, this.queryFilter = false, this.why = { mesh: [], source: [] };
  841. }
  842. static create(e3) {
  843. const s9 = new t5();
  844. for (const t6 in e3) {
  845. const r6 = e3[t6];
  846. if ("object" == typeof r6)
  847. for (const e4 in r6) {
  848. const a8 = r6[e4];
  849. s9[t6][e4] = a8;
  850. }
  851. s9[t6] = r6;
  852. }
  853. return s9;
  854. }
  855. static empty() {
  856. return t5.create({});
  857. }
  858. static all() {
  859. return t5.create({ source: true, targets: { feature: true, aggregate: true }, storage: { filters: true, data: true }, mesh: true });
  860. }
  861. unset(t6) {
  862. this.version = t6.version, t6.source && (this.source = false), t6.targets.feature && (this.targets.feature = false), t6.targets.aggregate && (this.targets.aggregate = false), t6.storage.filters && (this.storage.filters = false), t6.storage.data && (this.storage.data = false), t6.mesh && (this.mesh = false), t6.queryFilter && (this.queryFilter = false);
  863. }
  864. any() {
  865. return this.source || this.mesh || this.storage.filters || this.storage.data || this.targets.feature || this.targets.aggregate || this.queryFilter;
  866. }
  867. describe() {
  868. let t6 = 0, e3 = "";
  869. if (this.mesh) {
  870. t6 += 20, e3 += "-> (20) Mesh needs update\n";
  871. for (const t7 of this.why.mesh)
  872. e3 += ` + ${t7}
  873. `;
  874. }
  875. if (this.source) {
  876. t6 += 10, e3 += "-> (10) The source needs update\n";
  877. for (const t7 of this.why.source)
  878. e3 += ` + ${t7}
  879. `;
  880. }
  881. this.targets.feature && (t6 += 5, e3 += "-> (5) Feature target parameters changed\n"), this.storage.filters && (t6 += 5, e3 += "-> (5) Feature filter parameters changed\n"), this.targets.aggregate && (t6 += 4, e3 += "-> (4) Aggregate target parameters changed\n"), this.storage.data && (t6 += 1, e3 += "-> (1) Texture storage parameters changed");
  882. const s9 = t6 < 5 ? "Fastest" : t6 < 10 ? "Fast" : t6 < 15 ? "Moderate" : t6 < 20 ? "Slow" : "Very Slow";
  883. console.debug(`Applying ${s9} update of cost ${t6}/45 `), console.debug(e3);
  884. }
  885. toJSON() {
  886. return { queryFilter: this.queryFilter, source: this.source, targets: this.targets, storage: this.storage, mesh: this.mesh };
  887. }
  888. };
  889. // node_modules/@arcgis/core/views/2d/layers/features/sources/DataTileSubscription.js
  890. var a4 = class {
  891. constructor(s9, t6) {
  892. this.requests = { done: new Array(), stream: new s7(10) }, this._edits = null, this._abortController = new AbortController(), this._version = 0, this._done = false, this.didSend = false, this.tile = s9, this._version = t6;
  893. }
  894. get signal() {
  895. return this._abortController.signal;
  896. }
  897. get options() {
  898. return { signal: this._abortController.signal };
  899. }
  900. get empty() {
  901. return !this.requests.done.length;
  902. }
  903. get edits() {
  904. return this._edits;
  905. }
  906. get done() {
  907. return this._done;
  908. }
  909. end() {
  910. this._done = true;
  911. }
  912. clear() {
  913. this.requests.done = [];
  914. }
  915. applyUpdate(e3) {
  916. this.requests.done.forEach((s9) => s9.message.status.unset(e3)), this._version = e3.version, r(this._edits) && this._edits.status.unset(e3);
  917. }
  918. add(e3) {
  919. var _a2;
  920. e3.message.status = (_a2 = e3.message.status) != null ? _a2 : t5.empty(), e3.message.status.version = this._version, has("esri-2d-update-debug") && console.debug(this.tile.id, "DataTileSubscription:add", this._version), e3.message.end && this.requests.done.forEach((e4) => {
  921. r(e4.message) && e4.message.end && (e4.message.end = false);
  922. }), this.requests.done.push(e3);
  923. }
  924. edit(e3, s9) {
  925. const a8 = e3.getQuantizationTransform(), o7 = e3.fullSchema(), n7 = Array.from(e3.features()), h6 = [...s9, ...n7.map((e4) => e4.objectId)];
  926. if (this.removeIds(h6), this._invalidate(), t(this._edits))
  927. return void (this._edits = { type: "append", addOrUpdate: c5.fromOptimizedFeatures(n7, o7, e2(a8)), id: this.tile.id, status: t5.empty(), end: true });
  928. this.requests.done.forEach((e4) => e4.message.end = false);
  929. e2(this._edits.addOrUpdate).append(e3.features());
  930. }
  931. *readers() {
  932. for (const { message: e3 } of this.requests.done)
  933. r(e3.addOrUpdate) && (yield e3.addOrUpdate);
  934. r(this._edits) && r(this._edits.addOrUpdate) && (yield this._edits.addOrUpdate);
  935. }
  936. _invalidate() {
  937. for (const e3 of this.requests.done)
  938. e3.message.status = t5.empty();
  939. r(this._edits) && (this._edits.status = t5.empty());
  940. }
  941. removeIds(e3) {
  942. this._invalidate();
  943. for (const { message: t6 } of this.requests.done) {
  944. const r6 = t6.addOrUpdate;
  945. r(r6) && (r6.removeIds(e3), r6.isEmpty && (t6.addOrUpdate = null));
  946. }
  947. r(this._edits) && r(this._edits.addOrUpdate) && this._edits.addOrUpdate.removeIds(e3), this.requests.done = this.requests.done.filter((e4) => e4.message.addOrUpdate || e4.message.end);
  948. }
  949. abort() {
  950. this._abortController.abort();
  951. }
  952. };
  953. // node_modules/@arcgis/core/views/2d/layers/features/sources/DataTileSource.js
  954. function l6(e3, s9) {
  955. const t6 = /* @__PURE__ */ new Set();
  956. return e3 && e3.forEach((e4) => t6.add(e4)), s9 && s9.forEach((e4) => t6.add(e4)), t6.has("*") ? ["*"] : Array.from(t6);
  957. }
  958. var m4 = class {
  959. constructor(e3) {
  960. this.events = new n2(), this._resolver = D(), this._didEdit = false, this._subscriptions = /* @__PURE__ */ new Map(), this._outSR = e3.outSR, this._serviceInfo = e3.serviceInfo, this._onTileUpdateMessage = e3.onMessage;
  961. }
  962. destroy() {
  963. }
  964. async _onMessage(e3) {
  965. var _a, _b;
  966. const s9 = this._subscriptions.get(e3.id);
  967. if (!s9)
  968. return;
  969. const t6 = { ...e3, remove: (_a = e3.remove) != null ? _a : [], status: (_b = e3.status) != null ? _b : t5.empty() };
  970. return g(this._onTileUpdateMessage(t6, s9.options));
  971. }
  972. update(s9, t6) {
  973. var _a;
  974. const r6 = t6.fields.length;
  975. t6.outFields = l6((_a = this._schema) == null ? void 0 : _a.outFields, t6.outFields), t6.outFields = t6.outFields.length >= 0.75 * r6 ? ["*"] : t6.outFields, t6.outFields.sort();
  976. const i5 = m2(this._schema, t6);
  977. if (!i5)
  978. return;
  979. has("esri-2d-update-debug") && console.debug("Applying Update - Source:", i5);
  980. const o7 = "orderByFields" in this._serviceInfo && this._serviceInfo.orderByFields ? this._serviceInfo.orderByFields : this._serviceInfo.objectIdField + " ASC", n7 = { returnCentroid: "esriGeometryPolygon" === this._serviceInfo.geometryType, returnGeometry: true, timeReferenceUnknownClient: "stream" !== this._serviceInfo.type && this._serviceInfo.timeReferenceUnknownClient, outFields: t6.outFields, outSpatialReference: this._outSR, orderByFields: [o7], where: t6.definitionExpression || "1=1", gdbVersion: t6.gdbVersion, historicMoment: t6.historicMoment, timeExtent: T.fromJSON(t6.timeExtent) }, a8 = this._schema && a2(i5, "outFields");
  981. this._schema && y2(i5, ["timeExtent", "definitionExpression", "gdbVersion", "historicMoment", "customParameters"]) && (s9.why.mesh.push("Layer filter and/or custom parameters changed"), s9.why.source.push("Layer filter and/or custom parameters changed"), s9.mesh = true, s9.source = true, s9.queryFilter = true), a8 && (s9.why.source.push("Layer required fields changed"), s9.source = true), m2(n7, this._queryInfo) && (this._queryInfo = n7), this._schema = t6, this._resolver.resolve();
  982. }
  983. whenInitialized() {
  984. return this._resolver.promise;
  985. }
  986. async applyUpdate(e3) {
  987. if (e3.queryFilter || e3.source && this._didEdit)
  988. return this.refresh(e3.version), void (this._didEdit = false);
  989. this._subscriptions.forEach((s9) => s9.applyUpdate(e3)), await this.resend();
  990. }
  991. refresh(e3, s9) {
  992. for (const t6 of this._tiles())
  993. this.unsubscribe(t6), this.subscribe(t6, e3);
  994. }
  995. subscribe(e3, s9) {
  996. const t6 = new a4(e3, s9);
  997. this._subscriptions.set(e3.id, t6);
  998. }
  999. unsubscribe(e3) {
  1000. const s9 = this.get(e3.id);
  1001. r(s9) && s9.abort(), this._subscriptions.delete(e3.id);
  1002. }
  1003. createQuery(e3 = {}) {
  1004. const s9 = this._queryInfo.historicMoment ? new Date(this._queryInfo.historicMoment) : null;
  1005. return new x({ ...this._queryInfo, historicMoment: s9, ...e3 });
  1006. }
  1007. get(e3) {
  1008. return this._subscriptions.has(e3) ? this._subscriptions.get(e3) : null;
  1009. }
  1010. async queryLastEditDate() {
  1011. throw new Error("Service does not support query type");
  1012. }
  1013. async query(e3) {
  1014. throw new Error("Service does not support query");
  1015. }
  1016. *_tiles() {
  1017. const e3 = Array.from(this._subscriptions.values());
  1018. for (const s9 of e3)
  1019. yield s9.tile;
  1020. }
  1021. async edit(e3, s9) {
  1022. const t6 = Array.from(this._subscriptions.values()), r6 = t6.map(({ tile: e4 }) => e4);
  1023. for (const i5 of t6)
  1024. i5.removeIds(s9);
  1025. if (e3.length) {
  1026. const t7 = r6.map((s10) => {
  1027. const t8 = this.createTileQuery(s10);
  1028. return t8.objectIds = e3, { tile: s10, query: t8 };
  1029. }).map(async ({ tile: e4, query: s10 }) => ({ tile: e4, result: await this.query(s10), query: s10 })), i5 = (await L(t7)).map(async ({ tile: t8, result: r7 }) => {
  1030. if (!r7.hasFeatures && !s9.length && !e3.length)
  1031. return;
  1032. const i6 = this._subscriptions.get(t8.key.id);
  1033. i6 && i6.edit(r7, e3);
  1034. });
  1035. await E(i5);
  1036. }
  1037. this._didEdit = true;
  1038. }
  1039. };
  1040. // node_modules/@arcgis/core/views/2d/layers/features/sources/BaseFeatureSource.js
  1041. var p3 = 4;
  1042. var d5 = class extends m4 {
  1043. constructor(e3) {
  1044. super(e3), this.type = "feature", this.mode = "on-demand", this._adapter = y4(e3.serviceInfo), this._queue = new l2({ concurrency: 8, process: async (e4) => {
  1045. if (f2(e4), r(e4.tile)) {
  1046. const t6 = e4.tile.key.id, { signal: r6 } = e4, s9 = has("esri-tiles-debug") ? { tile: t6.replace(/\//g, "."), depth: e4.depth } : void 0, i5 = await this._adapter.executeQuery(e4.query, { signal: r6, query: { ...s9, ...this._schema.customParameters } });
  1047. return i5.level = e4.tile.key.level, i5;
  1048. }
  1049. return this._adapter.executeQuery(e4.query, { ...e4, query: this._schema.customParameters });
  1050. } }), this._patchQueue = new l2({ concurrency: 8, process: async (e4) => {
  1051. if (f2(e4), r(e4.tile)) {
  1052. const t6 = e4.tile.key.id, { signal: r6 } = e4, s9 = has("esri-tiles-debug") ? { tile: t6.replace(/\//g, "."), depth: e4.depth } : void 0, i5 = await this._adapter.executeQuery(e4.query, { signal: r6, query: { ...s9, ...this._schema.customParameters } });
  1053. return i5.level = e4.tile.key.level, i5;
  1054. }
  1055. return this._adapter.executeQuery(e4.query, { ...e4, query: this._schema.customParameters });
  1056. } });
  1057. }
  1058. destroy() {
  1059. super.destroy(), this._adapter.destroy(), this._queue.destroy(), this._patchQueue.destroy();
  1060. }
  1061. get updating() {
  1062. return !!this._queue.length || Array.from(this._subscriptions.values()).some((e3) => !e3.done);
  1063. }
  1064. get maxRecordCountFactor() {
  1065. const { query: e3 } = this._serviceInfo.capabilities;
  1066. return e3.supportsMaxRecordCountFactor ? p3 : null;
  1067. }
  1068. get maxPageSize() {
  1069. var _a;
  1070. const { query: e3 } = this._serviceInfo.capabilities;
  1071. return ((_a = e3.maxRecordCount) != null ? _a : 8e3) * i(this.maxRecordCountFactor, 1);
  1072. }
  1073. get pageSize() {
  1074. return Math.min(8e3, this.maxPageSize);
  1075. }
  1076. enableEvent(e3, t6) {
  1077. }
  1078. subscribe(e3, s9) {
  1079. super.subscribe(e3, s9);
  1080. const i5 = this._subscriptions.get(e3.id);
  1081. this._fetchDataTile(e3).catch((s10) => {
  1082. j(s10) || s.getLogger("esri.views.2d.layers.features.sources.BaseFeatureSource").error(new s2("mapview-query-error", "Encountered error when fetching tile", { tile: e3, error: s10 }));
  1083. }).then(() => i5.end());
  1084. }
  1085. unsubscribe(e3) {
  1086. super.unsubscribe(e3);
  1087. }
  1088. readers(e3) {
  1089. return this._subscriptions.get(e3).readers();
  1090. }
  1091. async query(e3) {
  1092. return this._adapter.executeQuery(e3, { query: this._schema.customParameters });
  1093. }
  1094. async queryLastEditDate() {
  1095. const t6 = this._serviceInfo.source, r6 = { ...t6.query, f: "json" };
  1096. return (await U2(t6.path, { query: r6, responseType: "json" })).data.editingInfo.lastEditDate;
  1097. }
  1098. createTileQuery(e3, t6 = {}) {
  1099. var _a;
  1100. const r6 = this._serviceInfo.geometryType, s9 = this.createQuery(t6);
  1101. s9.quantizationParameters = (_a = t6.quantizationParameters) != null ? _a : e3.getQuantizationParameters(), s9.resultType = "tile", s9.geometry = e3.extent, this._serviceInfo.capabilities.query.supportsQuantization ? "esriGeometryPolyline" === r6 && (s9.maxAllowableOffset = e3.resolution * has("feature-polyline-generalization-factor")) : "esriGeometryPolyline" !== r6 && "esriGeometryPolygon" !== r6 || (s9.maxAllowableOffset = e3.resolution, "esriGeometryPolyline" === r6 && (s9.maxAllowableOffset *= has("feature-polyline-generalization-factor")));
  1102. const i5 = this._serviceInfo.capabilities.query;
  1103. return s9.defaultSpatialReferenceEnabled = i5.supportsDefaultSpatialReference, s9.compactGeometryEnabled = i5.supportsCompactGeometry, s9;
  1104. }
  1105. async _executePatchQuery(e3, t6, r6, i5) {
  1106. const a8 = t6.clone();
  1107. a8.outFields = [this._serviceInfo.objectIdField, ...r6], a8.returnCentroid = false, a8.returnGeometry = false;
  1108. const o7 = r(a8.start) ? a8.start / 8e3 : 0, n7 = i5.signal;
  1109. return this._patchQueue.push({ tile: e3, query: a8, signal: n7, depth: o7 });
  1110. }
  1111. async _resend(e3, t6) {
  1112. const { query: r6, message: i5 } = e3, n7 = r(r6.outFields) ? r6.outFields : [], u4 = this._queryInfo.outFields, c9 = u4.filter((e4) => !n7.includes(e4));
  1113. if (t(i5.addOrUpdate))
  1114. this._onMessage({ ...i5, type: "append" });
  1115. else if (c9.length)
  1116. try {
  1117. const e4 = this._subscriptions.get(i5.id).tile, s9 = await this._executePatchQuery(e4, r6, c9, t6);
  1118. f2(t6), r6.outFields = u4, i5.addOrUpdate.joinAttributes(s9), this._onMessage({ ...i5, end: i5.end, type: "append" });
  1119. } catch (l9) {
  1120. }
  1121. else
  1122. this._onMessage({ ...i5, type: "append" });
  1123. }
  1124. async _resendSubscription(e3) {
  1125. if (has("esri-2d-update-debug") && console.debug(e3.tile.id, "Resend Subscription"), e3.empty)
  1126. return this._onMessage({ id: e3.tile.id, addOrUpdate: null, end: false, type: "append" });
  1127. const t6 = e3.signal;
  1128. for (const r6 of e3.requests.done)
  1129. await this._resend(r6, { signal: t6 });
  1130. return r(e3.edits) ? this._onMessage(e3.edits) : void 0;
  1131. }
  1132. async resend() {
  1133. const e3 = Array.from(this._subscriptions.values());
  1134. await Promise.all(e3.map((e4) => this._resendSubscription(e4)));
  1135. }
  1136. };
  1137. // node_modules/@arcgis/core/views/2d/layers/features/sources/DrillDownFeatureSource.js
  1138. var s8 = has("esri-mobile");
  1139. var i4 = { maxDrillLevel: s8 ? 1 : 4, maxRecordCountFactor: s8 ? 1 : 3 };
  1140. var a5 = class extends d5 {
  1141. constructor(e3) {
  1142. super(e3);
  1143. }
  1144. async _fetchDataTile(r6) {
  1145. const s9 = this._serviceInfo.capabilities.query.supportsMaxRecordCountFactor, a8 = this._subscriptions.get(r6.key.id), o7 = a8.signal, n7 = r6.getQuantizationParameters();
  1146. let c9 = 0;
  1147. const d9 = async (u4, l9) => {
  1148. const p4 = this._queryInfo, m6 = this.createTileQuery(u4, { maxRecordCountFactor: s9 ? i4.maxRecordCountFactor : void 0, returnExceededLimitFeatures: false, quantizationParameters: n7 });
  1149. c9++;
  1150. try {
  1151. const t6 = await this._queue.push({ tile: r6, query: m6, signal: o7, depth: l9 });
  1152. if (c9--, f2(o7), !t6)
  1153. return;
  1154. if (p4 !== this._queryInfo)
  1155. return void d9(u4, l9);
  1156. if (t6.exceededTransferLimit && l9 < i4.maxDrillLevel) {
  1157. for (const e3 of u4.createChildTiles())
  1158. d9(e3, l9 + 1);
  1159. return;
  1160. }
  1161. const s10 = { id: r6.id, addOrUpdate: t6, end: 0 === c9, type: "append" };
  1162. a8.add({ query: m6, message: s10 }), this._onMessage(s10);
  1163. } catch (h6) {
  1164. j(h6) || this._onMessage({ id: r6.id, addOrUpdate: null, end: true, type: "append" });
  1165. }
  1166. };
  1167. d9(r6, 0);
  1168. }
  1169. };
  1170. // node_modules/@arcgis/core/layers/graphics/data/StreamFeatureManager.js
  1171. var o6 = "__esri_stream_id__";
  1172. var d6 = "__esri_timestamp__";
  1173. var a6 = 1e3;
  1174. var h4 = class {
  1175. constructor(t6, e3, s9, i5, r6 = 128) {
  1176. this._trackIdToObservations = /* @__PURE__ */ new Map(), this._idCounter = 0, this._lastPurge = performance.now(), this._addOrUpdated = /* @__PURE__ */ new Map(), this._removed = [], this._maxAge = 0, this._timeInfo = s9, this._purgeOptions = i5, this.store = t6, this.objectIdField = e3, this.purgeInterval = r6, this._useGeneratedIds = this.objectIdField === o6;
  1177. }
  1178. add(r6) {
  1179. if (this._useGeneratedIds) {
  1180. const t6 = this._nextId();
  1181. r6.attributes[this.objectIdField] = t6, r6.objectId = t6;
  1182. } else
  1183. r6.objectId = r6.attributes[this.objectIdField];
  1184. if (this._addOrUpdated.set(r6.objectId, r6), this._maxAge = Math.max(this._maxAge, r6.attributes[this._timeInfo.startTimeField]), !this._timeInfo.trackIdField)
  1185. return t(this._trackIdLessObservations) && (this._trackIdLessObservations = new s7(1e5)), void this._trackIdLessObservations.enqueue(r6.objectId);
  1186. const o7 = r6.attributes[this._timeInfo.trackIdField];
  1187. if (!this._trackIdToObservations.has(o7)) {
  1188. const s9 = r(this._purgeOptions) && null != this._purgeOptions.maxObservations ? this._purgeOptions.maxObservations : a6, r7 = a(s9, 0, a6);
  1189. this._trackIdToObservations.set(o7, new s7(r7));
  1190. }
  1191. const d9 = this._trackIdToObservations.get(o7).enqueue(r6.objectId);
  1192. r(d9) && (this._addOrUpdated.has(d9) ? this._addOrUpdated.delete(d9) : this._removed.push(d9));
  1193. }
  1194. checkForUpdates() {
  1195. const t6 = this._getToAdd(), e3 = this._getToRemove(), s9 = performance.now();
  1196. s9 - this._lastPurge >= this.purgeInterval && (this._purge(s9), this._lastPurge = s9);
  1197. const r6 = [];
  1198. if (r(e3))
  1199. for (const o7 of e3) {
  1200. const t7 = this.store.removeById(o7);
  1201. r(t7) && r6.push(t7);
  1202. }
  1203. if (r(t6))
  1204. for (const i5 of t6)
  1205. i5.attributes[d6] = s9, this.store.add(i5);
  1206. (t6 || (r6 == null ? void 0 : r6.length)) && this.store.update(t6, r6);
  1207. }
  1208. _getToAdd() {
  1209. if (!this._addOrUpdated.size)
  1210. return null;
  1211. const t6 = new Array(this._addOrUpdated.size);
  1212. let e3 = 0;
  1213. return this._addOrUpdated.forEach((s9) => t6[e3++] = s9), this._addOrUpdated.clear(), t6;
  1214. }
  1215. _getToRemove() {
  1216. const t6 = this._removed;
  1217. return this._removed.length ? (this._removed = [], t6) : null;
  1218. }
  1219. _nextId() {
  1220. const t6 = this._idCounter;
  1221. return this._idCounter = (this._idCounter + 1) % 4294967294 + 1, t6;
  1222. }
  1223. _purge(t6) {
  1224. const e3 = this._purgeOptions;
  1225. r(e3) && (this._purgeSomeByDisplayCount(e3), this._purgeByAge(e3), this._purgeByAgeReceived(t6, e3), this._purgeTracks());
  1226. }
  1227. _purgeSomeByDisplayCount(t6) {
  1228. if (!t6.displayCount)
  1229. return;
  1230. let e3 = this.store.size;
  1231. if (e3 > t6.displayCount) {
  1232. if (this._timeInfo.trackIdField) {
  1233. for (const s9 of this._trackIdToObservations.values())
  1234. if (e3 > t6.displayCount && s9.size) {
  1235. const t7 = e2(s9.dequeue());
  1236. this._removed.push(t7), e3--;
  1237. }
  1238. }
  1239. if (r(this._trackIdLessObservations)) {
  1240. let s9 = e3 - t6.displayCount;
  1241. for (; s9-- > 0; ) {
  1242. const t7 = this._trackIdLessObservations.dequeue();
  1243. r(t7) && this._removed.push(t7);
  1244. }
  1245. }
  1246. }
  1247. }
  1248. _purgeByAge(t6) {
  1249. var _a;
  1250. if (!t6.age || !((_a = this._timeInfo) == null ? void 0 : _a.startTimeField))
  1251. return;
  1252. const e3 = 60 * t6.age * 1e3, s9 = this._maxAge - e3;
  1253. this.store.forEach((t7) => {
  1254. t7.attributes[this._timeInfo.startTimeField] < s9 && this._removed.push(t7.objectId);
  1255. });
  1256. }
  1257. _purgeByAgeReceived(t6, e3) {
  1258. if (!e3.ageReceived)
  1259. return;
  1260. const s9 = t6 - 60 * e3.ageReceived * 1e3;
  1261. this.store.forEach((t7) => {
  1262. t7.attributes[d6] < s9 && this._removed.push(t7.objectId);
  1263. });
  1264. }
  1265. _purgeTracks() {
  1266. this._trackIdToObservations.forEach((t6, e3) => {
  1267. 0 === t6.size && this._trackIdToObservations.delete(e3);
  1268. });
  1269. }
  1270. };
  1271. // node_modules/@arcgis/core/views/2d/layers/features/sources/GeoEventSource.js
  1272. var l7 = 2500;
  1273. function m5(t6, s9) {
  1274. const r6 = t6.weakClone();
  1275. if (r(t6.geometry)) {
  1276. const e3 = w2(s9, t6.geometry.coords[0]), i5 = M(s9, t6.geometry.coords[1]);
  1277. r6.geometry = new t3([], [e3, i5]);
  1278. }
  1279. return r6;
  1280. }
  1281. function _3(e3) {
  1282. return "esriGeometryPoint" === e3 ? m5 : (t6, s9) => {
  1283. const r6 = t6.weakClone(), n7 = new t3(), o7 = false, d9 = false, c9 = at(n7, t6.geometry, o7, d9, e3, s9, false, false);
  1284. return r6.geometry = c9, r6;
  1285. };
  1286. }
  1287. function f7(t6) {
  1288. return "esriGeometryPoint" === t6 ? (t7) => r(t7.geometry) ? { minX: t7.geometry.coords[0], minY: t7.geometry.coords[1], maxX: t7.geometry.coords[0], maxY: t7.geometry.coords[1] } : { minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 } : (t7) => {
  1289. let s9 = 1 / 0, r6 = 1 / 0, i5 = -1 / 0, n7 = -1 / 0;
  1290. return r(t7.geometry) && t7.geometry.forEachVertex((e3, t8) => {
  1291. s9 = Math.min(s9, e3), r6 = Math.min(r6, t8), i5 = Math.max(i5, e3), n7 = Math.max(n7, t8);
  1292. }), { minX: s9, minY: r6, maxX: i5, maxY: n7 };
  1293. };
  1294. }
  1295. function v5(e3, t6) {
  1296. const r6 = i2(9, f7(t6));
  1297. return r6.load(e3), r6;
  1298. }
  1299. function g5(e3, t6) {
  1300. return e3.search({ minX: t6.bounds[0], minY: t6.bounds[1], maxX: t6.bounds[2], maxY: t6.bounds[3] });
  1301. }
  1302. var y5 = class {
  1303. constructor(e3, t6) {
  1304. this.onUpdate = e3, this._geometryType = t6, this._objectIdToFeature = /* @__PURE__ */ new Map();
  1305. }
  1306. get _features() {
  1307. const e3 = [];
  1308. return this._objectIdToFeature.forEach((t6) => e3.push(t6)), e3;
  1309. }
  1310. add(e3) {
  1311. this._objectIdToFeature.set(e3.objectId, e3), this._index = null;
  1312. }
  1313. get(e3) {
  1314. return this._objectIdToFeature.has(e3) ? this._objectIdToFeature.get(e3) : null;
  1315. }
  1316. forEach(e3) {
  1317. this._objectIdToFeature.forEach(e3);
  1318. }
  1319. search(e3) {
  1320. return this._index || (this._index = v5(this._features, this._geometryType)), g5(this._index, e3);
  1321. }
  1322. removeById(e3) {
  1323. const t6 = this._objectIdToFeature.get(e3);
  1324. return t6 ? (this._objectIdToFeature.delete(e3), this._index = null, t6) : null;
  1325. }
  1326. update(e3, t6) {
  1327. this.onUpdate(e3, t6);
  1328. }
  1329. get size() {
  1330. return this._objectIdToFeature.size;
  1331. }
  1332. };
  1333. var b4 = class extends m4 {
  1334. constructor(e3) {
  1335. super(e3), this.type = "geoevent", this._dataReceiveEventEnabled = false, this._level = 0, this._updateInfo = { websocket: 0, client: 0 }, this._inUpdate = false;
  1336. const { outSR: s9 } = e3, { geometryType: r6, objectIdField: i5, timeInfo: n7, purgeOptions: o7, source: a8, spatialReference: h6, serviceFilter: u4, maxReconnectionAttempts: p4, maxReconnectionInterval: m6, updateInterval: f9, enableDataReceived: v6, customParameters: g6 } = e3.serviceInfo, b6 = new y5(this._onUpdate.bind(this), r6), I2 = new h4(b6, i5, n7, o7), U4 = t4(a8, h6, s9, r6, u4, p4, m6, g6);
  1337. this._store = b6, this._manager = I2, this._connection = U4, this._quantize = _3(r6), this._dataReceiveEventEnabled = v6, this._handles = [this._connection.on("data-received", (e4) => this._onFeature(e4)), l(() => U4.connectionStatus, (e4) => this.events.emit("connectionStatus", e4)), l(() => U4.errorString, (e4) => this.events.emit("errorString", e4))], this._initUpdateInterval = () => {
  1338. let t6 = performance.now();
  1339. this._updateIntervalId = setInterval(() => {
  1340. const s10 = performance.now(), r7 = s10 - t6;
  1341. if (r7 > l7) {
  1342. t6 = s10;
  1343. const e4 = Math.round(this._updateInfo.client / (r7 / 1e3)), i6 = Math.round(this._updateInfo.websocket / (r7 / 1e3));
  1344. this._updateInfo.client = 0, this._updateInfo.websocket = 0, this.events.emit("updateRate", { client: e4, websocket: i6 });
  1345. }
  1346. e3.canAcceptRequest() && !this._inUpdate && this._manager.checkForUpdates();
  1347. }, f9);
  1348. }, this._initUpdateInterval();
  1349. }
  1350. destroy() {
  1351. super.destroy(), this._clearUpdateInterval(), this._handles.forEach((e3) => e3.remove()), this._connection.destroy();
  1352. }
  1353. _fetchDataTile() {
  1354. }
  1355. pauseStream() {
  1356. this._clearUpdateInterval();
  1357. }
  1358. resumeStream() {
  1359. this._initUpdateInterval();
  1360. }
  1361. enableEvent(e3, t6) {
  1362. "data-received" === e3 && (this._dataReceiveEventEnabled = t6);
  1363. }
  1364. get updating() {
  1365. return false;
  1366. }
  1367. subscribe(e3, t6) {
  1368. super.subscribe(e3, t6);
  1369. const s9 = this._subscriptions.get(e3.id);
  1370. this._level = e3.level;
  1371. const r6 = this._getTileFeatures(e3);
  1372. this._onMessage({ type: "append", id: e3.key.id, addOrUpdate: r6, end: true }), s9.didSend = true;
  1373. }
  1374. unsubscribe(e3) {
  1375. super.unsubscribe(e3);
  1376. }
  1377. *readers(t6) {
  1378. const s9 = this._subscriptions.get(t6), { tile: r6 } = s9;
  1379. yield this._getTileFeatures(r6);
  1380. for (const i5 of s9.requests.stream.entries)
  1381. r(i5) && r(i5.addOrUpdate) && (yield i5.addOrUpdate);
  1382. }
  1383. createTileQuery(e3) {
  1384. throw new Error("Service does not support tile queries");
  1385. }
  1386. async resend() {
  1387. this._subscriptions.forEach((e3) => {
  1388. const { tile: t6 } = e3, s9 = { type: "append", id: t6.id, addOrUpdate: this._getTileFeatures(t6), end: true };
  1389. this._onMessage(s9);
  1390. });
  1391. }
  1392. _getTileFeatures(e3) {
  1393. const t6 = this._store.search(e3).map((t7) => this._quantize(t7, e3.transform));
  1394. return c5.fromOptimizedFeatures(t6, this._serviceInfo, e3.transform);
  1395. }
  1396. _onFeature(e3) {
  1397. this._updateInfo.websocket++;
  1398. try {
  1399. this._dataReceiveEventEnabled && this.events.emit("data-received", e3);
  1400. const t6 = X(e3, this._serviceInfo.geometryType, false, false, this._serviceInfo.objectIdField);
  1401. this._manager.add(t6);
  1402. } catch (t6) {
  1403. }
  1404. }
  1405. _clearUpdateInterval() {
  1406. clearInterval(this._updateIntervalId), this._updateIntervalId = 0;
  1407. }
  1408. async _onUpdate(t6, s9) {
  1409. this._inUpdate = true;
  1410. try {
  1411. r(t6) && (this._updateInfo.client += t6.length), this._subscriptions.forEach((e3, t7) => {
  1412. e3.didSend && e3.tile.level === this._level && this._onMessage({ type: "append", id: t7, addOrUpdate: null, clear: true, end: false });
  1413. });
  1414. const s10 = [];
  1415. this._subscriptions.forEach((e3, t7) => {
  1416. if (!e3.didSend || e3.tile.level !== this._level)
  1417. return;
  1418. const r6 = e3.tile, i5 = { type: "append", id: t7, addOrUpdate: this._getTileFeatures(r6), remove: [], end: false, status: t5.empty() };
  1419. e3.requests.stream.enqueue(i5), s10.push(this._onMessage(i5));
  1420. }), await Promise.all(s10), this._subscriptions.forEach((e3, t7) => {
  1421. e3.didSend && e3.tile.level === this._level && this._onMessage({ type: "append", id: t7, addOrUpdate: null, end: true });
  1422. });
  1423. } catch {
  1424. }
  1425. this._inUpdate = false;
  1426. }
  1427. };
  1428. // node_modules/@arcgis/core/views/2d/layers/features/sources/PagedFeatureSource.js
  1429. var n6 = class extends d5 {
  1430. constructor(e3) {
  1431. super(e3);
  1432. }
  1433. async _fetchDataTile(r6) {
  1434. const i5 = 6, o7 = 20, n7 = this._subscriptions.get(r6.key.id);
  1435. let d9 = false, c9 = 0, u4 = 0;
  1436. const p4 = (e3, t6) => {
  1437. u4--, f2(n7);
  1438. const a8 = r6.id, i6 = e3.reader, o8 = e3.query;
  1439. if (!i6.exceededTransferLimit) {
  1440. if (d9 = true, 0 !== t6 && !i6.hasFeatures) {
  1441. const e5 = { id: a8, addOrUpdate: i6, end: 0 === u4, type: "append" };
  1442. return n7.add({ message: e5, query: o8 }), void this._onMessage(e5);
  1443. }
  1444. const e4 = { id: a8, addOrUpdate: i6, end: 0 === u4, type: "append" };
  1445. return n7.add({ message: e4, query: o8 }), void this._onMessage(e4);
  1446. }
  1447. const c10 = { id: a8, addOrUpdate: i6, end: d9 && 0 === u4, type: "append" };
  1448. n7.add({ message: c10, query: o8 }), this._onMessage(c10);
  1449. };
  1450. let h6 = 0, m6 = 0;
  1451. for (; !d9 && m6++ < o7; ) {
  1452. let o8;
  1453. for (let s9 = 0; s9 < h6 + 1; s9++) {
  1454. const s10 = c9++;
  1455. u4++, o8 = this._fetchDataTilePage(r6, s10, n7).then((e3) => e3 && p4(e3, s10)).catch((s11) => {
  1456. d9 = true, j(s11) || (s.getLogger("esri.views.2d.layers.features.sources.PagedFeatureSource").error(new s2("mapview-query-error", "Encountered error when fetching tile", { tile: r6, error: s11 })), this._onMessage({ id: r6.id, addOrUpdate: null, end: d9, type: "append" }));
  1457. });
  1458. }
  1459. await o8, f2(n7), h6 = Math.min(h6 + 2, i5);
  1460. }
  1461. }
  1462. async _fetchDataTilePage(e3, t6, a8) {
  1463. f2(a8);
  1464. const o7 = this._queryInfo, n7 = { start: this.pageSize * t6, num: this.pageSize, returnExceededLimitFeatures: true, quantizationParameters: e3.getQuantizationParameters() };
  1465. r(this.maxRecordCountFactor) && (n7.maxRecordCountFactor = this.maxRecordCountFactor);
  1466. const d9 = this.createTileQuery(e3, n7);
  1467. try {
  1468. const r6 = a8.signal, i5 = await this._queue.push({ tile: e3, query: d9, signal: r6, depth: t6 });
  1469. return f2(a8), i5 ? o7 !== this._queryInfo ? this._fetchDataTilePage(e3, t6, a8) : { reader: i5, query: d9 } : null;
  1470. } catch (c9) {
  1471. return b2(c9), null;
  1472. }
  1473. }
  1474. };
  1475. // node_modules/@arcgis/core/views/2d/layers/features/sources/SnapshotFeatureSource.js
  1476. function h5(t6, e3, s9) {
  1477. const r6 = t6.getXHydrated(), o7 = t6.getYHydrated(), a8 = e3.getColumnForX(r6), n7 = Math.floor(e3.normalizeCol(a8));
  1478. return `${s9}/${Math.floor(e3.getRowForY(o7))}/${n7}`;
  1479. }
  1480. function l8(t6, e3) {
  1481. if (t(t6))
  1482. return null;
  1483. const s9 = e3.transform, o7 = t6.getQuantizationTransform();
  1484. if (t(o7)) {
  1485. const [e4, r6] = s9.scale, [o8, a9] = s9.translate, n8 = -o8 / e4, i6 = 1 / e4, d10 = a9 / r6, u5 = 1 / -r6;
  1486. return t6.transform(n8, d10, i6, u5);
  1487. }
  1488. const [a8, n7] = o7.scale, [i5, d9] = o7.translate, [u4, h6] = s9.scale, [l9, c9] = s9.translate, g6 = a8 / u4, _4 = (i5 - l9) / u4, p4 = n7 / h6, f9 = (-d9 + c9) / h6;
  1489. return t6.transform(_4, f9, g6, p4);
  1490. }
  1491. var c6 = class extends d5 {
  1492. constructor(t6) {
  1493. super(t6), this.mode = "snapshot", this._loading = true, this._controller = new AbortController(), this._downloadPromise = null, this._didSendEnd = false, this._queries = new Array(), this._invalidated = false, this._hasAggregates = false, this._random = new t2(1e3), this._store = t6.store, this._markedIdsBufId = this._store.storage.createBitset();
  1494. }
  1495. destroy() {
  1496. super.destroy(), this._controller.abort();
  1497. }
  1498. get loading() {
  1499. return this._loading;
  1500. }
  1501. get _signal() {
  1502. return this._controller.signal;
  1503. }
  1504. update(t6, s9) {
  1505. super.update(t6, s9), null == this._featureCount && (this._featureCount = s9.initialFeatureCount), r(s9.changedFeatureCount) && (this._featureCount = s9.changedFeatureCount), this._hasAggregates = t6.targets.aggregate;
  1506. }
  1507. async resend(t6 = false) {
  1508. if (await this._downloadPromise, this._invalidated || t6) {
  1509. const t7 = f(this._featureCount, "Expected featureCount to be defined");
  1510. return this._invalidated = false, this._subscriptions.forEach((t8) => t8.clear()), this._downloadPromise = this._download(t7), void await this._downloadPromise;
  1511. }
  1512. const e3 = this._queries.map(({ query: t7, reader: e4 }) => this._sendPatchQuery(t7, e4));
  1513. await Promise.all(e3), this._subscriptions.forEach((t7) => {
  1514. t7.requests.done.forEach((t8) => this._onMessage(t8.message));
  1515. });
  1516. }
  1517. async refresh(t6, e3) {
  1518. e3 && (this._featureCount = e3.featureCount), await this.resend(true);
  1519. }
  1520. async _sendPatchQuery(t6, s9) {
  1521. const r6 = r(t6.outFields) ? t6.outFields : [], a8 = this._queryInfo.outFields, n7 = a8.filter((t7) => !r6.includes(t7));
  1522. if (!n7.length)
  1523. return;
  1524. const i5 = t6.clone(), d9 = this._signal;
  1525. i5.returnGeometry = false, i5.returnCentroid = false, i5.outFields = n7, t6.outFields = a8;
  1526. const u4 = await this._queue.push({ query: i5, depth: 0, signal: d9 });
  1527. f2({ signal: d9 }), s9.joinAttributes(u4);
  1528. }
  1529. async _fetchDataTile(t6) {
  1530. if (!this._downloadPromise) {
  1531. const t7 = f(this._featureCount, "Expected featureCount to be defined");
  1532. this._downloadPromise = this._download(t7);
  1533. }
  1534. const e3 = this._store.search(t6), r6 = this._subscriptions.get(t6.key.id), o7 = e3.length - 1;
  1535. for (let s9 = 0; s9 < o7; s9++) {
  1536. const o8 = l8(e3[s9], t6), n8 = { type: "append", id: t6.id, addOrUpdate: o8, end: false, status: t5.empty() };
  1537. r6.add({ query: null, message: n8 }), this._hasAggregates || await U(1), this._onMessage(n8);
  1538. }
  1539. const n7 = l8(o7 >= 0 ? e3[o7] : null, t6), i5 = this._didSendEnd, d9 = { type: "append", id: t6.id, addOrUpdate: n7, end: i5, status: t5.empty() };
  1540. r6.add({ query: null, message: d9 }), this._onMessage(d9);
  1541. }
  1542. async _download(e3) {
  1543. try {
  1544. await this.whenInitialized();
  1545. const t6 = this._store.storage.getBitset(this._markedIdsBufId), s9 = /* @__PURE__ */ new Set();
  1546. t6.clear();
  1547. const r6 = Math.ceil(e3 / this.pageSize), o7 = Array.from({ length: r6 }, (t7, e4) => e4).sort((t7, e4) => this._random.getInt() - this._random.getInt()).map((e4) => this._downloadPage(e4, t6, s9));
  1548. await Promise.all(o7), this._store.sweepFeatures(t6, this._store.storage), this._store.sweepFeatureSets(s9);
  1549. } catch (s9) {
  1550. s.getLogger("esri.views.2d.layers.features.sources.SnapshotFeatureSource").error("mapview-snapshot-source", "Encountered and error when downloading feature snapshot", s9);
  1551. }
  1552. this._sendEnd(), this._loading = false;
  1553. }
  1554. async _downloadPage(t6, s9, r6) {
  1555. const a8 = this.pageSize, n7 = { start: t6 * a8, num: a8, cacheHint: true };
  1556. r(this.maxRecordCountFactor) && (n7.maxRecordCountFactor = this.maxRecordCountFactor);
  1557. const i5 = this.createQuery(n7), d9 = this._signal, u4 = await this._queue.push({ query: i5, depth: t6, signal: d9 });
  1558. f2({ signal: d9 }), this._queries.push({ query: i5, reader: u4 }), this._store.insert(u4), r6.add(u4.instance);
  1559. const h6 = u4.getCursor();
  1560. for (; h6.next(); )
  1561. s9.set(h6.getDisplayId());
  1562. this._send(u4);
  1563. }
  1564. _send(t6) {
  1565. if (!this._subscriptions.size)
  1566. return;
  1567. let s9 = null;
  1568. const o7 = /* @__PURE__ */ new Map(), a8 = /* @__PURE__ */ new Set(), n7 = /* @__PURE__ */ new Map();
  1569. this._subscriptions.forEach((t7) => {
  1570. var _a;
  1571. const e3 = t7.tile;
  1572. o7.set(e3.key.id, null), s9 = e3.tileInfoView, a8.add(e3.level);
  1573. const { row: r6, col: i5 } = e3.key, d9 = `${e3.level}/${r6}/${i5}`, u4 = (_a = n7.get(d9)) != null ? _a : [];
  1574. u4.push(t7), n7.set(d9, u4);
  1575. });
  1576. for (const e3 of a8) {
  1577. const a9 = s9.getLODInfoAt(e3), i5 = t6.getCursor();
  1578. for (; i5.next(); ) {
  1579. const t7 = h5(i5, a9, e3), s10 = i5.getIndex();
  1580. if (n7.has(t7))
  1581. for (const e4 of n7.get(t7)) {
  1582. const t8 = e4.tile.id;
  1583. let a10 = o7.get(t8);
  1584. t(a10) && (a10 = [], o7.set(t8, a10)), a10.push(s10);
  1585. }
  1586. }
  1587. }
  1588. o7.forEach((s10, r6) => {
  1589. if (r(s10)) {
  1590. const e3 = this._subscriptions.get(r6), o8 = { type: "append", id: r6, addOrUpdate: l8(r3.from(t6, s10), e3.tile), end: false, status: t5.empty() };
  1591. e3.add({ query: null, message: o8 }), this._onMessage(o8);
  1592. }
  1593. });
  1594. }
  1595. _sendEnd() {
  1596. this._subscriptions.forEach((t6) => {
  1597. const e3 = { type: "append", id: t6.tile.id, addOrUpdate: null, end: true, status: t5.empty() };
  1598. t6.add({ query: null, message: e3 }), this._onMessage(e3);
  1599. }), this._didSendEnd = true;
  1600. }
  1601. };
  1602. // node_modules/@arcgis/core/views/2d/layers/features/sources/createSource.js
  1603. function a7(e3, r6, a8, u4, i5, p4) {
  1604. const f9 = c7(e3, r6, a8, u4, i5, p4);
  1605. switch (f9.type) {
  1606. case "feature":
  1607. switch (f9.origin) {
  1608. case "hosted":
  1609. case "local":
  1610. return new n6(f9);
  1611. case "snapshot":
  1612. return new c6(f9);
  1613. case "unknown":
  1614. return new a5(f9);
  1615. }
  1616. case "geoevent":
  1617. return new b4(f9);
  1618. }
  1619. }
  1620. function c7(t6, o7, n7, s9, a8, c9) {
  1621. switch (t6.type) {
  1622. case "snapshot":
  1623. return { type: "feature", origin: "snapshot", featureCount: i(t6.featureCount, 0), serviceInfo: t6, onMessage: s9, outSR: o7, tileInfoView: n7, canAcceptRequest: a8, store: c9 };
  1624. case "stream":
  1625. return { type: "geoevent", serviceInfo: t6, onMessage: s9, outSR: o7, canAcceptRequest: a8 };
  1626. case "memory":
  1627. case "on-demand":
  1628. return { type: "feature", serviceInfo: t6, onMessage: s9, outSR: o7, origin: u4(t6.source), tileInfoView: n7, canAcceptRequest: a8 };
  1629. }
  1630. function u4(e3) {
  1631. return Array.isArray(e3) ? "local" : "path" in e3 && g3(e3.path) ? "hosted" : "unknown";
  1632. }
  1633. }
  1634. // node_modules/@arcgis/core/geohash/geohashUtils.js
  1635. var c8 = new Float64Array(2);
  1636. var f8 = new Float64Array(2);
  1637. function X2(t6, n7) {
  1638. let o7 = -90, r6 = 90, e3 = -180, c9 = 180;
  1639. for (let f9 = 0; f9 < n7; f9++) {
  1640. const n8 = Math.ceil((f9 + 1) / 2), u4 = Math.floor((f9 + 1) / 2), l9 = 1 - f9 % 2, h6 = 30 - (3 * n8 + 2 * u4), s9 = 30 - (2 * n8 + 3 * u4), i5 = 3 * l9 + 2 * (1 - l9), a8 = 2 * l9 + 3 * (1 - l9), g6 = 3 * l9 + 7 * (1 - l9) << s9, M2 = (7 * l9 + 3 * (1 - l9) << h6 & t6.geohashX) >> h6, A3 = (g6 & t6.geohashY) >> s9;
  1641. for (let t7 = i5 - 1; t7 >= 0; t7--) {
  1642. const n9 = (e3 + c9) / 2, o8 = M2 & 1 << t7 ? 1 : 0;
  1643. e3 = (1 - o8) * e3 + o8 * n9, c9 = (1 - o8) * n9 + o8 * c9;
  1644. }
  1645. for (let t7 = a8 - 1; t7 >= 0; t7--) {
  1646. const n9 = (o7 + r6) / 2, e4 = A3 & 1 << t7 ? 1 : 0;
  1647. o7 = (1 - e4) * o7 + e4 * n9, r6 = (1 - e4) * n9 + e4 * r6;
  1648. }
  1649. }
  1650. return [e3, o7, c9, r6];
  1651. }
  1652. function Y2(t6, n7, o7, r6) {
  1653. r6 % 2 && (r6 += 1);
  1654. let e3 = 0, c9 = 0, f9 = -90, u4 = 90, l9 = -180, h6 = 180;
  1655. for (let s9 = 0; s9 < r6 / 2; s9++) {
  1656. for (let t7 = 0; t7 < 5; t7++) {
  1657. const n8 = (l9 + h6) / 2, r7 = o7 > n8 ? 1 : 0;
  1658. e3 |= r7 << 29 - (t7 + 5 * s9), l9 = (1 - r7) * l9 + r7 * n8, h6 = (1 - r7) * n8 + r7 * h6;
  1659. }
  1660. for (let t7 = 0; t7 < 5; t7++) {
  1661. const o8 = (f9 + u4) / 2, r7 = n7 > o8 ? 1 : 0;
  1662. c9 |= r7 << 29 - (t7 + 5 * s9), f9 = (1 - r7) * f9 + r7 * o8, u4 = (1 - r7) * o8 + r7 * u4;
  1663. }
  1664. }
  1665. t6.geohashX = e3, t6.geohashY = c9;
  1666. }
  1667. function b5(t6, n7, o7, r6, e3) {
  1668. e3 % 2 && (e3 += 1);
  1669. let c9 = 0, f9 = 0, u4 = -90, l9 = 90, h6 = -180, s9 = 180;
  1670. for (let i5 = 0; i5 < e3 / 2; i5++) {
  1671. for (let t7 = 0; t7 < 5; t7++) {
  1672. const n8 = (h6 + s9) / 2, o8 = r6 > n8 ? 1 : 0;
  1673. c9 |= o8 << 29 - (t7 + 5 * i5), h6 = (1 - o8) * h6 + o8 * n8, s9 = (1 - o8) * n8 + o8 * s9;
  1674. }
  1675. for (let t7 = 0; t7 < 5; t7++) {
  1676. const n8 = (u4 + l9) / 2, r7 = o7 > n8 ? 1 : 0;
  1677. f9 |= r7 << 29 - (t7 + 5 * i5), u4 = (1 - r7) * u4 + r7 * n8, l9 = (1 - r7) * n8 + r7 * l9;
  1678. }
  1679. }
  1680. t6[2 * n7] = c9, t6[2 * n7 + 1] = f9;
  1681. }
  1682. // node_modules/@arcgis/core/geohash/GeohashTree.js
  1683. var u2 = class {
  1684. constructor(e3 = [], s9, i5 = 8096) {
  1685. this.onRelease = (t6) => {
  1686. }, this._nodes = 0, this._root = new d7(this, 0, 0, 0), this._statisticFields = e3, this._pool = i5 ? new s7(8096) : null, this._serviceInfo = s9;
  1687. }
  1688. destroy() {
  1689. this.clear();
  1690. }
  1691. _acquire(t6, s9, i5) {
  1692. this._nodes++;
  1693. let n7 = null;
  1694. return r(this._pool) && (n7 = this._pool.dequeue()), r(n7) ? n7.realloc(t6, s9, i5) : n7 = new d7(this, t6, s9, i5), n7;
  1695. }
  1696. _release(t6) {
  1697. this.onRelease(t6), this._nodes--, r(this._pool) && this._pool.enqueue(t6);
  1698. }
  1699. get count() {
  1700. return this._root.count;
  1701. }
  1702. get size() {
  1703. return this._nodes;
  1704. }
  1705. get poolSize() {
  1706. return b(this._pool, 0, (t6) => t6.size);
  1707. }
  1708. get depth() {
  1709. let t6 = 0;
  1710. return this.forEach((e3) => t6 = Math.max(t6, e3.depth)), t6;
  1711. }
  1712. dropLevels(t6) {
  1713. this.forEach((e3) => {
  1714. if (e3.depth >= t6)
  1715. for (let t7 = 0; t7 < e3.children.length; t7++) {
  1716. const s9 = e3.children[t7];
  1717. s9 && this._release(s9);
  1718. }
  1719. }), this.forEach((e3) => {
  1720. if (e3.depth >= t6)
  1721. for (let t7 = 0; t7 < e3.children.length; t7++)
  1722. e3.children[t7] = null;
  1723. });
  1724. }
  1725. clear() {
  1726. this.forEach((t6) => this._release(t6)), this._root = new d7(this, 0, 0, 0);
  1727. }
  1728. insert(t6, e3, s9 = 0) {
  1729. const i5 = c5.fromOptimizedFeatures([t6], this._serviceInfo).getCursor();
  1730. i5.next();
  1731. const n7 = i5.readGeometry();
  1732. if (!n7)
  1733. return;
  1734. const [o7, a8] = n7.coords, r6 = t6.geohashX, l9 = t6.geohashY;
  1735. this.insertCursor(i5, t6.displayId, o7, a8, r6, l9, e3, s9);
  1736. }
  1737. insertCursor(t6, e3, s9, i5, n7, o7, a8, r6 = 0) {
  1738. let l9 = this._root, h6 = 0, c9 = 0, u4 = 0;
  1739. for (; null !== l9; ) {
  1740. if (l9.depth >= r6 && (l9.count += 1, l9.xTotal += s9, l9.yTotal += i5, l9.xGeohashTotal += n7, l9.yGeohashTotal += o7, l9.referenceId = e3, this._updateStatisticsCursor(t6, l9, 1)), h6 >= a8)
  1741. return void l9.add(e3);
  1742. const d9 = Math.ceil((h6 + 1) / 2), f9 = Math.floor((h6 + 1) / 2), x4 = 1 - h6 % 2, m6 = 30 - (3 * d9 + 2 * f9), g6 = 30 - (2 * d9 + 3 * f9), y6 = (n7 & 7 * x4 + 3 * (1 - x4) << m6) >> m6, p4 = (o7 & 3 * x4 + 7 * (1 - x4) << g6) >> g6, _4 = y6 + p4 * (8 * x4 + 4 * (1 - x4));
  1743. c9 = c9 << 3 * x4 + 2 * (1 - x4) | y6, u4 = u4 << 2 * x4 + 3 * (1 - x4) | p4, null == l9.children[_4] && (l9.children[_4] = this._acquire(c9, u4, h6 + 1)), h6 += 1, l9 = l9.children[_4];
  1744. }
  1745. }
  1746. remove(t6, e3) {
  1747. const s9 = c5.fromOptimizedFeatures([t6], this._serviceInfo).getCursor();
  1748. s9.next();
  1749. const i5 = s9.readGeometry();
  1750. if (!i5)
  1751. return;
  1752. const [n7, o7] = i5.coords, a8 = t6.geohashX, r6 = t6.geohashY;
  1753. this.removeCursor(s9, n7, o7, a8, r6, e3);
  1754. }
  1755. removeCursor(t6, e3, s9, i5, n7, o7) {
  1756. let a8 = this._root, r6 = 0;
  1757. for (; null !== a8; ) {
  1758. if (a8.count -= 1, a8.xTotal -= e3, a8.yTotal -= s9, a8.xGeohashTotal -= i5, a8.yGeohashTotal -= n7, this._updateStatisticsCursor(t6, a8, -1), r6 >= o7)
  1759. return void a8.remove(t6.getDisplayId());
  1760. const l9 = Math.ceil((r6 + 1) / 2), h6 = Math.floor((r6 + 1) / 2), c9 = 1 - r6 % 2, u4 = 30 - (3 * l9 + 2 * h6), d9 = 30 - (2 * l9 + 3 * h6), f9 = ((i5 & 7 * c9 + 3 * (1 - c9) << u4) >> u4) + ((n7 & 3 * c9 + 7 * (1 - c9) << d9) >> d9) * (8 * c9 + 4 * (1 - c9)), x4 = a8.children[f9];
  1761. 1 === (x4 == null ? void 0 : x4.count) && (this._release(x4), a8.children[f9] = null), r6 += 1, a8 = x4;
  1762. }
  1763. }
  1764. forEach(t6) {
  1765. let e3 = this._root;
  1766. for (; null !== e3; ) {
  1767. const s9 = this._linkChildren(e3) || e3.next;
  1768. t6(e3), e3 = s9;
  1769. }
  1770. }
  1771. find(t6, e3, s9) {
  1772. return this._root.find(t6, e3, s9, 0, 0, 0);
  1773. }
  1774. findIf(t6) {
  1775. let e3 = null;
  1776. return this.forEach((s9) => {
  1777. t6(s9) && (e3 = s9);
  1778. }), e3;
  1779. }
  1780. findAllIf(t6) {
  1781. const e3 = [];
  1782. return this.forEach((s9) => {
  1783. t6(s9) && e3.push(s9);
  1784. }), e3;
  1785. }
  1786. findSingleOccupancyNode(t6, e3, s9, i5, n7) {
  1787. let o7 = this._root;
  1788. for (; null !== o7; ) {
  1789. const a8 = o7.depth, r6 = o7.xNode, l9 = o7.yNode, h6 = 1 - a8 % 2, c9 = o7.xGeohashTotal / o7.count, u4 = o7.yGeohashTotal / o7.count;
  1790. if (1 === o7.count && t6 < c9 && c9 <= s9 && e3 < u4 && u4 <= i5)
  1791. return o7;
  1792. if (a8 >= n7) {
  1793. o7 = o7.next;
  1794. continue;
  1795. }
  1796. const d9 = Math.ceil((a8 + 1) / 2), f9 = Math.floor((a8 + 1) / 2), x4 = 30 - (3 * d9 + 2 * f9), m6 = 30 - (2 * d9 + 3 * f9), g6 = ~((1 << x4) - 1), y6 = ~((1 << m6) - 1), p4 = (t6 & g6) >> x4, _4 = (e3 & y6) >> m6, v6 = (s9 & g6) >> x4, M2 = (i5 & y6) >> m6, T5 = r6 << 3 * h6 + 2 * (1 - h6), b6 = l9 << 2 * h6 + 3 * (1 - h6), k3 = T5 + 8 * h6 + 4 * (1 - h6), N = b6 + 4 * h6 + 8 * (1 - h6), I2 = Math.max(T5, p4), C = Math.max(b6, _4), G4 = Math.min(k3, v6), L3 = Math.min(N, M2);
  1797. let S3 = null, w4 = null;
  1798. for (let t7 = C; t7 <= L3; t7++)
  1799. for (let e4 = I2; e4 <= G4; e4++) {
  1800. const s10 = e4 - T5 + (t7 - b6) * (8 * h6 + 4 * (1 - h6)), i6 = o7.children[s10];
  1801. i6 && (S3 || (S3 = i6, S3.next = o7.next), w4 && (w4.next = i6), w4 = i6, i6.next = o7.next);
  1802. }
  1803. o7 = S3 || o7.next;
  1804. }
  1805. return null;
  1806. }
  1807. getRegionDisplayIds(t6) {
  1808. let e3 = this._root;
  1809. const { bounds: s9, geohashBounds: i5, level: n7 } = t6, [o7, a8, r6, l9] = s9, h6 = [];
  1810. for (; null !== e3; ) {
  1811. const t7 = e3.depth, s10 = e3.xNode, c9 = e3.yNode;
  1812. if (t7 >= n7) {
  1813. const t8 = e3.xTotal / e3.count, s11 = e3.yTotal / e3.count;
  1814. t8 >= o7 && t8 <= r6 && s11 >= a8 && s11 <= l9 && e3.displayIds.forEach((t9) => h6.push(t9)), e3 = e3.next;
  1815. continue;
  1816. }
  1817. const u4 = Math.ceil((t7 + 1) / 2), d9 = Math.floor((t7 + 1) / 2), f9 = 1 - t7 % 2, x4 = 30 - (3 * u4 + 2 * d9), m6 = 30 - (2 * u4 + 3 * d9), g6 = ~((1 << x4) - 1), y6 = ~((1 << m6) - 1), p4 = (i5.xLL & g6) >> x4, _4 = (i5.yLL & y6) >> m6, v6 = (i5.xTR & g6) >> x4, M2 = (i5.yTR & y6) >> m6, T5 = s10 << 3 * f9 + 2 * (1 - f9), b6 = c9 << 2 * f9 + 3 * (1 - f9), k3 = T5 + 8 * f9 + 4 * (1 - f9), N = b6 + 4 * f9 + 8 * (1 - f9), I2 = Math.max(T5, p4), C = Math.max(b6, _4), G4 = Math.min(k3, v6), L3 = Math.min(N, M2);
  1818. let S3 = null, w4 = null;
  1819. for (let i6 = C; i6 <= L3; i6++)
  1820. for (let t8 = I2; t8 <= G4; t8++) {
  1821. const s11 = t8 - T5 + (i6 - b6) * (8 * f9 + 4 * (1 - f9)), n8 = e3.children[s11];
  1822. n8 && (S3 || (S3 = n8, S3.next = e3.next), w4 && (w4.next = n8), w4 = n8, n8.next = e3.next);
  1823. }
  1824. e3 = S3 || e3.next;
  1825. }
  1826. return h6;
  1827. }
  1828. getRegionStatistics(t6) {
  1829. let e3 = this._root, s9 = 0, i5 = 0, n7 = 0;
  1830. const o7 = {}, { bounds: a8, geohashBounds: r6, level: l9 } = t6, [h6, c9, u4, d9] = a8;
  1831. let f9 = 0;
  1832. for (; null !== e3; ) {
  1833. const t7 = e3.depth, a9 = e3.xNode, x4 = e3.yNode;
  1834. if (t7 >= l9) {
  1835. const t8 = e3.xTotal / e3.count, a10 = e3.yTotal / e3.count;
  1836. t8 > h6 && t8 <= u4 && a10 > c9 && a10 <= d9 && (s9 += e3.count, i5 += e3.xTotal, n7 += e3.yTotal, 1 === e3.count && (f9 = e3.referenceId), this._aggregateStatistics(o7, e3.statistics)), e3 = e3.next;
  1837. continue;
  1838. }
  1839. const m6 = Math.ceil((t7 + 1) / 2), g6 = Math.floor((t7 + 1) / 2), y6 = 1 - t7 % 2, p4 = 30 - (3 * m6 + 2 * g6), _4 = 30 - (2 * m6 + 3 * g6), v6 = ~((1 << p4) - 1), M2 = ~((1 << _4) - 1), T5 = (r6.xLL & v6) >> p4, b6 = (r6.yLL & M2) >> _4, k3 = (r6.xTR & v6) >> p4, N = (r6.yTR & M2) >> _4, I2 = a9 << 3 * y6 + 2 * (1 - y6), C = x4 << 2 * y6 + 3 * (1 - y6), G4 = I2 + 8 * y6 + 4 * (1 - y6), L3 = C + 4 * y6 + 8 * (1 - y6), S3 = Math.max(I2, T5), w4 = Math.max(C, b6), R4 = Math.min(G4, k3), F5 = Math.min(L3, N);
  1840. let j5 = null, z = null;
  1841. for (let r7 = w4; r7 <= F5; r7++)
  1842. for (let t8 = S3; t8 <= R4; t8++) {
  1843. const a10 = t8 - I2 + (r7 - C) * (8 * y6 + 4 * (1 - y6)), l10 = e3.children[a10];
  1844. if (l10) {
  1845. if (r7 !== w4 && r7 !== F5 && t8 !== S3 && t8 !== R4) {
  1846. const t9 = l10.xTotal / l10.count, e4 = l10.yTotal / l10.count;
  1847. t9 > h6 && t9 <= u4 && e4 > c9 && e4 <= d9 && (s9 += l10.count, i5 += l10.xTotal, n7 += l10.yTotal, 1 === l10.count && (f9 = l10.referenceId), this._aggregateStatistics(o7, l10.statistics));
  1848. continue;
  1849. }
  1850. j5 || (j5 = l10, j5.next = e3.next), z && (z.next = l10), z = l10, l10.next = e3.next;
  1851. }
  1852. }
  1853. e3 = j5 || e3.next;
  1854. }
  1855. return { count: s9, attributes: this.normalizeStatistics(o7, s9), xTotal: i5, yTotal: n7, referenceId: f9 };
  1856. }
  1857. getBins(t6) {
  1858. const e3 = [], { geohashBounds: s9, level: i5 } = t6;
  1859. let n7 = this._root;
  1860. for (; null !== n7; ) {
  1861. const t7 = n7.depth, o7 = n7.xNode, a8 = n7.yNode;
  1862. if (t7 >= i5) {
  1863. e3.push(n7), n7 = n7.next;
  1864. continue;
  1865. }
  1866. const r6 = Math.ceil((t7 + 1) / 2), l9 = Math.floor((t7 + 1) / 2), h6 = 1 - t7 % 2, c9 = 30 - (3 * r6 + 2 * l9), u4 = 30 - (2 * r6 + 3 * l9), d9 = ~((1 << c9) - 1), f9 = ~((1 << u4) - 1), x4 = (s9.xLL & d9) >> c9, m6 = (s9.yLL & f9) >> u4, g6 = (s9.xTR & d9) >> c9, y6 = (s9.yTR & f9) >> u4, p4 = o7 << 3 * h6 + 2 * (1 - h6), _4 = a8 << 2 * h6 + 3 * (1 - h6), v6 = p4 + 8 * h6 + 4 * (1 - h6), M2 = _4 + 4 * h6 + 8 * (1 - h6), T5 = Math.max(p4, x4), b6 = Math.max(_4, m6), k3 = Math.min(v6, g6), N = Math.min(M2, y6);
  1867. let I2 = null, C = null;
  1868. for (let e4 = b6; e4 <= N; e4++)
  1869. for (let t8 = T5; t8 <= k3; t8++) {
  1870. const s10 = t8 - p4 + (e4 - _4) * (8 * h6 + 4 * (1 - h6)), i6 = n7.children[s10];
  1871. i6 && (I2 || (I2 = i6, I2.next = n7.next), C && (C.next = i6), C = i6, i6.next = n7.next);
  1872. }
  1873. n7 = I2 || n7.next;
  1874. }
  1875. return e3;
  1876. }
  1877. _linkChildren(t6) {
  1878. let e3 = null, s9 = null;
  1879. for (let i5 = 0; i5 <= t6.children.length; i5++) {
  1880. const n7 = t6.children[i5];
  1881. n7 && (e3 || (e3 = n7, e3.next = t6.next), s9 && (s9.next = n7), s9 = n7, n7.next = t6.next);
  1882. }
  1883. return e3;
  1884. }
  1885. _updateStatisticsCursor(t6, e3, s9) {
  1886. var _a, _b;
  1887. for (const i5 of this._statisticFields) {
  1888. const n7 = i5.name, o7 = i5.inField ? t6.readAttribute(i5.inField) : t6.getComputedNumericAtIndex(i5.inFieldIndex);
  1889. switch (i5.statisticType) {
  1890. case "min": {
  1891. if (isNaN(o7))
  1892. break;
  1893. if (!e3.statistics[n7]) {
  1894. e3.statistics[n7] = { value: o7 };
  1895. break;
  1896. }
  1897. const t7 = e3.statistics[n7].value;
  1898. e3.statistics[n7].value = Math.min(t7, o7);
  1899. break;
  1900. }
  1901. case "max": {
  1902. if (isNaN(o7))
  1903. break;
  1904. if (!e3.statistics[n7]) {
  1905. e3.statistics[n7] = { value: o7 };
  1906. break;
  1907. }
  1908. const t7 = e3.statistics[n7].value;
  1909. e3.statistics[n7].value = Math.max(t7, o7);
  1910. break;
  1911. }
  1912. case "count":
  1913. break;
  1914. case "sum":
  1915. case "avg": {
  1916. e3.statistics[n7] || (e3.statistics[n7] = { value: 0, nanCount: 0 });
  1917. const t7 = e3.statistics[n7].value, i6 = (_a = e3.statistics[n7].nanCount) != null ? _a : 0;
  1918. null == o7 || isNaN(o7) ? e3.statistics[n7].nanCount = i6 + s9 : e3.statistics[n7].value = t7 + s9 * o7;
  1919. break;
  1920. }
  1921. case "avg_angle": {
  1922. e3.statistics[n7] || (e3.statistics[n7] = { x: 0, y: 0, nanCount: 0 });
  1923. const t7 = e3.statistics[n7].x, i6 = e3.statistics[n7].y, a8 = (_b = e3.statistics[n7].nanCount) != null ? _b : 0, r6 = Math.PI / 180;
  1924. null == o7 || isNaN(o7) ? e3.statistics[n7].nanCount = a8 + s9 : (e3.statistics[n7].x = t7 + s9 * Math.cos(o7 * r6), e3.statistics[n7].y = i6 + s9 * Math.sin(o7 * r6));
  1925. break;
  1926. }
  1927. case "mode": {
  1928. e3.statistics[n7] || (e3.statistics[n7] = {});
  1929. const t7 = e3.statistics[n7][o7] || 0;
  1930. e3.statistics[n7][o7] = t7 + s9;
  1931. break;
  1932. }
  1933. }
  1934. }
  1935. }
  1936. _aggregateStatistics(t6, e3) {
  1937. for (const s9 of this._statisticFields) {
  1938. const i5 = s9.name;
  1939. switch (s9.statisticType) {
  1940. case "min": {
  1941. if (!t6[i5]) {
  1942. t6[i5] = { value: e3[i5].value };
  1943. break;
  1944. }
  1945. const s10 = t6[i5].value;
  1946. t6[i5].value = Math.min(s10, e3[i5].value);
  1947. break;
  1948. }
  1949. case "max": {
  1950. if (!t6[i5]) {
  1951. t6[i5] = { value: e3[i5].value };
  1952. break;
  1953. }
  1954. const s10 = t6[i5].value;
  1955. t6[i5].value = Math.max(s10, e3[i5].value);
  1956. break;
  1957. }
  1958. case "count":
  1959. break;
  1960. case "sum":
  1961. case "avg":
  1962. case "avg_angle":
  1963. case "mode":
  1964. t6[i5] || (t6[i5] = {});
  1965. for (const s10 in e3[i5]) {
  1966. const n7 = t6[i5][s10] || 0;
  1967. t6[i5][s10] = n7 + e3[i5][s10];
  1968. }
  1969. }
  1970. }
  1971. }
  1972. normalizeStatistics(t6, e3) {
  1973. const s9 = {};
  1974. for (const i5 of this._statisticFields) {
  1975. const n7 = i5.name;
  1976. switch (i5.statisticType) {
  1977. case "min":
  1978. case "max": {
  1979. const i6 = t6[n7];
  1980. if (!e3 || !i6)
  1981. break;
  1982. s9[n7] = i6.value;
  1983. break;
  1984. }
  1985. case "count":
  1986. if (!e3)
  1987. break;
  1988. s9[n7] = e3;
  1989. break;
  1990. case "sum": {
  1991. if (!e3)
  1992. break;
  1993. const { value: i6, nanCount: o7 } = t6[n7];
  1994. if (!(e3 - o7))
  1995. break;
  1996. s9[n7] = i6;
  1997. break;
  1998. }
  1999. case "avg": {
  2000. if (!e3)
  2001. break;
  2002. const { value: i6, nanCount: o7 } = t6[n7];
  2003. if (!(e3 - o7))
  2004. break;
  2005. s9[n7] = i6 / (e3 - o7);
  2006. break;
  2007. }
  2008. case "avg_angle": {
  2009. if (!e3)
  2010. break;
  2011. const { x: i6, y: o7, nanCount: a8 } = t6[n7];
  2012. if (!(e3 - a8))
  2013. break;
  2014. const r6 = i6 / (e3 - a8), l9 = o7 / (e3 - a8), h6 = 180 / Math.PI, c9 = Math.atan2(l9, r6) * h6;
  2015. s9[n7] = c9;
  2016. break;
  2017. }
  2018. case "mode": {
  2019. const e4 = t6[n7];
  2020. let i6 = 0, o7 = 0, a8 = null;
  2021. for (const t7 in e4) {
  2022. const s10 = e4[t7];
  2023. s10 === i6 ? o7 += 1 : s10 > i6 && (i6 = s10, o7 = 1, a8 = t7);
  2024. }
  2025. s9[n7] = "null" === a8 || o7 > 1 ? null : a8;
  2026. break;
  2027. }
  2028. }
  2029. }
  2030. return s9;
  2031. }
  2032. };
  2033. var d7 = class {
  2034. constructor(t6, e3, s9, i5) {
  2035. this.count = 0, this.xTotal = 0, this.yTotal = 0, this.statistics = {}, this.displayId = 0, this.referenceId = 0, this.displayIds = /* @__PURE__ */ new Set(), this.next = null, this.depth = 0, this.xNode = 0, this.yNode = 0, this.xGeohashTotal = 0, this.yGeohashTotal = 0, this._tree = t6, this.children = new Array(32);
  2036. for (let n7 = 0; n7 < this.children.length; n7++)
  2037. this.children[n7] = null;
  2038. this.xNode = e3, this.yNode = s9, this.depth = i5;
  2039. }
  2040. realloc(t6, e3, s9) {
  2041. for (let i5 = 0; i5 < this.children.length; i5++)
  2042. this.children[i5] = null;
  2043. return this.xNode = t6, this.yNode = e3, this.depth = s9, this.next = null, this.xGeohashTotal = 0, this.yGeohashTotal = 0, this.displayId = 0, this.referenceId = 0, this.xTotal = 0, this.yTotal = 0, this.count = 0, this.statistics = {}, this.displayIds.clear(), this;
  2044. }
  2045. get id() {
  2046. return `${this.xNode}.${this.yNode}`;
  2047. }
  2048. add(t6) {
  2049. this.displayIds.add(t6);
  2050. }
  2051. remove(t6) {
  2052. this.displayIds.delete(t6);
  2053. }
  2054. getAttributes() {
  2055. const t6 = this._tree.normalizeStatistics(this.statistics, this.count);
  2056. return t6.referenceId = null, t6.aggregateId = this.id, t6.aggregateCount = this.count, t6;
  2057. }
  2058. getGeometry(t6, s9) {
  2059. const i5 = this.getLngLatBounds(), [r6, c9, u4, d9] = i5, f9 = g2({ rings: [[[r6, c9], [r6, d9], [u4, d9], [u4, c9], [r6, c9]]] }, k.WGS84, t6), x4 = J(new t3(), f9, false, false);
  2060. if (r(s9)) {
  2061. return at(new t3(), x4, false, false, "esriGeometryPolygon", s9, false, false);
  2062. }
  2063. return x4;
  2064. }
  2065. getGeometryCentroid(t6, s9) {
  2066. const i5 = this.getLngLatBounds(), [o7, c9, u4, d9] = i5, f9 = g2({ x: (o7 + u4) / 2, y: (c9 + d9) / 2 }, k.WGS84, t6), x4 = _(new t3(), f9);
  2067. if (r(s9)) {
  2068. return at(new t3(), x4, false, false, "esriGeometryPoint", s9, false, false);
  2069. }
  2070. return x4;
  2071. }
  2072. getLngLatBounds() {
  2073. const t6 = this.depth, e3 = Math.ceil(t6 / 2), s9 = Math.floor(t6 / 2), n7 = 30 - (3 * e3 + 2 * s9), o7 = 30 - (2 * e3 + 3 * s9), a8 = this.xNode << n7, r6 = this.yNode << o7;
  2074. return X2({ geohashX: a8, geohashY: r6 }, this.depth);
  2075. }
  2076. find(t6, e3, s9, i5, n7, o7) {
  2077. if (i5 >= s9)
  2078. return this;
  2079. const a8 = 1 - i5 % 2, r6 = 3 * a8 + 2 * (1 - a8), l9 = 2 * a8 + 3 * (1 - a8), h6 = 30 - n7 - r6, c9 = 30 - o7 - l9, u4 = ((t6 & 7 * a8 + 3 * (1 - a8) << h6) >> h6) + ((e3 & 3 * a8 + 7 * (1 - a8) << c9) >> c9) * (8 * a8 + 4 * (1 - a8)), d9 = this.children[u4];
  2080. return null == d9 ? null : d9.find(t6, e3, s9, i5 + 1, n7 + r6, o7 + l9);
  2081. }
  2082. };
  2083. // node_modules/@arcgis/core/views/2d/layers/features/support/BinStore.js
  2084. var G3 = s.getLogger("esri.view.2d.layers.features.support.BinStore");
  2085. var R2 = 12;
  2086. var L2 = 64;
  2087. var T2 = 5;
  2088. function A(e3) {
  2089. return 57.29577951308232 * e3;
  2090. }
  2091. var D2 = class extends c4 {
  2092. constructor(t6, s9, r6, i5) {
  2093. super(t6, r6), this.type = "bin", this.events = new n2(), this.objectIdField = "aggregateId", this.featureAdapter = u, this._geohashLevel = T2, this._geohashBuf = [], this._serviceInfo = i5, this.geometryInfo = t6.geometryInfo, this._spatialReference = s9, this._projectionSupportCheck = f4(s9, k.WGS84), this._bitsets.geohash = r6.getBitset(r6.createBitset()), this._bitsets.inserted = r6.getBitset(r6.createBitset());
  2094. }
  2095. destroy() {
  2096. this._tree && this._tree.destroy();
  2097. }
  2098. get featureSpatialReference() {
  2099. return this._spatialReference;
  2100. }
  2101. get fields() {
  2102. return this._fields;
  2103. }
  2104. async updateSchema(e3, t6) {
  2105. const r6 = this._schema;
  2106. try {
  2107. await super.updateSchema(e3, t6), await this._projectionSupportCheck;
  2108. } catch (n7) {
  2109. }
  2110. this._fields = this._schema.params.fields;
  2111. const i5 = m2(r6, t6);
  2112. t6 && (!t(i5) || e3.source || e3.storage.filters) ? ((a2(i5, "params.fields") || a2(i5, "params") || !this._tree || e3.source) && (this._tree && this._tree.destroy(), this._tree = new u2(this._statisticFields, this._serviceInfo), this._tree.onRelease = (e4) => e4.displayId && this._storage.releaseDisplayId(e4.displayId), this._geohashLevel = this._schema.params.fixedBinLevel, this._rebuildTree(), has("esri-2d-update-debug") && G3.info("Aggregate mesh needs update due to tree changing")), has("esri-2d-update-debug") && G3.info("Aggregate mesh needs update due to tree changing"), e3.targets[t6.name] = true, e3.mesh = false) : r6 && (e3.mesh = true);
  2113. }
  2114. clear() {
  2115. this._rebuildTree();
  2116. }
  2117. sweepFeatures(e3, t6) {
  2118. this._bitsets.inserted.forEachSet((s9) => {
  2119. if (!e3.has(s9)) {
  2120. const e4 = t6.lookupByDisplayIdUnsafe(s9);
  2121. this._remove(e4);
  2122. }
  2123. });
  2124. }
  2125. sweepAggregates(e3, t6, s9) {
  2126. }
  2127. onTileData(e3, t6, r6, i5, o7 = true) {
  2128. if (!this._schema || t(t6.addOrUpdate))
  2129. return t6;
  2130. this.events.emit("changed");
  2131. const a8 = this._getTransforms(e3, this._spatialReference);
  2132. {
  2133. const e4 = t6.addOrUpdate.getCursor();
  2134. for (; e4.next(); )
  2135. this._update(e4, i5);
  2136. }
  2137. if (t6.status.mesh || !o7)
  2138. return t6;
  2139. const h6 = new Array();
  2140. this._getBinsForTile(h6, e3, a8, r6), t6.addOrUpdate = c5.fromOptimizedFeatures(h6, { ...this._serviceInfo, geometryType: "esriGeometryPolygon" }), t6.addOrUpdate.attachStorage(r6), t6.end = true, t6.isRepush || (t6.clear = true);
  2141. {
  2142. const s9 = t6.addOrUpdate.getCursor();
  2143. for (; s9.next(); ) {
  2144. const t7 = s9.getDisplayId();
  2145. this._bitsets.computed.unset(t7), this.setComputedAttributes(r6, s9, t7, e3.scale);
  2146. }
  2147. }
  2148. return t6;
  2149. }
  2150. forEachBin(e3) {
  2151. this._tree.forEach(e3);
  2152. }
  2153. forEach(e3) {
  2154. this._tree.forEach((t6) => {
  2155. if (t6.depth !== this._geohashLevel)
  2156. return;
  2157. const s9 = this._toFeatureJSON(t6), r6 = c5.fromFeatures([s9], { objectIdField: this.objectIdField, globalIdField: null, geometryType: this.geometryInfo.geometryType, fields: this.fields }).getCursor();
  2158. r6.next(), e3(r6);
  2159. });
  2160. }
  2161. forEachInBounds(e3, t6) {
  2162. }
  2163. forEachBounds(e3, t6, r6) {
  2164. const { hasM: i5, hasZ: o7 } = this.geometryInfo;
  2165. for (const a8 of e3) {
  2166. const e4 = gt([0, 0, 0, 0], a8.readGeometry(), o7, i5);
  2167. t(e4) || t6(G(r6, e4));
  2168. }
  2169. }
  2170. toArray() {
  2171. const e3 = [];
  2172. return this.forEach((t6) => e3.push(t6)), e3;
  2173. }
  2174. onTileUpdate(e3) {
  2175. }
  2176. getAggregate(e3) {
  2177. const t6 = s6(e3, true), s9 = this._tree.findIf((e4) => e4.displayId === t6);
  2178. return o(s9, (e4) => this._toFeatureJSON(e4));
  2179. }
  2180. getAggregates() {
  2181. return this._tree.findAllIf((e3) => e3.depth === this._geohashLevel).map(this._toFeatureJSON.bind(this));
  2182. }
  2183. getDisplayId(e3) {
  2184. const t6 = this._tree.findIf((t7) => t7.id === e3);
  2185. return o(t6, (e4) => e4.displayId);
  2186. }
  2187. getFeatureDisplayIdsForAggregate(e3) {
  2188. const t6 = this._tree.findIf((t7) => t7.id === e3);
  2189. return b(t6, [], (e4) => Array.from(e4.displayIds));
  2190. }
  2191. getDisplayIdForReferenceId(e3) {
  2192. const t6 = this._tree.findIf((t7) => 1 === t7.displayIds.size && t7.displayIds.has(e3));
  2193. return o(t6, (e4) => e4.displayId);
  2194. }
  2195. _toFeatureJSON(e3) {
  2196. const t6 = this._spatialReference;
  2197. return { displayId: e3.displayId, attributes: e3.getAttributes(), geometry: rt(e3.getGeometry(t6), "esriGeometryPolygon", false, false), centroid: null };
  2198. }
  2199. _rebuildTree() {
  2200. this._bitsets.computed.clear(), this._bitsets.inserted.clear(), this._tree && this._tree.clear();
  2201. }
  2202. _remove(e3) {
  2203. const t6 = e3.getDisplayId(), s9 = e3.getXHydrated(), r6 = e3.getYHydrated(), i5 = this._geohashBuf[2 * t6], o7 = this._geohashBuf[2 * t6 + 1];
  2204. this._bitsets.inserted.has(t6) && (this._bitsets.inserted.unset(t6), this._tree.removeCursor(e3, s9, r6, i5, o7, this._geohashLevel));
  2205. }
  2206. _update(e3, t6) {
  2207. const s9 = e3.getDisplayId(), r6 = this._bitsets.inserted, i5 = t6.isVisible(s9);
  2208. if (i5 === r6.has(s9))
  2209. return;
  2210. if (!i5)
  2211. return void this._remove(e3);
  2212. const o7 = e3.getXHydrated(), a8 = e3.getYHydrated();
  2213. if (!this._setGeohash(s9, o7, a8))
  2214. return;
  2215. const h6 = this._geohashBuf[2 * s9], n7 = this._geohashBuf[2 * s9 + 1];
  2216. this._tree.insertCursor(e3, s9, o7, a8, h6, n7, this._geohashLevel), r6.set(s9);
  2217. }
  2218. _setGeohash(e3, t6, s9) {
  2219. if (this._bitsets.geohash.has(e3))
  2220. return true;
  2221. const r6 = this._geohashBuf;
  2222. if (this._spatialReference.isWebMercator) {
  2223. const i5 = A(t6 / s3.radius), o7 = i5 - 360 * Math.floor((i5 + 180) / 360), a8 = A(Math.PI / 2 - 2 * Math.atan(Math.exp(-s9 / s3.radius)));
  2224. b5(r6, e3, a8, o7, R2);
  2225. } else {
  2226. const i5 = g2({ x: t6, y: s9 }, this._spatialReference, k.WGS84);
  2227. if (!i5)
  2228. return false;
  2229. b5(r6, e3, i5.y, i5.x, R2);
  2230. }
  2231. return this._bitsets.geohash.set(e3), true;
  2232. }
  2233. _getBinsForTile(e3, t6, s9, r6) {
  2234. try {
  2235. const i5 = this._getGeohashBounds(t6), o7 = this._tree.getBins(i5);
  2236. for (const t7 of o7) {
  2237. t7.displayId || (t7.displayId = r6.createDisplayId(true));
  2238. let i6 = null;
  2239. const o8 = t7.getGeometry(this._spatialReference, s9.tile);
  2240. o8 || (i6 = t7.getGeometryCentroid(this._spatialReference, s9.tile));
  2241. const a8 = new s4(o8, t7.getAttributes(), i6);
  2242. a8.objectId = t7.id, a8.displayId = t7.displayId, e3.push(a8);
  2243. }
  2244. } catch (i5) {
  2245. return void G3.error("Unable to get bins for tile", t6.key.id);
  2246. }
  2247. }
  2248. _getGeohash(e3, t6, s9) {
  2249. const r6 = { geohashX: 0, geohashY: 0 };
  2250. return Y2(r6, t6, e3, s9), r6;
  2251. }
  2252. _getGeohashBounds(e3) {
  2253. const t6 = this._getGeohashLevel(e3.key.level), s9 = [e3.extent.xmin, e3.extent.ymin, e3.extent.xmax, e3.extent.ymax], r6 = v.fromExtent(w.fromBounds(s9, this._spatialReference)), i5 = g2(r6, this._spatialReference, k.WGS84, { densificationStep: e3.resolution * L2 }), o7 = J(new t3(), i5, false, false), a8 = o7.coords.filter((e4, t7) => !(t7 % 2)), h6 = o7.coords.filter((e4, t7) => t7 % 2), n7 = Math.min(...a8), d9 = Math.min(...h6), l9 = Math.max(...a8), p4 = Math.max(...h6), g6 = this._getGeohash(n7, d9, t6), c9 = this._getGeohash(l9, p4, t6);
  2254. return { bounds: s9, geohashBounds: { xLL: g6.geohashX, yLL: g6.geohashY, xTR: c9.geohashX, yTR: c9.geohashY }, level: t6 };
  2255. }
  2256. _getGeohashLevel(e3) {
  2257. return this._schema.params.fixedBinLevel;
  2258. }
  2259. _getTransforms(e3, t6) {
  2260. const s9 = { originPosition: "upperLeft", scale: [e3.resolution, e3.resolution], translate: [e3.bounds[0], e3.bounds[3]] }, r6 = R(t6);
  2261. if (!r6)
  2262. return { tile: s9, left: null, right: null };
  2263. const [i5, o7] = r6.valid;
  2264. return { tile: s9, left: { ...s9, translate: [o7, e3.bounds[3]] }, right: { ...s9, translate: [i5 - o7 + e3.bounds[0], e3.bounds[3]] } };
  2265. }
  2266. };
  2267. // node_modules/@arcgis/core/views/2d/layers/features/support/ClusterStore.js
  2268. var F3 = 12;
  2269. var w3 = 64;
  2270. var S2 = 1;
  2271. var V = class extends o2 {
  2272. constructor(e3, t6, s9, r6, o7) {
  2273. super(new t3([], [t6, s9]), r6, null, e3), this.geohashBoundsInfo = o7;
  2274. }
  2275. get count() {
  2276. return this.attributes.cluster_count;
  2277. }
  2278. static create(e3, t6, s9, r6, o7, a8, i5, h6) {
  2279. const n7 = new V(t6, s9, r6, a8, i5);
  2280. return n7.displayId = e3.createDisplayId(true), n7.referenceId = h6, n7.tileLevel = o7, n7;
  2281. }
  2282. update(e3, t6, s9, r6, o7, a8) {
  2283. return this.geometry.coords[0] = e3, this.geometry.coords[1] = t6, this.tileLevel = s9, this.attributes = r6, this.geohashBoundsInfo = o7, this.referenceId = null, this.referenceId = a8, this;
  2284. }
  2285. toJSON() {
  2286. return { attributes: { ...this.attributes, aggregateId: this.objectId, referenceId: 1 === this.attributes.cluster_count ? this.referenceId : null }, geometry: { x: this.geometry.coords[0], y: this.geometry.coords[1] } };
  2287. }
  2288. };
  2289. function T3(e3) {
  2290. return 57.29577951308232 * e3;
  2291. }
  2292. var D3 = class extends c4 {
  2293. constructor(t6, s9, r6, o7) {
  2294. super(t6, r6), this.type = "cluster", this.events = new n2(), this.objectIdField = "aggregateId", this.featureAdapter = u, this._geohashLevel = 0, this._tileLevel = 0, this._aggregateValueRanges = {}, this._aggregateValueRangesChanged = false, this._geohashBuf = [], this._clusters = /* @__PURE__ */ new Map(), this._tiles = /* @__PURE__ */ new Map(), this._serviceInfo = o7, this.geometryInfo = t6.geometryInfo, this._spatialReference = s9, this._projectionSupportCheck = f4(s9, k.WGS84), this._bitsets.geohash = r6.getBitset(r6.createBitset()), this._bitsets.inserted = r6.getBitset(r6.createBitset());
  2295. }
  2296. destroy() {
  2297. this._tree.destroy();
  2298. }
  2299. get featureSpatialReference() {
  2300. return this._spatialReference;
  2301. }
  2302. get fields() {
  2303. return this._fields;
  2304. }
  2305. async updateSchema(e3, s9) {
  2306. const r6 = this._schema;
  2307. try {
  2308. await super.updateSchema(e3, s9), await this._projectionSupportCheck;
  2309. } catch (n7) {
  2310. }
  2311. this._fields = this._schema.params.fields;
  2312. const h6 = m2(r6, s9);
  2313. s9 && (!t(h6) || e3.source || e3.storage.filters) ? ((a2(h6, "params.fields") || !this._tree || e3.source) && (this._tree && this._tree.destroy(), this._tree = new u2(this._statisticFields, this._serviceInfo), this._rebuildTree(), has("esri-2d-update-debug") && console.debug("Aggregate mesh needs update due to tree changing")), has("esri-2d-update-debug") && console.debug("Applying Update - ClusterStore:", h6), e3.targets[s9.name] = true, e3.mesh = false, this._aggregateValueRanges = {}) : r6 && (e3.mesh = true);
  2314. }
  2315. clear() {
  2316. this._rebuildTree();
  2317. }
  2318. sweepFeatures(e3, t6) {
  2319. this._bitsets.inserted.forEachSet((s9) => {
  2320. if (!e3.has(s9)) {
  2321. const e4 = t6.lookupByDisplayIdUnsafe(s9);
  2322. this._remove(e4);
  2323. }
  2324. });
  2325. }
  2326. sweepAggregates(e3, t6, s9) {
  2327. this._clusters.forEach((r6, o7) => {
  2328. r6 && r6.tileLevel !== s9 && (e3.releaseDisplayId(r6.displayId), t6.unsetAttributeData(r6.displayId), this._clusters.delete(o7));
  2329. });
  2330. }
  2331. onTileData(e3, s9, r6, o7, a8 = true) {
  2332. if (!this._schema || t(s9.addOrUpdate))
  2333. return s9;
  2334. this.events.emit("changed");
  2335. const i5 = this._getTransforms(e3, this._spatialReference);
  2336. {
  2337. const e4 = s9.addOrUpdate.getCursor();
  2338. for (; e4.next(); )
  2339. this._update(e4, o7);
  2340. }
  2341. if (s9.status.mesh || !a8)
  2342. return s9;
  2343. const h6 = new Array(), n7 = this._schema.params.clusterRadius;
  2344. this._getClustersForTile(h6, e3, n7, r6, i5), s9.addOrUpdate = c5.fromOptimizedFeatures(h6, this._serviceInfo), s9.addOrUpdate.attachStorage(r6), s9.clear = true, s9.end = true;
  2345. {
  2346. const t6 = s9.addOrUpdate.getCursor();
  2347. for (; t6.next(); ) {
  2348. const s10 = t6.getDisplayId();
  2349. this._bitsets.computed.unset(s10), this.setComputedAttributes(r6, t6, s10, e3.scale);
  2350. }
  2351. }
  2352. return this._aggregateValueRangesChanged && s9.end && (this.events.emit("valueRangesChanged", { valueRanges: this._aggregateValueRanges }), this._aggregateValueRangesChanged = false), s9;
  2353. }
  2354. onTileUpdate({ added: e3, removed: t6 }) {
  2355. if (e3.length) {
  2356. const t7 = e3[0].level;
  2357. this._tileLevel = t7, this._setGeohashLevel(t7);
  2358. }
  2359. if (!this._schema)
  2360. return;
  2361. const s9 = this._schema.params.clusterRadius;
  2362. t6.forEach((e4) => {
  2363. this._tiles.delete(e4.key.id), this._markTileClustersForDeletion(e4, s9);
  2364. });
  2365. }
  2366. getAggregate(e3) {
  2367. for (const t6 of this._clusters.values())
  2368. if (((t6 == null ? void 0 : t6.displayId) & n4) == (e3 & n4))
  2369. return t6.toJSON();
  2370. return null;
  2371. }
  2372. getAggregates() {
  2373. const e3 = [];
  2374. for (const t6 of this._clusters.values())
  2375. (t6 == null ? void 0 : t6.tileLevel) === this._tileLevel && e3.push(t6.toJSON());
  2376. return e3;
  2377. }
  2378. getDisplayId(e3) {
  2379. const t6 = this._clusters.get(e3);
  2380. return t6 ? t6.displayId : null;
  2381. }
  2382. getFeatureDisplayIdsForAggregate(e3) {
  2383. const t6 = this._clusters.get(e3);
  2384. return t6 ? this._tree.getRegionDisplayIds(t6.geohashBoundsInfo) : [];
  2385. }
  2386. getDisplayIdForReferenceId(e3) {
  2387. for (const t6 of this._clusters.values())
  2388. if ((t6 == null ? void 0 : t6.referenceId) === e3)
  2389. return t6.displayId;
  2390. return null;
  2391. }
  2392. getAggregateValueRanges() {
  2393. return this._aggregateValueRanges;
  2394. }
  2395. forEach(e3) {
  2396. this._clusters.forEach((t6) => {
  2397. if (!t6)
  2398. return;
  2399. const s9 = t6.toJSON(), r6 = c5.fromFeatures([s9], { objectIdField: this.objectIdField, globalIdField: null, geometryType: this.geometryInfo.geometryType, fields: this.fields }).getCursor();
  2400. r6.next(), e3(r6);
  2401. });
  2402. }
  2403. forEachInBounds(e3, t6) {
  2404. }
  2405. forEachBounds(e3, s9, r6) {
  2406. const { hasM: o7, hasZ: a8 } = this.geometryInfo;
  2407. for (const i5 of e3) {
  2408. const e4 = gt([0, 0, 0, 0], i5.readGeometry(), a8, o7);
  2409. t(e4) || s9(G(r6, e4));
  2410. }
  2411. }
  2412. toArray() {
  2413. const e3 = [];
  2414. return this.forEach((t6) => e3.push(t6)), e3;
  2415. }
  2416. size() {
  2417. let e3 = 0;
  2418. return this.forEach((t6) => e3++), e3;
  2419. }
  2420. _rebuildTree() {
  2421. this._bitsets.computed.clear(), this._bitsets.inserted.clear(), this._tree && this._tree.clear();
  2422. }
  2423. _remove(e3) {
  2424. const t6 = e3.getDisplayId(), s9 = e3.getXHydrated(), r6 = e3.getYHydrated(), o7 = this._geohashBuf[2 * t6], a8 = this._geohashBuf[2 * t6 + 1];
  2425. this._bitsets.inserted.has(t6) && (this._bitsets.inserted.unset(t6), this._tree.removeCursor(e3, s9, r6, o7, a8, this._geohashLevel));
  2426. }
  2427. _update(e3, t6) {
  2428. const s9 = e3.getDisplayId(), r6 = this._bitsets.inserted, o7 = t6.isVisible(s9);
  2429. if (o7 === r6.has(s9))
  2430. return;
  2431. if (!o7)
  2432. return void this._remove(e3);
  2433. const a8 = e3.getXHydrated(), i5 = e3.getYHydrated();
  2434. if (!this._setGeohash(s9, a8, i5))
  2435. return;
  2436. const h6 = this._geohashBuf[2 * s9], n7 = this._geohashBuf[2 * s9 + 1];
  2437. this._tree.insertCursor(e3, s9, a8, i5, h6, n7, this._geohashLevel), r6.set(s9);
  2438. }
  2439. _setGeohash(e3, t6, s9) {
  2440. if (this._bitsets.geohash.has(e3))
  2441. return true;
  2442. const r6 = this._geohashBuf;
  2443. if (this._spatialReference.isWebMercator) {
  2444. const o7 = T3(t6 / s3.radius), a8 = o7 - 360 * Math.floor((o7 + 180) / 360), i5 = T3(Math.PI / 2 - 2 * Math.atan(Math.exp(-s9 / s3.radius)));
  2445. b5(r6, e3, i5, a8, F3);
  2446. } else {
  2447. const o7 = g2({ x: t6, y: s9 }, this._spatialReference, k.WGS84);
  2448. if (!o7)
  2449. return false;
  2450. b5(r6, e3, o7.y, o7.x, F3);
  2451. }
  2452. return this._bitsets.geohash.set(e3), true;
  2453. }
  2454. _getClustersForTile(e3, o7, a8, i5, h6, n7 = true) {
  2455. const l9 = this._schema.params.clusterPixelBuffer, u4 = 2 * a8, g6 = Math.ceil(2 ** o7.key.level * o3 / u4) + 1, c9 = Math.ceil(l9 / u4) + 0, p4 = Math.ceil(o3 / u4), { row: m6, col: y6 } = o7.key, I2 = y6 * o3, b6 = m6 * o3, R4 = Math.floor(I2 / u4) - c9, M2 = Math.floor(b6 / u4) - c9, x4 = R4 + p4 + 2 * c9, C = M2 + p4 + 2 * c9, j5 = o7.tileInfoView.getLODInfoAt(o7.key.level);
  2456. for (let v6 = R4; v6 <= x4; v6++)
  2457. for (let a9 = M2; a9 <= C; a9++) {
  2458. let l10 = v6;
  2459. j5.wrap && (l10 = v6 < 0 ? v6 + g6 : v6 % g6);
  2460. const u5 = j5.wrap && v6 < 0, c10 = j5.wrap && v6 % g6 !== v6, p5 = this._lookupCluster(i5, j5, o7.key.level, l10, a9, o7);
  2461. if (r(p5)) {
  2462. const o8 = o(h6, (e4) => u5 ? e4.left : c10 ? e4.right : e4.tile);
  2463. if (n7 && t(o8))
  2464. continue;
  2465. if (!p5.count)
  2466. continue;
  2467. if (r(o8) && n7) {
  2468. const t6 = p5.geometry.clone();
  2469. let r6 = p5.attributes;
  2470. t6.coords[0] = w2(o8, t6.coords[0]), t6.coords[1] = M(o8, t6.coords[1]), 1 === p5.count && r(p5.referenceId) && (r6 = { ...p5.attributes, referenceId: p5.referenceId });
  2471. const a10 = new s4(t6, r6);
  2472. a10.displayId = p5.displayId, e3.push(a10);
  2473. }
  2474. }
  2475. }
  2476. }
  2477. _getGeohashLevel(e3) {
  2478. return Math.min(Math.ceil(e3 / 2 + 2), F3);
  2479. }
  2480. _setGeohashLevel(e3) {
  2481. const t6 = this._getGeohashLevel(e3), s9 = (Math.floor(t6 / S2) + 1) * S2 - 1;
  2482. if (this._geohashLevel !== s9)
  2483. return this._geohashLevel = s9, this._rebuildTree(), void this._bitsets.geohash.clear();
  2484. }
  2485. _getTransforms(e3, t6) {
  2486. const s9 = { originPosition: "upperLeft", scale: [e3.resolution, e3.resolution], translate: [e3.bounds[0], e3.bounds[3]] }, r6 = R(t6);
  2487. if (!r6)
  2488. return { tile: s9, left: null, right: null };
  2489. const [o7, a8] = r6.valid;
  2490. return { tile: s9, left: { ...s9, translate: [a8, e3.bounds[3]] }, right: { ...s9, translate: [o7 - a8 + e3.bounds[0], e3.bounds[3]] } };
  2491. }
  2492. _getClusterId(e3, t6, s9) {
  2493. return (15 & e3) << 28 | (16383 & t6) << 14 | 16383 & s9;
  2494. }
  2495. _markForDeletion(e3, t6, s9) {
  2496. const r6 = this._getClusterId(e3, t6, s9);
  2497. this._clusters.delete(r6);
  2498. }
  2499. _getClusterBounds(e3, t6, s9) {
  2500. const r6 = this._schema.params.clusterRadius, o7 = 2 * r6;
  2501. let a8 = s9 % 2 ? t6 * o7 : t6 * o7 - r6;
  2502. const i5 = s9 * o7;
  2503. let h6 = a8 + o7;
  2504. const n7 = i5 - o7, l9 = 2 ** e3.level * o3;
  2505. e3.wrap && a8 < 0 && (a8 = 0), e3.wrap && h6 > l9 && (h6 = l9);
  2506. const u4 = a8 / o3, g6 = i5 / o3, c9 = h6 / o3, d9 = n7 / o3;
  2507. return [e3.getXForColumn(u4), e3.getYForRow(g6), e3.getXForColumn(c9), e3.getYForRow(d9)];
  2508. }
  2509. _getGeohash(e3, t6, s9) {
  2510. const r6 = { geohashX: 0, geohashY: 0 };
  2511. return Y2(r6, t6, e3, s9), r6;
  2512. }
  2513. _getGeohashBounds(e3, t6) {
  2514. const s9 = this._getGeohashLevel(e3.key.level);
  2515. if (this._spatialReference.isWebMercator) {
  2516. const [e4, r7, o8, a9] = t6, i6 = { x: e4, y: r7 }, h7 = { x: o8, y: a9 };
  2517. let l10 = 0, g7 = 0, c10 = 0, d10 = 0;
  2518. {
  2519. const e5 = T3(i6.x / s3.radius);
  2520. l10 = e5 - 360 * Math.floor((e5 + 180) / 360), g7 = T3(Math.PI / 2 - 2 * Math.atan(Math.exp(-i6.y / s3.radius)));
  2521. }
  2522. {
  2523. const e5 = T3(h7.x / s3.radius);
  2524. c10 = e5 - 360 * Math.floor((e5 + 180) / 360), d10 = T3(Math.PI / 2 - 2 * Math.atan(Math.exp(-h7.y / s3.radius)));
  2525. }
  2526. const f10 = { geohashX: 0, geohashY: 0 }, p4 = { geohashX: 0, geohashY: 0 };
  2527. Y2(f10, g7, l10, s9), Y2(p4, d10, c10, s9);
  2528. return { bounds: [e4, r7, o8, a9], geohashBounds: { xLL: f10.geohashX, yLL: f10.geohashY, xTR: p4.geohashX, yTR: p4.geohashY }, level: s9 };
  2529. }
  2530. const r6 = v.fromExtent(w.fromBounds(t6, this._spatialReference)), o7 = g2(r6, this._spatialReference, k.WGS84, { densificationStep: e3.resolution * w3 });
  2531. if (!o7)
  2532. return null;
  2533. const a8 = J(new t3(), o7, false, false), i5 = a8.coords.filter((e4, t7) => !(t7 % 2)), h6 = a8.coords.filter((e4, t7) => t7 % 2), l9 = Math.min(...i5), g6 = Math.min(...h6), c9 = Math.max(...i5), d9 = Math.max(...h6), f9 = this._getGeohash(l9, g6, s9), m6 = this._getGeohash(c9, d9, s9);
  2534. return { bounds: t6, geohashBounds: { xLL: f9.geohashX, yLL: f9.geohashY, xTR: m6.geohashX, yTR: m6.geohashY }, level: s9 };
  2535. }
  2536. _lookupCluster(e3, r6, o7, a8, i5, h6) {
  2537. const n7 = this._getClusterId(o7, a8, i5), l9 = this._clusters.get(n7), u4 = this._getClusterBounds(r6, a8, i5), g6 = this._getGeohashBounds(h6, u4);
  2538. if (t(g6))
  2539. return null;
  2540. const c9 = this._tree.getRegionStatistics(g6), { count: d9, xTotal: f9, yTotal: p4, referenceId: m6 } = c9, _4 = d9 ? f9 / d9 : 0, y6 = d9 ? p4 / d9 : 0;
  2541. if (0 === d9)
  2542. return this._clusters.set(n7, null), null;
  2543. const I2 = { cluster_count: d9, ...c9.attributes }, b6 = r(l9) ? l9.update(_4, y6, o7, I2, g6, m6) : V.create(e3, n7, _4, y6, o7, I2, g6, m6);
  2544. if (0 === d9) {
  2545. const [e4, t6, s9, r7] = u4;
  2546. b6.geometry.coords[0] = (e4 + s9) / 2, b6.geometry.coords[1] = (t6 + r7) / 2;
  2547. }
  2548. return this._clusters.set(n7, b6), this._updateAggregateValueRangeForCluster(b6, b6.tileLevel), b6;
  2549. }
  2550. _updateAggregateValueRangeForCluster(e3, t6) {
  2551. const s9 = this._aggregateValueRanges[t6] || { minValue: 1 / 0, maxValue: 0 }, r6 = s9.minValue, o7 = s9.maxValue;
  2552. s9.minValue = Math.min(r6, e3.count), s9.maxValue = Math.max(o7, e3.count), this._aggregateValueRanges[t6] = s9, r6 === s9.minValue && o7 === s9.maxValue || (this._aggregateValueRangesChanged = true);
  2553. }
  2554. _markTileClustersForDeletion(e3, t6) {
  2555. const s9 = 2 * t6, r6 = Math.ceil(o3 / s9), { row: o7, col: a8 } = e3.key, i5 = a8 * o3, h6 = o7 * o3, n7 = Math.floor(i5 / s9), l9 = Math.floor(h6 / s9);
  2556. for (let u4 = n7; u4 < n7 + r6; u4++)
  2557. for (let t7 = l9; t7 < l9 + r6; t7++)
  2558. this._markForDeletion(e3.key.level, u4, t7);
  2559. }
  2560. };
  2561. // node_modules/@arcgis/core/views/2d/layers/features/controllers/FeatureController2D.js
  2562. var F4 = 5e3;
  2563. var j4 = "tileRenderer.featuresView.attributeView.initialize";
  2564. var T4 = "tileRenderer.featuresView.attributeView.requestUpdate";
  2565. var k2 = "tileRenderer.featuresView.requestRender";
  2566. function x3(e3) {
  2567. return "worker:port-closed" === e3.name;
  2568. }
  2569. function R3(e3) {
  2570. if (!j(e3) && !x3(e3))
  2571. throw e3;
  2572. }
  2573. function A2(e3) {
  2574. return "feature" === e3.type && "snapshot" === e3.mode;
  2575. }
  2576. var U3 = class extends d {
  2577. constructor() {
  2578. super(...arguments), this._storage = new r4(), this._markedIdsBufId = this._storage.createBitset(), this._lastCleanup = performance.now(), this._cleanupNeeded = false, this._invalidated = false, this._tileToResolver = /* @__PURE__ */ new Map(), this._didEdit = false, this._updateVersion = 1, this.tileStore = null, this.config = null, this.processor = null, this.remoteClient = null, this.service = null;
  2579. }
  2580. initialize() {
  2581. this._initStores(), this._initSource(), this._updateQueue = new l2({ concurrency: "geoevent" === this._source.type ? 1 : 4, process: (e3, t6) => this._onTileMessage(e3, { signal: t6 }) }), this.handles.add([this.tileStore.on("update", this.onTileUpdate.bind(this)), f3(() => !this.updating, () => this.onIdle())]), this._checkUpdating = setInterval(() => this.notifyChange("updating"), 300);
  2582. }
  2583. _initSource() {
  2584. const e3 = this.tileStore.tileScheme, t6 = () => this._updateQueue.length < 50, r6 = (e4, t7) => (this._invalidated = true, this._patchTile(e4, t7));
  2585. this._source = a7(this.service, this.spatialReference, e3, r6, t6, this.featureStore), this._proxyEvents();
  2586. }
  2587. _proxyEvents() {
  2588. if ("geoevent" === this._source.type) {
  2589. const e3 = this._source.events;
  2590. this.handles.add([e3.on("connectionStatus", (e4) => this.remoteClient.invoke("setProperty", { propertyName: "connectionStatus", value: e4 }).catch(R3)), e3.on("errorString", (e4) => this.remoteClient.invoke("setProperty", { propertyName: "errorString", value: e4 }).catch(R3)), e3.on("data-received", (e4) => this.remoteClient.invoke("emitEvent", { name: "data-received", event: { attributes: e4.attributes, centroid: e4.centroid, geometry: e4.geometry } }).catch(R3)), e3.on("updateRate", (e4) => this.remoteClient.invoke("emitEvent", { name: "update-rate", event: { ...e4 } }).catch(R3))]);
  2591. }
  2592. }
  2593. _initAttributeStore(e3) {
  2594. this.attributeStore || (this.attributeStore = new v2({ type: "remote", initialize: (e4, t6) => g(this.remoteClient.invoke(j4, e4, { signal: t6 }).catch(R3)), update: (e4, t6) => g(this.remoteClient.invoke(T4, e4, { signal: t6 }).catch(R3)), render: (e4) => g(this.remoteClient.invoke(k2, void 0, { signal: e4 }).catch(R3)) }, e3, () => this.notifyChange("updating")));
  2595. }
  2596. _initStores() {
  2597. const e3 = "snapshot" === this.service.type ? "snapshot" : "on-demand", t6 = { geometryInfo: { geometryType: this.service.geometryType, hasM: false, hasZ: false }, spatialReference: this.spatialReference, fieldsIndex: this.fieldsIndex, fields: this.service.fields };
  2598. this.featureStore = new l3(t6, this._storage, e3);
  2599. }
  2600. _initQueryEngine(e3) {
  2601. var _a;
  2602. const t6 = this;
  2603. (_a = this.featureQueryEngine) == null ? void 0 : _a.destroy(), this.featureQueryEngine = new Y({ definitionExpression: e3.schema.source.definitionExpression, fields: this.service.fields, geometryType: this.service.geometryType, objectIdField: this.service.objectIdField, hasM: false, hasZ: false, spatialReference: this.spatialReference.toJSON(), cacheSpatialQueries: true, featureStore: this.featureStore, aggregateAdapter: { getFeatureObjectIds(e4) {
  2604. if (t(t6.aggregateStore))
  2605. return [];
  2606. return t6.aggregateStore.getFeatureDisplayIdsForAggregate(e4).map((e5) => t6.getObjectId(e5));
  2607. } }, timeInfo: this.service.timeInfo });
  2608. }
  2609. _initAggregateQueryEngine(e3, t6) {
  2610. var _a;
  2611. if ((_a = this.aggregateQueryEngine) == null ? void 0 : _a.destroy(), t(e3))
  2612. return;
  2613. const s9 = t6.targets.aggregate.params.fields.slice();
  2614. this.aggregateQueryEngine = new Y({ definitionExpression: null, fields: s9, geometryType: e3.geometryInfo.geometryType, objectIdField: e3.objectIdField, hasM: e3.geometryInfo.hasM, hasZ: e3.geometryInfo.hasZ, spatialReference: this.spatialReference.toJSON(), cacheSpatialQueries: false, featureStore: e3, aggregateAdapter: { getFeatureObjectIds: (e4) => [] } });
  2615. }
  2616. destroy() {
  2617. var _a, _b, _c;
  2618. this._updateQueue.destroy(), this._source.destroy(), (_a = this.featureQueryEngine) == null ? void 0 : _a.destroy(), (_b = this.aggregateQueryEngine) == null ? void 0 : _b.destroy(), (_c = this.attributeStore) == null ? void 0 : _c.destroy();
  2619. for (const e3 of this.tileStore.tiles)
  2620. this._source.unsubscribe(e3);
  2621. clearInterval(this._checkUpdating);
  2622. }
  2623. get fieldsIndex() {
  2624. return new r2(this.service.fields);
  2625. }
  2626. get spatialReference() {
  2627. return this.tileStore.tileScheme.spatialReference;
  2628. }
  2629. get updating() {
  2630. return this.isUpdating();
  2631. }
  2632. isUpdating() {
  2633. const e3 = this._source.updating, t6 = !!this._updateQueue.length, r6 = !this.attributeStore || this.attributeStore.isUpdating(), s9 = e3 || t6 || r6;
  2634. return has("esri-2d-log-updating") && console.log(`Updating FeatureController2D: ${s9}
  2635. -> updatingSource ${e3}
  2636. -> updateQueue ${t6}
  2637. -> updatingAttributeStore ${r6}
  2638. `), s9;
  2639. }
  2640. enableEvent(e3) {
  2641. this._source.enableEvent(e3.name, e3.value);
  2642. }
  2643. pause() {
  2644. this._updateQueue.pause(), this._updateQueue.clear();
  2645. }
  2646. resume() {
  2647. this._updateQueue.resume();
  2648. }
  2649. pauseStream() {
  2650. "geoevent" === this._source.type && this._source.pauseStream();
  2651. }
  2652. resumeStream() {
  2653. "geoevent" === this._source.type && this._source.resumeStream();
  2654. }
  2655. _initAggregateStore(e3) {
  2656. var _a, _b;
  2657. const t6 = (_b = (_a = e3.schema.targets) == null ? void 0 : _a.aggregate) == null ? void 0 : _b.type, r6 = o(this.config, (e4) => {
  2658. var _a2, _b2;
  2659. return (_b2 = (_a2 = e4.schema.targets) == null ? void 0 : _a2.aggregate) == null ? void 0 : _b2.type;
  2660. });
  2661. if (r6 !== t6 && (r(this.aggregateStore) && (this.handles.remove("valueRangesChanged"), this.aggregateStore.destroy(), this.aggregateStore = null), t6)) {
  2662. switch (t6) {
  2663. case "cluster": {
  2664. const e4 = { geometryInfo: { geometryType: "esriGeometryPoint", hasM: false, hasZ: false }, spatialReference: this.spatialReference, fieldsIndex: this.fieldsIndex, fields: this.service.fields };
  2665. this.aggregateStore = new D3(e4, this.spatialReference, this._storage, this.service), this.handles.add(this.aggregateStore.events.on("valueRangesChanged", (e5) => {
  2666. this.remoteClient.invoke("emitEvent", { name: "valueRangesChanged", event: { valueRanges: e5.valueRanges } }).catch(R3);
  2667. }), "valueRangesChanged");
  2668. break;
  2669. }
  2670. case "bin": {
  2671. const e4 = { geometryInfo: { geometryType: "esriGeometryPolygon", hasM: false, hasZ: false }, spatialReference: this.spatialReference, fieldsIndex: this.fieldsIndex, fields: this.service.fields };
  2672. this.aggregateStore = new D2(e4, this.spatialReference, this._storage, this.service);
  2673. break;
  2674. }
  2675. }
  2676. this.aggregateStore.onTileUpdate({ added: this.tileStore.tiles, removed: [] });
  2677. }
  2678. }
  2679. async update(e3, t6) {
  2680. this._updateVersion++, this._initQueryEngine(t6), this._initAttributeStore(t6), this.pause(), await Promise.all([this._source.update(e3, t6.schema.source), this.featureStore.updateSchema(e3, t6.schema.targets.feature), this.attributeStore.update(e3, t6), this.attributeStore.updateFilters(e3, t6, this)]), this._initAggregateStore(t6), r(this.aggregateStore) && await this.aggregateStore.updateSchema(e3, t6.schema.targets.aggregate), this._initAggregateQueryEngine(this.aggregateStore, t6.schema), has("esri-2d-update-debug") && e3.describe(), this._set("config", t6);
  2681. }
  2682. async applyUpdate(e3) {
  2683. e3.version = this._updateVersion, has("esri-2d-update-debug") && console.debug(`Applying update ${e3.version}`), e3.mesh && this.clearTiles(), this._updateQueue.resume(), await this._source.applyUpdate(e3), this.notifyChange("updating"), await j2(() => !this.updating), r(this.aggregateStore) && (await U(10), await j2(() => !this.updating));
  2684. }
  2685. async onEdits({ edits: e3 }) {
  2686. has("esri-2d-update-debug") && console.debug("Applying Edit:", e3), this._didEdit = true;
  2687. try {
  2688. const t6 = e3.removed.map((e4) => e4.objectId && -1 !== e4.objectId ? e4.objectId : this._lookupObjectIdByGlobalId(e4.globalId)), r6 = e3.addOrModified.map(({ objectId: e4 }) => e4);
  2689. this.featureStore.invalidate(), await this._source.edit(r6, t6), this.clearTiles(), this.notifyChange("updating"), r(this.aggregateStore) && this.aggregateStore.clear(), await this._source.resend(), await j2(() => !this.updating);
  2690. } catch (t6) {
  2691. }
  2692. }
  2693. async refresh(e3) {
  2694. if (!e3.dataChanged) {
  2695. const e4 = t5.empty();
  2696. return e4.storage.filters = true, this.applyUpdate(e4);
  2697. }
  2698. this.featureStore.invalidate(), this.clearTiles(), this._source.refresh(this._updateVersion, e3), this._cleanupNeeded = true, this.notifyChange("updating"), await j2(() => !this.updating);
  2699. }
  2700. clearTiles() {
  2701. for (const e3 of this.tileStore.tiles)
  2702. this.processor.onTileClear(e3);
  2703. }
  2704. onTileUpdate(e3) {
  2705. r(this.aggregateStore) && this.aggregateStore.onTileUpdate(e3);
  2706. for (const t6 of e3.added)
  2707. this._source.subscribe(t6, this._updateVersion), this._level = t6.level;
  2708. for (const t6 of e3.removed)
  2709. this._source.unsubscribe(t6), this._cleanupNeeded = true, this._tileToResolver.has(t6.id) && (this._tileToResolver.get(t6.id).resolve(), this._tileToResolver.delete(t6.id));
  2710. this.notifyChange("updating");
  2711. }
  2712. async onIdle() {
  2713. this._invalidated && (this._invalidated = false, (r(this.aggregateStore) || "heatmap" === this.processor.type) && await this._repushCurrentLevelTiles()), this._markAndSweep();
  2714. }
  2715. async querySummaryStatistics({ query: e3, params: t6 }) {
  2716. return this.featureQueryEngine.executeQueryForSummaryStatistics(e3, t6);
  2717. }
  2718. async queryAggregateSummaryStatistics({ query: e3, params: t6 }) {
  2719. return this.aggregateQueryEngine.executeQueryForSummaryStatistics(e3, t6);
  2720. }
  2721. async queryUniqueValues({ query: e3, params: t6 }) {
  2722. return this.featureQueryEngine.executeQueryForUniqueValues(e3, t6);
  2723. }
  2724. async queryAggregateUniqueValues({ query: e3, params: t6 }) {
  2725. return this.aggregateQueryEngine.executeQueryForUniqueValues(e3, t6);
  2726. }
  2727. async queryClassBreaks({ query: e3, params: t6 }) {
  2728. return this.featureQueryEngine.executeQueryForClassBreaks(e3, t6);
  2729. }
  2730. async queryAggregateClassBreaks({ query: e3, params: t6 }) {
  2731. return this.aggregateQueryEngine.executeQueryForClassBreaks(e3, t6);
  2732. }
  2733. async queryHistogram({ query: e3, params: t6 }) {
  2734. return this.featureQueryEngine.executeQueryForHistogram(e3, t6);
  2735. }
  2736. async queryAggregateHistogram({ query: e3, params: t6 }) {
  2737. return this.aggregateQueryEngine.executeQueryForHistogram(e3, t6);
  2738. }
  2739. queryExtent(e3) {
  2740. return this.featureQueryEngine.executeQueryForExtent(e3);
  2741. }
  2742. queryAggregates(e3) {
  2743. return this.aggregateQueryEngine.executeQuery(e3);
  2744. }
  2745. queryAggregateCount(e3) {
  2746. return this.aggregateQueryEngine.executeQueryForCount(e3);
  2747. }
  2748. queryAggregateIds(e3) {
  2749. return this.aggregateQueryEngine.executeQueryForIds(e3);
  2750. }
  2751. queryFeatures(e3) {
  2752. return this.featureQueryEngine.executeQuery(e3);
  2753. }
  2754. async queryVisibleFeatures(e3) {
  2755. const t6 = await this.featureQueryEngine.executeQuery(e3), r6 = t6.objectIdFieldName;
  2756. return t6.features = t6.features.filter((e4) => {
  2757. const t7 = e4.attributes[r6], i5 = this.getDisplayId(t7);
  2758. return o(i5, (e5) => this.attributeStore.isVisible(e5));
  2759. }), t6;
  2760. }
  2761. queryFeatureCount(e3) {
  2762. return this.featureQueryEngine.executeQueryForCount(e3);
  2763. }
  2764. queryLatestObservations(e3) {
  2765. return this.featureQueryEngine.executeQueryForLatestObservations(e3);
  2766. }
  2767. queryObjectIds(e3) {
  2768. return this.featureQueryEngine.executeQueryForIds(e3);
  2769. }
  2770. async queryStatistics() {
  2771. return this.featureStore.storeStatistics;
  2772. }
  2773. getObjectId(e3) {
  2774. return this.featureStore.lookupObjectId(e3, this._storage);
  2775. }
  2776. getDisplayId(e3) {
  2777. if (r(this.aggregateStore)) {
  2778. const t6 = this.aggregateStore.getDisplayId(e3);
  2779. if (t(t6)) {
  2780. const t7 = this.featureStore.lookupDisplayId(e3);
  2781. return this.aggregateStore.getDisplayIdForReferenceId(t7);
  2782. }
  2783. return t6;
  2784. }
  2785. return this.featureStore.lookupDisplayId(e3);
  2786. }
  2787. getFeatures(e3) {
  2788. const t6 = [], r6 = [];
  2789. for (const s9 of e3) {
  2790. const e4 = r(this.aggregateStore) ? this.getAggregate(s9) : null;
  2791. if (r(e4))
  2792. if (r(e4.attributes.referenceId)) {
  2793. const r7 = this.getFeature(e4.attributes.referenceId);
  2794. r(r7) && t6.push(r7);
  2795. } else
  2796. r6.push(e4);
  2797. else {
  2798. const e5 = this.getFeature(s9);
  2799. r(e5) && t6.push(e5);
  2800. }
  2801. }
  2802. return { features: t6, aggregates: r6 };
  2803. }
  2804. getFeature(e3) {
  2805. const t6 = this.featureStore.lookupFeatureByDisplayId(e3, this._storage);
  2806. if (t(t6))
  2807. return null;
  2808. const s9 = t6.readHydratedGeometry(), i5 = rt(s9, t6.geometryType, t6.hasZ, t6.hasM);
  2809. return { attributes: t6.readAttributes(), geometry: i5 };
  2810. }
  2811. getAggregate(e3) {
  2812. return t(this.aggregateStore) ? null : this.aggregateStore.getAggregate(e3);
  2813. }
  2814. getAggregates() {
  2815. return t(this.aggregateStore) ? [] : this.aggregateStore.getAggregates();
  2816. }
  2817. async setHighlight(e3) {
  2818. const t6 = m(e3.map((e4) => this.getDisplayId(e4)));
  2819. return this.attributeStore.setHighlight(e3, t6);
  2820. }
  2821. _lookupObjectIdByGlobalId(e3) {
  2822. const t6 = this.service.globalIdField;
  2823. if (t(t6))
  2824. throw new Error("Expected globalIdField to be defined");
  2825. let s9 = null;
  2826. if (this.featureStore.forEach((r6) => {
  2827. e3 === r6.readAttribute(t6) && (s9 = r6.getObjectId());
  2828. }), t(s9))
  2829. throw new Error(`Expected to find a feature with globalId ${e3}`);
  2830. return s9;
  2831. }
  2832. async _repushCurrentLevelTiles() {
  2833. const e3 = this.tileStore.tiles.filter((e4) => e4.level === this._level);
  2834. e3.map(async (e4) => this._patchTile({ type: "append", id: e4.key.id, clear: true, addOrUpdate: null, end: false }));
  2835. const t6 = e3.map(async (e4) => this._patchTile({ type: "append", id: e4.key.id, addOrUpdate: c5.fromOptimizedFeatures([], this.service), remove: [], end: true, isRepush: true, status: t5.empty() }));
  2836. await Promise.all(t6);
  2837. }
  2838. _maybeForceCleanup() {
  2839. performance.now() - this._lastCleanup > F4 && this._markAndSweep();
  2840. }
  2841. _patchTile(e3, t6) {
  2842. const r6 = this._updateQueue.push(e3, t6).then(() => {
  2843. this.notifyChange("updating");
  2844. }).catch((e4) => {
  2845. this.notifyChange("updating");
  2846. });
  2847. return this.notifyChange("updating"), r6;
  2848. }
  2849. async _onTileMessage(e3, t6) {
  2850. if (f2(t6), has("esri-2d-update-debug")) {
  2851. const t7 = o(e3.addOrUpdate, (e4) => e4.hasFeatures);
  2852. console.debug(e3.id, `FeatureController:onTileMessage: [clear:${e3.clear}, end:${e3.end}, features: ${t7}]`);
  2853. }
  2854. const a8 = this.tileStore.get(e3.id);
  2855. if (!a8)
  2856. return;
  2857. if (e3.clear)
  2858. return this.processor.onTileClear(a8);
  2859. const o7 = e3.status;
  2860. this._cleanupNeeded = true;
  2861. const n7 = [];
  2862. for (const r6 of e3.remove) {
  2863. const e4 = this.featureStore.lookupDisplayId(r6);
  2864. e4 && n7.push(e4);
  2865. }
  2866. e3.remove = n7;
  2867. try {
  2868. if (t(e3.addOrUpdate))
  2869. return void this.processor.onTileMessage(a8, { ...e3, addOrUpdate: null }, r(this.aggregateStore), t6).catch(b2);
  2870. if (e3.addOrUpdate.setArcadeSpatialReference(this.spatialReference), this.featureStore.hasInstance(e3.addOrUpdate.instance) && o7.targets.feature || (o7.targets.feature = true, this.featureStore.onTileData(a8, e3)), !o7.storage.data || !o7.storage.filters) {
  2871. o7.storage.data = true, o7.storage.filters = true, this.attributeStore.onTileData(a8, e3);
  2872. "geoevent" === this._source.type || this._didEdit ? (await this.attributeStore.sendUpdates(), f2(t6)) : this.attributeStore.sendUpdates();
  2873. }
  2874. if (r(this.aggregateStore) && !o7.targets.aggregate) {
  2875. o7.targets.aggregate = true;
  2876. const t7 = A2(this._source) && this._source.loading, r6 = !A2(this._source) || t7 || e3.end;
  2877. if (this.aggregateStore.onTileData(a8, e3, this._storage, this.attributeStore, r6), !r6)
  2878. return;
  2879. o7.mesh || (this.attributeStore.onTileData(a8, e3), await this.attributeStore.sendUpdates());
  2880. }
  2881. if (!o7.mesh) {
  2882. o7.mesh = true;
  2883. const r6 = r(this.aggregateStore) && "cluster" === this.aggregateStore.type;
  2884. await this.processor.onTileMessage(a8, e3, r6, t6), f2(t6);
  2885. }
  2886. this._maybeForceCleanup();
  2887. } catch (h6) {
  2888. b2(h6);
  2889. }
  2890. }
  2891. _mark(e3, t6, r6) {
  2892. const s9 = (4294901760 & this._storage.getInstanceId(e3)) >>> 16;
  2893. e3 && (t6.add(s9), r6.set(e3));
  2894. }
  2895. _markAndSweep() {
  2896. this._lastCleanup = performance.now();
  2897. if (!(!("feature" === this._source.type && "snapshot" === this._source.mode) && ("geoevent" === this._source.type || this._cleanupNeeded)))
  2898. return;
  2899. this._cleanupNeeded = false;
  2900. const e3 = this._storage.getBitset(this._markedIdsBufId), t6 = /* @__PURE__ */ new Set();
  2901. e3.clear();
  2902. for (const r6 of this.tileStore.tiles)
  2903. for (const s9 of this._source.readers(r6.id)) {
  2904. const r7 = s9.getCursor();
  2905. for (; r7.next(); ) {
  2906. let s10 = r7.getDisplayId();
  2907. if (!s10) {
  2908. const e4 = r7.getObjectId();
  2909. s10 = this.featureStore.lookupDisplayId(e4);
  2910. }
  2911. this._mark(s10, t6, e3);
  2912. }
  2913. }
  2914. "symbol" === this.processor.type && this.processor.forEachBufferId((r6) => {
  2915. this._mark(r6, t6, e3);
  2916. }), this._updateQueue.forEach((r6) => {
  2917. for (const s9 of r6.remove) {
  2918. const r7 = this.featureStore.lookupDisplayId(s9);
  2919. this._mark(r7, t6, e3);
  2920. }
  2921. }), r(this.aggregateStore) && (this.aggregateStore.sweepFeatures(e3, this.featureStore), "sweepAggregates" in this.aggregateStore && this.aggregateStore.sweepAggregates(this._storage, this.attributeStore, this._level)), this.featureStore.sweepFeatures(e3, this._storage, this.attributeStore), this.featureStore.sweepFeatureSets(t6);
  2922. }
  2923. };
  2924. e([y({ constructOnly: true })], U3.prototype, "tileStore", void 0), e([y()], U3.prototype, "config", void 0), e([y({ readOnly: true })], U3.prototype, "fieldsIndex", null), e([y()], U3.prototype, "processor", void 0), e([y({ constructOnly: true })], U3.prototype, "remoteClient", void 0), e([y({ constructOnly: true })], U3.prototype, "service", void 0), e([y()], U3.prototype, "spatialReference", null), e([y()], U3.prototype, "updating", null), U3 = e([n("esri.views.2d.layers.features.controllers.FeatureController2D")], U3);
  2925. var q4 = U3;
  2926. // node_modules/@arcgis/core/views/2d/layers/features/Pipeline.js
  2927. var d8 = class extends d {
  2928. constructor() {
  2929. super(...arguments), this.controller = null, this.processor = null, this.remoteClient = null, this.tileStore = null, this.service = null, this.viewState = null, this._paused = false, this._pendingTileUpdates = [];
  2930. }
  2931. initialize() {
  2932. this.handles.add(l(() => this.updating, (e3) => {
  2933. this.remoteClient.invoke("setUpdating", e3).catch((e4) => {
  2934. });
  2935. }));
  2936. }
  2937. destroy() {
  2938. var _a, _b;
  2939. this.stop(), (_a = this.controller) == null ? void 0 : _a.destroy(), (_b = this.processor) == null ? void 0 : _b.destroy(), this.controller = this.processor = this.tileStore = this.remoteClient = null;
  2940. }
  2941. get updating() {
  2942. return !this.controller || this.controller.updating;
  2943. }
  2944. stop() {
  2945. var _a, _b, _c;
  2946. this._paused = true, Array.isArray((_a = this.service) == null ? void 0 : _a.source) && (this.service.source.forEach((e3) => e3.close()), this.service.source.length = 0), (_b = this.tileStore) == null ? void 0 : _b.updateTiles({ added: [], removed: this.tileStore.tiles.map((e3) => e3.id) }), (_c = this.tileStore) == null ? void 0 : _c.destroy(), this.tileStore = null, this._pendingTileUpdates.length = 0;
  2947. }
  2948. async startup({ service: e3, config: t6, tileInfo: r6, tiles: s9 }) {
  2949. var _a, _b, _c;
  2950. if (this._paused = true, Array.isArray((_a = this.service) == null ? void 0 : _a.source) && (this.service.source.forEach((e4) => e4.close()), this.service.source.length = 0), this.service = e3, !this.tileStore || !E2(this.tileStore.tileScheme.spatialReference, r6.spatialReference)) {
  2951. const e4 = new h(j3.fromJSON(r6));
  2952. s9.added.length = s9.removed.length = 0, (_b = this.tileStore) == null ? void 0 : _b.updateTiles({ added: [], removed: this.tileStore.tiles.map((e5) => e5.id) }), (_c = this.tileStore) == null ? void 0 : _c.destroy(), this.tileStore = new d3(e4), this._pendingTileUpdates.length = 0;
  2953. }
  2954. for (await this._createProcessorAndController(t6), await this.update({ config: t6 }), this.controller.resume(), this.tileStore.clear(), this.tileStore.updateTiles(s9), this._paused = false; this._pendingTileUpdates.length; )
  2955. this.tileStore.updateTiles(this._pendingTileUpdates.pop());
  2956. }
  2957. async updateTiles(e3) {
  2958. this._paused ? this._pendingTileUpdates.push(e3) : this.tileStore.updateTiles(e3);
  2959. }
  2960. async update({ config: e3 }) {
  2961. const t6 = t5.empty();
  2962. return await Promise.all([this.processor.update(t6, e3), this.controller.update(t6, e3)]), t6.toJSON();
  2963. }
  2964. async applyUpdate(e3) {
  2965. return this.controller.applyUpdate(t5.create(e3));
  2966. }
  2967. async _createProcessorAndController(e3) {
  2968. await Promise.all([this._handleControllerConfig(e3), this._handleProcessorConfig(e3)]), this.controller.processor = this.processor;
  2969. }
  2970. async _handleControllerConfig(e3) {
  2971. return this._createController(this.service, e3);
  2972. }
  2973. async _handleProcessorConfig(e3) {
  2974. return this._createProcessor(this.service, e3);
  2975. }
  2976. async _createController(e3, t6) {
  2977. this.controller && this.controller.destroy();
  2978. const { tileStore: r6, remoteClient: s9 } = this, o7 = new q4({ service: e3, tileStore: r6, remoteClient: s9 });
  2979. return this.controller = o7, o7;
  2980. }
  2981. async _createProcessor(e3, t6) {
  2982. const r6 = t6.schema.processors[0].type, s9 = (await o4(r6)).default, { remoteClient: o7, tileStore: i5 } = this, l9 = new s9({ service: e3, config: t6, tileStore: i5, remoteClient: o7 });
  2983. return this.processor && this.processor.destroy(), this.processor = l9, l9;
  2984. }
  2985. };
  2986. e([y()], d8.prototype, "controller", void 0), e([y()], d8.prototype, "processor", void 0), e([y()], d8.prototype, "updating", null), e([y()], d8.prototype, "viewState", void 0), d8 = e([n("esri.views.2d.layers.features.Pipeline")], d8);
  2987. var u3 = d8;
  2988. export {
  2989. u3 as default
  2990. };
  2991. //# sourceMappingURL=Pipeline-DHW3SLJM.js.map