@arcgis/core 5.2.0-next.156 → 5.2.0-next.157

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/analysis/LineOfSightAnalysis.d.ts +49 -32
  2. package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
  3. package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
  4. package/analysis/Viewshed.d.ts +23 -3
  5. package/analysis/ViewshedAnalysis.d.ts +33 -13
  6. package/arcade/geometry/operatorsWorkerConnection.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/{925271bb763607a326ae.js → 2f04b8679c9f15390517.js} +1 -1
  9. package/assets/esri/core/workers/chunks/35e5762642d1a3a2e375.js +1 -0
  10. package/assets/esri/core/workers/chunks/{544070198d2ca556103a.js → 44918ff37818a7d36d76.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{be5f92e98d09d6e6e38e.js → 4bb1bb3ffb1b71bc43c8.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{1aa4f5394a596e544aeb.js → 4eae066673484986d4c1.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{5f4feca26102088ea565.js → 60737732ce495bbdd0fc.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
  16. package/assets/esri/core/workers/chunks/9215b59c5ccecf9add58.js +1 -0
  17. package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
  18. package/assets/esri/core/workers/chunks/cb4be68cc5085d421615.js +1 -0
  19. package/assets/esri/core/workers/chunks/{de6081df29183bf80787.js → d65383f4058dc813f40d.js} +1 -1
  20. package/assets/esri/core/workers/chunks/d6cd0039d6e9c40961e3.js +1 -0
  21. package/assets/esri/views/interactive/tooltip/t9n/messages.ar.json +1 -1
  22. package/assets/esri/views/interactive/tooltip/t9n/messages.bg.json +1 -1
  23. package/assets/esri/views/interactive/tooltip/t9n/messages.bs.json +1 -1
  24. package/assets/esri/views/interactive/tooltip/t9n/messages.ca.json +1 -1
  25. package/assets/esri/views/interactive/tooltip/t9n/messages.cs.json +1 -1
  26. package/assets/esri/views/interactive/tooltip/t9n/messages.da.json +1 -1
  27. package/assets/esri/views/interactive/tooltip/t9n/messages.de.json +1 -1
  28. package/assets/esri/views/interactive/tooltip/t9n/messages.el.json +1 -1
  29. package/assets/esri/views/interactive/tooltip/t9n/messages.es.json +1 -1
  30. package/assets/esri/views/interactive/tooltip/t9n/messages.et.json +1 -1
  31. package/assets/esri/views/interactive/tooltip/t9n/messages.fi.json +1 -1
  32. package/assets/esri/views/interactive/tooltip/t9n/messages.fr.json +1 -1
  33. package/assets/esri/views/interactive/tooltip/t9n/messages.he.json +1 -1
  34. package/assets/esri/views/interactive/tooltip/t9n/messages.hr.json +1 -1
  35. package/assets/esri/views/interactive/tooltip/t9n/messages.hu.json +1 -1
  36. package/assets/esri/views/interactive/tooltip/t9n/messages.id.json +1 -1
  37. package/assets/esri/views/interactive/tooltip/t9n/messages.it.json +1 -1
  38. package/assets/esri/views/interactive/tooltip/t9n/messages.ja.json +1 -1
  39. package/assets/esri/views/interactive/tooltip/t9n/messages.ko.json +1 -1
  40. package/assets/esri/views/interactive/tooltip/t9n/messages.lt.json +1 -1
  41. package/assets/esri/views/interactive/tooltip/t9n/messages.lv.json +1 -1
  42. package/assets/esri/views/interactive/tooltip/t9n/messages.nl.json +1 -1
  43. package/assets/esri/views/interactive/tooltip/t9n/messages.no.json +1 -1
  44. package/assets/esri/views/interactive/tooltip/t9n/messages.pl.json +1 -1
  45. package/assets/esri/views/interactive/tooltip/t9n/messages.pt-BR.json +1 -1
  46. package/assets/esri/views/interactive/tooltip/t9n/messages.pt-PT.json +1 -1
  47. package/assets/esri/views/interactive/tooltip/t9n/messages.ro.json +1 -1
  48. package/assets/esri/views/interactive/tooltip/t9n/messages.ru.json +1 -1
  49. package/assets/esri/views/interactive/tooltip/t9n/messages.sk.json +1 -1
  50. package/assets/esri/views/interactive/tooltip/t9n/messages.sl.json +1 -1
  51. package/assets/esri/views/interactive/tooltip/t9n/messages.sr.json +1 -1
  52. package/assets/esri/views/interactive/tooltip/t9n/messages.sv.json +1 -1
  53. package/assets/esri/views/interactive/tooltip/t9n/messages.th.json +1 -1
  54. package/assets/esri/views/interactive/tooltip/t9n/messages.tr.json +1 -1
  55. package/assets/esri/views/interactive/tooltip/t9n/messages.uk.json +1 -1
  56. package/assets/esri/views/interactive/tooltip/t9n/messages.vi.json +1 -1
  57. package/assets/esri/views/interactive/tooltip/t9n/messages.zh-CN.json +1 -1
  58. package/assets/esri/views/interactive/tooltip/t9n/messages.zh-HK.json +1 -1
  59. package/assets/esri/views/interactive/tooltip/t9n/messages.zh-TW.json +1 -1
  60. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ar.json +1 -1
  61. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bg.json +1 -1
  62. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bs.json +1 -1
  63. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ca.json +1 -1
  64. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.cs.json +1 -1
  65. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.da.json +1 -1
  66. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.de.json +1 -1
  67. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.el.json +1 -1
  68. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.es.json +1 -1
  69. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.et.json +1 -1
  70. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fi.json +1 -1
  71. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fr.json +1 -1
  72. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.he.json +1 -1
  73. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hr.json +1 -1
  74. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hu.json +1 -1
  75. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.id.json +1 -1
  76. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.it.json +1 -1
  77. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ja.json +1 -1
  78. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ko.json +1 -1
  79. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lt.json +1 -1
  80. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lv.json +1 -1
  81. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.nl.json +1 -1
  82. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.no.json +1 -1
  83. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pl.json +1 -1
  84. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-BR.json +1 -1
  85. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-PT.json +1 -1
  86. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ro.json +1 -1
  87. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ru.json +1 -1
  88. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sk.json +1 -1
  89. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sl.json +1 -1
  90. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sr.json +1 -1
  91. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sv.json +1 -1
  92. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.th.json +1 -1
  93. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.tr.json +1 -1
  94. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.uk.json +1 -1
  95. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.vi.json +1 -1
  96. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-CN.json +1 -1
  97. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-HK.json +1 -1
  98. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-TW.json +1 -1
  99. package/assets/esri/widgets/Editor/t9n/messages.ar.json +1 -1
  100. package/assets/esri/widgets/Editor/t9n/messages.bg.json +1 -1
  101. package/assets/esri/widgets/Editor/t9n/messages.bs.json +1 -1
  102. package/assets/esri/widgets/Editor/t9n/messages.ca.json +1 -1
  103. package/assets/esri/widgets/Editor/t9n/messages.cs.json +1 -1
  104. package/assets/esri/widgets/Editor/t9n/messages.da.json +1 -1
  105. package/assets/esri/widgets/Editor/t9n/messages.de.json +1 -1
  106. package/assets/esri/widgets/Editor/t9n/messages.el.json +1 -1
  107. package/assets/esri/widgets/Editor/t9n/messages.es.json +1 -1
  108. package/assets/esri/widgets/Editor/t9n/messages.et.json +1 -1
  109. package/assets/esri/widgets/Editor/t9n/messages.fi.json +1 -1
  110. package/assets/esri/widgets/Editor/t9n/messages.fr.json +1 -1
  111. package/assets/esri/widgets/Editor/t9n/messages.he.json +1 -1
  112. package/assets/esri/widgets/Editor/t9n/messages.hr.json +1 -1
  113. package/assets/esri/widgets/Editor/t9n/messages.hu.json +1 -1
  114. package/assets/esri/widgets/Editor/t9n/messages.id.json +1 -1
  115. package/assets/esri/widgets/Editor/t9n/messages.it.json +1 -1
  116. package/assets/esri/widgets/Editor/t9n/messages.ja.json +1 -1
  117. package/assets/esri/widgets/Editor/t9n/messages.ko.json +1 -1
  118. package/assets/esri/widgets/Editor/t9n/messages.lt.json +1 -1
  119. package/assets/esri/widgets/Editor/t9n/messages.lv.json +1 -1
  120. package/assets/esri/widgets/Editor/t9n/messages.nl.json +1 -1
  121. package/assets/esri/widgets/Editor/t9n/messages.no.json +1 -1
  122. package/assets/esri/widgets/Editor/t9n/messages.pl.json +1 -1
  123. package/assets/esri/widgets/Editor/t9n/messages.pt-BR.json +1 -1
  124. package/assets/esri/widgets/Editor/t9n/messages.pt-PT.json +1 -1
  125. package/assets/esri/widgets/Editor/t9n/messages.ro.json +1 -1
  126. package/assets/esri/widgets/Editor/t9n/messages.ru.json +1 -1
  127. package/assets/esri/widgets/Editor/t9n/messages.sk.json +1 -1
  128. package/assets/esri/widgets/Editor/t9n/messages.sl.json +1 -1
  129. package/assets/esri/widgets/Editor/t9n/messages.sr.json +1 -1
  130. package/assets/esri/widgets/Editor/t9n/messages.sv.json +1 -1
  131. package/assets/esri/widgets/Editor/t9n/messages.th.json +1 -1
  132. package/assets/esri/widgets/Editor/t9n/messages.tr.json +1 -1
  133. package/assets/esri/widgets/Editor/t9n/messages.uk.json +1 -1
  134. package/assets/esri/widgets/Editor/t9n/messages.vi.json +1 -1
  135. package/assets/esri/widgets/Editor/t9n/messages.zh-CN.json +1 -1
  136. package/assets/esri/widgets/Editor/t9n/messages.zh-HK.json +1 -1
  137. package/assets/esri/widgets/Editor/t9n/messages.zh-TW.json +1 -1
  138. package/assets/esri/widgets/FeatureForm/t9n/messages.ar.json +1 -1
  139. package/assets/esri/widgets/FeatureForm/t9n/messages.bg.json +1 -1
  140. package/assets/esri/widgets/FeatureForm/t9n/messages.bs.json +1 -1
  141. package/assets/esri/widgets/FeatureForm/t9n/messages.ca.json +1 -1
  142. package/assets/esri/widgets/FeatureForm/t9n/messages.cs.json +1 -1
  143. package/assets/esri/widgets/FeatureForm/t9n/messages.da.json +1 -1
  144. package/assets/esri/widgets/FeatureForm/t9n/messages.de.json +1 -1
  145. package/assets/esri/widgets/FeatureForm/t9n/messages.el.json +1 -1
  146. package/assets/esri/widgets/FeatureForm/t9n/messages.es.json +1 -1
  147. package/assets/esri/widgets/FeatureForm/t9n/messages.et.json +1 -1
  148. package/assets/esri/widgets/FeatureForm/t9n/messages.fi.json +1 -1
  149. package/assets/esri/widgets/FeatureForm/t9n/messages.fr.json +1 -1
  150. package/assets/esri/widgets/FeatureForm/t9n/messages.he.json +1 -1
  151. package/assets/esri/widgets/FeatureForm/t9n/messages.hr.json +1 -1
  152. package/assets/esri/widgets/FeatureForm/t9n/messages.hu.json +1 -1
  153. package/assets/esri/widgets/FeatureForm/t9n/messages.id.json +1 -1
  154. package/assets/esri/widgets/FeatureForm/t9n/messages.it.json +1 -1
  155. package/assets/esri/widgets/FeatureForm/t9n/messages.ja.json +1 -1
  156. package/assets/esri/widgets/FeatureForm/t9n/messages.ko.json +1 -1
  157. package/assets/esri/widgets/FeatureForm/t9n/messages.lt.json +1 -1
  158. package/assets/esri/widgets/FeatureForm/t9n/messages.lv.json +1 -1
  159. package/assets/esri/widgets/FeatureForm/t9n/messages.nl.json +1 -1
  160. package/assets/esri/widgets/FeatureForm/t9n/messages.no.json +1 -1
  161. package/assets/esri/widgets/FeatureForm/t9n/messages.pl.json +1 -1
  162. package/assets/esri/widgets/FeatureForm/t9n/messages.pt-BR.json +1 -1
  163. package/assets/esri/widgets/FeatureForm/t9n/messages.pt-PT.json +1 -1
  164. package/assets/esri/widgets/FeatureForm/t9n/messages.ro.json +1 -1
  165. package/assets/esri/widgets/FeatureForm/t9n/messages.ru.json +1 -1
  166. package/assets/esri/widgets/FeatureForm/t9n/messages.sk.json +1 -1
  167. package/assets/esri/widgets/FeatureForm/t9n/messages.sl.json +1 -1
  168. package/assets/esri/widgets/FeatureForm/t9n/messages.sr.json +1 -1
  169. package/assets/esri/widgets/FeatureForm/t9n/messages.sv.json +1 -1
  170. package/assets/esri/widgets/FeatureForm/t9n/messages.th.json +1 -1
  171. package/assets/esri/widgets/FeatureForm/t9n/messages.tr.json +1 -1
  172. package/assets/esri/widgets/FeatureForm/t9n/messages.uk.json +1 -1
  173. package/assets/esri/widgets/FeatureForm/t9n/messages.vi.json +1 -1
  174. package/assets/esri/widgets/FeatureForm/t9n/messages.zh-CN.json +1 -1
  175. package/assets/esri/widgets/FeatureForm/t9n/messages.zh-HK.json +1 -1
  176. package/assets/esri/widgets/FeatureForm/t9n/messages.zh-TW.json +1 -1
  177. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ar.json +1 -1
  178. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.bg.json +1 -1
  179. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.bs.json +1 -1
  180. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ca.json +1 -1
  181. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.cs.json +1 -1
  182. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.da.json +1 -1
  183. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.de.json +1 -1
  184. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.el.json +1 -1
  185. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.es.json +1 -1
  186. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.et.json +1 -1
  187. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.fi.json +1 -1
  188. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.fr.json +1 -1
  189. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.he.json +1 -1
  190. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.hr.json +1 -1
  191. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.hu.json +1 -1
  192. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.id.json +1 -1
  193. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.it.json +1 -1
  194. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ja.json +1 -1
  195. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ko.json +1 -1
  196. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.lt.json +1 -1
  197. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.lv.json +1 -1
  198. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.nl.json +1 -1
  199. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.no.json +1 -1
  200. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pl.json +1 -1
  201. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pt-BR.json +1 -1
  202. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.pt-PT.json +1 -1
  203. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ro.json +1 -1
  204. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.ru.json +1 -1
  205. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sk.json +1 -1
  206. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sl.json +1 -1
  207. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sr.json +1 -1
  208. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.sv.json +1 -1
  209. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.th.json +1 -1
  210. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.tr.json +1 -1
  211. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.uk.json +1 -1
  212. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.vi.json +1 -1
  213. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-CN.json +1 -1
  214. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-HK.json +1 -1
  215. package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.zh-TW.json +1 -1
  216. package/assets/esri/widgets/Sketch/t9n/messages.ar.json +1 -1
  217. package/assets/esri/widgets/Sketch/t9n/messages.bg.json +1 -1
  218. package/assets/esri/widgets/Sketch/t9n/messages.bs.json +1 -1
  219. package/assets/esri/widgets/Sketch/t9n/messages.ca.json +1 -1
  220. package/assets/esri/widgets/Sketch/t9n/messages.cs.json +1 -1
  221. package/assets/esri/widgets/Sketch/t9n/messages.da.json +1 -1
  222. package/assets/esri/widgets/Sketch/t9n/messages.de.json +1 -1
  223. package/assets/esri/widgets/Sketch/t9n/messages.el.json +1 -1
  224. package/assets/esri/widgets/Sketch/t9n/messages.es.json +1 -1
  225. package/assets/esri/widgets/Sketch/t9n/messages.et.json +1 -1
  226. package/assets/esri/widgets/Sketch/t9n/messages.fi.json +1 -1
  227. package/assets/esri/widgets/Sketch/t9n/messages.fr.json +1 -1
  228. package/assets/esri/widgets/Sketch/t9n/messages.he.json +1 -1
  229. package/assets/esri/widgets/Sketch/t9n/messages.hr.json +1 -1
  230. package/assets/esri/widgets/Sketch/t9n/messages.hu.json +1 -1
  231. package/assets/esri/widgets/Sketch/t9n/messages.id.json +1 -1
  232. package/assets/esri/widgets/Sketch/t9n/messages.it.json +1 -1
  233. package/assets/esri/widgets/Sketch/t9n/messages.ja.json +1 -1
  234. package/assets/esri/widgets/Sketch/t9n/messages.ko.json +1 -1
  235. package/assets/esri/widgets/Sketch/t9n/messages.lt.json +1 -1
  236. package/assets/esri/widgets/Sketch/t9n/messages.lv.json +1 -1
  237. package/assets/esri/widgets/Sketch/t9n/messages.nl.json +1 -1
  238. package/assets/esri/widgets/Sketch/t9n/messages.no.json +1 -1
  239. package/assets/esri/widgets/Sketch/t9n/messages.pl.json +1 -1
  240. package/assets/esri/widgets/Sketch/t9n/messages.pt-BR.json +1 -1
  241. package/assets/esri/widgets/Sketch/t9n/messages.pt-PT.json +1 -1
  242. package/assets/esri/widgets/Sketch/t9n/messages.ro.json +1 -1
  243. package/assets/esri/widgets/Sketch/t9n/messages.ru.json +1 -1
  244. package/assets/esri/widgets/Sketch/t9n/messages.sk.json +1 -1
  245. package/assets/esri/widgets/Sketch/t9n/messages.sl.json +1 -1
  246. package/assets/esri/widgets/Sketch/t9n/messages.sr.json +1 -1
  247. package/assets/esri/widgets/Sketch/t9n/messages.sv.json +1 -1
  248. package/assets/esri/widgets/Sketch/t9n/messages.th.json +1 -1
  249. package/assets/esri/widgets/Sketch/t9n/messages.tr.json +1 -1
  250. package/assets/esri/widgets/Sketch/t9n/messages.uk.json +1 -1
  251. package/assets/esri/widgets/Sketch/t9n/messages.vi.json +1 -1
  252. package/assets/esri/widgets/Sketch/t9n/messages.zh-CN.json +1 -1
  253. package/assets/esri/widgets/Sketch/t9n/messages.zh-HK.json +1 -1
  254. package/assets/esri/widgets/Sketch/t9n/messages.zh-TW.json +1 -1
  255. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ar.json +1 -1
  256. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.bg.json +1 -1
  257. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.bs.json +1 -1
  258. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ca.json +1 -1
  259. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.cs.json +1 -1
  260. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.da.json +1 -1
  261. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.de.json +1 -1
  262. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.el.json +1 -1
  263. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.es.json +1 -1
  264. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.et.json +1 -1
  265. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.fi.json +1 -1
  266. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.fr.json +1 -1
  267. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.he.json +1 -1
  268. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.hr.json +1 -1
  269. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.hu.json +1 -1
  270. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.id.json +1 -1
  271. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.it.json +1 -1
  272. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ja.json +1 -1
  273. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ko.json +1 -1
  274. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.lt.json +1 -1
  275. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.lv.json +1 -1
  276. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.nl.json +1 -1
  277. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.no.json +1 -1
  278. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.pl.json +1 -1
  279. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.pt-BR.json +1 -1
  280. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.pt-PT.json +1 -1
  281. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ro.json +1 -1
  282. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.ru.json +1 -1
  283. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sk.json +1 -1
  284. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sl.json +1 -1
  285. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sr.json +1 -1
  286. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.sv.json +1 -1
  287. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.th.json +1 -1
  288. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.tr.json +1 -1
  289. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.uk.json +1 -1
  290. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.vi.json +1 -1
  291. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.zh-CN.json +1 -1
  292. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.zh-HK.json +1 -1
  293. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.zh-TW.json +1 -1
  294. package/config.js +1 -1
  295. package/core/workers/WorkerOwner.js +1 -1
  296. package/core/workers/workerFactory.js +1 -1
  297. package/core/workers/workers.js +2 -2
  298. package/core/workers.d.ts +9 -0
  299. package/geometry/Mesh.js +1 -1
  300. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  301. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  302. package/geometry/support/meshUtils/rotate.js +1 -1
  303. package/kernel.js +1 -1
  304. package/layers/ImageryTileLayer.js +1 -1
  305. package/layers/LineOfSightLayer.d.ts +10 -8
  306. package/layers/ViewshedLayer.d.ts +1 -1
  307. package/layers/graphics/data/QueryEngineResult.js +1 -1
  308. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  309. package/layers/raster/datasets/BaseRaster.js +1 -1
  310. package/layers/raster/datasets/ImageAuxRaster.js +2 -2
  311. package/layers/raster/datasets/InMemoryRaster.js +1 -1
  312. package/layers/support/kmlUtils.js +1 -1
  313. package/package.json +2 -2
  314. package/smartMapping/statistics/support/statsWorker.js +1 -1
  315. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  316. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  317. package/smartMapping/support/adapters/OGCFeatureLayerAdapter.js +1 -1
  318. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  319. package/smartMapping/support/adapters/support/utils.js +1 -1
  320. package/symbols/support/ElevationInfo.d.ts +4 -3
  321. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  322. package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
  323. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
  324. package/views/3d/analysis/Viewshed/types.d.ts +7 -0
  325. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
  326. package/views/interactive/options/TooltipOptions.d.ts +2 -0
  327. package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
  328. package/views/layers/LineOfSightLayerView.d.ts +35 -13
  329. package/views/layers/SketchLayerView.d.ts +1 -0
  330. package/views/layers/ViewshedLayerView.d.ts +36 -12
  331. package/assets/esri/core/workers/chunks/bac8c32665e982896ecc.js +0 -1
  332. package/assets/esri/core/workers/chunks/d9b1aed88b205689cec6.js +0 -1
  333. package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
  334. package/assets/esri/core/workers/chunks/f4f9d08b2df856e3b694.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../request.js";import n from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{debounce as a,onAbort as o}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{ensureClass as u}from"../../../core/accessorSupport/ensureType.js";import d from"../../../geometry/Extent.js";import f from"../../../geometry/Point.js";import p from"../../../geometry/SpatialReference.js";import{isFunctionRaster as m,getPixelSpaceCoverage as h}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as g,getSliceIndex as _,createSlices as v,getSliceIds as y}from"./multidimensionalUtils.js";import{clearRegisteredIds as b,getRasterId as x,getBlock as S,putBlock as C,deleteBlock as w,decreaseRefCount as T}from"./RawBlockCache.js";import{convertNoDataToMask as E}from"../formats/pixelRangeUtils.js";import{decode as D}from"../formats/RasterCodec.js";import{convertPixelSize as O}from"../functions/clipUtils.js";import{mosaic as k,approximateTransform as A,getLocalArithmeticNorthRotations as j,compositeBands as M}from"../functions/pixelUtils.js";import{getWorldWidth as N,load as P,projectPoint as F,snapPyramid as I,shiftExtent as L,getWorldWrapCount as R,projectExtent as z,getProjectionOffsetGrid as B,getRasterDatasetAlignmentInfo as V,projectResolution as H}from"../functions/rasterProjectionHelper.js";import{convertToLocalDirections as U,uvComponentToVector as W}from"../functions/vectorFieldUtils.js";import{sanitizeUrl as G}from"../../support/arcgisLayerUrl.js";import{url as K}from"../../support/commonProperties.js";import q from"../../support/DimensionalDefinition.js";import J from"../../support/LOD.js";import Y from"../../support/RasterStorageInfo.js";import X from"../../support/TileInfo.js";let Z=0,Q=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this.fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:`closest`},this.rawBlockRegistryIds=[],this.refresh=a(async e=>{await this._openPromise;let t=await this._refresh(e);return t.dataChanged&&b(this.rasterId,this.rawBlockRegistryIds),t})}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:`closest`,tileInfo:X.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){let{rasterInfo:e}=this,t=N(e.spatialReference);return t!=null&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){let{transform:e}=this.rasterInfo;return e==null||e.type===`gcs-shift`}set rasterJobHandler(e){this._set(`rasterJobHandler`,e),m(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||`rasterId-${Z++}`}set url(e){this._set(`url`,G(e,i.getLogger(this)))}async open(e){return this._openPromise??=P().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,r,i={}){let a=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,o=this.getTileExtentFromTileInfo(e,t,r,a);if(!o)throw new n(`imagery-tile:out-of-bounds`,`Level for fetch tile out of range`);return i={noClip:!0,...i},this.fetchPixels(o,a.size[0],a.size[1],i)}async identify(e,t={}){e=u(f,e).clone().normalize();let{multidimensionalDefinition:n,timeExtent:r}=t,{rasterInfo:i}=this,{hasMultidimensionalTranspose:a,multidimensionalInfo:o}=i,{transposedVariableName:s}=t,c=o!=null&&a&&(r!=null||g(n));c&&!s&&(s=n!=null&&n.length>0?n[0].variableName??void 0:o.variables[0].name,t={...t,transposedVariableName:s}),t=this._getRequestOptionsWithSliceId(t);let{spatialReference:l,extent:p}=i,{datumTransformation:h}=t,_=F(e,l,h);if(!p.intersects(_))return{location:_,value:null};if(i.transform!=null){let e=i.transform.inverseTransform(_);if(!i.nativeExtent.intersects(e))return{location:e,value:null};_=e}let v=s!=null&&o!=null&&i.hasMultidimensionalTranspose;if(m(this)){let e=this.primaryRasters.rasters[0];if(v)return e.identify(_,t);let{pixelSize:r}=i,a=r.x*3/2,o=r.y*3/2,s=new d({xmin:_.x-a,xmax:_.x+a,ymin:_.y-o,ymax:_.y+o,spatialReference:l}),c={interpolation:`nearest`,multidimensionalDefinition:n,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:u}=await e.fetchPixels(s,3,3,c),{pixelBlock:f}=await this.fetchPixels(s,3,3,c);if(u==null)return{location:_,value:null};let p=!u.mask||u.mask[4]?u.pixels.map(e=>e[4]):null,m;return f!=null&&(m=!f.mask||f.mask[4]?f.pixels.map(e=>e[4]):void 0),{location:_,value:p,processedValue:m,pyramidLevel:0}}let y=0;if(!v){let{srcResolution:n}=t;if(n)n.spatialReference&&(n=O(new f(n),l)),y=I(n,i,this.ioConfig.sampling).pyramidLevel;else if(y=await this.computeBestPyramidLevelForLocation(e,t),y==null)return{location:_,value:null}}let b=this.identifyPixelLocation(_,y,null,v);if(b===null)return{location:_,value:null};let{row:x,col:S,rowOffset:C,colOffset:w,blockWidth:T}=b,E=await this._fetchRawTile(y,x,S,t);if(!E?.pixels?.length)return{location:_,value:null};let D=C*T+w;return this._processIdentifyResult(E,{srcLocation:_,position:D,pyramidLevel:y,useTransposedTile:!!v,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,n,r={}){e=L(e),r=this._getRequestOptionsWithSliceId(r);let{_hasNoneOrGCSShiftTransform:i}=this;if(r.requestRawData&&i)return this._fetchPixels(e,t,n,r);let a=N(e.spatialReference),o=R(e);if(a==null||o===0||o===1&&this._isGlobalWrappableSource&&i)return this._fetchPixels(e,t,n,r);if(o>=3)return{extent:e,pixelBlock:null};let s=[],{xmin:c,xmax:l}=e,u=Math.round(a/(l-c)*t),f=u-Math.round((a/2-c)/(l-c)*t),p=0,m=[];for(let i=0;i<=o;i++){let h=i===0?c:-a/2,g=i===o?l-a*i:a/2,_=new d({xmin:h,xmax:g,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),v=i===0?u-f:i===o?t-p:u;p+=v,m.push(v);let y=r.disableWrapAround&&i>0?null:this._fetchPixels(_,v,n,r);s.push(y)}let h=(await Promise.all(s)).map(e=>e?.pixelBlock),g=null,_={width:t,height:n};g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:_,destDimension:null,coefs:null,sampleSpacing:null,interpolation:`nearest`,alignmentInfo:null,blockWidths:m},r)).pixelBlock:k(h,_,{blockWidths:m});let v=z(e,this.rasterInfo.spatialReference,r.datumTransformation);return{extent:e,srcExtent:v,pixelBlock:g}}async fetchRawPixels(e,t,n,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};let i=await this._fetchRawTiles(e,t,n,r),{nativeExtent:a,nativePixelSize:o,storageInfo:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,f=new d({xmin:a.xmin+l*t.x,xmax:a.xmin+l*(t.x+n.width-1),ymin:a.ymax-u*(t.y+n.height-1),ymax:a.ymax-u*t.y,spatialReference:a.spatialReference});if(!i)return{extent:f,srcExtent:f,pixelBlock:null};let{pixelBlocks:p,mosaicSize:m}=i;if(p.length===1&&p[0]!=null&&p[0].width===n.width&&p[0].height===n.height)return{extent:f,srcExtent:f,pixelBlock:i.pixelBlocks[0]};let h=e>0?s.pyramidBlockWidth:s.blockWidth,g=e>0?s.pyramidBlockHeight:s.blockHeight,_={x:t.x%h,y:t.y%g},v;return v=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:m,destDimension:n,clipOffset:_,clipSize:n,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock:k(p,m,{clipOffset:_,clipSize:n}),{extent:f,srcExtent:f,pixelBlock:v}}fetchRawTile(e,t,r,i){throw new n(`BaseRaster:read-not-implemented`,`fetchRawTile() is not implemented`)}computeExtent(e){return z(this.rasterInfo.extent,e)}decodePixelBlock(e,t,n){return this.rasterJobHandler?this.rasterJobHandler.decode({data:e,options:t},n):D(e,t,n)}async request(e,n,r=0){let{customFetchParameters:i}=this.ioConfig,{range:a,query:o,headers:s}=n;r=r??n.retryCount??this.ioConfig.retryCount;let c=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await t(e,{...n,query:{...o,...i},headers:{...s,...c}})}catch(t){if(r>0)return r--,this.request(e,n,r);throw t}}getSliceIndex(e){let{multidimensionalInfo:t}=this.rasterInfo;return t==null||e==null||e.length===0?null:_(e,t)}getTileExtentFromTileInfo(e,t,n,r){let i=r.lodAt(e);return i?this.getTileExtent({x:i.resolution,y:i.resolution},t,n,r.origin,r.spatialReference,r.size):null}updateTileInfo(){let{storageInfo:e,spatialReference:t,extent:n,pixelSize:r}=this.rasterInfo,{pyramidResolutions:i}=e;if(!e.tileInfo){let a=[],o=e.maximumPyramidLevel||0,s=(r.x+r.y)/2,c=1/.0254*96*s;for(let e=0;e<=o&&(a.unshift(new J({level:o-e,resolution:s,scale:c})),e!==o);e++)if(i){let t=(i[e].x+i[e].y)/2;c*=t/s,s=t}else s*=2,c*=2;let l=new f({x:n.xmin,y:n.ymax,spatialReference:t});e.tileInfo=new X({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:a}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,n=512,r){let{width:i,height:a,nativeExtent:o,pixelSize:s,spatialReference:c}=e,l=new f({x:o.xmin,y:o.ymax,spatialReference:c});r??=Math.max(0,Math.round(Math.log(Math.max(i,a))/Math.LN2-8));let u=this.computeBlockBoundary(o,512,512,{x:o.xmin,y:o.ymax},[s],r);e.storageInfo=new Y({blockWidth:t,blockHeight:n,pyramidBlockWidth:t,pyramidBlockHeight:n,origin:l,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,n,r,i,a=0,o=2){if(i.length===1&&a>0){i=[...i];let{x:e,y:t}=i[0];for(let n=0;n<a;n++)e*=o,t*=o,i.push({x:e,y:t})}let s=[],{x:c,y:l}=r;for(let r=0;r<i.length;r++){let{x:a,y:o}=i[r];s.push({minCol:Math.floor((e.xmin-c+.1*a)/t/a),maxCol:Math.floor((e.xmax-c-.1*a)/t/a),minRow:Math.floor((l-e.ymax+.1*o)/n/o),maxRow:Math.floor((l-e.ymin-.1*o)/n/o)})}return s}getPyramidPixelSize(e){let{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(e===0)return t;if(n!=null&&n.length)return n[e-1];let i=r**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,n,r){let{spatialReference:i,nativeExtent:a,storageInfo:o}=this.rasterInfo,{maximumPyramidLevel:s,origin:c,transposeInfo:l}=o,u=r&&l!=null?l.tileSize[0]:o.blockWidth,d=r&&l!=null?l.tileSize[1]:o.blockHeight,f=F(e,i,n);if(!a.intersects(f)||t<0||t>s)return null;let{x:p,y:m}=this.getPyramidPixelSize(t),h=(c.y-f.y)/m/d,g=(f.x-c.x)/p/u,_=Math.min(d-1,Math.floor((h-Math.floor(h))*d)),v=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(g),rowOffset:_,colOffset:v,blockWidth:u,srcLocation:f}}getTileExtent(e,t,n,r,i,a){let[o,s]=a,c=r.x+n*o*e.x,l=c+o*e.x,u=r.y-t*s*e.y,f=u-s*e.y;return new d({xmin:c,xmax:l,ymin:f,ymax:u,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,n){let r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<n||r.minRow>t||r.minCol>n}updateImageSpaceRasterInfo(e){let{pixelSize:t}=e,{width:n,height:r}=e,i=p.WebMercator;e.spatialReference=i,e.extent=e.nativeExtent=new d({xmin:-.5,ymax:.5,xmax:n-.5,ymin:.5-r,spatialReference:i}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new f({x:1,y:1,spatialReference:i});let{extent:a,storageInfo:o}=e;if(o){o.origin=new f({x:a.xmin,y:a.ymax,spatialReference:i});let{pyramidResolutions:n,tileInfo:r}=o;if(n&&n.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=o.origin;let t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,n)=>{e.resolution=t*2**n,e.scale=96*e.resolution/.0254})}}}async _refresh(e){return{dataChanged:!0}}async _fetchPixels(e,t,n,r={}){let i=R(e);if(i>=2)return{extent:e,pixelBlock:null};let a=this._getSourceDataInfo(e,t,n,r),{pyramidLevel:o,srcResolution:s,srcWidth:c,srcHeight:l,ul:u}=a,{srcExtent:d}=a;if(c===0||l===0)return{extent:e,srcExtent:d,pixelBlock:null};let{rasterInfo:p}=this,m=p.transform,h=m?.type===`gcs-shift`,g=N(e.spatialReference)!=null;(h||!g)&&(i=R(d,h));let _=await this._fetchRawTiles(o,u,{width:c,height:l,wrapCount:i},r);if(!_)return{extent:e,srcExtent:d,pixelBlock:null};d=_.extent;let v=p.storageInfo,y=o>0?v.pyramidBlockWidth:v.blockWidth,b=o>0?v.pyramidBlockHeight:v.blockHeight,{x,y:S}=p.pixelSize;if(o>0){let{pyramidResolutions:e,pyramidScalingFactor:t}=v;if(e!=null&&e[o-1])({x,y:S}=e[o-1]);else{let e=t**o;x*=e,S*=e}}let C=p.spatialReference,w=new f({x,y:S,spatialReference:C}),T=y===c&&b===l&&u.x%y===0&&u.y%b===0,E=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),D=!e.spatialReference.equals(C),O=C.isGeographic?1e-9:1e-4,{datumTransformation:M}=r;if(!D&&T&&_.pixelBlocks.length===1&&y===t&&b===n&&$(s,E,O))return{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:_.pixelBlocks[0]};let F=g&&N(d.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,I=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith(`vector`);I&&!this.rasterJobHandler&&await P();let L=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:d,pixelSize:E.toJSON(),datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:I},r):B({projectedExtent:e,srcBufferExtent:d,pixelSize:E,datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:!1,includeGCSGrid:I}),z,V=!r.requestRawData,H={rows:L.spacing[0],cols:L.spacing[1]},W=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(o,d.xmin):void 0,{pixelBlocks:G,mosaicSize:K,isPartiallyFilled:q}=_,J=null;if(this.rasterJobHandler){let e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:G,srcMosaicSize:K,destDimension:V?{width:t,height:n}:null,coefs:V?L.coefficients:null,sampleSpacing:V?H:null,projectDirections:I,gcsGrid:I?L.gcsGrid:null,isUV:this.rasterInfo.dataType===`vector-uv`,interpolation:r.interpolation,alignmentInfo:W,blockWidths:null},r);({pixelBlock:z,localNorthDirections:J}=e)}else{let e=k(G,K,{alignmentInfo:W});z=V?A(e,{width:t,height:n},L.coefficients,H,r.interpolation):e,I&&L.gcsGrid&&(J=j({width:t,height:n},L.gcsGrid),z=U(z,this.rasterInfo.dataType,J))}return r.requestRawData||I?{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:z,transformGrid:L,localNorthDirections:J,isPartiallyFilled:q}:{extent:e,srcExtent:e,srcTilePixelSize:w,pixelBlock:z}}async _fetchRawTiles(e,t,n,r){let{origin:i,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:o,blockHeight:s}=this.getBlockWidthHeight(e),{x:c,y:l}=t,{width:u,height:f,wrapCount:p}=n,m=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(c-=r.buffer.cols,l-=r.buffer.rows,u+=r.buffer.cols*2,f+=r.buffer.rows*2);let h=0,g=0,_=0;p&&m!=null&&({worldColumnCountFromOrigin:g,originColumnOffset:_,rightPadding:h}=m,g*m.blockWidth-h>=c+u&&(h=0));let v=Math.floor(c/o),y=Math.floor(l/s),b=Math.floor((c+u+h-1)/o),x=Math.floor((l+f+h-1)/s),S=a[e];if(!S)return null;let{minRow:C,minCol:w,maxCol:T,maxRow:E}=S;if(p===0&&(x<C||b<w||y>E||v>T))return null;let D=[],O=!1,k=this.ioConfig.allowPartialFill==null?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=y;t<=x;t++)for(let n=v;n<=b;n++){let i=n;if(!r.disableWrapAround&&p&&m!=null&&g<=n&&(i=n-g-_),t>=C&&i>=w&&E>=t&&T>=i){let n=this._fetchRawTile(e,t,i,r);k?D.push(new Promise(e=>{n.then(t=>e(t)).catch(()=>{O=!0,e(null)})})):D.push(n)}else D.push(Promise.resolve(null))}if(D.length===0)return null;let A=await Promise.all(D),j={height:(x-y+1)*s,width:(b-v+1)*o},{spatialReference:M}=this.rasterInfo,{x:N,y:P}=this.getPyramidPixelSize(e);return{extent:new d({xmin:i.x+v*o*N,xmax:i.x+(b+1)*o*N,ymin:i.y-(x+1)*s*P,ymax:i.y-y*s*P,spatialReference:M}),pixelBlocks:A,mosaicSize:j,isPartiallyFilled:O}}_fetchRawTile(e,t,n,r){let{storageInfo:i}=this.rasterInfo,a=i.transposeInfo!=null&&!!r.transposedVariableName;if(!a){let r=i.blockBoundary[e];if(!r)return Promise.resolve(null);let{minRow:a,minCol:o,maxCol:s,maxRow:c}=r;if(t<a||n<o||t>c||n>s)return Promise.resolve(null)}let s=a?r.transposeVariableName:r.sliceId,c=i.isBsqTile?r.bandIds:null,l=x(this.rasterId,s,c),u=`${e}/${t}/${n}`,d=S(l,r.registryId,u);if(d==null){let a=new AbortController,o=r.bandIds?.slice();if(o?.length&&i.isBsqTile){let i=new Set(o),s=[],c=Array.from(i);for(let i of c)s.push(this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:{...r,bandIds:[i]}},{signal:a.signal}));d=Promise.all(s).then(e=>{if(e.some(e=>e==null))return null;if(c.length!==o.length){let t=[];for(let n of o){let r=e[c.indexOf(n)];t.includes(r)&&(r=r.clone()),t.push(r)}e=t}return this.rasterJobHandler?this.rasterJobHandler.compositeBands({pixelBlocks:e},{signal:a.signal,transferPixelsToWorker:!0}):M(e)})}else d=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:r},{signal:a.signal});C(l,r.registryId,u,d,a),d.catch(()=>w(l,r.registryId,u))}return r.signal&&o(r,()=>{T(l,r.registryId,u)}),d}_computeMagDirValues(e){let{bandCount:t,dataType:n}=this.rasterInfo;if(!(t===2&&n===`vector-magdir`||n===`vector-uv`)||e?.length!==2||!e[0]?.length)return null;let r=e[0].length;if(n===`vector-magdir`){let t=e[1].map(e=>(e+360)%360);return[e[0],t]}let[i,a]=e,o=[],s=[];for(let e=0;e<r;e++){let[t,n]=W([i[e],a[e]]);o.push(t),s.push(n)}return[o,s]}_getRasterTileAlignmentInfo(e,t){return this._rasterTileAlignmentInfo??=V(this.rasterInfo),this._rasterTileAlignmentInfo.pyramidsInfo==null?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,n,r={}){let i={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(i.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,i));let a=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:o,srcHeight:s,pyramidLevel:c}=i,l=o/t,u=s/n,d=c<a&&l*u>=16,p=c===a&&this._requireTooManySrcTiles(o,s,t,n);if(d||p||o===0||s===0){let o=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),s=H(o,this.rasterInfo.spatialReference,e,i.datumTransformation),p=!s||r.srcResolution&&s.x+s.y<r.srcResolution.x+r.srcResolution.y;if(d&&r.srcResolution&&p){let e=Math.round(Math.log(Math.max(l,u))/Math.LN2)-1;if(a-c+3>=e){let t=2**e;s={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}s&&(i.srcResolution=s,this._updateSourceDataInfo(e,i))}return this._requireTooManySrcTiles(i.srcWidth,i.srcHeight,t,n)&&(i.srcWidth=0,i.srcHeight=0),i}_requireTooManySrcTiles(e,t,n,r){let{tileInfo:i}=this.rasterInfo.storageInfo,a=Math.ceil(e/i.size[0])*Math.ceil(t/i.size[1]),o=e/n,s=t/r;return a>=256*Math.max(1,(n+r)/1024)||o>8||s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;let{rasterInfo:n}=this,r=n.spatialReference,{srcResolution:i,datumTransformation:a}=t,{pyramidLevel:o,pyramidResolution:s,excessiveReading:c}=I(i,n,this.ioConfig.sampling);if(c)return;let l=t.srcExtent||z(e,r,a);if(l==null)return;let u=n.transform;u&&(l=u.inverseTransform(l)),t.srcExtent=l;let{origin:d}=n.storageInfo,{width:f,height:p,ul:m}=h(l,d,s,o);t.pyramidLevel=o,t.pyramidResolution=s,t.srcWidth=f,t.srcHeight=p,t.ul=m}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){let{srcLocation:n,position:r,pyramidLevel:i,useTransposedTile:a}=t,o=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[r])return{location:n,value:null};let{multidimensionalInfo:s}=this.rasterInfo;if(s==null||!a){let t=e.pixels.map(e=>e[r]),a={location:n,value:t,pyramidLevel:i},o=this._computeMagDirValues(t.map(e=>[e]));return o?.length&&(a.magdirValue=o.map(e=>e[0])),a}let c=e.pixels.map(e=>e.slice(r*o,r*o+o)),l=this._computeMagDirValues(c),{requestSomeSlices:u,identifyOptions:d}=t,f=v(s,d.transposedVariableName);if(u){let e=y(f,d.multidimensionalDefinition,d.timeExtent);c=c.map(t=>e.map(e=>t[e])),l=l?.map(t=>e.map(e=>t[e])),f=e.map(e=>f[e])}let p=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:c,pixelType:e.pixelType},h;return p!=null&&(E(m,p),h=m.mask),{location:n,value:null,dataSeries:f.map((e,t)=>{let n={value:h?.[t]===0?null:c.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new q({...e,isSlice:!0}))};return l?.length&&(n.magdirValue=[l[0][t],l[1][t]]),n}),pyramidLevel:i}}};e([c()],Q.prototype,`_rasterTileAlignmentInfo`,void 0),e([c()],Q.prototype,`_tileFetchQueue`,void 0),e([c({readOnly:!0})],Q.prototype,`_isGlobalWrappableSource`,null),e([c({readOnly:!0})],Q.prototype,`_hasNoneOrGCSShiftTransform`,null),e([c()],Q.prototype,`_openPromise`,void 0),e([c()],Q.prototype,`rasterJobHandler`,null),e([c({readOnly:!0})],Q.prototype,`rasterId`,null),e([c(K)],Q.prototype,`url`,null),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetName`,void 0),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetFormat`,void 0),e([c()],Q.prototype,`hasUniqueSourceStorageInfo`,void 0),e([c()],Q.prototype,`rasterInfo`,void 0),e([c()],Q.prototype,`ioConfig`,void 0),e([c()],Q.prototype,`sourceJSON`,void 0),e([c()],Q.prototype,`rawBlockRegistryIds`,void 0),Q=e([l(`esri.layers.raster.datasets.BaseRaster`)],Q);function $(e,t,n){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}export{Q as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../request.js";import n from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{debounce as a,onAbort as o}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{ensureClass as u}from"../../../core/accessorSupport/ensureType.js";import d from"../../../geometry/Extent.js";import f from"../../../geometry/Point.js";import p from"../../../geometry/SpatialReference.js";import{isFunctionRaster as m,getPixelSpaceCoverage as h}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as g,getSliceIndex as _,createSlices as v,getSliceIds as y}from"./multidimensionalUtils.js";import{clearRegisteredIds as b,getRasterId as x,getBlock as S,putBlock as C,deleteBlock as w,decreaseRefCount as T}from"./RawBlockCache.js";import{convertNoDataToMask as E}from"../formats/pixelRangeUtils.js";import{decode as D}from"../formats/RasterCodec.js";import{convertPixelSize as O}from"../functions/clipUtils.js";import{mosaic as k,approximateTransform as A,getLocalArithmeticNorthRotations as j,compositeBands as M}from"../functions/pixelUtils.js";import{getWorldWidth as N,load as P,projectPoint as F,snapPyramid as I,shiftExtent as L,getWorldWrapCount as R,projectExtent as z,getProjectionOffsetGrid as B,getRasterDatasetAlignmentInfo as V,projectResolution as H}from"../functions/rasterProjectionHelper.js";import{convertToLocalDirections as U,uvComponentToVector as W}from"../functions/vectorFieldUtils.js";import{sanitizeUrl as G}from"../../support/arcgisLayerUrl.js";import{url as K}from"../../support/commonProperties.js";import q from"../../support/DimensionalDefinition.js";import J from"../../support/LOD.js";import Y from"../../support/RasterStorageInfo.js";import X from"../../support/TileInfo.js";let Z=0,Q=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this.fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:`closest`},this.rawBlockRegistryIds=[],this.refresh=a(async e=>{await this._openPromise;let t=await this._refresh(e);return t.dataChanged&&b(this.rasterId,this.rawBlockRegistryIds),t})}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:`closest`,tileInfo:X.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){let{rasterInfo:e}=this,t=N(e.spatialReference);return t!=null&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){let{transform:e}=this.rasterInfo;return e==null||e.type===`gcs-shift`}set rasterJobHandler(e){this._set(`rasterJobHandler`,e),m(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||`rasterId-${Z++}`}set url(e){this._set(`url`,G(e,i.getLogger(this)))}async open(e){return this._openPromise??=P().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,r,i={}){let a=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,o=this.getTileExtentFromTileInfo(e,t,r,a);if(!o)throw new n(`imagery-tile:out-of-bounds`,`Level for fetch tile out of range`);return i={noClip:!0,...i},this.fetchPixels(o,a.size[0],a.size[1],i)}async identify(e,t={}){e=u(f,e).clone().normalize();let{multidimensionalDefinition:n,timeExtent:r}=t,{rasterInfo:i}=this,{hasMultidimensionalTranspose:a,multidimensionalInfo:o}=i,{transposedVariableName:s}=t,c=o!=null&&a&&(r!=null||g(n));c&&!s&&(s=n!=null&&n.length>0?n[0].variableName??void 0:o.variables[0].name,t={...t,transposedVariableName:s}),t=this._getRequestOptionsWithSliceId(t);let{spatialReference:l,extent:p}=i,{datumTransformation:h}=t,_=F(e,l,h);if(!p.intersects(_))return{location:_,value:null};if(i.transform!=null){let e=i.transform.inverseTransform(_);if(!i.nativeExtent.intersects(e))return{location:e,value:null};_=e}let v=s!=null&&o!=null&&i.hasMultidimensionalTranspose;if(m(this)){let e=this.primaryRasters.rasters[0];if(v)return e.identify(_,t);let{pixelSize:r}=i,a=r.x*3/2,o=r.y*3/2,s=new d({xmin:_.x-a,xmax:_.x+a,ymin:_.y-o,ymax:_.y+o,spatialReference:l}),c={interpolation:`nearest`,multidimensionalDefinition:n,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:u}=await e.fetchPixels(s,3,3,c),{pixelBlock:f}=await this.fetchPixels(s,3,3,c);if(u==null)return{location:_,value:null};let p=!u.mask||u.mask[4]?u.pixels.map(e=>e[4]):null,m;return f!=null&&(m=!f.mask||f.mask[4]?f.pixels.map(e=>e[4]):void 0),{location:_,value:p,processedValue:m,pyramidLevel:0}}let y=0;if(!v){let{srcResolution:n}=t;if(n)n.spatialReference&&(n=O(new f(n),l)),y=I(n,i,this.ioConfig.sampling).pyramidLevel;else if(y=await this.computeBestPyramidLevelForLocation(e,t),y==null)return{location:_,value:null}}let b=this.identifyPixelLocation(_,y,null,v);if(b===null)return{location:_,value:null};let{row:x,col:S,rowOffset:C,colOffset:w,blockWidth:T}=b,E=await this._fetchRawTile(y,x,S,t);if(!E?.pixels?.length)return{location:_,value:null};let D=C*T+w;return this._processIdentifyResult(E,{srcLocation:_,position:D,pyramidLevel:y,useTransposedTile:!!v,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,n,r={}){e=L(e),r=this._getRequestOptionsWithSliceId(r);let{_hasNoneOrGCSShiftTransform:i}=this;if(r.requestRawData&&i)return this._fetchPixels(e,t,n,r);let a=N(e.spatialReference),o=R(e);if(a==null||o===0||o===1&&this._isGlobalWrappableSource&&i)return this._fetchPixels(e,t,n,r);if(o>=3)return{extent:e,pixelBlock:null};let s=[],{xmin:c,xmax:l}=e,u=Math.round(a/(l-c)*t),f=u-Math.round((a/2-c)/(l-c)*t),p=0,m=[];for(let i=0;i<=o;i++){let h=i===0?c:-a/2,g=i===o?l-a*i:a/2,_=new d({xmin:h,xmax:g,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),v=i===0?u-f:i===o?t-p:u;p+=v,m.push(v);let y=r.disableWrapAround&&i>0?null:this._fetchPixels(_,v,n,r);s.push(y)}let h=(await Promise.all(s)).map(e=>e?.pixelBlock),g=null,_={width:t,height:n};g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:_,destDimension:null,coefs:null,sampleSpacing:null,interpolation:`nearest`,alignmentInfo:null,blockWidths:m},r)).pixelBlock:k(h,_,{blockWidths:m});let v=z(e,this.rasterInfo.spatialReference,r.datumTransformation);return{extent:e,srcExtent:v,pixelBlock:g}}async fetchRawPixels(e,t,n,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};let i=await this._fetchRawTiles(e,t,n,r),{nativeExtent:a,nativePixelSize:o,storageInfo:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,f=new d({xmin:a.xmin+l*t.x,xmax:a.xmin+l*(t.x+n.width-1),ymin:a.ymax-u*(t.y+n.height-1),ymax:a.ymax-u*t.y,spatialReference:a.spatialReference});if(!i)return{extent:f,srcExtent:f,pixelBlock:null};let{pixelBlocks:p,mosaicSize:m}=i;if(p.length===1&&p[0]!=null&&p[0].width===n.width&&p[0].height===n.height)return{extent:f,srcExtent:f,pixelBlock:i.pixelBlocks[0]};let h=e>0?s.pyramidBlockWidth:s.blockWidth,g=e>0?s.pyramidBlockHeight:s.blockHeight,_={x:t.x%h,y:t.y%g},v;return v=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:m,destDimension:n,clipOffset:_,clipSize:n,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock:k(p,m,{clipOffset:_,clipSize:n}),{extent:f,srcExtent:f,pixelBlock:v}}fetchRawTile(e,t,r,i){throw new n(`BaseRaster:read-not-implemented`,`fetchRawTile() is not implemented`)}computeExtent(e){return z(this.rasterInfo.extent,e)}decodePixelBlock(e,t,n){return this.rasterJobHandler?this.rasterJobHandler.decode({data:e,options:t},n):D(e,t,n)}async request(e,n,r=0){let{customFetchParameters:i}=this.ioConfig,{range:a,query:o,headers:s}=n;r=r??n.retryCount??this.ioConfig.retryCount;let c=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await t(e,{...n,query:{...o,...i},headers:{...s,...c}})}catch(t){if(r>0)return r--,this.request(e,n,r);throw t}}getSliceIndex(e){let{multidimensionalInfo:t}=this.rasterInfo;return t==null||e==null||e.length===0?null:_(e,t)}getTileExtentFromTileInfo(e,t,n,r){let i=r.lodAt(e);return i?this.getTileExtent({x:i.resolution,y:i.resolution},t,n,r.origin,r.spatialReference,r.size):null}updateTileInfo(){let{storageInfo:e,spatialReference:t,extent:n,pixelSize:r}=this.rasterInfo,{pyramidResolutions:i}=e;if(!e.tileInfo){let a=[],o=e.maximumPyramidLevel||0,s=(r.x+r.y)/2,c=1/.0254*96*s;for(let e=0;e<=o&&(a.unshift(new J({level:o-e,resolution:s,scale:c})),e!==o);e++)if(i){let t=(i[e].x+i[e].y)/2;c*=t/s,s=t}else s*=2,c*=2;let l=new f({x:n.xmin,y:n.ymax,spatialReference:t});e.tileInfo=new X({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:a}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,n=512,r){let{width:i,height:a,nativeExtent:o,pixelSize:s,spatialReference:c}=e,l=new f({x:o.xmin,y:o.ymax,spatialReference:c});r??=Math.max(0,Math.round(Math.log(Math.max(i,a))/Math.LN2-8));let u=this.computeBlockBoundary(o,t,n,{x:o.xmin,y:o.ymax},[s],r);e.storageInfo=new Y({blockWidth:t,blockHeight:n,pyramidBlockWidth:t,pyramidBlockHeight:n,origin:l,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,n,r,i,a=0,o=2){if(i.length===1&&a>0){i=[...i];let{x:e,y:t}=i[0];for(let n=0;n<a;n++)e*=o,t*=o,i.push({x:e,y:t})}let s=[],{x:c,y:l}=r;for(let r=0;r<i.length;r++){let{x:a,y:o}=i[r];s.push({minCol:Math.floor((e.xmin-c+.1*a)/t/a),maxCol:Math.floor((e.xmax-c-.1*a)/t/a),minRow:Math.floor((l-e.ymax+.1*o)/n/o),maxRow:Math.floor((l-e.ymin-.1*o)/n/o)})}return s}getPyramidPixelSize(e){let{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(e===0)return t;if(n!=null&&n.length)return n[e-1];let i=r**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,n,r){let{spatialReference:i,nativeExtent:a,storageInfo:o}=this.rasterInfo,{maximumPyramidLevel:s,origin:c,transposeInfo:l}=o,u=r&&l!=null?l.tileSize[0]:o.blockWidth,d=r&&l!=null?l.tileSize[1]:o.blockHeight,f=F(e,i,n);if(!a.intersects(f)||t<0||t>s)return null;let{x:p,y:m}=this.getPyramidPixelSize(t),h=(c.y-f.y)/m/d,g=(f.x-c.x)/p/u,_=Math.min(d-1,Math.floor((h-Math.floor(h))*d)),v=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(g),rowOffset:_,colOffset:v,blockWidth:u,srcLocation:f}}getTileExtent(e,t,n,r,i,a){let[o,s]=a,c=r.x+n*o*e.x,l=c+o*e.x,u=r.y-t*s*e.y,f=u-s*e.y;return new d({xmin:c,xmax:l,ymin:f,ymax:u,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,n){let r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<n||r.minRow>t||r.minCol>n}updateImageSpaceRasterInfo(e){let{pixelSize:t}=e,{width:n,height:r}=e,i=p.WebMercator;e.spatialReference=i,e.extent=e.nativeExtent=new d({xmin:-.5,ymax:.5,xmax:n-.5,ymin:.5-r,spatialReference:i}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new f({x:1,y:1,spatialReference:i});let{extent:a,storageInfo:o}=e;if(o){o.origin=new f({x:a.xmin,y:a.ymax,spatialReference:i});let{pyramidResolutions:n,tileInfo:r}=o;if(n&&n.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=o.origin;let t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,n)=>{e.resolution=t*2**n,e.scale=96*e.resolution/.0254})}}}async _refresh(e){return{dataChanged:!0}}async _fetchPixels(e,t,n,r={}){let i=R(e);if(i>=2)return{extent:e,pixelBlock:null};let a=this._getSourceDataInfo(e,t,n,r),{pyramidLevel:o,srcResolution:s,srcWidth:c,srcHeight:l,ul:u}=a,{srcExtent:d}=a;if(c===0||l===0)return{extent:e,srcExtent:d,pixelBlock:null};let{rasterInfo:p}=this,m=p.transform,h=m?.type===`gcs-shift`,g=N(e.spatialReference)!=null;(h||!g)&&(i=R(d,h));let _=await this._fetchRawTiles(o,u,{width:c,height:l,wrapCount:i},r);if(!_)return{extent:e,srcExtent:d,pixelBlock:null};d=_.extent;let v=p.storageInfo,y=o>0?v.pyramidBlockWidth:v.blockWidth,b=o>0?v.pyramidBlockHeight:v.blockHeight,{x,y:S}=p.pixelSize;if(o>0){let{pyramidResolutions:e,pyramidScalingFactor:t}=v;if(e!=null&&e[o-1])({x,y:S}=e[o-1]);else{let e=t**o;x*=e,S*=e}}let C=p.spatialReference,w=new f({x,y:S,spatialReference:C}),T=y===c&&b===l&&u.x%y===0&&u.y%b===0,E=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),D=!e.spatialReference.equals(C),O=C.isGeographic?1e-9:1e-4,{datumTransformation:M}=r;if(!D&&T&&_.pixelBlocks.length===1&&y===t&&b===n&&$(s,E,O))return{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:_.pixelBlocks[0]};let F=g&&N(d.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,I=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith(`vector`);I&&!this.rasterJobHandler&&await P();let L=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:d,pixelSize:E.toJSON(),datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:I},r):B({projectedExtent:e,srcBufferExtent:d,pixelSize:E,datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:!1,includeGCSGrid:I}),z,V=!r.requestRawData,H={rows:L.spacing[0],cols:L.spacing[1]},W=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(o,d.xmin):void 0,{pixelBlocks:G,mosaicSize:K,isPartiallyFilled:q}=_,J=null;if(this.rasterJobHandler){let e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:G,srcMosaicSize:K,destDimension:V?{width:t,height:n}:null,coefs:V?L.coefficients:null,sampleSpacing:V?H:null,projectDirections:I,gcsGrid:I?L.gcsGrid:null,isUV:this.rasterInfo.dataType===`vector-uv`,interpolation:r.interpolation,alignmentInfo:W,blockWidths:null},r);({pixelBlock:z,localNorthDirections:J}=e)}else{let e=k(G,K,{alignmentInfo:W});z=V?A(e,{width:t,height:n},L.coefficients,H,r.interpolation):e,I&&L.gcsGrid&&(J=j({width:t,height:n},L.gcsGrid),z=U(z,this.rasterInfo.dataType,J))}return r.requestRawData||I?{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:z,transformGrid:L,localNorthDirections:J,isPartiallyFilled:q}:{extent:e,srcExtent:e,srcTilePixelSize:w,pixelBlock:z}}async _fetchRawTiles(e,t,n,r){let{origin:i,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:o,blockHeight:s}=this.getBlockWidthHeight(e),{x:c,y:l}=t,{width:u,height:f,wrapCount:p}=n,m=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(c-=r.buffer.cols,l-=r.buffer.rows,u+=r.buffer.cols*2,f+=r.buffer.rows*2);let h=0,g=0,_=0;p&&m!=null&&({worldColumnCountFromOrigin:g,originColumnOffset:_,rightPadding:h}=m,g*m.blockWidth-h>=c+u&&(h=0));let v=Math.floor(c/o),y=Math.floor(l/s),b=Math.floor((c+u+h-1)/o),x=Math.floor((l+f+h-1)/s),S=a[e];if(!S)return null;let{minRow:C,minCol:w,maxCol:T,maxRow:E}=S;if(p===0&&(x<C||b<w||y>E||v>T))return null;let D=[],O=!1,k=this.ioConfig.allowPartialFill==null?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=y;t<=x;t++)for(let n=v;n<=b;n++){let i=n;if(!r.disableWrapAround&&p&&m!=null&&g<=n&&(i=n-g-_),t>=C&&i>=w&&E>=t&&T>=i){let n=this._fetchRawTile(e,t,i,r);k?D.push(new Promise(e=>{n.then(t=>e(t)).catch(()=>{O=!0,e(null)})})):D.push(n)}else D.push(Promise.resolve(null))}if(D.length===0)return null;let A=await Promise.all(D),j={height:(x-y+1)*s,width:(b-v+1)*o},{spatialReference:M}=this.rasterInfo,{x:N,y:P}=this.getPyramidPixelSize(e);return{extent:new d({xmin:i.x+v*o*N,xmax:i.x+(b+1)*o*N,ymin:i.y-(x+1)*s*P,ymax:i.y-y*s*P,spatialReference:M}),pixelBlocks:A,mosaicSize:j,isPartiallyFilled:O}}_fetchRawTile(e,t,n,r){let{storageInfo:i}=this.rasterInfo,a=i.transposeInfo!=null&&!!r.transposedVariableName;if(!a){let r=i.blockBoundary[e];if(!r)return Promise.resolve(null);let{minRow:a,minCol:o,maxCol:s,maxRow:c}=r;if(t<a||n<o||t>c||n>s)return Promise.resolve(null)}let s=a?r.transposeVariableName:r.sliceId,c=i.isBsqTile?r.bandIds:null,l=x(this.rasterId,s,c),u=`${e}/${t}/${n}`,d=S(l,r.registryId,u);if(d==null){let a=new AbortController,o=r.bandIds?.slice();if(o?.length&&i.isBsqTile){let i=new Set(o),s=[],c=Array.from(i);for(let i of c)s.push(this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:{...r,bandIds:[i]}},{signal:a.signal}));d=Promise.all(s).then(e=>{if(e.some(e=>e==null))return null;if(c.length!==o.length){let t=[];for(let n of o){let r=e[c.indexOf(n)];t.includes(r)&&(r=r.clone()),t.push(r)}e=t}return this.rasterJobHandler?this.rasterJobHandler.compositeBands({pixelBlocks:e},{signal:a.signal,transferPixelsToWorker:!0}):M(e)})}else d=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:r},{signal:a.signal});C(l,r.registryId,u,d,a),d.catch(()=>w(l,r.registryId,u))}return r.signal&&o(r,()=>{T(l,r.registryId,u)}),d}_computeMagDirValues(e){let{bandCount:t,dataType:n}=this.rasterInfo;if(!(t===2&&n===`vector-magdir`||n===`vector-uv`)||e?.length!==2||!e[0]?.length)return null;let r=e[0].length;if(n===`vector-magdir`){let t=e[1].map(e=>(e+360)%360);return[e[0],t]}let[i,a]=e,o=[],s=[];for(let e=0;e<r;e++){let[t,n]=W([i[e],a[e]]);o.push(t),s.push(n)}return[o,s]}_getRasterTileAlignmentInfo(e,t){return this._rasterTileAlignmentInfo??=V(this.rasterInfo),this._rasterTileAlignmentInfo.pyramidsInfo==null?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,n,r={}){let i={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(i.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,i));let a=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:o,srcHeight:s,pyramidLevel:c}=i,l=o/t,u=s/n,d=c<a&&l*u>=16,p=c===a&&this._requireTooManySrcTiles(o,s,t,n);if(d||p||o===0||s===0){let o=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),s=H(o,this.rasterInfo.spatialReference,e,i.datumTransformation),p=!s||r.srcResolution&&s.x+s.y<r.srcResolution.x+r.srcResolution.y;if(d&&r.srcResolution&&p){let e=Math.round(Math.log(Math.max(l,u))/Math.LN2)-1;if(a-c+3>=e){let t=2**e;s={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}s&&(i.srcResolution=s,this._updateSourceDataInfo(e,i))}return this._requireTooManySrcTiles(i.srcWidth,i.srcHeight,t,n)&&(i.srcWidth=0,i.srcHeight=0),i}_requireTooManySrcTiles(e,t,n,r){let{tileInfo:i}=this.rasterInfo.storageInfo,a=Math.ceil(e/i.size[0])*Math.ceil(t/i.size[1]),o=e/n,s=t/r;return a>=256*Math.max(1,(n+r)/1024)||o>8||s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;let{rasterInfo:n}=this,r=n.spatialReference,{srcResolution:i,datumTransformation:a}=t,{pyramidLevel:o,pyramidResolution:s,excessiveReading:c}=I(i,n,this.ioConfig.sampling);if(c)return;let l=t.srcExtent||z(e,r,a);if(l==null)return;let u=n.transform;u&&(l=u.inverseTransform(l)),t.srcExtent=l;let{origin:d}=n.storageInfo,{width:f,height:p,ul:m}=h(l,d,s,o);t.pyramidLevel=o,t.pyramidResolution=s,t.srcWidth=f,t.srcHeight=p,t.ul=m}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){let{srcLocation:n,position:r,pyramidLevel:i,useTransposedTile:a}=t,o=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[r])return{location:n,value:null};let{multidimensionalInfo:s}=this.rasterInfo;if(s==null||!a){let t=e.pixels.map(e=>e[r]),a={location:n,value:t,pyramidLevel:i},o=this._computeMagDirValues(t.map(e=>[e]));return o?.length&&(a.magdirValue=o.map(e=>e[0])),a}let c=e.pixels.map(e=>e.slice(r*o,r*o+o)),l=this._computeMagDirValues(c),{requestSomeSlices:u,identifyOptions:d}=t,f=v(s,d.transposedVariableName);if(u){let e=y(f,d.multidimensionalDefinition,d.timeExtent);c=c.map(t=>e.map(e=>t[e])),l=l?.map(t=>e.map(e=>t[e])),f=e.map(e=>f[e])}let p=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:c,pixelType:e.pixelType},h;return p!=null&&(E(m,p),h=m.mask),{location:n,value:null,dataSeries:f.map((e,t)=>{let n={value:h?.[t]===0?null:c.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new q({...e,isSlice:!0}))};return l?.length&&(n.magdirValue=[l[0][t],l[1][t]]),n}),pyramidLevel:i}}};e([c()],Q.prototype,`_rasterTileAlignmentInfo`,void 0),e([c()],Q.prototype,`_tileFetchQueue`,void 0),e([c({readOnly:!0})],Q.prototype,`_isGlobalWrappableSource`,null),e([c({readOnly:!0})],Q.prototype,`_hasNoneOrGCSShiftTransform`,null),e([c()],Q.prototype,`_openPromise`,void 0),e([c()],Q.prototype,`rasterJobHandler`,null),e([c({readOnly:!0})],Q.prototype,`rasterId`,null),e([c(K)],Q.prototype,`url`,null),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetName`,void 0),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetFormat`,void 0),e([c()],Q.prototype,`hasUniqueSourceStorageInfo`,void 0),e([c()],Q.prototype,`rasterInfo`,void 0),e([c()],Q.prototype,`ioConfig`,void 0),e([c()],Q.prototype,`sourceJSON`,void 0),e([c()],Q.prototype,`rawBlockRegistryIds`,void 0),Q=e([l(`esri.layers.raster.datasets.BaseRaster`)],Q);function $(e,t,n){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}export{Q as default};
@@ -1,3 +1,3 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{eachAlways as n,createAbortError as r}from"../../../core/promiseUtils.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"../../../geometry/Extent.js";import s from"../../../geometry/SpatialReference.js";import c from"./BaseRaster.js";import l from"./InMemoryRaster.js";import{parsePAMInfo as u}from"./pamParser.js";import{parseHeader as d}from"../formats/JpgPlus.js";import{getFormat as f}from"../formats/RasterCodec.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import m from"../transforms/PolynomialTransform.js";import h from"../../support/RasterInfo.js";let g=class extends c{set rasterJobHandler(e){this._set(`rasterJobHandler`,e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}fetchRawTile(e,t,n,r={}){if(this._imageBlob){let{blockWidth:i,blockHeight:a}=this.rasterInfo.storageInfo;return this.decodePixelBlock(this._imageBlob,{tileSize:[i,a],tileIndex:[e,t,n],canvasUsage:`canvas-only`,cloneSource:!0,skipStatistics:!0},{signal:r.signal})}return this._inMemoryRaster?this._inMemoryRaster.fetchRawTile(e,t,n,r):Promise.resolve(null)}async _open(e){let n=await this._fetchData(e);if(n==null)throw new t(`image-aux-raster:open`,`the data cannot be decoded`);let{spatialReference:r,statistics:i,histograms:a,transform:c}=await this._fetchAuxiliaryData(e),u=!r;u&&(r=new s({wkid:3857})),a?.length&&i==null&&(i=p(a));let{width:d,height:f,pixelBlock:m}=n,g=new o({xmin:-.5,ymin:.5-f,xmax:d-.5,ymax:.5,spatialReference:r}),_=c?c.forwardTransform(g):g,v=!0;if(c){let e=c.forwardCoefficients;v=e&&e[1]===0&&e[2]===0,v&&(c=null,g=_)}if(!m){let e=new h({width:d,height:f,bandCount:3,pixelType:`u8`,extent:_,nativeExtent:g,transform:c,pixelSize:{x:_.width/d,y:_.height/f},spatialReference:_.spatialReference,keyProperties:{DataType:`Processed`}});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(e),this.createRemoteDatasetStorageInfo(e,512,512),this._set(`rasterInfo`,e),this.updateTileInfo();return}let{rasterJobHandler:y,ioConfig:b}=this,x=new l({preGenerateTiles:!1,rasterJobHandler:y,source:{extent:_,nativeExtent:g,transform:c,pixelBlocks:[m],statistics:i,histograms:a,keyProperties:{DataType:`Processed`},isPseudoSpatialReference:u},ioConfig:{...b,sampling:`closest`,skipStatistics:!0}});await x.open(),x.source=null,this._set(`rasterInfo`,x.rasterInfo),this._inMemoryRaster=x}async _fetchData(e){let{data:n}=await this.request(this.url,{responseType:`array-buffer`,signal:e?.signal}),r=f(n);if(r===`jpg`||r===`png`||r===`gif`||r===`bmp`)this._set(`datasetFormat`,r.toUpperCase());else throw new t(`image-aux-raster:open`,`the data is not a supported format`);if(r===`jpg`){let e=d(n);if(e==null)throw new t(`image-aux-raster:open`,`the data is not a supported format`);return this._imageBlob=n,e}try{let t=await this.decodePixelBlock(n,{format:r,canvasUsage:`canvas-only`,cloneSource:!0,skipStatistics:!0},e);return this._imageBlob=n,t?{width:t.width,height:t.height,pixelBlock:t}:null}catch{let t=await this.decodePixelBlock(n,{format:r,canvasUsage:`no-canvas`,skipStatistics:!0},e);return t?{width:t.width,height:t.height,pixelBlock:t}:null}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:a}=this.ioConfig,o=a||i.includes(`aux.xml`)?null:this.request(this.url+`.aux.xml`,{responseType:`xml`,signal:t}),s=this.datasetFormat,c=s===`JPG`?`jgw`:s===`PNG`?`pgw`:s===`BMP`?`bpw`:null,l=c&&i.includes(c)?null:this.request(this.url.slice(0,this.url.lastIndexOf(`.`))+`.`+c,{responseType:`text`,signal:t}),d=await n([o,l]);if(t?.aborted)throw r();let f=u(d[0].value?.data);if(!f.transform){let e=d[1].value?d[1].value.data.split(`
3
- `).slice(0,6).map(e=>Number(e)):null;f.transform=e?.length===6?new m({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return f}};e([i({type:String,json:{write:!0}})],g.prototype,`datasetFormat`,void 0),e([i()],g.prototype,`rasterJobHandler`,null),g=e([a(`esri.layers.raster.datasets.ImageAuxRaster`)],g);const _=g;export{_ as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{throwIfAborted as n,eachAlways as r,createAbortError as i}from"../../../core/promiseUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import s from"../../../geometry/Extent.js";import c from"../../../geometry/SpatialReference.js";import l from"./BaseRaster.js";import u from"./InMemoryRaster.js";import{parsePAMInfo as d}from"./pamParser.js";import{parseHeader as f}from"../formats/JpgPlus.js";import{getFormat as p}from"../formats/RasterCodec.js";import{estimateStatisticsFromHistograms as m}from"../functions/stretchUtils.js";import h from"../transforms/PolynomialTransform.js";const g=`image-aux-raster:open`,_=`The data is not a supported format.`;let v=class extends l{set rasterJobHandler(e){this._set(`rasterJobHandler`,e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}async fetchRawTile(e,t,n,r={}){return this._inMemoryRaster?.fetchRawTile(e,t,n,r)}async _open(e){let{data:n,format:r}=await this._fetchData(e),i,{tileGeneration:a}=this.ioConfig,o=a===`immediate`||r!==`jpg`;if(o){let a=await this._decodeFullImage(n,r,e);if(!a)throw new t(g,`The data cannot be decoded.`);i=await this._createRasterSource(a,e)}else{let r=f(n);if(!r)throw new t(g,_);i=await this._createRasterSource(r,e),i.encodedData=n}let{rasterJobHandler:s,ioConfig:c}=this,l=new u({preGenerateTiles:o,rasterJobHandler:s,source:i,ioConfig:{...c,sampling:`closest`,skipStatistics:!0}});await l.open(e),this._set(`rasterInfo`,l.rasterInfo),this._inMemoryRaster=l}async _createRasterSource(e,t){let{spatialReference:n,statistics:r,histograms:i,transform:a}=await this._fetchAuxiliaryData(t),o=!n;o&&(n=new c({wkid:3857})),i?.length&&r==null&&(r=m(i));let{width:l,height:u}=e,d=new s({xmin:-.5,ymin:.5-u,xmax:l-.5,ymax:.5,spatialReference:n}),f=a?a.forwardTransform(d):d,p=!0;if(a){let e=a.forwardCoefficients;p=e&&e[1]===0&&e[2]===0,p&&(a=null,d=f)}let h=[];return`pixels`in e&&h.push(e),{name:this.datasetName,pixelBlocks:h,imageInfo:{width:l,height:u,pixelType:`u8`,bandCount:3},extent:f,nativeExtent:d,transform:a,statistics:r,histograms:i,isPseudoSpatialReference:o,keyProperties:{DataType:`Processed`}}}async _fetchData(e){let{data:n}=await this.request(this.url,{responseType:`array-buffer`,signal:e?.signal}),r=p(n);if(r===`jpg`||r===`png`||r===`gif`||r===`bmp`)this._set(`datasetFormat`,r.toUpperCase());else throw new t(g,_);return{data:n,format:r}}async _decodeFullImage(e,t,r){try{return await this.decodePixelBlock(e,{format:t,canvasUsage:`canvas-only`,cloneSource:!0,skipStatistics:!0},r)}catch{return n(r?.signal),this.decodePixelBlock(e,{format:t,canvasUsage:`no-canvas`,skipStatistics:!0},r)}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:n=[],skipMapInfo:a}=this.ioConfig,o=a||n.includes(`aux.xml`)?null:this.request(this.url+`.aux.xml`,{responseType:`xml`,signal:t}),s=this.datasetFormat,c=s===`JPG`?`jgw`:s===`PNG`?`pgw`:s===`BMP`?`bpw`:null,l=a||c==null||n.includes(c)?null:this.request(this.url.slice(0,this.url.lastIndexOf(`.`))+`.`+c,{responseType:`text`,signal:t}),u=await r([o,l]);if(t?.aborted)throw i();let f=d(u[0].value?.data);if(!f.transform){let e=u[1].value?u[1].value.data.split(`
3
+ `).slice(0,6).map(e=>Number(e)):null;f.transform=e?.length===6?new h({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return f}};e([a({type:String,json:{write:!0}})],v.prototype,`datasetFormat`,void 0),e([a()],v.prototype,`rasterJobHandler`,null),v=e([o(`esri.layers.raster.datasets.ImageAuxRaster`)],v);const y=v;export{y as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{eachAlways as n}from"../../../core/promiseUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import a from"../../../geometry/Extent.js";import o from"../../../geometry/SpatialReference.js";import s from"./BaseRaster.js";import{getSliceIndex as c}from"./multidimensionalUtils.js";import{clipTile as l,split as u}from"../functions/pixelUtils.js";import{estimateStatisticsHistograms as d,computeStatisticsHistograms as f}from"../functions/stretchUtils.js";import p from"../../support/DimensionalDefinition.js";import m from"../../support/RasterInfo.js";let h=class extends s{constructor(){super(...arguments),this.datasetFormat=`MEMORY`,this.preGenerateTiles=!0,this.source=null}get url(){return``}fetchRawTile(e,t,n,r={}){if(!this._pixelBlockTiles){let{rasterInfo:i}=this,[a,o]=i.storageInfo.tileInfo.size,{sliceId:s}=r,{pixelBlocks:c}=this.source,u={pixelBlock:s==null?c[0]:c[s],useBilinear:i.dataType!==`thematic`,tileSize:{width:a,height:o},level:e,row:t,col:n},d=this.rasterJobHandler?this.rasterJobHandler.clipTile(u,r):l(u);return Promise.resolve(d)}let i=this._pixelBlockTiles.get(`${e}/${t}/${n}`);return Promise.resolve(i)}async _open(e){let t=this.source,{pixelBlocks:n,attributeTable:r,statistics:i,histograms:s,name:c,nativeExtent:l,transform:u,colormap:d}=t,f=n[0],{width:p,height:h,pixelType:g}=f,_=t.extent??new a({xmin:-.5,ymin:.5,xmax:p-.5,ymax:h-.5,spatialReference:new o({wkid:3857})}),v=t.isPseudoSpatialReference??!t.extent,y={x:_.width/p,y:_.height/h},b={...t.keyProperties};t.dataType&&(b.DataType=t.dataType),t.bandInfos&&(b.BandProperties=t.bandInfos.map(e=>e.toJSON())),r&&(b.DataType=`Thematic`);let x=new m({width:p,height:h,pixelType:g,extent:_,nativeExtent:l,attributeTable:r,colormap:d,transform:u,pixelSize:y,spatialReference:_.spatialReference,bandCount:f.pixels.length,keyProperties:b,multidimensionalInfo:t.multidimensionalInfo,statistics:i,isPseudoSpatialReference:v,histograms:s});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(x),this.createRemoteDatasetStorageInfo(x,512,512),this._set(`rasterInfo`,x),this.updateTileInfo(),x.multidimensionalInfo?await this._buildMDimStats(t.pixelBlocks,x.multidimensionalInfo):this.preGenerateTiles&&await this._buildInMemoryRaster(f,{width:512,height:512},e),x.multidimensionalInfo||(this.source=null),this.datasetName=c}async _buildInMemoryRaster(e,r,i){let{rasterInfo:a}=this,o=a.storageInfo.maximumPyramidLevel??0,s=a.dataType!==`thematic`,c=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:r,maximumPyramidLevel:o,useBilinear:s},i):Promise.resolve(u(e,r,o,s)),l=a.statistics!=null,f=a.histograms!=null,p=this.ioConfig.skipStatistics||l?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve(d(e)),m=await n([c,p]);if(!m[0].value&&m[1].value)throw new t(`inmemory-raster:open`,`failed to build in memory raster`);this._pixelBlockTiles=m[0].value,l||(a.statistics=m[1].value?.statistics),f||(a.histograms=m[1].value?.histograms)}async _buildMDimStats(e,t,n){for(let r=0;r<t.variables.length;r++){let i=t.variables[r];if(i.statistics)continue;let a=i.dimensions.map(e=>new p({variableName:i.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),o=c(a,t),s=o==null?null:e[o];if(s==null)continue;let l=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:s},n):f(s);i.statistics=l.statistics,i.histograms||=l.histograms}}};e([r({type:String,json:{write:!0}})],h.prototype,`datasetFormat`,void 0),e([r({constructOnly:!0})],h.prototype,`preGenerateTiles`,void 0),e([r()],h.prototype,`source`,void 0),e([r()],h.prototype,`url`,null),h=e([i(`esri.layers.raster.datasets.InMemoryRaster`)],h);const g=h;export{g as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{eachAlways as n}from"../../../core/promiseUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import a from"../../../geometry/Extent.js";import o from"../../../geometry/SpatialReference.js";import s from"./BaseRaster.js";import{getSliceIndex as c}from"./multidimensionalUtils.js";import{clipTile as l,split as u}from"../functions/pixelUtils.js";import{estimateStatisticsHistograms as d,computeStatisticsHistograms as f}from"../functions/stretchUtils.js";import p from"../../support/DimensionalDefinition.js";import m from"../../support/RasterInfo.js";let h=class extends s{constructor(){super(...arguments),this._pixelBlockTiles=new Map,this.datasetFormat=`MEMORY`,this.preGenerateTiles=!0,this.source=null}get url(){return``}async fetchRawTile(e,t,n,r={}){let i=`${e}/${t}/${n}`,a=this._pixelBlockTiles.get(i);if(a)return a;if(!this.source)return null;let{rasterInfo:o}=this,[s,c]=o.storageInfo.tileInfo.size,{sliceId:u}=r,{encodedData:d}=this.source;if(d){let a=await this.decodePixelBlock(d,{tileSize:[s,c],tileIndex:[e,t,n],canvasUsage:`canvas-only`,cloneSource:!0,skipStatistics:!0},{signal:r.signal});return a&&this._pixelBlockTiles.set(i,a),a}let{pixelBlocks:f}=this.source,p=u==null?f[0]:f[u];if(p==null)return null;let m={pixelBlock:p,useBilinear:o.dataType!==`thematic`,tileSize:{width:s,height:c},level:e,row:t,col:n};return this.rasterJobHandler?this.rasterJobHandler.clipTile(m,r):l(m)}async _open(e){if(!this.source)throw new t(`in-memory-raster:open`,`source is required to open an in memory raster`);let n=this.source;this.datasetName=n.name;let{pixelBlocks:r,attributeTable:i,statistics:s,histograms:c,nativeExtent:l,transform:u,colormap:d}=n,f=r[0],{width:p,height:h,pixelType:g}=f??n.imageInfo,_=n.extent??new a({xmin:-.5,ymin:.5,xmax:p-.5,ymax:h-.5,spatialReference:new o({wkid:3857})}),v=n.isPseudoSpatialReference??!n.extent,y={x:_.width/p,y:_.height/h},b={...n.keyProperties};n.dataType&&(b.DataType=n.dataType),n.bandInfos&&(b.BandProperties=n.bandInfos.map(e=>e.toJSON())),i&&(b.DataType=`Thematic`);let x=new m({width:p,height:h,pixelType:g,extent:_,nativeExtent:l,attributeTable:i,colormap:d,transform:u,pixelSize:y,spatialReference:_.spatialReference,bandCount:f?.pixels.length??n.imageInfo.bandCount,keyProperties:b,multidimensionalInfo:n.multidimensionalInfo,statistics:s,isPseudoSpatialReference:v,histograms:c});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(x),this.createRemoteDatasetStorageInfo(x,512,512),this._set(`rasterInfo`,x),this.updateTileInfo(),x.multidimensionalInfo?await this._buildMDimStats(r,x.multidimensionalInfo):this.preGenerateTiles&&f&&(await this._buildInMemoryRaster(f,{width:512,height:512},e),this.source=null)}async _buildInMemoryRaster(e,r,i){let{rasterInfo:a}=this,o=a.storageInfo.maximumPyramidLevel??0,s=a.dataType!==`thematic`,c=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:r,maximumPyramidLevel:o,useBilinear:s},i):Promise.resolve(u(e,r,o,s)),l=a.statistics!=null,f=a.histograms!=null,p=this.ioConfig.skipStatistics||l?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve(d(e)),m=await n([c,p]);if(!m[0].value)throw new t(`in-memory-raster:open`,`failed to build in memory raster`);this._pixelBlockTiles=m[0].value,l||(a.statistics=m[1].value?.statistics),f||(a.histograms=m[1].value?.histograms)}async _buildMDimStats(e,t,n){for(let r=0;r<t.variables.length;r++){let i=t.variables[r];if(i.statistics)continue;let a=i.dimensions.map(e=>new p({variableName:i.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),o=c(a,t),s=o==null?null:e[o];if(s==null)continue;let l=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:s},n):f(s);i.statistics=l.statistics,i.histograms||=l.histograms}}};e([r({type:String,json:{write:!0}})],h.prototype,`datasetFormat`,void 0),e([r({constructOnly:!0})],h.prototype,`preGenerateTiles`,void 0),e([r()],h.prototype,`source`,void 0),e([r()],h.prototype,`url`,null),h=e([i(`esri.layers.raster.datasets.InMemoryRaster`)],h);const g=h;export{g as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../config.js";import{id as t}from"../../kernel.js";import n from"../../PopupTemplate.js";import r from"../../request.js";import{clone as i}from"../../core/lang.js";import{addQueryParameters as a}from"../../core/urlUtils.js";import o from"../../geometry/SpatialReference.js";import{create as s,expandWithAABB as c,equals as l,negativeInfinity as u}from"../../geometry/support/aaBoundingBox.js";import{getBoundsXYZ as d}from"../../geometry/support/boundsUtils.js";import{fromJSON as f}from"../../renderers/support/jsonUtils.js";import p from"../../rest/support/FeatureSet.js";const m={esriGeometryPoint:`points`,esriGeometryPolyline:`polylines`,esriGeometryPolygon:`polygons`};function h(e){let t=e.folders||[],n=t.slice(),r=new Map,a=new Map,o=new Map,s=new Map,c=new Map,l={esriGeometryPoint:a,esriGeometryPolyline:o,esriGeometryPolygon:s};return(e.featureCollection?.layers||[]).forEach(e=>{let t=i(e);t.featureSet.features=[];let n=e.featureSet.geometryType;r.set(n,t);let c=e.layerDefinition.objectIdField;n===`esriGeometryPoint`?v(a,c,e.featureSet.features):n===`esriGeometryPolyline`?v(o,c,e.featureSet.features):n===`esriGeometryPolygon`&&v(s,c,e.featureSet.features)}),e.groundOverlays&&e.groundOverlays.forEach(e=>{c.set(e.id,e)}),t.forEach(t=>{t.networkLinkIds.forEach(r=>{let i=b(r,t.id,e.networkLinks);i&&n.push(i)})}),n.forEach(e=>{if(e.featureInfos){e.points=i(r.get(`esriGeometryPoint`)),e.polylines=i(r.get(`esriGeometryPolyline`)),e.polygons=i(r.get(`esriGeometryPolygon`)),e.mapImages=[];for(let t of e.featureInfos)switch(t.type){case`esriGeometryPoint`:case`esriGeometryPolyline`:case`esriGeometryPolygon`:{let n=l[t.type].get(t.id);n&&e[m[t.type]]?.featureSet.features.push(n);break}case`GroundOverlay`:{let n=c.get(t.id);n&&e.mapImages.push(n);break}}e.fullExtent=S([e])}}),{folders:t,sublayers:n,extent:S(n)}}function g(n,i,o,s){let c=t?.findCredential(n);n=a(n,{token:c?.token});let l=e.kmlServiceUrl;return r(l,{query:{url:n,model:`simple`,folders:``,refresh:o!==0||void 0,outSR:JSON.stringify(i)},responseType:`json`,signal:s})}function _(e,t,n=null,r=[]){let i=[],a={},o=t.sublayers,s=new Set(t.folders.map(e=>e.id));return o.forEach(t=>{let o=new e;if(n?o.read(t,n):o.read(t),r.length&&s.has(o.id)&&(o.visible=r.includes(o.id)),a[t.id]=o,t.parentFolderId!=null&&t.parentFolderId!==-1){let e=a[t.parentFolderId];e.sublayers||=[],e.sublayers?.unshift(o)}else i.unshift(o)}),i}function v(e,t,n){n.forEach(n=>{e.set(n.attributes[t],n)})}function y(e,t){let n;return t.some(t=>t.id===e&&(n=t,!0)),n}function b(e,t,n){let r=y(e,n);return r&&(r.parentFolderId=t,r.networkLink=r),r}async function x(e,t,r,i){let a=e[t];if(!a)return[];let o=p.fromJSON(a.featureSet).features,s=a.layerDefinition,c=f(s.drawingInfo.renderer),l=n.fromJSON(a.popupInfo),u=[];for(let e of o)e.symbol=await c.getSymbolAsync(e),e.popupTemplate=l,e.visible=!0,e.origin=r.sublayerById.get(i).origin,u.push(e);return u}function S(e){let t=s(u),n=s(u);for(let r of e){if(r.polygons?.featureSet?.features)for(let e of r.polygons.featureSet.features)d(t,e.geometry),c(n,t);if(r.polylines?.featureSet?.features)for(let e of r.polylines.featureSet.features)d(t,e.geometry),c(n,t);if(r.points?.featureSet?.features)for(let e of r.points.featureSet.features)d(t,e.geometry),c(n,t);if(r.mapImages)for(let e of r.mapImages)d(t,e.extent),c(n,t)}return l(n,u)?void 0:{xmin:n[0],ymin:n[1],zmin:n[2],xmax:n[3],ymax:n[4],zmax:n[5],spatialReference:o.WGS84}}export{S as computeExtent,g as fetchService,x as getGraphics,h as parseKML,_ as sublayersFromJSON};
2
+ import e from"../../config.js";import{id as t}from"../../kernel.js";import n from"../../PopupTemplate.js";import r from"../../request.js";import{clone as i}from"../../core/lang.js";import{addQueryParameters as a}from"../../core/urlUtils.js";import o from"../../geometry/SpatialReference.js";import{create as s,negativeInfinity as c,expandWithAABB as l,equals as u}from"../../geometry/support/aaBoundingBox.js";import{getBoundsXYZ as d}from"../../geometry/support/boundsUtils.js";import{fromJSON as f}from"../../renderers/support/jsonUtils.js";import p from"../../rest/support/FeatureSet.js";const m={esriGeometryPoint:`points`,esriGeometryPolyline:`polylines`,esriGeometryPolygon:`polygons`};function h(e){let t=e.folders||[],n=t.slice(),r=new Map,a=new Map,o=new Map,s=new Map,c=new Map,l={esriGeometryPoint:a,esriGeometryPolyline:o,esriGeometryPolygon:s};return(e.featureCollection?.layers||[]).forEach(e=>{let t=i(e);t.featureSet.features=[];let n=e.featureSet.geometryType;r.set(n,t);let c=e.layerDefinition.objectIdField;n===`esriGeometryPoint`?v(a,c,e.featureSet.features):n===`esriGeometryPolyline`?v(o,c,e.featureSet.features):n===`esriGeometryPolygon`&&v(s,c,e.featureSet.features)}),e.groundOverlays&&e.groundOverlays.forEach(e=>{c.set(e.id,e)}),t.forEach(t=>{t.networkLinkIds.forEach(r=>{let i=b(r,t.id,e.networkLinks);i&&n.push(i)})}),n.forEach(e=>{if(e.featureInfos){e.points=i(r.get(`esriGeometryPoint`)),e.polylines=i(r.get(`esriGeometryPolyline`)),e.polygons=i(r.get(`esriGeometryPolygon`)),e.mapImages=[];for(let t of e.featureInfos)switch(t.type){case`esriGeometryPoint`:case`esriGeometryPolyline`:case`esriGeometryPolygon`:{let n=l[t.type].get(t.id);n&&e[m[t.type]]?.featureSet.features.push(n);break}case`GroundOverlay`:{let n=c.get(t.id);n&&e.mapImages.push(n);break}}e.fullExtent=S([e])}}),{folders:t,sublayers:n,extent:S(n)}}function g(n,i,o,s){let c=t?.findCredential(n);n=a(n,{token:c?.token});let l=e.kmlServiceUrl;return r(l,{query:{url:n,model:`simple`,folders:``,refresh:o!==0||void 0,outSR:JSON.stringify(i)},responseType:`json`,signal:s})}function _(e,t,n=null,r=[]){let i=[],a={},o=t.sublayers,s=new Set(t.folders.map(e=>e.id));return o.forEach(t=>{let o=new e;if(n?o.read(t,n):o.read(t),r.length&&s.has(o.id)&&(o.visible=r.includes(o.id)),a[t.id]=o,t.parentFolderId!=null&&t.parentFolderId!==-1){let e=a[t.parentFolderId];e.sublayers||=[],e.sublayers?.unshift(o)}else i.unshift(o)}),i}function v(e,t,n){n.forEach(n=>{e.set(n.attributes[t],n)})}function y(e,t){let n;return t.some(t=>t.id===e&&(n=t,!0)),n}function b(e,t,n){let r=y(e,n);return r&&(r.parentFolderId=t,r.networkLink=r),r}async function x(e,t,r,i){let a=e[t];if(!a)return[];let o=p.fromJSON(a.featureSet).features,s=a.layerDefinition,c=f(s.drawingInfo.renderer),l=n.fromJSON(a.popupInfo),u=[];for(let e of o)e.symbol=await c.getSymbolAsync(e),e.popupTemplate=l,e.visible=!0,e.origin=r.sublayerById.get(i).origin,u.push(e);return u}function S(e){let t=s(c),n=s(c);for(let r of e){if(r.polygons?.featureSet?.features)for(let e of r.polygons.featureSet.features)d(t,e.geometry),l(n,t);if(r.polylines?.featureSet?.features)for(let e of r.polylines.featureSet.features)d(t,e.geometry),l(n,t);if(r.points?.featureSet?.features)for(let e of r.points.featureSet.features)d(t,e.geometry),l(n,t);if(r.mapImages)for(let e of r.mapImages)d(t,e.extent),l(n,t)}return u(n,c)?void 0:{xmin:n[0],ymin:n[1],zmin:n[2],xmax:n[3],ymax:n[4],zmax:n[5],spatialReference:o.WGS84}}export{S as computeExtent,g as fetchService,x as getGraphics,h as parseKML,_ as sublayersFromJSON};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.2.0-next.156",
3
+ "version": "5.2.0-next.157",
4
4
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
5
5
  "keywords": [
6
6
  "ArcGIS",
@@ -20,7 +20,7 @@
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
22
  "@amcharts/amcharts5": "~5.20.8",
23
- "@arcgis/toolkit": "5.2.0-next.156",
23
+ "@arcgis/toolkit": "5.2.0-next.157",
24
24
  "@esri/arcgis-html-sanitizer": "~4.2.0-next.2",
25
25
  "@esri/calcite-components": "^5.2.0-next.89",
26
26
  "@vaadin/grid": "~25.3.2",
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getDataValues as e,quantizeFeatures as t,calculateHeatmapStats as n}from"./utils.js";import{calculateClassBreaks as r,resolveCBResult as i,calculateHistogram as a,isNullCountSupported as o,calculateStringStatistics as s,calculateStatistics as c,processSummaryStatisticsResult as l,calculateUniqueValuesCount as u,createUVResult as d}from"../../../statistics/utils.js";async function f(t){let{attribute:n,features:r}=t,{normalizationType:i,normalizationField:a,minValue:u,maxValue:d,fieldType:f,outStatisticTypes:p}=n,m=await e({field:n.field,valueExpression:n.valueExpression,normalizationType:i,normalizationField:a,normalizationTotal:n.normalizationTotal,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r),h=o({normalizationType:i,normalizationField:a,minValue:u,maxValue:d}),g={value:.5,fieldType:f},_=f===`esriFieldTypeString`?s({values:m,supportsNullCount:h,percentileParams:g,outStatisticTypes:p}):c({values:m,minValue:u,maxValue:d,useSampleStdDev:!i,supportsNullCount:h,percentileParams:g,outStatisticTypes:p});return l(_,p,f===`esriFieldTypeDate`)}async function p(t){let{attribute:n,features:r}=t,i=await e({field:n.field,field2:n.field2,field3:n.field3,fieldDelimiter:n.fieldDelimiter,valueExpression:n.valueExpression,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r,!1),a=u(i);return d(a,n.domains,n.returnAllCodedValues,n.fieldDelimiter)}async function m(t){let{attribute:n,features:a}=t,{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,classificationMethod:u}=n,d=await e({field:o,valueExpression:n.valueExpression,normalizationType:s,normalizationField:c,normalizationTotal:l,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},a),f=r(d,{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,classificationMethod:u,standardDeviationInterval:n.standardDeviationInterval,numClasses:n.numClasses,minValue:n.minValue,maxValue:n.maxValue});return i(f,u)}async function h(t){let{attribute:n,features:r}=t,{field:i,normalizationType:o,normalizationField:s,normalizationTotal:c,classificationMethod:l}=n,u=await e({field:i,valueExpression:n.valueExpression,sqlExpression:n.sqlExpression,normalizationType:o,normalizationField:s,normalizationTotal:c,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r);return a(u,{field:i,normalizationType:o,normalizationField:s,normalizationTotal:c,classificationMethod:l,standardDeviationInterval:n.standardDeviationInterval,numBins:n.numBins,minValue:n.minValue,maxValue:n.maxValue})}async function g(e){let{attribute:r,features:i}=e,{field:a,radius:o,transform:s,spatialReference:c}=r,l=r.size??[0,0],u=t(i??[],s,c,l);return n(u,o??void 0,a,l[0],l[1])}export{m as classBreaks,g as heatmapStatistics,h as histogram,f as summaryStatistics,p as uniqueValues};
2
+ import{getDataValues as e,quantizeFeatures as t,calculateHeatmapStats as n}from"./utils.js";import{calculateClassBreaks as r,resolveCBResult as i,calculateHistogram as a,calculateStringStatistics as o,calculateStatistics as s,processSummaryStatisticsResult as c,calculateUniqueValuesCount as l,createUVResult as u,isNullCountSupported as d}from"../../../statistics/utils.js";async function f(t){let{attribute:n,features:r}=t,{normalizationType:i,normalizationField:a,minValue:l,maxValue:u,fieldType:f,outStatisticTypes:p}=n,m=await e({field:n.field,valueExpression:n.valueExpression,normalizationType:i,normalizationField:a,normalizationTotal:n.normalizationTotal,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r),h=d({normalizationType:i,normalizationField:a,minValue:l,maxValue:u}),g={value:.5,fieldType:f},_=f===`esriFieldTypeString`?o({values:m,supportsNullCount:h,percentileParams:g,outStatisticTypes:p}):s({values:m,minValue:l,maxValue:u,useSampleStdDev:!i,supportsNullCount:h,percentileParams:g,outStatisticTypes:p});return c(_,p,f===`esriFieldTypeDate`)}async function p(t){let{attribute:n,features:r}=t,i=await e({field:n.field,field2:n.field2,field3:n.field3,fieldDelimiter:n.fieldDelimiter,valueExpression:n.valueExpression,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r,!1),a=l(i);return u(a,n.domains,n.returnAllCodedValues,n.fieldDelimiter)}async function m(t){let{attribute:n,features:a}=t,{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,classificationMethod:u}=n,d=await e({field:o,valueExpression:n.valueExpression,normalizationType:s,normalizationField:c,normalizationTotal:l,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},a),f=r(d,{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,classificationMethod:u,standardDeviationInterval:n.standardDeviationInterval,numClasses:n.numClasses,minValue:n.minValue,maxValue:n.maxValue});return i(f,u)}async function h(t){let{attribute:n,features:r}=t,{field:i,normalizationType:o,normalizationField:s,normalizationTotal:c,classificationMethod:l}=n,u=await e({field:i,valueExpression:n.valueExpression,sqlExpression:n.sqlExpression,normalizationType:o,normalizationField:s,normalizationTotal:c,viewInfoParams:n.viewInfoParams,timeZone:n.timeZone,fieldInfos:n.fieldInfos},r);return a(u,{field:i,normalizationType:o,normalizationField:s,normalizationTotal:c,classificationMethod:l,standardDeviationInterval:n.standardDeviationInterval,numBins:n.numBins,minValue:n.minValue,maxValue:n.maxValue})}async function g(e){let{attribute:r,features:i}=e,{field:a,radius:o,transform:s,spatialReference:c}=r,l=r.size??[0,0],u=t(i??[],s,c,l);return n(u,o??void 0,a,l[0],l[1])}export{m as classBreaks,g as heatmapStatistics,h as histogram,f as summaryStatistics,p as uniqueValues};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{pickRandom as n}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{isHostedAgolService as s}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as c,isNumericField as l}from"../../../layers/support/fieldUtils.js";import{generateRenderer as u}from"../../../rest/generateRenderer.js";import d from"../../../rest/support/GenerateRendererParameters.js";import f from"../../../rest/support/PivotQuery.js";import p from"../../../rest/support/StatisticDefinition.js";import m from"../../../rest/support/UniqueValueDefinition.js";import h from"../../../rest/support/UnPivotDefinition.js";import{getArcadeForPredominantCategory as g,getSQLForPredominantCategoryName as _}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as v,getRangeExpr as y,getSQLFilterForNormalization as b}from"../../statistics/support/utils.js";import{WorkerClient as x}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as S,isIntegerField as C,castIntegerFieldToFloat as w,fieldDelimiter as T}from"../utils.js";import E from"./InMemoryLayerAdapter.js";import{getQueryParamsForExpr as ee,getDataRange as D,getAttributeBinsQuery as O,processQueryAttributeBinsResult as k,binParamsFromGenRend as A}from"./support/histogramUtils.js";import{ensureFeaturesJSON as j,getSummaryStatsQuery as M,getSummaryStatisticsFromFeatureSet as N,getSummaryStatsQueryForFields as P,getSummaryStatsPivotQuery as F,getUVQuery as I,getUniqueValuesFromFeatureSet as L,defaultNumBins as R,updateQueryWithFeatureFilter as z,getHistogramFromFeatureSet as B,getFieldExpr as V,getDomainsForFields as H,getBins as U,getPredominantCategoriesFromUVInfos as W,getMissingFields as G}from"./support/utils.js";import{processSummaryStatisticsResult as K,createUVResult as q,getEqualIntervalBins as J,createClassBreaksDefinition as Y,resolveCBResult as X}from"../../../statistics/utils.js";import{getScaleToResolutionFactor as te}from"../../../views/2d/viewpointUtils.js";const Z=2e4;let Q=class extends E{constructor(){super(...arguments),this.adapterName=`feature-layer-adapter`}_isStatsSupportedOnService(){let e=this.layer;if(!e.capabilities?.query?.supportsStatistics||this.geometryType===`multipatch`&&!s(e.url)&&e.version<10.5)throw new r(`${this.adapterName}:not-supported`,`Layer does not support statistics query`);return Promise.resolve()}_fetchFeaturesFromService(e,t){return this.layer.queryFeatures(e,{signal:t}).then(e=>e.features)}_fetchFeaturesJSONFromService(e,t){return this._fetchFeaturesFromService(e,t).then(j)}_summaryStatsFromGenRend(e){let t=e.normalizationType,n=e.normalizationField;return this.classBreaks({field:e.field,numClasses:5,classificationMethod:`standard-deviation`,standardDeviationInterval:.25,normalizationType:t,normalizationField:t===`field`?n:void 0,minValue:e.minValue,maxValue:e.maxValue,filter:e.filter,signal:e.signal}).then(t=>{let n,r,i;if(t.classBreakInfos?.some(e=>(e.hasAvg&&(n=e),!!n)),n){let e=n.maxValue-n.minValue;r=n.minValue+e/2,i=e*4}let a={min:t.minValue,max:t.maxValue,avg:r,stddev:i};return K(a,e.outStatisticTypes)})}async _summaryStatsFromServiceQuery(e,t){await this._isStatsSupportedOnService(),e.normalizationType===`percent-of-total`&&(e.normalizationTotal=await this._getNormalizationTotal(e.field,e.normalizationType,e.filter));let n=S(t)||c(t),r=(`capabilities`in this.layer?this.layer.capabilities:null)?.query?.supportsPercentileStatistics??!1,i=M(this,e,t,r),a=await this.layer.queryFeatures(i,{signal:e.signal}),o=N(a,n);return K(o,e.outStatisticTypes)}async _summaryStatsForFieldsBasic(e){let{outStatisticTypes:t,fields:n}=e,r=[];for(let t=0;t<n.length;t+=50){let i=n.slice(t,t+50),a=P(this,e,i);r.push(this.layer.queryFeatures(a,{signal:e.signal}))}let i=(await Promise.all(r)).flatMap(e=>e.features).map(e=>e.attributes).reduce((e,t)=>Object.assign(e,t),{}),a={};for(let e in i){let t=e.match(/^(\w+)_value_/);if(i[e]!=null&&t)switch(t[1]){case`min`:a.min=a.min==null?i[e]:Math.min(a.min,i[e]);break;case`max`:a.max=a.max==null?i[e]:Math.max(a.max,i[e]);break;case`sum`:a.sum=(a.sum||0)+i[e];break;case`count`:a.count=(a.count||0)+i[e]}}return K(a,t)}async _summaryStatsForFieldsAdvanced(e,t){let{outStatisticTypes:n,fields:r}=e,i=n?.exclude?.includes(`variance`)||n?.include&&!n.include.includes(`variance`),a=n?.exclude?.includes(`stddev`)||n?.include&&!n.include.includes(`stddev`);if(t.sum==null||!t.count||i&&a)return t;t.avg=t.sum/t.count;let o=[];for(let n=0;n<r.length;n+=50){let i=r.slice(n,n+50),a=P(this,e,i);a.outStatistics=[];for(let e of i){let n=`sumOfSquares_${e}`,r=`(power(${C(this.layer,e)?w(e):e} - ${t.avg}, 2))`,i=new p({statisticType:`sum`,onStatisticField:r,outStatisticFieldName:n});a.outStatistics.push(i)}o.push(this.layer.queryFeatures(a,{signal:e.signal}))}return t.variance=(await Promise.all(o)).reduce((e,t)=>e+Object.values(t.features[0].attributes).reduce((e,t)=>e+t,0),0)/(t.count-1),t.stddev=Math.sqrt(t.variance),K(t,n)}async _summaryStatsForFields(e){let t=await this._summaryStatsForFieldsBasic(e);return this._summaryStatsForFieldsAdvanced(e,t)}async _summaryStatsUsingQueryPivot(e){await this._isStatsSupportedOnService();let t=(`capabilities`in this.layer?this.layer.capabilities:null)?.query?.supportsPercentileStatistics??!1,n=F(this,e,t),r=await this.layer.queryPivot(n,{signal:e.signal}),i=N(r,!1);return K(i,e.outStatisticTypes)}_uvFromGenRenderer(e,t){let n=e.field??void 0,r=new m({attributeField:n}),i=new d({classificationDefinition:r});return this.generateRenderer(i,e.signal).then(e=>{let t={},r=this.getField(n);return e.uniqueValues.forEach(e=>{let n=e.value;(n==null||n===``||typeof n==`string`&&(n.trim()===``||n.toLowerCase()===`<null>`))&&(n=null),t[n]==null?t[n]={count:e.count,data:l(r)&&n?Number(n):n}:t[n].count=t[n].count+e.count}),{count:t}}).then(n=>q(n,[t],e.returnAllCodedValues))}async _uvFromServiceQuery(e,t){return this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(I(this,e),{signal:e.signal})).then(t=>L(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:T,view:e.view,signal:e.signal})).then(n=>q(n,t,e.returnAllCodedValues,T))}_getNormalizationTotal(e,t,n,r){return e&&t===`percent-of-total`?this.summaryStatistics({field:e,outStatisticTypes:{include:[`sum`]},filter:n,signal:r}).then(e=>e.sum):Promise.resolve(null)}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then(t=>{let n=ee(e,this,t);return D(n,this,e.minValue,e.maxValue).then(r=>{let i=r.min,a=r.max;if(i==null||a==null)return{bins:[],minValue:i,maxValue:a,normalizationTotal:t};let o=e.numBins||R,s=J(i,a,o),c=$(n.sqlExpression,s,e.minValue!=null&&e.maxValue!=null),l=new p({statisticType:`count`,outStatisticFieldName:`countOFExpr`,onStatisticField:`1`}),u=this.layer.createQuery();return u.where=v(u.where,n.sqlWhere),u.sqlFormat=`standard`,u.outStatistics=[l],u.groupByFieldsForStatistics=[c],u.orderByFields=[c],z(u,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(u,{signal:n.signal})).then(e=>B(e,i,a,o,t))})})}async _histogramForFields(e){let{min:t,max:n}=await D({fields:e.fields,sqlWhere:e.sqlWhere,filter:e.filter,signal:e.signal},this,e.minValue,e.maxValue);if(t==null||n==null)return{bins:[],minValue:t,maxValue:n};let r=`newField`,i=e.numBins||R,a=$(r,J(t,n,i),e.minValue!=null&&e.maxValue!=null),o=new p({statisticType:`count`,outStatisticFieldName:`countOFExpr`,onStatisticField:r}),s=new f,{where:c,timeExtent:l}=this.createQuery();return s.where=v(c,e.sqlWhere),s.outPivots=[new h({sourceFields:e.fields,valueFieldName:r})],s.outStatistics=[o],s.groupByFieldsForStatistics=[a],s.orderByFields=[a],s.timeExtent=l,z(s,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryPivot(s,{signal:e.signal})).then(e=>B(e,t,n,i))}async _histogramFromQueryAttributeBins(e){let{field:t,normalizationType:n,filter:r,signal:i}=e,a=await this._getNormalizationTotal(t,n,r,i),{query:o,min:s,max:c}=await O(e,this,a,this.createQuery());if(!o)return{bins:[],minValue:s,maxValue:c,normalizationTotal:a};let l=await this.layer.queryAttributeBins(o,{signal:i});return k(l,t?this.getField(t):null,{minValue:s,maxValue:c,normalizationTotal:a})}_classBreaksFromGenRend(e){let{field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,signal:a}=e,o=b({field:t,normalizationType:n,normalizationField:r}),s=V({field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,layer:this}),c=y(s,e.minValue,e.maxValue),l=Y({field:t,normalizationType:n,normalizationField:r,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||5}),u=new d({classificationDefinition:l});return u.where=v(o,c),this.generateRenderer(u,a).then(t=>X(t,e.classificationMethod))}async summaryStatistics(e){let{field:t,fields:n,normalizationType:a,valueExpression:o,sqlExpression:s,view:l,features:u,useFeaturesInView:d}=e,f=t?this.getField(t):null,p=S(f)||c(f),m=o&&!(s&&this.supportsSQLExpression),h=this._hasLocalSource||u||d,g=l?.type===`3d`;if(n?.length){let t={...e,fields:n};if(!this.layer.capabilities?.operations?.supportsQueryPivot)return await this._summaryStatsForFields(t);try{return await this._summaryStatsUsingQueryPivot(t)}catch{return await this._summaryStatsForFields(t)}}if(h||m)return m||u||d||g||this._hasLocalSource&&!this.layer.capabilities.query.supportsStatistics?this._summaryStatsFromMemory(e,f):this._summaryStatsFromClientQuery(e,f);if(!this.supportsSQLExpression&&(p||s||a===`natural-log`||a===`square-root`))throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return(a&&!this.supportsSQLExpression?this._summaryStatsFromGenRend(e):this._summaryStatsFromServiceQuery(e,f)).catch(()=>(i(e.signal),this._summaryStatsFromMemory(e,f)))}async uniqueValues(e){let{valueExpression:t,sqlExpression:n,features:r,useFeaturesInView:a,signal:o}=e,s=t&&!(n&&this.supportsSQLExpression),c=this._hasLocalSource||r||a||s,l=e.view?.type===`3d`,u=await H(e,this);return c?s||r||a||l||this._hasLocalSource&&!this.layer.capabilities.query.supportsStatistics?this._uvFromMemory(e,u):this._uvFromClientQuery(e,u):this._uvFromServiceQuery(e,u).catch(t=>(i(o),e.field&&!e.field2&&!e.field3&&!e.filter?this._uvFromGenRenderer(e,u[0]):t)).catch(()=>(i(o),l?this._uvFromMemory(e,u):this._uvFromClientQuery(e,u)))}async histogram(e){let{field:t,normalizationType:n,normalizationField:a,classificationMethod:o,view:s,filter:l,signal:u}=e,d=t?this.getField(t):null,f=S(d)||c(d),p=e.valueExpression||e.sqlExpression,m=e.valueExpression&&!(e.sqlExpression&&this.supportsSQLExpression),h=this._hasLocalSource||e.features||e.useFeaturesInView||m,g=this.supportsSQLExpression,_=!o||o===`equal-interval`,v=e.minValue,b=e.maxValue,x=v!=null&&b!=null,C=e.numBins||R;if(e.fields?.length){if(!g)throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);if(!this.layer.capabilities?.operations?.supportsQueryPivot)throw new r(`${this.adapterName}:not-supported`,`Layer does not support pivot queries`);return this._histogramForFields(e)}if(this.layer.capabilities?.operations?.supportsQueryBins&&e.useQueryAttributeBins&&!m){if(h)return this._histogramFromQueryAttributeBinsFromMemory(e);try{return await this._histogramFromQueryAttributeBins(e)}catch{return i(u),this._histogramFromQueryAttributeBinsFromMemory(e)}}if(e.returnAggregateIds)throw new r(`${this.adapterName}:not-supported`,`returnAggregateIds option is only supported with queryAttributeBins`);if(h)return this._histogramFromMemory(e);if((p||g)&&_){if(!g&&(p||n===`natural-log`||n===`square-root`))throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);if(this.layer.capabilities.query.supportsOrderBy)return this._histogramForExpr(e)}if(f&&_)throw new r(`${this.adapterName}:not-supported`,`Normalization and date field are not allowed when layer does not support standardized SQL expression for queries`);return n||!_?A(e,this).then(i=>{if(!x)return U(this,i,t,C,s,l,u);if(v>i.max||b<i.min)throw new r(`${this.adapterName}:insufficient-data`,`Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field`);if(_)return U(this,{min:v,max:b,sqlExpr:i.sqlExpr,excludeZerosExpr:i.excludeZerosExpr},t,C,s,l,u);{let r={field:t,normalizationType:n,normalizationField:a,normalizationTotal:i.normTotal,layer:this},o=V(r),c=y(o,v,b);return A(e,this,c).then(e=>U(this,e,t,C,s,l,u))}}):this._histogramForField(e)}async classBreaks(e){let t=e.analyzeData!==!1,n=this._hasLocalSource||e.features||e.useFeaturesInView||e.valueExpression||e.filter;return t&&n?this._classBreaksFromMemory(e):(t?this._classBreaksFromGenRend(e):this._classBreaksFromInterpolation(e)).catch(()=>(i(e.signal),this._classBreaksFromMemory(e)))}async queryFeatureCount(e){if(this._hasLocalSource)throw new r(`${this.adapterName}:not-supported`,`Layer does not support count query`);let t=this.layer,n=t.createQuery();return n.where=v(n.where,e.whereClause),z(n,e.filter),t.queryFeatureCount(n,{signal:e.signal})}async generateRenderer(e,t){let n=this.layer;if(this._hasLocalSource||n.version<10.1)throw new r(`${this.adapterName}:not-supported`,`Layer does not support generateRenderer operation (requires ArcGIS Server version 10.1+)`);let i=n.createQuery();return e.where=v(e.where,i.where),u(n.parsedUrl?.path??``,{source:n.dynamicDataSource??void 0,gdbVersion:n.gdbVersion??void 0},e,{signal:t})}async predominantCategories(e){if(!this._hasLocalSource&&!this.supportsSQLExpression)throw new r(`${this.adapterName}:not-supported`,`Layer does not support advanced SQL expressions and standardized queries`);let{fields:t,view:n,signal:i,filter:a}=e,o=g(t),s=_(t),c=n&&this._hasLocalSource?await this._uvFromMemory({valueExpression:o,view:n,signal:i,filter:a}):await this._uvFromServiceQuery({sqlExpression:s.expression,valueExpression:o,signal:i,filter:a});return W(c.uniqueValueInfos,t)}async getSampleFeatures(e,r){let{view:a,requiredFields:o,returnGeometry:s,sqlWhere:c,filter:l,signal:u}=e,d=e.sampleSize;if(d==null||d===0)return[];let f=this.layer.createQuery(),p=r===`json`;f.outSpatialReference=a?.spatialReference,f.returnGeometry=!!s,f.outFields=o,f.where=v(f.where,c),z(f,l);let m=[],h=!1;if(a)try{let i=await a.whenLayerView(this.layer);if(h=!G(this,o,i).length,h){if(d>=1&&!e.filter&&`getSampleFeatures`in i){await this._waitForLayerViewUpdate(i);let e=await i.getSampleFeatures({minFeatureCount:d,sampleSize:d});if(e!=null)return p?e:e.map(e=>t.fromJSON(e))}if(m=await this._fetchFeaturesFromMemory(i,f,u,r),m.length>=d&&d>0)return n(m,d,1)}}catch{i(u)}try{if(this._hasLocalSource)return h?m:p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u);let t=await this.queryFeatureCount({view:a,filter:l,signal:u}),r=this.layer.capabilities.query.maxRecordCount,i=d===-1?t:d;if(i=r&&i>r?r:i,t<=m.length||m.length>=r)return m;if(f.maxAllowableOffset=e.resolution||(a?a.extent.width/a.width/a.scale:te(this.layer.spatialReference))*4e5,t<=i)return p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u);if(t<=Z){let e=this.layer.createQuery();z(e,l);let t=await this.layer.queryObjectIds();return f.objectIds=n(t,i,1),p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u)}return this.layer.capabilities?.query?.supportsPagination&&(f.num=Math.min(i,Z)),p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u)}catch{return i(u),m}}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this._hasLocalSource=t.type!==`parquet`&&!t.url&&!!t.source,this.hasQueryEngine=this._hasLocalSource,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=x.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([a({readOnly:!0})],Q.prototype,`adapterName`,void 0),e([a({constructOnly:!0})],Q.prototype,`layer`,void 0),Q=e([o(`esri.smartMapping.support.adapters.FeatureLayerAdapter`)],Q);function $(e,t,n){let r=[],i=t.length;return t.forEach((t,a)=>{let[o,s]=t,c=null;c=a===0&&!n?`${e} < ${s}`:a===i-1&&!n?`${e} >= ${o}`:v(`${e} >= ${o}`,`${e} ${a===i-1?` <= `:` < `} ${s}`),r.push(`WHEN (`+c+`) THEN `+(a+1))}),[`CASE`,r.join(` `),`ELSE 0`,`END`].join(` `)}export{Q as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{pickRandom as n}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{isHostedAgolService as s}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as c,isNumericField as l}from"../../../layers/support/fieldUtils.js";import{generateRenderer as u}from"../../../rest/generateRenderer.js";import d from"../../../rest/support/GenerateRendererParameters.js";import f from"../../../rest/support/PivotQuery.js";import p from"../../../rest/support/StatisticDefinition.js";import m from"../../../rest/support/UniqueValueDefinition.js";import h from"../../../rest/support/UnPivotDefinition.js";import{getArcadeForPredominantCategory as g,getSQLForPredominantCategoryName as _}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as v,getRangeExpr as y,getSQLFilterForNormalization as b}from"../../statistics/support/utils.js";import{WorkerClient as x}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as S,isIntegerField as C,castIntegerFieldToFloat as w,fieldDelimiter as T}from"../utils.js";import E from"./InMemoryLayerAdapter.js";import{getQueryParamsForExpr as ee,getDataRange as D,getAttributeBinsQuery as O,processQueryAttributeBinsResult as k,binParamsFromGenRend as A}from"./support/histogramUtils.js";import{ensureFeaturesJSON as j,getSummaryStatsQuery as M,getSummaryStatisticsFromFeatureSet as N,getSummaryStatsQueryForFields as P,getSummaryStatsPivotQuery as F,getUVQuery as I,getUniqueValuesFromFeatureSet as L,defaultNumBins as R,updateQueryWithFeatureFilter as z,getHistogramFromFeatureSet as B,getFieldExpr as V,getDomainsForFields as H,getBins as U,getPredominantCategoriesFromUVInfos as W,getMissingFields as G}from"./support/utils.js";import{processSummaryStatisticsResult as K,createUVResult as q,getEqualIntervalBins as J,createClassBreaksDefinition as Y,resolveCBResult as X}from"../../../statistics/utils.js";import{getScaleToResolutionFactor as te}from"../../../views/2d/viewpointUtils.js";const Z=2e4;let Q=class extends E{constructor(){super(...arguments),this.adapterName=`feature-layer-adapter`}_isStatsSupportedOnService(){let e=this.layer;if(!e.capabilities?.query?.supportsStatistics||this.geometryType===`multipatch`&&!s(e.url)&&e.version<10.5)throw new r(`${this.adapterName}:not-supported`,`Layer does not support statistics query`);return Promise.resolve()}_fetchFeaturesFromService(e,t){return this.layer.queryFeatures(e,{signal:t}).then(e=>e.features)}_fetchFeaturesJSONFromService(e,t){return this._fetchFeaturesFromService(e,t).then(j)}_summaryStatsFromGenRend(e){let t=e.normalizationType,n=e.normalizationField;return this.classBreaks({field:e.field,numClasses:5,classificationMethod:`standard-deviation`,standardDeviationInterval:.25,normalizationType:t,normalizationField:t===`field`?n:void 0,minValue:e.minValue,maxValue:e.maxValue,filter:e.filter,signal:e.signal}).then(t=>{let n,r,i;if(t.classBreakInfos?.some(e=>(e.hasAvg&&(n=e),!!n)),n){let e=n.maxValue-n.minValue;r=n.minValue+e/2,i=e*4}let a={min:t.minValue,max:t.maxValue,avg:r,stddev:i};return K(a,e.outStatisticTypes)})}async _summaryStatsFromServiceQuery(e,t){await this._isStatsSupportedOnService(),e.normalizationType===`percent-of-total`&&(e.normalizationTotal=await this._getNormalizationTotal(e.field,e.normalizationType,e.filter));let n=S(t)||c(t),r=(`capabilities`in this.layer?this.layer.capabilities:null)?.query?.supportsPercentileStatistics??!1,i=M(this,e,t,r),a=await this.layer.queryFeatures(i,{signal:e.signal}),o=N(a,n);return K(o,e.outStatisticTypes)}async _summaryStatsForFieldsBasic(e){let{outStatisticTypes:t,fields:n}=e,r=[];for(let t=0;t<n.length;t+=50){let i=n.slice(t,t+50),a=P(this,e,i);r.push(this.layer.queryFeatures(a,{signal:e.signal}))}let i=(await Promise.all(r)).flatMap(e=>e.features).map(e=>e.attributes).reduce((e,t)=>Object.assign(e,t),{}),a={};for(let e in i){let t=e.match(/^(\w+)_value_/);if(i[e]!=null&&t)switch(t[1]){case`min`:a.min=a.min==null?i[e]:Math.min(a.min,i[e]);break;case`max`:a.max=a.max==null?i[e]:Math.max(a.max,i[e]);break;case`sum`:a.sum=(a.sum||0)+i[e];break;case`count`:a.count=(a.count||0)+i[e]}}return K(a,t)}async _summaryStatsForFieldsAdvanced(e,t){let{outStatisticTypes:n,fields:r}=e,i=n?.exclude?.includes(`variance`)||n?.include&&!n.include.includes(`variance`),a=n?.exclude?.includes(`stddev`)||n?.include&&!n.include.includes(`stddev`);if(t.sum==null||!t.count||i&&a)return t;t.avg=t.sum/t.count;let o=[];for(let n=0;n<r.length;n+=50){let i=r.slice(n,n+50),a=P(this,e,i);a.outStatistics=[];for(let e of i){let n=`sumOfSquares_${e}`,r=`(power(${C(this.layer,e)?w(e):e} - ${t.avg}, 2))`,i=new p({statisticType:`sum`,onStatisticField:r,outStatisticFieldName:n});a.outStatistics.push(i)}o.push(this.layer.queryFeatures(a,{signal:e.signal}))}return t.variance=(await Promise.all(o)).reduce((e,t)=>e+Object.values(t.features[0].attributes).reduce((e,t)=>e+t,0),0)/(t.count-1),t.stddev=Math.sqrt(t.variance),K(t,n)}async _summaryStatsForFields(e){let t=await this._summaryStatsForFieldsBasic(e);return this._summaryStatsForFieldsAdvanced(e,t)}async _summaryStatsUsingQueryPivot(e){await this._isStatsSupportedOnService();let t=(`capabilities`in this.layer?this.layer.capabilities:null)?.query?.supportsPercentileStatistics??!1,n=F(this,e,t),r=await this.layer.queryPivot(n,{signal:e.signal}),i=N(r,!1);return K(i,e.outStatisticTypes)}_uvFromGenRenderer(e,t){let n=e.field??void 0,r=new m({attributeField:n}),i=new d({classificationDefinition:r});return this.generateRenderer(i,e.signal).then(e=>{let t={},r=this.getField(n);return e.uniqueValues.forEach(e=>{let n=e.value;(n==null||n===``||typeof n==`string`&&(n.trim()===``||n.toLowerCase()===`<null>`))&&(n=null),t[n]==null?t[n]={count:e.count,data:l(r)&&n?Number(n):n}:t[n].count=t[n].count+e.count}),{count:t}}).then(n=>q(n,[t],e.returnAllCodedValues))}async _uvFromServiceQuery(e,t){return this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(I(this,e),{signal:e.signal})).then(t=>L(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:T,filter:e.filter,view:e.view,signal:e.signal})).then(n=>q(n,t,e.returnAllCodedValues,T))}_getNormalizationTotal(e,t,n,r){return e&&t===`percent-of-total`?this.summaryStatistics({field:e,outStatisticTypes:{include:[`sum`]},filter:n,signal:r}).then(e=>e.sum):Promise.resolve(null)}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then(t=>{let n=ee(e,this,t);return D(n,this,e.minValue,e.maxValue).then(r=>{let i=r.min,a=r.max;if(i==null||a==null)return{bins:[],minValue:i,maxValue:a,normalizationTotal:t};let o=e.numBins||R,s=J(i,a,o),c=$(n.sqlExpression,s,e.minValue!=null&&e.maxValue!=null),l=new p({statisticType:`count`,outStatisticFieldName:`countOFExpr`,onStatisticField:`1`}),u=this.layer.createQuery();return u.where=v(u.where,n.sqlWhere),u.sqlFormat=`standard`,u.outStatistics=[l],u.groupByFieldsForStatistics=[c],u.orderByFields=[c],z(u,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(u,{signal:n.signal})).then(e=>B(e,i,a,o,t))})})}async _histogramForFields(e){let{min:t,max:n}=await D({fields:e.fields,sqlWhere:e.sqlWhere,filter:e.filter,signal:e.signal},this,e.minValue,e.maxValue);if(t==null||n==null)return{bins:[],minValue:t,maxValue:n};let r=`newField`,i=e.numBins||R,a=$(r,J(t,n,i),e.minValue!=null&&e.maxValue!=null),o=new p({statisticType:`count`,outStatisticFieldName:`countOFExpr`,onStatisticField:r}),s=new f,{where:c,timeExtent:l}=this.createQuery();return s.where=v(c,e.sqlWhere),s.outPivots=[new h({sourceFields:e.fields,valueFieldName:r})],s.outStatistics=[o],s.groupByFieldsForStatistics=[a],s.orderByFields=[a],s.timeExtent=l,z(s,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryPivot(s,{signal:e.signal})).then(e=>B(e,t,n,i))}async _histogramFromQueryAttributeBins(e){let{field:t,normalizationType:n,filter:r,signal:i}=e,a=await this._getNormalizationTotal(t,n,r,i),{query:o,min:s,max:c}=await O(e,this,a,this.createQuery());if(!o)return{bins:[],minValue:s,maxValue:c,normalizationTotal:a};let l=await this.layer.queryAttributeBins(o,{signal:i});return k(l,t?this.getField(t):null,{minValue:s,maxValue:c,normalizationTotal:a})}_classBreaksFromGenRend(e){let{field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,signal:a}=e,o=b({field:t,normalizationType:n,normalizationField:r}),s=V({field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,layer:this}),c=y(s,e.minValue,e.maxValue),l=Y({field:t,normalizationType:n,normalizationField:r,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||5}),u=new d({classificationDefinition:l});return u.where=v(o,c),this.generateRenderer(u,a).then(t=>X(t,e.classificationMethod))}async summaryStatistics(e){let{field:t,fields:n,normalizationType:a,valueExpression:o,sqlExpression:s,view:l,features:u,useFeaturesInView:d}=e,f=t?this.getField(t):null,p=S(f)||c(f),m=o&&!(s&&this.supportsSQLExpression),h=this._hasLocalSource||u||d,g=l?.type===`3d`;if(n?.length){let t={...e,fields:n};if(!this.layer.capabilities?.operations?.supportsQueryPivot)return await this._summaryStatsForFields(t);try{return await this._summaryStatsUsingQueryPivot(t)}catch{return await this._summaryStatsForFields(t)}}if(h||m)return m||u||d||g||this._hasLocalSource&&!this.layer.capabilities.query.supportsStatistics?this._summaryStatsFromMemory(e,f):this._summaryStatsFromClientQuery(e,f);if(!this.supportsSQLExpression&&(p||s||a===`natural-log`||a===`square-root`))throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return(a&&!this.supportsSQLExpression?this._summaryStatsFromGenRend(e):this._summaryStatsFromServiceQuery(e,f)).catch(()=>(i(e.signal),this._summaryStatsFromMemory(e,f)))}async uniqueValues(e){let{valueExpression:t,sqlExpression:n,features:r,useFeaturesInView:a,signal:o}=e,s=t&&!(n&&this.supportsSQLExpression),c=this._hasLocalSource||r||a||s,l=e.view?.type===`3d`,u=await H(e,this);return c?s||r||a||l||this._hasLocalSource&&!this.layer.capabilities.query.supportsStatistics?this._uvFromMemory(e,u):this._uvFromClientQuery(e,u):this._uvFromServiceQuery(e,u).catch(t=>(i(o),e.field&&!e.field2&&!e.field3&&!e.filter?this._uvFromGenRenderer(e,u[0]):t)).catch(()=>(i(o),l?this._uvFromMemory(e,u):this._uvFromClientQuery(e,u)))}async histogram(e){let{field:t,normalizationType:n,normalizationField:a,classificationMethod:o,view:s,filter:l,signal:u}=e,d=t?this.getField(t):null,f=S(d)||c(d),p=e.valueExpression||e.sqlExpression,m=e.valueExpression&&!(e.sqlExpression&&this.supportsSQLExpression),h=this._hasLocalSource||e.features||e.useFeaturesInView||m,g=this.supportsSQLExpression,_=!o||o===`equal-interval`,v=e.minValue,b=e.maxValue,x=v!=null&&b!=null,C=e.numBins||R;if(e.fields?.length){if(!g)throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);if(!this.layer.capabilities?.operations?.supportsQueryPivot)throw new r(`${this.adapterName}:not-supported`,`Layer does not support pivot queries`);return this._histogramForFields(e)}if(this.layer.capabilities?.operations?.supportsQueryBins&&e.useQueryAttributeBins&&!m){if(h)return this._histogramFromQueryAttributeBinsFromMemory(e);try{return await this._histogramFromQueryAttributeBins(e)}catch{return i(u),this._histogramFromQueryAttributeBinsFromMemory(e)}}if(e.returnAggregateIds)throw new r(`${this.adapterName}:not-supported`,`returnAggregateIds option is only supported with queryAttributeBins`);if(h)return this._histogramFromMemory(e);if((p||g)&&_){if(!g&&(p||n===`natural-log`||n===`square-root`))throw new r(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);if(this.layer.capabilities.query.supportsOrderBy)return this._histogramForExpr(e)}if(f&&_)throw new r(`${this.adapterName}:not-supported`,`Normalization and date field are not allowed when layer does not support standardized SQL expression for queries`);return n||!_?A(e,this).then(i=>{if(!x)return U(this,i,t,C,s,l,u);if(v>i.max||b<i.min)throw new r(`${this.adapterName}:insufficient-data`,`Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field`);if(_)return U(this,{min:v,max:b,sqlExpr:i.sqlExpr,excludeZerosExpr:i.excludeZerosExpr},t,C,s,l,u);{let r={field:t,normalizationType:n,normalizationField:a,normalizationTotal:i.normTotal,layer:this},o=V(r),c=y(o,v,b);return A(e,this,c).then(e=>U(this,e,t,C,s,l,u))}}):this._histogramForField(e)}async classBreaks(e){let t=e.analyzeData!==!1,n=this._hasLocalSource||e.features||e.useFeaturesInView||e.valueExpression||e.filter;return t&&n?this._classBreaksFromMemory(e):(t?this._classBreaksFromGenRend(e):this._classBreaksFromInterpolation(e)).catch(()=>(i(e.signal),this._classBreaksFromMemory(e)))}async queryFeatureCount(e){if(this._hasLocalSource)throw new r(`${this.adapterName}:not-supported`,`Layer does not support count query`);let t=this.layer,n=t.createQuery();return n.where=v(n.where,e.whereClause),z(n,e.filter),t.queryFeatureCount(n,{signal:e.signal})}async generateRenderer(e,t){let n=this.layer;if(this._hasLocalSource||n.version<10.1)throw new r(`${this.adapterName}:not-supported`,`Layer does not support generateRenderer operation (requires ArcGIS Server version 10.1+)`);let i=n.createQuery();return e.where=v(e.where,i.where),u(n.parsedUrl?.path??``,{source:n.dynamicDataSource??void 0,gdbVersion:n.gdbVersion??void 0},e,{signal:t})}async predominantCategories(e){if(!this._hasLocalSource&&!this.supportsSQLExpression)throw new r(`${this.adapterName}:not-supported`,`Layer does not support advanced SQL expressions and standardized queries`);let{fields:t,view:n,signal:i,filter:a}=e,o=g(t),s=_(t),c=n&&this._hasLocalSource?await this._uvFromMemory({valueExpression:o,view:n,signal:i,filter:a}):await this._uvFromServiceQuery({sqlExpression:s.expression,valueExpression:o,signal:i,filter:a});return W(c.uniqueValueInfos,t)}async getSampleFeatures(e,r){let{view:a,requiredFields:o,returnGeometry:s,sqlWhere:c,filter:l,signal:u}=e,d=e.sampleSize;if(d==null||d===0)return[];let f=this.layer.createQuery(),p=r===`json`;f.outSpatialReference=a?.spatialReference,f.returnGeometry=!!s,f.outFields=o,f.where=v(f.where,c),z(f,l);let m=[],h=!1;if(a)try{let i=await a.whenLayerView(this.layer);if(h=!G(this,o,i).length,h){if(d>=1&&!e.filter&&`getSampleFeatures`in i){await this._waitForLayerViewUpdate(i);let e=await i.getSampleFeatures({minFeatureCount:d,sampleSize:d});if(e!=null)return p?e:e.map(e=>t.fromJSON(e))}if(m=await this._fetchFeaturesFromMemory(i,f,u,r),m.length>=d&&d>0)return n(m,d,1)}}catch{i(u)}try{if(this._hasLocalSource)return h?m:p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u);let t=await this.queryFeatureCount({view:a,filter:l,signal:u}),r=this.layer.capabilities.query.maxRecordCount,i=d===-1?t:d;if(i=r&&i>r?r:i,t<=m.length||m.length>=r)return m;if(f.maxAllowableOffset=e.resolution||(a?a.extent.width/a.width/a.scale:te(this.layer.spatialReference))*4e5,t<=i)return p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u);if(t<=Z){let e=this.layer.createQuery();z(e,l);let t=await this.layer.queryObjectIds();return f.objectIds=n(t,i,1),p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u)}return this.layer.capabilities?.query?.supportsPagination&&(f.num=Math.min(i,Z)),p?await this._fetchFeaturesJSONFromService(f,u):await this._fetchFeaturesFromService(f,u)}catch{return i(u),m}}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this._hasLocalSource=t.type!==`parquet`&&!t.url&&!!t.source,this.hasQueryEngine=this._hasLocalSource,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=x.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([a({readOnly:!0})],Q.prototype,`adapterName`,void 0),e([a({constructOnly:!0})],Q.prototype,`layer`,void 0),Q=e([o(`esri.smartMapping.support.adapters.FeatureLayerAdapter`)],Q);function $(e,t,n){let r=[],i=t.length;return t.forEach((t,a)=>{let[o,s]=t,c=null;c=a===0&&!n?`${e} < ${s}`:a===i-1&&!n?`${e} >= ${o}`:v(`${e} >= ${o}`,`${e} ${a===i-1?` <= `:` < `} ${s}`),r.push(`WHEN (`+c+`) THEN `+(a+1))}),[`CASE`,r.join(` `),`ELSE 0`,`END`].join(` `)}export{Q as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{pickRandom as t}from"../../../core/arrayUtils.js";import n from"../../../core/Error.js";import r from"../../../core/Logger.js";import{assertIsSome as i}from"../../../core/maybe.js";import{timeout as a,throwIfAborted as o}from"../../../core/promiseUtils.js";import{whenOnce as s}from"../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{toQuantizationTransform as u}from"../../../geometry/support/quantizationUtils.js";import{kebabDict as d}from"../../../layers/support/fieldType.js";import{isTimeOnlyField as f}from"../../../layers/support/fieldUtils.js";import p from"../../../rest/support/QuantizationParameters.js";import{getArcadeForPredominantCategory as m}from"../../statistics/support/predominanceUtils.js";import{summaryStatistics as h,uniqueValues as g,histogram as _,classBreaks as v,heatmapStatistics as y}from"../../statistics/support/statsWorker.js";import{mergeWhereClauses as b}from"../../statistics/support/utils.js";import{WorkerClient as x}from"../../statistics/support/WorkerClient.js";import{getFieldsList as S,isAnyDateField as C,getFieldsFromWhereClauses as w,fieldDelimiter as T}from"../utils.js";import E from"./LayerAdapter.js";import{getHistogramAttributeDefinition as D,getAttributeBinsQuery as O,processQueryAttributeBinsResult as k}from"./support/histogramUtils.js";import{ensureFeaturesJSON as A,getSummaryStatsQuery as j,getSummaryStatisticsFromFeatureSet as M,getViewInfoParams as N,getMissingFields as P,updateQueryWithFeatureFilter as F,getUVQuery as I,getUniqueValuesFromFeatureSet as L,getBins as R,getDomainsForFields as z,getPredominantCategoriesFromUVInfos as B}from"./support/utils.js";import{processSummaryStatisticsResult as V,createUVResult as H,resolveCBResult as U}from"../../../statistics/utils.js";import{loadArcade as W}from"../../../support/loadArcade.js";let G,K=class extends E{constructor(){super(...arguments),this._hasLocalSource=!1,this.adapterName=`in-memory-layer-adapter`}destroy(){this.workerClient?.destroy()}async _waitForLayerViewUpdate(e){if(!e)throw new n(`${this.adapterName}:insufficient-data`,`layerView is required to fetch the features`);let t=new AbortController,i=s(()=>!e.updating,t.signal);await a(i,5e3,t).catch(e=>{throw r.getLogger(this).warn(`LayerView is taking too long to update. Aborting fetch from layerView.`),e})}async _fetchFeatureSetFromMemory(e,t,r){let i=this.layer;if(this._hasLocalSource&&`queryFeatures`in i)return i.queryFeatures(e);if(!t)throw new n(`${this.adapterName}:insufficient-data`,`view is required to fetch the features from layerView`);let a=await t.whenLayerView(this.layer);return await this._waitForLayerViewUpdate(a),a.queryFeatures(e,{signal:r})}async _fetchFeaturesFromMemory(e,t,r,i){let a=this.layer,o=i===`json`;if(this._hasLocalSource&&`queryFeatures`in a){let e=await a.queryFeatures(t);return o?A(e.features):e.features}if(await this._waitForLayerViewUpdate(e),o&&`queryFeaturesJSON`in e&&e.queryFeaturesJSON){let{features:n}=await e.queryFeaturesJSON(t,{signal:r});return n}if(!(`queryFeatures`in e))throw new n(`${this.adapterName}:not-supported`,`'queryFeatures' is not supported on the layerView`);let s=await e.queryFeatures(t,{signal:r});return o?A(s.features):s.features}_fetchFeaturesForStats(e,t){return S({field:e.field,field2:e.field2,field3:e.field3,normalizationField:e.normalizationField,valueExpression:e.valueExpression,fields:e.fields}).then(n=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,filter:e.filter,requiredFields:n,sqlWhere:e.sqlWhere,signal:e.signal},t))}async _summaryStatsFromClientQuery(e,t){let{view:n,signal:r}=e,i=j(this,e,t),a=await this._fetchFeatureSetFromMemory(i,n,r),o=M(a,C(t)||f(t));return V(o,e.outStatisticTypes)}async _getNormalizationTotalFromMemory(e,t,r){let{featuresJSON:i,graphics:a,layerView:o,query:s}=t,c={include:[`sum`]},l=(!i&&!a&&o&&`querySummaryStatistics`in o?await o.querySummaryStatistics(s,{field:e},{signal:r}):i?await this.workerClient.summaryStatistics({field:e,outStatisticTypes:c},i):await h({attribute:{field:e,outStatisticTypes:c},features:a??[]})).sum;if(l==null)throw new n(`${this.adapterName}:invalid`,`invalid normalizationTotal`);return l}async _summaryStatsFromMemory(e,t){let{view:n,field:r,valueExpression:i,normalizationType:a,signal:o}=e,s={field:r,valueExpression:i,normalizationType:a,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,outStatisticTypes:e.outStatisticTypes},{featuresJSON:c,graphics:l,layerView:u,query:f,fieldInfos:p}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`querySummaryStatistics`});return i&&n&&(c||l)&&(s.fieldType=t?.type?d.toJSON(t.type):null,s.viewInfoParams=N(n),s.timeZone=n.timeZone,s.fieldInfos=p),a===`percent-of-total`&&e.normalizationTotal==null&&(s.normalizationTotal=await this._getNormalizationTotalFromMemory(r,{featuresJSON:c,graphics:l,layerView:u,query:f},o)),!c&&!l&&u&&`querySummaryStatistics`in u?u.querySummaryStatistics(f,s,{signal:o}):c?this.workerClient.summaryStatistics(s,c):h({attribute:s,features:l})}async _getFilteredFeatures(e,t){let n=e,r=t?.geometry;if(t?.spatialRelationship===`intersects`&&r){let{intersectionExecute:t}=await import(`../../../geometry/operators/intersectionOperator.js`);n=e.filter(({geometry:e})=>!!(e&&t(e,r)))}return e.length&&`declaredClass`in e[0]&&e[0].declaredClass===`esri.Graphic`?{graphics:n}:{featuresJSON:n}}async _processStatsFromMemoryParams(e){let{features:t,filter:n}=e;if(t?.length)return this._getFilteredFeatures(t,n);let{view:r,field:i,field2:a,field3:o,normalizationField:s,valueExpression:c,sqlExpression:l,sqlWhere:u,layerViewFunc:d,signal:f}=e,p=e.returnGeometry;if(p==null&&c){if(!G){let{arcadeUtils:e}=await W();G=e}let e=G.hasGeometryOperations(c);e&&await G.enableGeometryOperations(),p=e}let m=null,h=null,g=null,_=null,v=null;if(r)try{let e=this.layer.type===`subtype-sublayer`?this.layer.parent:this.layer;m=await r.whenLayerView(e),h=d!=null&&m!=null&&d in m&&typeof m[d]==`function`}catch{h=!1}if(h)try{await this._waitForLayerViewUpdate(m);let e=await S({field:i,field2:a,field3:o,normalizationField:s,valueExpression:c,fields:await w([l,u],this.layer.fieldsIndex)});P(this,e,m).length?h=!1:(g=this.layer.createQuery(),g.outFields=e,g.returnGeometry=!1,g.where=b(g.where,u),F(g,n)),m.suspended&&(h=!1)}catch{h=!1}return h||(_=await this._fetchFeaturesForStats({field:i,field2:a,field3:o,fields:await w([l,u],this.layer.fieldsIndex),valueExpression:c,normalizationField:s,returnGeometry:p,filter:n,sqlWhere:u,view:r,signal:f},`json`),v=(await S({valueExpression:c})).map(e=>this.getField(e)?.toJSON()).filter(Boolean)),{layerView:m,query:g,featuresJSON:_,fieldInfos:v}}async _uvFromClientQuery(e,t){let{view:n,signal:r}=e,i=I(this,e),a=await this._fetchFeatureSetFromMemory(i,n,r),o=await L(a,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:T,view:e.view,signal:e.signal});return H(o,t,e.returnAllCodedValues,T)}async _uvFromMemory(e,t){let{view:n,field:r,valueExpression:i,returnAllCodedValues:a,signal:o}=e,{featuresJSON:s,graphics:c,layerView:l,query:u,fieldInfos:d}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryUniqueValues`}),f={field:r,field2:e.field2,field3:e.field3,fieldDelimiter:T,valueExpression:i,domains:t,returnAllCodedValues:a};return i&&n&&(s||c)&&(f.viewInfoParams=N(n),f.timeZone=n.timeZone,f.fieldInfos=d),!s&&!c&&l&&`queryUniqueValues`in l?l.queryUniqueValues(u,f,{signal:o}):s?this.workerClient.uniqueValues(f,s):g({attribute:f,features:c})}_histogramForField(e){let t=null;return t=e.minValue!=null&&e.maxValue!=null?Promise.resolve({min:e.minValue,max:e.maxValue}):this.summaryStatistics({...e,outStatisticTypes:{include:[`min`,`max`,`count`]}}).then(e=>{if(!e.count)throw new n(`${this.adapterName}:insufficient-data`,`Either the layer has no features or none of the features have data for the field`);return{min:e.min,max:e.max}}),t.then(t=>R(this,{min:t.min,max:t.max},e.field,e.numBins??void 0,e.view,e.filter,e.signal))}async _histogramFromQueryAttributeBinsFromMemory(e){let{field:t,normalizationType:n,signal:r}=e,i=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryAttributeBins`}),{featuresJSON:a,graphics:o,layerView:s,query:c}=i,l=n===`percent-of-total`?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,i,r):void 0;if(!s||!(`queryAttributeBins`in s)||a||o){let t=D(e,i,l);return a?this.workerClient.histogram(t,a):_({attribute:t,features:o})}let{query:u,min:d,max:f}=await O(e,this,l,c);if(!u)return{bins:[],minValue:d,maxValue:f,normalizationTotal:l};let p=await s.queryAttributeBins(u,{signal:r});return k(p,t?this.getField(t):null,{minValue:d,maxValue:f,normalizationTotal:l})}async _histogramFromMemory(e){let{field:t,signal:n}=e,r=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryHistogram`}),{featuresJSON:i,graphics:a,layerView:o,query:s}=r,c=e.normalizationType===`percent-of-total`?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,r,n):void 0,l=D(e,r,c);return!i&&!a&&o&&`queryHistogram`in o?o.queryHistogram(s,l,{signal:n}):i?this.workerClient.histogram(l,i):_({attribute:l,features:a})}_classBreaksFromInterpolation(e){let{minValue:t,maxValue:n}=e,r=e.numClasses||5,i=[],a=(n-t)/r;for(let e=0;e<r;e++){let n=t+e*a;i.push({minValue:n,maxValue:n+a})}i[r-1].maxValue=n;let o={classBreaks:i,normalizationTotal:e.normalizationTotal},s=U(o,e.classificationMethod);return Promise.resolve(s)}async _classBreaksFromMemory(e){let{view:t,field:n,valueExpression:r,signal:i}=e,{featuresJSON:a,graphics:o,layerView:s,query:c,fieldInfos:l}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryClassBreaks`}),u={field:n,valueExpression:r,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return r&&t&&(a||o)&&(u.viewInfoParams=N(t),u.timeZone=t.timeZone,u.fieldInfos=l),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(u.normalizationTotal=await this._getNormalizationTotalFromMemory(n,{featuresJSON:a,graphics:o,layerView:s,query:c},i)),!a&&!o&&s&&`queryClassBreaks`in s?s.queryClassBreaks(c,u,{signal:i}):a?this.workerClient.classBreaks(u,a):v({attribute:u,features:o})}async _heatmapStatsFromMemory(e){let{view:t,field:n,radius:r,signal:a}=e;i(t,`InMemoryLayerAdapter: must have a view`);try{let n=await t.whenLayerView(this.layer);if(`queryHeatmapStatistics`in n&&!n.updating&&!e.filter)return await n.queryHeatmapStatistics({field:e.field,radius:e.radius})}catch{o(a)}let{featuresJSON:s,graphics:c}=await this._processStatsFromMemoryParams({...e,returnGeometry:!0}),l=new p({extent:t.extent,tolerance:t.type===`2d`?t.state.resolution:t.pixelSizeAt?.(t.center)}),d={field:n,radius:r,transform:u(l),spatialReference:t.spatialReference?.toJSON(),size:t.size};return!s?.length&&!c?.length?{min:null,max:null}:s?this.workerClient.heatmapStatistics(d,s):y({attribute:d,features:c})}getField(e=``){return this.layer.getField(e)}getFieldUsageInfo(e){return this.getField(e)?{supportsLabelingInfo:!0,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:!0,supportsStatistics:!0}:null}getFieldDomain(e,t){return this.layer.getFieldDomain(e,t)}createQuery(){return this.layer.createQuery()}async summaryStatistics(e){let{field:t,valueExpression:r,sqlExpression:i,features:a,view:o}=e,s=t?this.getField(t):null,c=!!r,l=o?.type===`3d`;if(!r&&i&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return c||a||l?this._summaryStatsFromMemory(e,s):this._summaryStatsFromClientQuery(e,s)}async uniqueValues(e){let{valueExpression:t,sqlExpression:r,features:i,view:a}=e,o=await z(e,this),s=!!t,c=a?.type===`3d`;if(!t&&r&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return s||i||c?this._uvFromMemory(e,o):this._uvFromClientQuery(e,o)}async histogram(e){let{features:t,valueExpression:r,normalizationType:i,sqlExpression:a}=e,o=t||!!r;if(!r&&a&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return o||i?this._histogramFromMemory(e):this._histogramForField(e)}async classBreaks(e){return e.analyzeData===!1?this._classBreaksFromInterpolation(e):this._classBreaksFromMemory(e)}async queryFeatureCount(e){let{whereClause:t,view:r,signal:i}=e;if(!r)throw new n(`${this.adapterName}:insufficient-data`,`view is required to fetch the features from layerView`);let a=this.layer.createQuery();a.where=b(a.where,t);let o=await r.whenLayerView(this.layer);return await s(()=>!o.updating,i),o.queryFeatureCount(a,{signal:i})}async generateRenderer(e,t){throw new n(`${this.adapterName}:not-supported`,`Layer does not support generateRenderer operation`)}async predominantCategories(e){let{fields:t,view:n,signal:r,filter:i}=e,a=m(t),o=await this._uvFromMemory({valueExpression:a,view:n,signal:r,filter:i});return B(o.uniqueValueInfos,t)}async heatmapStatistics(e){return this._heatmapStatsFromMemory(e)}async getSampleFeatures(e,r){let{view:i,sampleSize:a,requiredFields:o,returnGeometry:s,sqlWhere:c,filter:l,signal:u}=e,d=this.layer.createQuery();if(d.outSpatialReference=i?.spatialReference,d.returnGeometry=!!s,d.outFields=o,d.where=b(d.where,c),F(d,l),!i)throw new n(`${this.adapterName}:not-supported`,`view is required to get sample features for Layer`);let f=await i.whenLayerView(this.layer);if(P(this,o,f).length)throw new n(`${this.adapterName}:not-supported`,`Required fields need to be passed in the outFields for Layer`);let p=await this._fetchFeaturesFromMemory(f,d,u,r),m=a!=null&&a>0&&a<=p.length?a:p.length;return t(p,m,1)}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.type===`stream`||!!t.capabilities?.query?.supportsSqlExpression,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=`fullExtent`in t?t.fullExtent:t.parent?.fullExtent,this._hasLocalSource=!1,this.hasQueryEngine=!0,this.workerClient=x.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([c({readOnly:!0})],K.prototype,`adapterName`,void 0),e([c({constructOnly:!0})],K.prototype,`layer`,void 0),K=e([l(`esri.smartMapping.support.adapters.InMemoryLayerAdapter`)],K);export{K as default};
2
+ import{__decorate as e}from"tslib";import{pickRandom as t}from"../../../core/arrayUtils.js";import n from"../../../core/Error.js";import r from"../../../core/Logger.js";import{assertIsSome as i}from"../../../core/maybe.js";import{timeout as a,throwIfAborted as o}from"../../../core/promiseUtils.js";import{whenOnce as s}from"../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{toQuantizationTransform as u}from"../../../geometry/support/quantizationUtils.js";import{kebabDict as d}from"../../../layers/support/fieldType.js";import{isTimeOnlyField as f}from"../../../layers/support/fieldUtils.js";import p from"../../../rest/support/QuantizationParameters.js";import{getArcadeForPredominantCategory as m}from"../../statistics/support/predominanceUtils.js";import{summaryStatistics as h,uniqueValues as g,histogram as _,classBreaks as v,heatmapStatistics as y}from"../../statistics/support/statsWorker.js";import{mergeWhereClauses as b}from"../../statistics/support/utils.js";import{WorkerClient as x}from"../../statistics/support/WorkerClient.js";import{getFieldsList as S,isAnyDateField as C,getFieldsFromWhereClauses as w,fieldDelimiter as T}from"../utils.js";import E from"./LayerAdapter.js";import{getHistogramAttributeDefinition as D,getAttributeBinsQuery as O,processQueryAttributeBinsResult as k}from"./support/histogramUtils.js";import{ensureFeaturesJSON as A,getSummaryStatsQuery as j,getSummaryStatisticsFromFeatureSet as M,getViewInfoParams as N,getMissingFields as P,updateQueryWithFeatureFilter as F,getUVQuery as I,getUniqueValuesFromFeatureSet as L,getBins as R,getDomainsForFields as z,getPredominantCategoriesFromUVInfos as B}from"./support/utils.js";import{processSummaryStatisticsResult as V,createUVResult as H,resolveCBResult as U}from"../../../statistics/utils.js";import{loadArcade as W}from"../../../support/loadArcade.js";let G,K=class extends E{constructor(){super(...arguments),this._hasLocalSource=!1,this.adapterName=`in-memory-layer-adapter`}destroy(){this.workerClient?.destroy()}async _waitForLayerViewUpdate(e){if(!e)throw new n(`${this.adapterName}:insufficient-data`,`layerView is required to fetch the features`);let t=new AbortController,i=s(()=>!e.updating,t.signal);await a(i,5e3,t).catch(e=>{throw r.getLogger(this).warn(`LayerView is taking too long to update. Aborting fetch from layerView.`),e})}async _fetchFeatureSetFromMemory(e,t,r){let i=this.layer;if(this._hasLocalSource&&`queryFeatures`in i)return i.queryFeatures(e);if(!t)throw new n(`${this.adapterName}:insufficient-data`,`view is required to fetch the features from layerView`);let a=await t.whenLayerView(this.layer);return await this._waitForLayerViewUpdate(a),a.queryFeatures(e,{signal:r})}async _fetchFeaturesFromMemory(e,t,r,i){let a=this.layer,o=i===`json`;if(this._hasLocalSource&&`queryFeatures`in a){let e=await a.queryFeatures(t);return o?A(e.features):e.features}if(await this._waitForLayerViewUpdate(e),o&&`queryFeaturesJSON`in e&&e.queryFeaturesJSON){let{features:n}=await e.queryFeaturesJSON(t,{signal:r});return n}if(!(`queryFeatures`in e))throw new n(`${this.adapterName}:not-supported`,`'queryFeatures' is not supported on the layerView`);let s=await e.queryFeatures(t,{signal:r});return o?A(s.features):s.features}_fetchFeaturesForStats(e,t){return S({field:e.field,field2:e.field2,field3:e.field3,normalizationField:e.normalizationField,valueExpression:e.valueExpression,fields:e.fields}).then(n=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,filter:e.filter,requiredFields:n,sqlWhere:e.sqlWhere,signal:e.signal},t))}async _summaryStatsFromClientQuery(e,t){let{view:n,signal:r}=e,i=j(this,e,t),a=await this._fetchFeatureSetFromMemory(i,n,r),o=M(a,C(t)||f(t));return V(o,e.outStatisticTypes)}async _getNormalizationTotalFromMemory(e,t,r){let{featuresJSON:i,graphics:a,layerView:o,query:s}=t,c={include:[`sum`]},l=(!i&&!a&&o&&`querySummaryStatistics`in o?await o.querySummaryStatistics(s,{field:e},{signal:r}):i?await this.workerClient.summaryStatistics({field:e,outStatisticTypes:c},i):await h({attribute:{field:e,outStatisticTypes:c},features:a??[]})).sum;if(l==null)throw new n(`${this.adapterName}:invalid`,`invalid normalizationTotal`);return l}async _summaryStatsFromMemory(e,t){let{view:n,field:r,valueExpression:i,normalizationType:a,signal:o}=e,s={field:r,valueExpression:i,normalizationType:a,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,outStatisticTypes:e.outStatisticTypes},{featuresJSON:c,graphics:l,layerView:u,query:f,fieldInfos:p}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`querySummaryStatistics`});return i&&n&&(c||l)&&(s.fieldType=t?.type?d.toJSON(t.type):null,s.viewInfoParams=N(n),s.timeZone=n.timeZone,s.fieldInfos=p),a===`percent-of-total`&&e.normalizationTotal==null&&(s.normalizationTotal=await this._getNormalizationTotalFromMemory(r,{featuresJSON:c,graphics:l,layerView:u,query:f},o)),!c&&!l&&u&&`querySummaryStatistics`in u?u.querySummaryStatistics(f,s,{signal:o}):c?this.workerClient.summaryStatistics(s,c):h({attribute:s,features:l})}async _getFilteredFeatures(e,t){let n=e,r=t?.geometry;if(t?.spatialRelationship===`intersects`&&r){let{intersectionExecute:t}=await import(`../../../geometry/operators/intersectionOperator.js`);n=e.filter(({geometry:e})=>!!(e&&t(e,r)))}return e.length&&`declaredClass`in e[0]&&e[0].declaredClass===`esri.Graphic`?{graphics:n}:{featuresJSON:n}}async _processStatsFromMemoryParams(e){let{features:t,filter:n}=e;if(t?.length)return this._getFilteredFeatures(t,n);let{view:r,field:i,field2:a,field3:o,normalizationField:s,valueExpression:c,sqlExpression:l,sqlWhere:u,layerViewFunc:d,signal:f}=e,p=e.returnGeometry;if(p==null&&c){if(!G){let{arcadeUtils:e}=await W();G=e}let e=G.hasGeometryOperations(c);e&&await G.enableGeometryOperations(),p=e}let m=null,h=null,g=null,_=null,v=null;if(r)try{let e=this.layer.type===`subtype-sublayer`?this.layer.parent:this.layer;m=await r.whenLayerView(e),h=d!=null&&m!=null&&d in m&&typeof m[d]==`function`}catch{h=!1}if(h)try{await this._waitForLayerViewUpdate(m);let e=await S({field:i,field2:a,field3:o,normalizationField:s,valueExpression:c,fields:await w([l,u],this.layer.fieldsIndex)});P(this,e,m).length?h=!1:(g=this.layer.createQuery(),g.outFields=e,g.returnGeometry=!1,g.where=b(g.where,u),F(g,n)),m.suspended&&(h=!1)}catch{h=!1}return h||(_=await this._fetchFeaturesForStats({field:i,field2:a,field3:o,fields:await w([l,u],this.layer.fieldsIndex),valueExpression:c,normalizationField:s,returnGeometry:p,filter:n,sqlWhere:u,view:r,signal:f},`json`),v=(await S({valueExpression:c})).map(e=>this.getField(e)?.toJSON()).filter(Boolean)),{layerView:m,query:g,featuresJSON:_,fieldInfos:v}}async _uvFromClientQuery(e,t){let{view:n,signal:r}=e,i=I(this,e),a=await this._fetchFeatureSetFromMemory(i,n,r),o=await L(a,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:T,filter:e.filter,view:e.view,signal:e.signal});return H(o,t,e.returnAllCodedValues,T)}async _uvFromMemory(e,t){let{view:n,field:r,valueExpression:i,returnAllCodedValues:a,signal:o}=e,{featuresJSON:s,graphics:c,layerView:l,query:u,fieldInfos:d}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryUniqueValues`}),f={field:r,field2:e.field2,field3:e.field3,fieldDelimiter:T,valueExpression:i,domains:t,returnAllCodedValues:a};return i&&n&&(s||c)&&(f.viewInfoParams=N(n),f.timeZone=n.timeZone,f.fieldInfos=d),!s&&!c&&l&&`queryUniqueValues`in l?l.queryUniqueValues(u,f,{signal:o}):s?this.workerClient.uniqueValues(f,s):g({attribute:f,features:c})}_histogramForField(e){let t=null;return t=e.minValue!=null&&e.maxValue!=null?Promise.resolve({min:e.minValue,max:e.maxValue}):this.summaryStatistics({...e,outStatisticTypes:{include:[`min`,`max`,`count`]}}).then(e=>{if(!e.count)throw new n(`${this.adapterName}:insufficient-data`,`Either the layer has no features or none of the features have data for the field`);return{min:e.min,max:e.max}}),t.then(t=>R(this,{min:t.min,max:t.max},e.field,e.numBins??void 0,e.view,e.filter,e.signal))}async _histogramFromQueryAttributeBinsFromMemory(e){let{field:t,normalizationType:n,signal:r}=e,i=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryAttributeBins`}),{featuresJSON:a,graphics:o,layerView:s,query:c}=i,l=n===`percent-of-total`?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,i,r):void 0;if(!s||!(`queryAttributeBins`in s)||a||o){let t=D(e,i,l);return a?this.workerClient.histogram(t,a):_({attribute:t,features:o})}let{query:u,min:d,max:f}=await O(e,this,l,c);if(!u)return{bins:[],minValue:d,maxValue:f,normalizationTotal:l};let p=await s.queryAttributeBins(u,{signal:r});return k(p,t?this.getField(t):null,{minValue:d,maxValue:f,normalizationTotal:l})}async _histogramFromMemory(e){let{field:t,signal:n}=e,r=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryHistogram`}),{featuresJSON:i,graphics:a,layerView:o,query:s}=r,c=e.normalizationType===`percent-of-total`?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,r,n):void 0,l=D(e,r,c);return!i&&!a&&o&&`queryHistogram`in o?o.queryHistogram(s,l,{signal:n}):i?this.workerClient.histogram(l,i):_({attribute:l,features:a})}_classBreaksFromInterpolation(e){let{minValue:t,maxValue:n}=e,r=e.numClasses||5,i=[],a=(n-t)/r;for(let e=0;e<r;e++){let n=t+e*a;i.push({minValue:n,maxValue:n+a})}i[r-1].maxValue=n;let o={classBreaks:i,normalizationTotal:e.normalizationTotal},s=U(o,e.classificationMethod);return Promise.resolve(s)}async _classBreaksFromMemory(e){let{view:t,field:n,valueExpression:r,signal:i}=e,{featuresJSON:a,graphics:o,layerView:s,query:c,fieldInfos:l}=await this._processStatsFromMemoryParams({...e,layerViewFunc:`queryClassBreaks`}),u={field:n,valueExpression:r,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return r&&t&&(a||o)&&(u.viewInfoParams=N(t),u.timeZone=t.timeZone,u.fieldInfos=l),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(u.normalizationTotal=await this._getNormalizationTotalFromMemory(n,{featuresJSON:a,graphics:o,layerView:s,query:c},i)),!a&&!o&&s&&`queryClassBreaks`in s?s.queryClassBreaks(c,u,{signal:i}):a?this.workerClient.classBreaks(u,a):v({attribute:u,features:o})}async _heatmapStatsFromMemory(e){let{view:t,field:n,radius:r,signal:a}=e;i(t,`InMemoryLayerAdapter: must have a view`);try{let n=await t.whenLayerView(this.layer);if(`queryHeatmapStatistics`in n&&!n.updating&&!e.filter)return await n.queryHeatmapStatistics({field:e.field,radius:e.radius})}catch{o(a)}let{featuresJSON:s,graphics:c}=await this._processStatsFromMemoryParams({...e,returnGeometry:!0}),l=new p({extent:t.extent,tolerance:t.type===`2d`?t.state.resolution:t.pixelSizeAt?.(t.center)}),d={field:n,radius:r,transform:u(l),spatialReference:t.spatialReference?.toJSON(),size:t.size};return!s?.length&&!c?.length?{min:null,max:null}:s?this.workerClient.heatmapStatistics(d,s):y({attribute:d,features:c})}getField(e=``){return this.layer.getField(e)}getFieldUsageInfo(e){return this.getField(e)?{supportsLabelingInfo:!0,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:!0,supportsStatistics:!0}:null}getFieldDomain(e,t){return this.layer.getFieldDomain(e,t)}createQuery(){return this.layer.createQuery()}async summaryStatistics(e){let{field:t,valueExpression:r,sqlExpression:i,features:a,view:o}=e,s=t?this.getField(t):null,c=!!r,l=o?.type===`3d`;if(!r&&i&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return c||a||l?this._summaryStatsFromMemory(e,s):this._summaryStatsFromClientQuery(e,s)}async uniqueValues(e){let{valueExpression:t,sqlExpression:r,features:i,view:a}=e,o=await z(e,this),s=!!t,c=a?.type===`3d`;if(!t&&r&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return s||i||c?this._uvFromMemory(e,o):this._uvFromClientQuery(e,o)}async histogram(e){let{features:t,valueExpression:r,normalizationType:i,sqlExpression:a}=e,o=t||!!r;if(!r&&a&&!this.supportsSQLExpression)throw new n(`${this.adapterName}:not-supported`,`Layer does not support standardized SQL expression for queries`);return o||i?this._histogramFromMemory(e):this._histogramForField(e)}async classBreaks(e){return e.analyzeData===!1?this._classBreaksFromInterpolation(e):this._classBreaksFromMemory(e)}async queryFeatureCount(e){let{whereClause:t,view:r,signal:i}=e;if(!r)throw new n(`${this.adapterName}:insufficient-data`,`view is required to fetch the features from layerView`);let a=this.layer.createQuery();a.where=b(a.where,t),F(a,e.filter);let o=await r.whenLayerView(this.layer);return await s(()=>!o.updating,i),o.queryFeatureCount(a,{signal:i})}async generateRenderer(e,t){throw new n(`${this.adapterName}:not-supported`,`Layer does not support generateRenderer operation`)}async predominantCategories(e){let{fields:t,view:n,signal:r,filter:i}=e,a=m(t),o=await this._uvFromMemory({valueExpression:a,view:n,signal:r,filter:i});return B(o.uniqueValueInfos,t)}async heatmapStatistics(e){return this._heatmapStatsFromMemory(e)}async getSampleFeatures(e,r){let{view:i,sampleSize:a,requiredFields:o,returnGeometry:s,sqlWhere:c,filter:l,signal:u}=e,d=this.layer.createQuery();if(d.outSpatialReference=i?.spatialReference,d.returnGeometry=!!s,d.outFields=o,d.where=b(d.where,c),F(d,l),!i)throw new n(`${this.adapterName}:not-supported`,`view is required to get sample features for Layer`);let f=await i.whenLayerView(this.layer);if(P(this,o,f).length)throw new n(`${this.adapterName}:not-supported`,`Required fields need to be passed in the outFields for Layer`);let p=await this._fetchFeaturesFromMemory(f,d,u,r),m=a!=null&&a>0&&a<=p.length?a:p.length;return t(p,m,1)}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.type===`stream`||!!t.capabilities?.query?.supportsSqlExpression,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=`fullExtent`in t?t.fullExtent:t.parent?.fullExtent,this._hasLocalSource=!1,this.hasQueryEngine=!0,this.workerClient=x.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([c({readOnly:!0})],K.prototype,`adapterName`,void 0),e([c({constructOnly:!0})],K.prototype,`layer`,void 0),K=e([l(`esri.smartMapping.support.adapters.InMemoryLayerAdapter`)],K);export{K as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{pickRandom as t}from"../../../core/arrayUtils.js";import n from"../../../core/Error.js";import{whenOnce as r}from"../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import{isTimeOnlyField as o}from"../../../layers/support/fieldUtils.js";import{getArcadeForPredominantCategory as s}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as c}from"../../statistics/support/utils.js";import{WorkerClient as l}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as u,fieldDelimiter as d}from"../utils.js";import f from"./FeatureLayerAdapter.js";import{getSummaryStatsQuery as p,getSummaryStatisticsFromFeatureSet as m,getUVQuery as h,getUniqueValuesFromFeatureSet as g,getDomainsForFields as _,getPredominantCategoriesFromUVInfos as v,getMissingFields as y}from"./support/utils.js";import{processSummaryStatisticsResult as b,createUVResult as x}from"../../../statistics/utils.js";let S=class extends f{constructor(e){super(e),this.adapterName=`ogc-feature-layer-adapter`}async _waitForLayerViewUpdate(e){if(!e)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`layerView is required to fetch the features`);await r(()=>!e.updating)}async _summaryStatsFromClientQuery(e,t){let{signal:i,view:a}=e;if(!a)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let s=p(this,e,t),c=await a.whenLayerView(this.layer);await r(()=>!c.updating,i);let l=await c.queryFeatures(s,{signal:i}),d=m(l,u(t)||o(t));return b(d,e.outStatisticTypes)}async _uvFromClientQuery(e,t){let{signal:i,view:a}=e;if(!a)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let o=h(this,e),s=await a.whenLayerView(this.layer);await r(()=>!s.updating,i);let c=await s.queryFeatures(o,{signal:i}),l=await g(c,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:d,view:e.view,signal:e.signal});return x(l,t,e.returnAllCodedValues,d)}summaryStatistics(e){let{field:t,valueExpression:r,sqlExpression:i,features:a,view:o}=e,s=t?this.getField(t):null,c=!!r,l=o?.type===`3d`;if(!r&&i&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return c||a||l?this._summaryStatsFromMemory(e,s):this._summaryStatsFromClientQuery(e,s)}async uniqueValues(e){let{valueExpression:t,sqlExpression:r,features:i,view:a}=e,o=await _(e,this),s=!!t,c=a?.type===`3d`;if(!t&&r&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return s||i||c?this._uvFromMemory(e,o):this._uvFromClientQuery(e,o)}histogram(e){let{features:t,valueExpression:r,normalizationType:i,sqlExpression:a}=e,o=t||!!r;if(!r&&a&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return o||i?this._histogramFromMemory(e):this._histogramForField(e)}classBreaks(e){return e.analyzeData===!1?this._classBreaksFromInterpolation(e):this._classBreaksFromMemory(e)}async queryFeatureCount(e){let{whereClause:t,view:i,signal:a}=e;if(!i)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let o=this.layer.createQuery();o.where=c(o.where,t);let s=await i.whenLayerView(this.layer);return await r(()=>!s.updating,a),s.queryFeatureCount(o,{signal:a})}generateRenderer(e,t){throw new n(`ogc-feature-layer-adapter:not-supported`,`OGCFeatureLayer does not support generateRenderer operation`)}async predominantCategories(e){let{fields:t,view:n,signal:r}=e,i=s(t),a=await this._uvFromMemory({valueExpression:i,view:n,signal:r});return v(a.uniqueValueInfos,t)}async getSampleFeatures(e,r){let{view:i,sampleSize:a,requiredFields:o,returnGeometry:s,signal:c}=e,l=this.layer.createQuery();if(l.outSpatialReference=i?.spatialReference,l.returnGeometry=!!s,l.outFields=o,!i)throw new n(`ogc-feature-layer-adapter:not-supported`,`view is required to get sample features for OGCFeatureLayer`);let u=await i.whenLayerView(this.layer);if(y(this,o,u).length)throw new n(`ogc-feature-layer-adapter:not-supported`,`Required fields need to be passed in the outFields for OGCFeatureLayer`);let d=await this._fetchFeaturesFromMemory(u,l,c,r),f=a!=null&&a>0&&a<=d.length?a:d.length;return t(d,f,1)}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=l.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([i({readOnly:!0})],S.prototype,`adapterName`,void 0),S=e([a(`esri.smartMapping.support.adapters.OGCFeatureLayerAdapter`)],S);const C=S;export{C as default};
2
+ import{__decorate as e}from"tslib";import{pickRandom as t}from"../../../core/arrayUtils.js";import n from"../../../core/Error.js";import{whenOnce as r}from"../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import{isTimeOnlyField as o}from"../../../layers/support/fieldUtils.js";import{getArcadeForPredominantCategory as s}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as c}from"../../statistics/support/utils.js";import{WorkerClient as l}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as u,fieldDelimiter as d}from"../utils.js";import f from"./FeatureLayerAdapter.js";import{getSummaryStatsQuery as p,getSummaryStatisticsFromFeatureSet as m,getUVQuery as h,getUniqueValuesFromFeatureSet as g,getDomainsForFields as _,updateQueryWithFeatureFilter as v,getPredominantCategoriesFromUVInfos as y,getMissingFields as b}from"./support/utils.js";import{processSummaryStatisticsResult as x,createUVResult as S}from"../../../statistics/utils.js";let C=class extends f{constructor(e){super(e),this.adapterName=`ogc-feature-layer-adapter`}async _waitForLayerViewUpdate(e){if(!e)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`layerView is required to fetch the features`);await r(()=>!e.updating)}async _summaryStatsFromClientQuery(e,t){let{signal:i,view:a}=e;if(!a)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let s=p(this,e,t),c=await a.whenLayerView(this.layer);await r(()=>!c.updating,i);let l=await c.queryFeatures(s,{signal:i}),d=m(l,u(t)||o(t));return x(d,e.outStatisticTypes)}async _uvFromClientQuery(e,t){let{signal:i,view:a}=e;if(!a)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let o=h(this,e),s=await a.whenLayerView(this.layer);await r(()=>!s.updating,i);let c=await s.queryFeatures(o,{signal:i}),l=await g(c,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:d,filter:e.filter,view:e.view,signal:e.signal});return S(l,t,e.returnAllCodedValues,d)}summaryStatistics(e){let{field:t,valueExpression:r,sqlExpression:i,features:a,view:o}=e,s=t?this.getField(t):null,c=!!r,l=o?.type===`3d`;if(!r&&i&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return c||a||l?this._summaryStatsFromMemory(e,s):this._summaryStatsFromClientQuery(e,s)}async uniqueValues(e){let{valueExpression:t,sqlExpression:r,features:i,view:a}=e,o=await _(e,this),s=!!t,c=a?.type===`3d`;if(!t&&r&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return s||i||c?this._uvFromMemory(e,o):this._uvFromClientQuery(e,o)}histogram(e){let{features:t,valueExpression:r,normalizationType:i,sqlExpression:a}=e,o=t||!!r;if(!r&&a&&!this.supportsSQLExpression)throw new n(`ogc-feature-layer-adapter:not-supported`,`Layer does not support standardized SQL expression for queries`);return o||i?this._histogramFromMemory(e):this._histogramForField(e)}classBreaks(e){return e.analyzeData===!1?this._classBreaksFromInterpolation(e):this._classBreaksFromMemory(e)}async queryFeatureCount(e){let{whereClause:t,view:i,signal:a}=e;if(!i)throw new n(`ogc-feature-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let o=this.layer.createQuery();o.where=c(o.where,t),v(o,e.filter);let s=await i.whenLayerView(this.layer);return await r(()=>!s.updating,a),s.queryFeatureCount(o,{signal:a})}generateRenderer(e,t){throw new n(`ogc-feature-layer-adapter:not-supported`,`OGCFeatureLayer does not support generateRenderer operation`)}async predominantCategories(e){let{fields:t,view:n,signal:r}=e,i=s(t),a=await this._uvFromMemory({valueExpression:i,view:n,signal:r});return y(a.uniqueValueInfos,t)}async getSampleFeatures(e,r){let{view:i,sampleSize:a,requiredFields:o,returnGeometry:s,signal:c}=e,l=this.layer.createQuery();if(l.outSpatialReference=i?.spatialReference,l.returnGeometry=!!s,l.outFields=o,!i)throw new n(`ogc-feature-layer-adapter:not-supported`,`view is required to get sample features for OGCFeatureLayer`);let u=await i.whenLayerView(this.layer);if(b(this,o,u).length)throw new n(`ogc-feature-layer-adapter:not-supported`,`Required fields need to be passed in the outFields for OGCFeatureLayer`);let d=await this._fetchFeaturesFromMemory(u,l,c,r),f=a!=null&&a>0&&a<=d.length?a:d.length;return t(d,f,1)}load(e){let t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=l.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};e([i({readOnly:!0})],C.prototype,`adapterName`,void 0),C=e([a(`esri.smartMapping.support.adapters.OGCFeatureLayerAdapter`)],C);const w=C;export{w as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{pickRandom as n}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{timeout as i,throwIfAborted as a}from"../../../core/promiseUtils.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{kebabDict as l}from"../../../layers/support/fieldType.js";import{isNumericField as u}from"../../../layers/support/fieldUtils.js";import d from"../../../rest/support/FeatureSet.js";import{summaryStatistics as f,uniqueValues as p,classBreaks as m,histogram as h}from"../../statistics/support/statsWorker.js";import{WorkerClient as g}from"../../statistics/support/WorkerClient.js";import{getFieldsList as _,isAnyDateField as v,fieldDelimiter as y}from"../utils.js";import b from"./FeatureLayerAdapter.js";import x from"./LayerAdapter.js";import{getMissingFields as S,ensureFeaturesJSON as C,getViewInfoParams as w,getUniqueValuesFromFeatureSet as T,getHistogramFromFeatureSet as E,getDomainsForFields as D}from"./support/utils.js";import{createUVResult as O}from"../../../statistics/utils.js";let k=class extends x{constructor(e){super(e),this._featureLayerAdapter=null,this.workerClient=null,this.adapterName=`scene-layer-adapter`}destroy(){this.workerClient?.destroy()}_hasCachedStatistics(e){return this.layer.hasCachedStatistics(e)}_updateQuery(e,t=[],n=[]){if(!e||!n.length)return e;let r=this.layer.objectIdField,i=e.clone(),a=t.filter(e=>{let t=this.layer.getField(e);return!n.includes(t.name)});return i.outFields=a.some(e=>this.layer.getField(e).name===r)?a:[...a,r],i}async _fetchFeaturesFromMemory(e,t,n){if(!e)throw new r(`scene-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let s=await e.whenLayerView(this.layer),c=new AbortController,l=c.signal,u=o(()=>!s.updating,l);await i(u,5e3,c);let d=S(this,n,s);a(l);let f=this._updateQuery(t,n??[],d),p=await s.queryFeatures(f,{signal:l});a(l);let m=p.features;return d.length?s.whenGraphicAttributes(m,d):m}async _fetchFeaturesJSONFromMemory(e,t,n){return this._fetchFeaturesFromMemory(e,t,n).then(C)}_fetchFeaturesForStats(e,t){return _({field:e.field,normalizationField:e.normalizationField,valueExpression:e.valueExpression}).then(n=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,requiredFields:n,signal:e.signal},t))}async _processStatsFromMemoryParams(e){let t=e.features;if(t?.length)return t.length&&`declaredClass`in t[0]&&t[0].declaredClass===`esri.Graphic`?{graphics:t}:{featuresJSON:t};let{view:n,field:i,normalizationField:a,valueExpression:o,signal:s}=e,c=await this._fetchFeaturesForStats({field:i,valueExpression:o,normalizationField:a,view:n,signal:s},null);if(!c?.length)throw new r(`scene-layer-adapter:insufficient-data`,`No features are available to calculate statistics`);return{graphics:c}}_getCachedStatistics(e,t){let n=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.minValue||e.maxValue?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression', 'sqlWhere', 'minValue' or 'maxValue' is specified`)):n.queryCachedStatistics(t?.name,{signal:e.signal}).then(e=>{let t=e.stats,{min:n,max:r,totalValuesCount:i}=t,{avg:a,stddev:o,sum:s,variance:c,count:l}=t;return(n!==0||r!==0)&&(a=a===0?null:a,s=s===0?null:s,o=o===0?null:o,c=c===0?null:c,l=l===0?null:l),l??(s!=null&&a!=null?l=Math.round(s/a):i!=null&&(l=i)),{avg:a,count:l,max:r,min:n,stddev:o,sum:s,variance:c}})}async _getNormalizationTotal(e,t,n){let i={include:[`sum`]},a=(t?await this.workerClient.summaryStatistics({field:e,outStatisticTypes:i},t):await f({attribute:{field:e,outStatisticTypes:i},features:n})).sum;if(a==null)throw new r(`scene-layer-adapter:invalid`,`invalid normalizationTotal`);return a}async _getSummaryStatisticsFromMemory(e,t){let{view:n,field:r,normalizationField:i,valueExpression:a}=e,{featuresJSON:o,graphics:s}=await this._processStatsFromMemoryParams(e),c={field:r,valueExpression:a,normalizationType:e.normalizationType,normalizationField:i,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,outStatisticTypes:e.outStatisticTypes};return e.valueExpression&&n&&o&&(c.fieldType=t?.type?l.toJSON(t.type):null,c.viewInfoParams=w(n),c.timeZone=n.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(c.normalizationTotal=await this._getNormalizationTotal(r,o,s)),o?this.workerClient.summaryStatistics(c,o):f({attribute:c,features:s})}_getCachedStatisticsForUniqueValues(e,n){let i=this.layer,a=n?.name,o=n&&e.field?this.getFieldDomain(e.field):null;return e.valueExpression||e.sqlExpression||e.sqlWhere?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression' or 'sqlWhere' is specified`)):i.queryCachedStatistics(a,{signal:e.signal}).then(r=>{let o=r.stats;if(!o.mostFrequentValues)throw Error();let s=r.labels?.labels,c={},l=[],f=`countOF`+a;o.mostFrequentValues.forEach(e=>{let r=new t({attributes:{}});r.attributes[a]=n&&n.name!==i.objectIdField&&(u(n)||v(n))?Number(e.value):e.value,r.attributes[f]=e.count,l.push(r)}),s&&s.forEach(e=>{c[e.value]=e.label});let p=new d({features:l});return T(p,{layer:this,field:e.field,labels:c,view:e.view,signal:e.signal})}).then(t=>O(t,[o],e.returnAllCodedValues))}async _getUniqueValuesFromMemory(e,t){let{view:n,field:r,field2:i,field3:a,valueExpression:o,returnAllCodedValues:s}=e,c={field:r,field2:i,field3:a,fieldDelimiter:y,valueExpression:o,domains:t,returnAllCodedValues:s},{featuresJSON:l,graphics:u}=await this._processStatsFromMemoryParams(e);return e.valueExpression&&n&&l&&(c.viewInfoParams=w(n),c.timeZone=n.timeZone),l?this.workerClient.uniqueValues(c,l):p({attribute:c,features:u})}_getCachedStatisticsForHistogram(e,t){let n=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.normalizationType?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression' or 'sqlExpression' or 'sqlWhere' or 'normalizationType' is specified`)):n.queryCachedStatistics(t&&t.name,{signal:e.signal}).then(t=>{let n=t.stats,{minValue:r,maxValue:i}=e,a=r??n.min,o=i??n.max,s=e.numBins||10,c=A(n.histogram,a,o,s);return E(c,a,o,s)})}async _getClassBreaksFromMemory(e){let{view:t,field:n,normalizationField:r,valueExpression:i}=e,{featuresJSON:a,graphics:o}=await this._processStatsFromMemoryParams(e),s={field:n,valueExpression:i,normalizationType:e.normalizationType,normalizationField:r,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return e.valueExpression&&t&&a&&(s.viewInfoParams=w(t),s.timeZone=t.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(s.normalizationTotal=await this._getNormalizationTotal(n,a,o)),a?this.workerClient.classBreaks(s,a):m({attribute:s,features:o})}async _getHistogramFromMemory(e){let{view:t,field:n}=e,{featuresJSON:r,graphics:i}=await this._processStatsFromMemoryParams(e),a={field:n,valueExpression:e.valueExpression,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numBins:e.numBins};return e.valueExpression&&t&&r&&(a.viewInfoParams=w(t),a.timeZone=t.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(a.normalizationTotal=await this._getNormalizationTotal(n,r,i)),r?this.workerClient.histogram(a,r):h({attribute:a,features:i})}getField(e){return this.layer.getField(e??``)}getFieldUsageInfo(e){let t=this.getField(e);if(!t)return null;let n=this.layer.getFieldUsageInfo(t.name);return{supportsLabelingInfo:n.supportsLabelingInfo,supportsPopupTemplate:n.supportsPopupTemplate,supportsRenderer:n.supportsRenderer,supportsLayerQuery:n.supportsLayerQuery,supportsStatistics:!0}}getFieldDomain(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.getFieldDomain(e,t):null}createQuery(){return this.layer.createQuery()}summaryStatistics(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.summaryStatistics(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return this._hasCachedStatistics(t?.name)?this._getCachedStatistics(e,t).catch(()=>(a(e.signal),this._getSummaryStatisticsFromMemory(e,t))):this._getSummaryStatisticsFromMemory(e,t)}async uniqueValues(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.uniqueValues(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);let t=await D(e,this),{field:n,field2:i}=e,o=n&&i,s=this.getField(n);return!o&&s&&this._hasCachedStatistics(s.name)?this._getCachedStatisticsForUniqueValues(e,s).catch(()=>(a(e.signal),this._getUniqueValuesFromMemory(e,t))):this._getUniqueValuesFromMemory(e,t)}histogram(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.histogram(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return t&&this._hasCachedStatistics(t.name)?this._getCachedStatisticsForHistogram(e,t).catch(()=>(a(e.signal),this._getHistogramFromMemory(e))):this._getHistogramFromMemory(e)}classBreaks(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.classBreaks(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return this._hasCachedStatistics(t?.name)?Promise.reject(new r(`scene-layer-adapter:not-supported`,`Cached stats not supported`)):this._getClassBreaksFromMemory(e)}queryFeatureCount(e){return this._featureLayerAdapter?this._featureLayerAdapter.queryFeatureCount(e):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support count query`))}generateRenderer(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.generateRenderer(e,t):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support generateRenderer operation`))}heatmapStatistics(e){return this._featureLayerAdapter?this._featureLayerAdapter.heatmapStatistics(e):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support heatmapStatistics operation`))}async predominantCategories(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.predominantCategories(e);throw new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support predominantCategories`)}async getSampleFeatures(e,t){if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);let{view:i,sampleSize:o,requiredFields:s,returnGeometry:c,signal:l}=e,u=t===`json`,d=this.createQuery();d.outFields=s,d.returnGeometry=!!c,d.where=null,d.num=o;let f=[];try{if(f=u?await this._fetchFeaturesJSONFromMemory(i,d,s):await this._fetchFeaturesFromMemory(i,d,s),f.length&&o!=null&&o>0&&o<=f.length)return n(f,o,1)}catch{a(l)}let p=null;if(this._featureLayerAdapter){let n={...e};delete n.view,p=await this._featureLayerAdapter.getSampleFeatures(n,t)}return p?.length?p:n(f,f.length,1)}load(e){let t=this.layer.load(e).then(async t=>{this.workerClient=g.getInstance(),await this.workerClient.open(e.signal);let n=t.associatedLayer;if(this.geometryType=t.geometryType,n!=null)return this._featureLayerAdapter=new b({layer:n}),this._featureLayerAdapter.load(e).then(()=>{this.objectIdField=this._featureLayerAdapter.objectIdField,this.supportsSQLExpression=this._featureLayerAdapter.supportsSQLExpression,this.minScale=this._featureLayerAdapter.minScale,this.maxScale=this._featureLayerAdapter.maxScale,this.fullExtent=this._featureLayerAdapter.fullExtent});this.objectIdField=t.objectIdField,this.supportsSQLExpression=!1,this.hasQueryEngine=!1,this.fullExtent=t.fullExtent});return this.addResolvingPromise(t),Promise.resolve(this)}};e([s({readOnly:!0})],k.prototype,`adapterName`,void 0),e([s({constructOnly:!0})],k.prototype,`layer`,void 0),k=e([c(`esri.smartMapping.support.adapters.SceneLayerAdapter`)],k);function A(e,n=e.minimum,r=e.maximum,i){let a=[];for(let e=0;e<i;e++)a[e]=0;let o=e.counts.length,s=e.minimum,c=e.maximum;for(let t=0;t<o;t++){let l=(t+.5)/o,u=((1-l)*s+l*c-n)/(r-n)*i;u>=0&&u<=i&&(a[u===i?i-1:Math.floor(u)]+=e.counts[t])}let l=[];return a.forEach((e,n)=>{let r=new t({attributes:{}});r.attributes.EXPR_1=n+1,r.attributes.countOFExpr=e,l.push(r)}),new d({features:l})}export{k as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{pickRandom as n}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{timeout as i,throwIfAborted as a}from"../../../core/promiseUtils.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../../core/accessorSupport/decorators.js";import{kebabDict as l}from"../../../layers/support/fieldType.js";import{isNumericField as u}from"../../../layers/support/fieldUtils.js";import d from"../../../rest/support/FeatureSet.js";import{summaryStatistics as f,uniqueValues as p,classBreaks as m,histogram as h}from"../../statistics/support/statsWorker.js";import{WorkerClient as g}from"../../statistics/support/WorkerClient.js";import{getFieldsList as _,isAnyDateField as v,fieldDelimiter as y}from"../utils.js";import b from"./FeatureLayerAdapter.js";import x from"./LayerAdapter.js";import{getMissingFields as S,ensureFeaturesJSON as C,getViewInfoParams as w,getUniqueValuesFromFeatureSet as T,getHistogramFromFeatureSet as E,getDomainsForFields as D}from"./support/utils.js";import{createUVResult as O}from"../../../statistics/utils.js";let k=class extends x{constructor(e){super(e),this._featureLayerAdapter=null,this.workerClient=null,this.adapterName=`scene-layer-adapter`}destroy(){this.workerClient?.destroy()}_hasCachedStatistics(e){return this.layer.hasCachedStatistics(e)}_updateQuery(e,t=[],n=[]){if(!e||!n.length)return e;let r=this.layer.objectIdField,i=e.clone(),a=t.filter(e=>{let t=this.layer.getField(e);return!n.includes(t.name)});return i.outFields=a.some(e=>this.layer.getField(e).name===r)?a:[...a,r],i}async _fetchFeaturesFromMemory(e,t,n){if(!e)throw new r(`scene-layer-adapter:insufficient-data`,`view is required to fetch the features from layerView`);let s=await e.whenLayerView(this.layer),c=new AbortController,l=c.signal,u=o(()=>!s.updating,l);await i(u,5e3,c);let d=S(this,n,s);a(l);let f=this._updateQuery(t,n??[],d),p=await s.queryFeatures(f,{signal:l});a(l);let m=p.features;return d.length?s.whenGraphicAttributes(m,d):m}async _fetchFeaturesJSONFromMemory(e,t,n){return this._fetchFeaturesFromMemory(e,t,n).then(C)}_fetchFeaturesForStats(e,t){return _({field:e.field,normalizationField:e.normalizationField,valueExpression:e.valueExpression}).then(n=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,requiredFields:n,signal:e.signal},t))}async _processStatsFromMemoryParams(e){let t=e.features;if(t?.length)return t.length&&`declaredClass`in t[0]&&t[0].declaredClass===`esri.Graphic`?{graphics:t}:{featuresJSON:t};let{view:n,field:i,normalizationField:a,valueExpression:o,signal:s}=e,c=await this._fetchFeaturesForStats({field:i,valueExpression:o,normalizationField:a,view:n,signal:s},null);if(!c?.length)throw new r(`scene-layer-adapter:insufficient-data`,`No features are available to calculate statistics`);return{graphics:c}}_getCachedStatistics(e,t){let n=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.minValue||e.maxValue?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression', 'sqlWhere', 'minValue' or 'maxValue' is specified`)):n.queryCachedStatistics(t?.name,{signal:e.signal}).then(e=>{let t=e.stats,{min:n,max:r,totalValuesCount:i}=t,{avg:a,stddev:o,sum:s,variance:c,count:l}=t;return(n!==0||r!==0)&&(a=a===0?null:a,s=s===0?null:s,o=o===0?null:o,c=c===0?null:c,l=l===0?null:l),l??(s!=null&&a!=null?l=Math.round(s/a):i!=null&&(l=i)),{avg:a,count:l,max:r,min:n,stddev:o,sum:s,variance:c}})}async _getNormalizationTotal(e,t,n){let i={include:[`sum`]},a=(t?await this.workerClient.summaryStatistics({field:e,outStatisticTypes:i},t):await f({attribute:{field:e,outStatisticTypes:i},features:n})).sum;if(a==null)throw new r(`scene-layer-adapter:invalid`,`invalid normalizationTotal`);return a}async _getSummaryStatisticsFromMemory(e,t){let{view:n,field:r,normalizationField:i,valueExpression:a}=e,{featuresJSON:o,graphics:s}=await this._processStatsFromMemoryParams(e),c={field:r,valueExpression:a,normalizationType:e.normalizationType,normalizationField:i,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,outStatisticTypes:e.outStatisticTypes};return e.valueExpression&&n&&o&&(c.fieldType=t?.type?l.toJSON(t.type):null,c.viewInfoParams=w(n),c.timeZone=n.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(c.normalizationTotal=await this._getNormalizationTotal(r,o,s)),o?this.workerClient.summaryStatistics(c,o):f({attribute:c,features:s})}_getCachedStatisticsForUniqueValues(e,n){let i=this.layer,a=n?.name,o=n&&e.field?this.getFieldDomain(e.field):null;return e.valueExpression||e.sqlExpression||e.sqlWhere?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression' or 'sqlWhere' is specified`)):i.queryCachedStatistics(a,{signal:e.signal}).then(r=>{let o=r.stats;if(!o.mostFrequentValues)throw Error();let s=r.labels?.labels,c={},l=[],f=`countOF`+a;o.mostFrequentValues.forEach(e=>{let r=new t({attributes:{}});r.attributes[a]=n&&n.name!==i.objectIdField&&(u(n)||v(n))?Number(e.value):e.value,r.attributes[f]=e.count,l.push(r)}),s&&s.forEach(e=>{c[e.value]=e.label});let p=new d({features:l});return T(p,{layer:this,field:e.field,labels:c,filter:e.filter,view:e.view,signal:e.signal})}).then(t=>O(t,[o],e.returnAllCodedValues))}async _getUniqueValuesFromMemory(e,t){let{view:n,field:r,field2:i,field3:a,valueExpression:o,returnAllCodedValues:s}=e,c={field:r,field2:i,field3:a,fieldDelimiter:y,valueExpression:o,domains:t,returnAllCodedValues:s},{featuresJSON:l,graphics:u}=await this._processStatsFromMemoryParams(e);return e.valueExpression&&n&&l&&(c.viewInfoParams=w(n),c.timeZone=n.timeZone),l?this.workerClient.uniqueValues(c,l):p({attribute:c,features:u})}_getCachedStatisticsForHistogram(e,t){let n=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.normalizationType?Promise.reject(new r(`scene-layer-adapter:not-supported`,`This Layer does not support calculating statistics when 'valueExpression' or 'sqlExpression' or 'sqlWhere' or 'normalizationType' is specified`)):n.queryCachedStatistics(t&&t.name,{signal:e.signal}).then(t=>{let n=t.stats,{minValue:r,maxValue:i}=e,a=r??n.min,o=i??n.max,s=e.numBins||10,c=A(n.histogram,a,o,s);return E(c,a,o,s)})}async _getClassBreaksFromMemory(e){let{view:t,field:n,normalizationField:r,valueExpression:i}=e,{featuresJSON:a,graphics:o}=await this._processStatsFromMemoryParams(e),s={field:n,valueExpression:i,normalizationType:e.normalizationType,normalizationField:r,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return e.valueExpression&&t&&a&&(s.viewInfoParams=w(t),s.timeZone=t.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(s.normalizationTotal=await this._getNormalizationTotal(n,a,o)),a?this.workerClient.classBreaks(s,a):m({attribute:s,features:o})}async _getHistogramFromMemory(e){let{view:t,field:n}=e,{featuresJSON:r,graphics:i}=await this._processStatsFromMemoryParams(e),a={field:n,valueExpression:e.valueExpression,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numBins:e.numBins};return e.valueExpression&&t&&r&&(a.viewInfoParams=w(t),a.timeZone=t.timeZone),e.normalizationType===`percent-of-total`&&e.normalizationTotal==null&&(a.normalizationTotal=await this._getNormalizationTotal(n,r,i)),r?this.workerClient.histogram(a,r):h({attribute:a,features:i})}getField(e){return this.layer.getField(e??``)}getFieldUsageInfo(e){let t=this.getField(e);if(!t)return null;let n=this.layer.getFieldUsageInfo(t.name);return{supportsLabelingInfo:n.supportsLabelingInfo,supportsPopupTemplate:n.supportsPopupTemplate,supportsRenderer:n.supportsRenderer,supportsLayerQuery:n.supportsLayerQuery,supportsStatistics:!0}}getFieldDomain(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.getFieldDomain(e,t):null}createQuery(){return this.layer.createQuery()}summaryStatistics(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.summaryStatistics(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return this._hasCachedStatistics(t?.name)?this._getCachedStatistics(e,t).catch(()=>(a(e.signal),this._getSummaryStatisticsFromMemory(e,t))):this._getSummaryStatisticsFromMemory(e,t)}async uniqueValues(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.uniqueValues(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);let t=await D(e,this),{field:n,field2:i}=e,o=n&&i,s=this.getField(n);return!o&&s&&this._hasCachedStatistics(s.name)?this._getCachedStatisticsForUniqueValues(e,s).catch(()=>(a(e.signal),this._getUniqueValuesFromMemory(e,t))):this._getUniqueValuesFromMemory(e,t)}histogram(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.histogram(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return t&&this._hasCachedStatistics(t.name)?this._getCachedStatisticsForHistogram(e,t).catch(()=>(a(e.signal),this._getHistogramFromMemory(e))):this._getHistogramFromMemory(e)}classBreaks(e){let t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.classBreaks(e);if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);return this._hasCachedStatistics(t?.name)?Promise.reject(new r(`scene-layer-adapter:not-supported`,`Cached stats not supported`)):this._getClassBreaksFromMemory(e)}queryFeatureCount(e){return this._featureLayerAdapter?this._featureLayerAdapter.queryFeatureCount(e):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support count query`))}generateRenderer(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.generateRenderer(e,t):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support generateRenderer operation`))}heatmapStatistics(e){return this._featureLayerAdapter?this._featureLayerAdapter.heatmapStatistics(e):Promise.reject(new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support heatmapStatistics operation`))}async predominantCategories(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.predominantCategories(e);throw new r(`scene-layer-adapter:not-supported`,`SceneLayer without associated FeatureLayer does not support predominantCategories`)}async getSampleFeatures(e,t){if(e.filter)throw new r(`scene-layer-adapter:not-supported`,`filter is not supported`);let{view:i,sampleSize:o,requiredFields:s,returnGeometry:c,signal:l}=e,u=t===`json`,d=this.createQuery();d.outFields=s,d.returnGeometry=!!c,d.where=null,d.num=o;let f=[];try{if(f=u?await this._fetchFeaturesJSONFromMemory(i,d,s):await this._fetchFeaturesFromMemory(i,d,s),f.length&&o!=null&&o>0&&o<=f.length)return n(f,o,1)}catch{a(l)}let p=null;if(this._featureLayerAdapter){let n={...e};delete n.view,p=await this._featureLayerAdapter.getSampleFeatures(n,t)}return p?.length?p:n(f,f.length,1)}load(e){let t=this.layer.load(e).then(async t=>{this.workerClient=g.getInstance(),await this.workerClient.open(e.signal);let n=t.associatedLayer;if(this.geometryType=t.geometryType,n!=null)return this._featureLayerAdapter=new b({layer:n}),this._featureLayerAdapter.load(e).then(()=>{this.objectIdField=this._featureLayerAdapter.objectIdField,this.supportsSQLExpression=this._featureLayerAdapter.supportsSQLExpression,this.minScale=this._featureLayerAdapter.minScale,this.maxScale=this._featureLayerAdapter.maxScale,this.fullExtent=this._featureLayerAdapter.fullExtent});this.objectIdField=t.objectIdField,this.supportsSQLExpression=!1,this.hasQueryEngine=!1,this.fullExtent=t.fullExtent});return this.addResolvingPromise(t),Promise.resolve(this)}};e([s({readOnly:!0})],k.prototype,`adapterName`,void 0),e([s({constructOnly:!0})],k.prototype,`layer`,void 0),k=e([c(`esri.smartMapping.support.adapters.SceneLayerAdapter`)],k);function A(e,n=e.minimum,r=e.maximum,i){let a=[];for(let e=0;e<i;e++)a[e]=0;let o=e.counts.length,s=e.minimum,c=e.maximum;for(let t=0;t<o;t++){let l=(t+.5)/o,u=((1-l)*s+l*c-n)/(r-n)*i;u>=0&&u<=i&&(a[u===i?i-1:Math.floor(u)]+=e.counts[t])}let l=[];return a.forEach((e,n)=>{let r=new t({attributes:{}});r.attributes.EXPR_1=n+1,r.attributes.countOFExpr=e,l.push(r)}),new d({features:l})}export{k as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as e}from"../../../../core/arrayUtils.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import n from"../../../../layers/support/CodedValue.js";import r from"../../../../layers/support/CodedValueDomain.js";import i from"../../../../layers/support/Field.js";import{isStringField as a,isTimeOnlyField as o,getAggregateFieldType as s}from"../../../../layers/support/fieldUtils.js";import c from"../../../../rest/support/PivotQuery.js";import l from"../../../../rest/support/StatisticDefinition.js";import u from"../../../../rest/support/UnPivotDefinition.js";import{noDominantCategoryField as d}from"../../../statistics/support/predominanceUtils.js";import{getSQLFilterForNormalization as f,mergeWhereClauses as p,getRangeExpr as m}from"../../../statistics/support/utils.js";import{isIntegerField as h,isAnyDateField as g,getDateDiffSQL as _,castIntegerFieldToFloat as v}from"../../utils.js";import{isNullCountSupported as y,statisticTypes as b,getEqualIntervalBins as x,processNullValue as S}from"../../../../statistics/utils.js";const C=/_value$/i,w=Math.LOG10E,T={SECOND:1e3,MINUTE:6e4,HOUR:36e5},E=10;function D(e){return e.map(e=>e.toJSON())}function O(e,t){let n=[],r=e.layer,i=`featureReduction`in r?r.featureReduction:null,a=i?.type===`binning`,o=i!=null&&`fields`in i?i.fields?.map(e=>e.name?.toLowerCase()).filter(Boolean):[];if(!a||!t)return n;for(let e of t)o.includes(e.toLowerCase())||n.push(e);return n}function k(e,t,n){let r=[];if(t)for(let i of t){let t=e.getField(i);t&&n&&`availableFields`in n&&!n.availableFields?.includes(t.name)&&r.push(t.name)}return r}function A(e,t){let n=e&&e.features;if(n?.length===0)return{avg:null,count:0,max:null,median:null,min:null,nullcount:0,stddev:null,sum:null,variance:null};let r=n?.[0]?.attributes,i={};for(let e in r)i[e.replace(C,``).toLowerCase()]=r[e];return i.totalcount!=null&&i.totalcount>=i.count&&(i.nullcount=i.totalcount-i.count),delete i.totalcount,i.min===i.max&&i.min!=null&&i.stddev==null&&(i.stddev=i.variance=0),t&&([`min`,`max`,`avg`,`stddev`,`sum`,`variance`].forEach(e=>{i[e]!=null&&(i[e]=Math.ceil(i[e]))}),i.min===i.max&&i.min!=null&&(i.avg=i.min,i.stddev=i.variance=0)),i}function j(e){let t=[],n=e.classBreaks,r=n[0].minValue,i=n[n.length-1].maxValue;return n.forEach(e=>{t.push([e.minValue,e.maxValue])}),{min:r,max:i,intervals:t,sqlExpr:M({field:e.field,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,layer:e.layer}),excludeZerosExpr:e.where,normTotal:e.normalizationTotal}}function M(e){let{field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,layer:a}=e,o=h(a,t),s=t;return n===`percent-of-total`?s=`((${o?v(t):t} / ${i}) * 100)`:n===`log`?s=`(log(${t}) * ${w})`:n===`field`?s=`(${o?v(t):t} / ${r})`:n===`natural-log`?s=`(log(${o?v(t):t}))`:n===`square-root`&&(s=`(power(${o?v(t):t}, 0.5))`),s}function N(e,t){let n;if(t=t.toLowerCase(),e){for(let r in e)if(r.toLowerCase()!==t){n=e[r];break}}return n}function P(e,t){let n;if(t=t.toLowerCase(),e){for(let r in e)if(r.toLowerCase()===t){n=e[r];break}}return n}function F(e,t,n,r,i){let a={},o=`countOFExpr`;e&&e.features&&e.features.forEach(e=>{let t=e.attributes,n=N(t,o),r=P(t,o);n!=null&&r!=null&&n!==0&&(a[n]=r)});let s=[];return x(t,n,r).forEach((e,t)=>{let n=(t+1).toString();s.push({minValue:e[0],maxValue:e[1],count:a.hasOwnProperty(n)?a[n]:0})}),{bins:s,minValue:t,maxValue:n,normalizationTotal:i}}async function I(e,n){let r=e&&e.features,{field:i,field2:a,field3:o,fieldDelimiter:s,layer:c,view:l,signal:u,labels:d}=n,f=`countOF${i&&a?`Expr`:i||`Expr`}`,p={},m=!1;for(let e of r){let t=e.attributes,n=P(t,f),r=i?P(t,i):N(t,f),c=a?P(t,a):null,l=o?P(t,o):null;r===null&&n===0&&(m=!0),(r==null||typeof r==`string`&&r.trim()===``)&&(r=null),a&&(c==null||typeof c==`string`&&c.trim()===``)&&(c=null),o&&(l==null||typeof l==`string`&&l.trim()===``)&&(l=null);let u=r;a&&(u=`${S(u)}${s}${S(c)}`,o&&(u=`${u}${s}${S(l)}`)),p[u]==null?p[u]={count:n,data:u}:p[u].count=p[u].count+n}if(i&&m){let e=i+` is NULL`;try{let t=await c.queryFeatureCount({whereClause:e,view:l,signal:u});return p.null.count=p.null.count+t,L(p,d)}catch{return t(u),L(p,d)}}return L(p,d)}function L(e,t){if(t)for(let n in e)e[n].label=t[n];return{count:e}}async function R(e,t,i){let a=e?i.getField(e):null,o=a?i.getFieldDomain(a.name):null;if(o)return o;let{uniqueValueInfos:s}=await i.uniqueValues({field:e,sqlWhere:t.sqlWhere,features:t.features,useFeaturesInView:t.useFeaturesInView,view:t.view,signal:t.signal}),c=s.map(e=>new n({code:e.value}));return new r({codedValues:c})}async function z(e,t){if(!e.returnAllCodedValues)return[];let{field:n,field2:r,field3:i}=e;if(n&&!r){let e=n?t.getField(n):null,r=e?t.getFieldDomain(e.name):null;return r?[r]:[]}let a=[];return n&&(a.push(R(n,e,t)),r&&(a.push(R(r,e,t)),i&&a.push(R(i,e,t)))),Promise.all(a)}function B(e,t){return _(e,new Date(0),t,`milliseconds`).sqlExpression}function V(e,t){return`EXTRACT(${t} FROM ${e}) * ${T[t]}`}function H(e){return e?v([`HOUR`,`MINUTE`,`SECOND`].map(t=>`(${V(e,t)})`).join(` + `)):null}function U(e){return{viewingMode:e.type===`2d`?`map`:e.viewingMode,scale:e.scale,spatialReference:e.spatialReference?.toJSON()}}function W(e,t){let n=new Set(e.map(e=>e.value)),r=t.filter(e=>!n.has(e));for(let t of r)e.push({value:t,count:0});e.sort((e,n)=>t.indexOf(e.value)-t.indexOf(n.value));for(let t of e)t.value===d&&(t.value=null);return{predominantCategoryInfos:e}}function G(t){let n=`featureReduction`in t?t.featureReduction:null;return((n!=null&&`fields`in n?n.fields:null)??[]).map(e=>{let n=s(e,t.fieldsIndex);return n?new i({type:n,name:e.name,alias:e.alias}):null}).filter(e)}function K(e,t){return g(t)?B(e,t?.name):o(t)?H(t?.name):null}function q(e,t,n){let r=null;for(let i of n){let n=i?e.getField(i):null,a=Y(e,{...t,field:i,outStatisticTypes:{include:[`min`,`max`,`sum`,`count`]}},n,!0,!0);r?r.outStatistics=r.outStatistics.concat(a.outStatistics):r=a}return r.where=e.createQuery()?.where,r}function J(e,t,n,r){return t.map(t=>{let i=new l,a=null,o=null,s=`${t}_value${r?`_${r}`:``}`;if(t===`variance`)a=`var`,o=n;else if(t===`nullcount`){let t=e.objectIdField;a=`count`,o=t&&e.getField(t)?t:`1`,s=`totalcount_value`}else t===`median`?(a=`percentile-continuous`,o=n,i.statisticParameters={value:.5}):(a=t,o=n);return i.statisticType=a,i.onStatisticField=o,i.outStatisticFieldName=s,i})}function Y(e,t,n,r=!0,i=!1){let{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,minValue:u,maxValue:d,filter:h}=t,g=e.supportsSQLExpression?K(e,n)||t.sqlExpression:null,_=M({field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,layer:e}),v=g||_,x=v?m(v,u,d):null,S=f({field:o,normalizationField:c,normalizationType:s}),C=p(t.sqlWhere,S),w=p(C,x),T=y({normalizationField:c,normalizationType:s,sqlExpression:g,supportsSQLExpression:e.supportsSQLExpression,minValue:u,maxValue:d}),E=a(e.getField(o??void 0)),{include:D,exclude:O}=t.outStatisticTypes||{},k=b.filter(e=>(!D||D.includes(e))&&(!O||!O.includes(e))&&(e===`nullcount`?T:!E||e===`count`)&&(e!==`median`||r)),A=e.createQuery();return A.where=p(A.where,w),A.sqlFormat=g?`standard`:null,A.outStatistics=J(e,k,v,i?o:void 0),Z(A,h),A}function X(e,t,n=!0){let{fields:r,filter:i}=t,{include:a,exclude:o}=t.outStatisticTypes||{},s=b.filter(e=>(!a||a.includes(e))&&(!o||!o.includes(e))&&(e!==`median`||n)),l=new c;l.where=p(e.createQuery()?.where,t.sqlWhere)??void 0;let d=`new_value`;return l.outPivots=[new u({sourceFields:r,valueFieldName:d})],l.outStatistics=J(e,s,d),Z(l,i),l}function Z(e,t){t&&(e.geometry=t.geometry,e.spatialRelationship=t.spatialRelationship,e.timeExtent=e.timeExtent?.intersection(t.timeExtent)??t.timeExtent,e.distance=t.distance,e.units=t.units)}function Q(e,t){let{field:n,field2:r,field3:i,sqlExpression:a}=t,o=!!(n&&r),s=e.createQuery();return s.where=p(s.where,t.sqlWhere),s.sqlFormat=a?`standard`:null,s.outStatistics=[$(o?null:n,o?`1`:a)].filter(Boolean),s.groupByFieldsForStatistics=[n||a,r,i].filter(Boolean),Z(s,t.filter),s}function $(e,t){let n=`countOF`+(e||`Expr`),r=new l;return r.statisticType=`count`,r.onStatisticField=t?`1`:e,r.outStatisticFieldName=n,r}function ee(e,t,n,r=10,i,a,o){let{min:s,max:c,normTotal:l,excludeZerosExpr:u}=t,d=t.intervals||x(s,c,r);return te(e,d,t.sqlExpr||n,u,i,a,o).then(e=>({bins:e.map((e,t)=>({minValue:d[t][0],maxValue:d[t][1],count:e.status===`fulfilled`?e.value:0})),minValue:s,maxValue:c,normalizationTotal:l}))}function te(e,t,n,r,i,a,o){let s=[],c=t.length;for(let e=0;e<c;e++){let i=p(r,p(n+` >= `+t[e][0],t[e][1]===null?``:n+(e===c-1?` <= `:` < `)+t[e][1]));s.push(i)}return Promise.allSettled(s.map(t=>e.queryFeatureCount({whereClause:t,view:i,filter:a,signal:o})))}export{E as defaultNumBins,D as ensureFeaturesJSON,j as generateBinParams,ee as getBins,z as getDomainsForFields,G as getFeatureReductionFields,M as getFieldExpr,F as getHistogramFromFeatureSet,k as getMissingFields,O as getMissingFieldsForBinning,W as getPredominantCategoriesFromUVInfos,K as getSQLExpressionForDateOrTimeField,A as getSummaryStatisticsFromFeatureSet,X as getSummaryStatsPivotQuery,Y as getSummaryStatsQuery,q as getSummaryStatsQueryForFields,Q as getUVQuery,I as getUniqueValuesFromFeatureSet,U as getViewInfoParams,H as msForTimeOnlyFieldSQL,B as msSinceUnixEpochSQL,Z as updateQueryWithFeatureFilter};
2
+ import{isSome as e}from"../../../../core/arrayUtils.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import n from"../../../../layers/support/CodedValue.js";import r from"../../../../layers/support/CodedValueDomain.js";import i from"../../../../layers/support/Field.js";import{isStringField as a,isTimeOnlyField as o,getAggregateFieldType as s}from"../../../../layers/support/fieldUtils.js";import c from"../../../../rest/support/PivotQuery.js";import l from"../../../../rest/support/StatisticDefinition.js";import u from"../../../../rest/support/UnPivotDefinition.js";import{noDominantCategoryField as d}from"../../../statistics/support/predominanceUtils.js";import{getSQLFilterForNormalization as f,mergeWhereClauses as p,getRangeExpr as m}from"../../../statistics/support/utils.js";import{isIntegerField as h,isAnyDateField as g,getDateDiffSQL as _,castIntegerFieldToFloat as v}from"../../utils.js";import{isNullCountSupported as y,statisticTypes as b,getEqualIntervalBins as x,processNullValue as S}from"../../../../statistics/utils.js";const C=/_value$/i,w=Math.LOG10E,T={SECOND:1e3,MINUTE:6e4,HOUR:36e5},E=10;function D(e){return e.map(e=>e.toJSON())}function O(e,t){let n=[],r=e.layer,i=`featureReduction`in r?r.featureReduction:null,a=i?.type===`binning`,o=i!=null&&`fields`in i?i.fields?.map(e=>e.name?.toLowerCase()).filter(Boolean):[];if(!a||!t)return n;for(let e of t)o.includes(e.toLowerCase())||n.push(e);return n}function k(e,t,n){let r=[];if(t)for(let i of t){let t=e.getField(i);t&&n&&`availableFields`in n&&!n.availableFields?.includes(t.name)&&r.push(t.name)}return r}function A(e,t){let n=e&&e.features;if(n?.length===0)return{avg:null,count:0,max:null,median:null,min:null,nullcount:0,stddev:null,sum:null,variance:null};let r=n?.[0]?.attributes,i={};for(let e in r)i[e.replace(C,``).toLowerCase()]=r[e];return i.totalcount!=null&&i.totalcount>=i.count&&(i.nullcount=i.totalcount-i.count),delete i.totalcount,i.min===i.max&&i.min!=null&&i.stddev==null&&(i.stddev=i.variance=0),t&&([`min`,`max`,`avg`,`stddev`,`sum`,`variance`].forEach(e=>{i[e]!=null&&(i[e]=Math.ceil(i[e]))}),i.min===i.max&&i.min!=null&&(i.avg=i.min,i.stddev=i.variance=0)),i}function j(e){let t=[],n=e.classBreaks,r=n[0].minValue,i=n[n.length-1].maxValue;return n.forEach(e=>{t.push([e.minValue,e.maxValue])}),{min:r,max:i,intervals:t,sqlExpr:M({field:e.field,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,layer:e.layer}),excludeZerosExpr:e.where,normTotal:e.normalizationTotal}}function M(e){let{field:t,normalizationType:n,normalizationField:r,normalizationTotal:i,layer:a}=e,o=h(a,t),s=t;return n===`percent-of-total`?s=`((${o?v(t):t} / ${i}) * 100)`:n===`log`?s=`(log(${t}) * ${w})`:n===`field`?s=`(${o?v(t):t} / ${r})`:n===`natural-log`?s=`(log(${o?v(t):t}))`:n===`square-root`&&(s=`(power(${o?v(t):t}, 0.5))`),s}function N(e,t){let n;if(t=t.toLowerCase(),e){for(let r in e)if(r.toLowerCase()!==t){n=e[r];break}}return n}function P(e,t){let n;if(t=t.toLowerCase(),e){for(let r in e)if(r.toLowerCase()===t){n=e[r];break}}return n}function F(e,t,n,r,i){let a={},o=`countOFExpr`;e&&e.features&&e.features.forEach(e=>{let t=e.attributes,n=N(t,o),r=P(t,o);n!=null&&r!=null&&n!==0&&(a[n]=r)});let s=[];return x(t,n,r).forEach((e,t)=>{let n=(t+1).toString();s.push({minValue:e[0],maxValue:e[1],count:a.hasOwnProperty(n)?a[n]:0})}),{bins:s,minValue:t,maxValue:n,normalizationTotal:i}}async function I(e,n){let r=e&&e.features,{field:i,field2:a,field3:o,fieldDelimiter:s,filter:c,layer:l,view:u,signal:d,labels:f}=n,p=`countOF${i&&a?`Expr`:i||`Expr`}`,m={},h=!1;for(let e of r){let t=e.attributes,n=P(t,p),r=i?P(t,i):N(t,p),c=a?P(t,a):null,l=o?P(t,o):null;r===null&&n===0&&(h=!0),(r==null||typeof r==`string`&&r.trim()===``)&&(r=null),a&&(c==null||typeof c==`string`&&c.trim()===``)&&(c=null),o&&(l==null||typeof l==`string`&&l.trim()===``)&&(l=null);let u=r;a&&(u=`${S(u)}${s}${S(c)}`,o&&(u=`${u}${s}${S(l)}`)),m[u]==null?m[u]={count:n,data:u}:m[u].count=m[u].count+n}if(i&&h){let e=i+` is NULL`;try{let t=await l.queryFeatureCount({whereClause:e,filter:c,view:u,signal:d});return m.null.count=m.null.count+t,L(m,f)}catch{return t(d),L(m,f)}}return L(m,f)}function L(e,t){if(t)for(let n in e)e[n].label=t[n];return{count:e}}async function R(e,t,i){let a=e?i.getField(e):null,o=a?i.getFieldDomain(a.name):null;if(o)return o;let{uniqueValueInfos:s}=await i.uniqueValues({field:e,sqlWhere:t.sqlWhere,features:t.features,useFeaturesInView:t.useFeaturesInView,view:t.view,signal:t.signal}),c=s.map(e=>new n({code:e.value}));return new r({codedValues:c})}async function z(e,t){if(!e.returnAllCodedValues)return[];let{field:n,field2:r,field3:i}=e;if(n&&!r){let e=n?t.getField(n):null,r=e?t.getFieldDomain(e.name):null;return r?[r]:[]}let a=[];return n&&(a.push(R(n,e,t)),r&&(a.push(R(r,e,t)),i&&a.push(R(i,e,t)))),Promise.all(a)}function B(e,t){return _(e,new Date(0),t,`milliseconds`).sqlExpression}function V(e,t){return`EXTRACT(${t} FROM ${e}) * ${T[t]}`}function H(e){return e?v([`HOUR`,`MINUTE`,`SECOND`].map(t=>`(${V(e,t)})`).join(` + `)):null}function U(e){return{viewingMode:e.type===`2d`?`map`:e.viewingMode,scale:e.scale,spatialReference:e.spatialReference?.toJSON()}}function W(e,t){let n=new Set(e.map(e=>e.value)),r=t.filter(e=>!n.has(e));for(let t of r)e.push({value:t,count:0});e.sort((e,n)=>t.indexOf(e.value)-t.indexOf(n.value));for(let t of e)t.value===d&&(t.value=null);return{predominantCategoryInfos:e}}function G(t){let n=`featureReduction`in t?t.featureReduction:null;return((n!=null&&`fields`in n?n.fields:null)??[]).map(e=>{let n=s(e,t.fieldsIndex);return n?new i({type:n,name:e.name,alias:e.alias}):null}).filter(e)}function K(e,t){return g(t)?B(e,t?.name):o(t)?H(t?.name):null}function q(e,t,n){let r=null;for(let i of n){let n=i?e.getField(i):null,a=Y(e,{...t,field:i,outStatisticTypes:{include:[`min`,`max`,`sum`,`count`]}},n,!0,!0);r?r.outStatistics=r.outStatistics.concat(a.outStatistics):r=a}return r.where=e.createQuery()?.where,r}function J(e,t,n,r){return t.map(t=>{let i=new l,a=null,o=null,s=`${t}_value${r?`_${r}`:``}`;if(t===`variance`)a=`var`,o=n;else if(t===`nullcount`){let t=e.objectIdField;a=`count`,o=t&&e.getField(t)?t:`1`,s=`totalcount_value`}else t===`median`?(a=`percentile-continuous`,o=n,i.statisticParameters={value:.5}):(a=t,o=n);return i.statisticType=a,i.onStatisticField=o,i.outStatisticFieldName=s,i})}function Y(e,t,n,r=!0,i=!1){let{field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,minValue:u,maxValue:d,filter:h}=t,g=e.supportsSQLExpression?K(e,n)||t.sqlExpression:null,_=M({field:o,normalizationType:s,normalizationField:c,normalizationTotal:l,layer:e}),v=g||_,x=v?m(v,u,d):null,S=f({field:o,normalizationField:c,normalizationType:s}),C=p(t.sqlWhere,S),w=p(C,x),T=y({normalizationField:c,normalizationType:s,sqlExpression:g,supportsSQLExpression:e.supportsSQLExpression,minValue:u,maxValue:d}),E=a(e.getField(o??void 0)),{include:D,exclude:O}=t.outStatisticTypes||{},k=b.filter(e=>(!D||D.includes(e))&&(!O||!O.includes(e))&&(e===`nullcount`?T:!E||e===`count`)&&(e!==`median`||r)),A=e.createQuery();return A.where=p(A.where,w),A.sqlFormat=g?`standard`:null,A.outStatistics=J(e,k,v,i?o:void 0),Z(A,h),A}function X(e,t,n=!0){let{fields:r,filter:i}=t,{include:a,exclude:o}=t.outStatisticTypes||{},s=b.filter(e=>(!a||a.includes(e))&&(!o||!o.includes(e))&&(e!==`median`||n)),l=new c;l.where=p(e.createQuery()?.where,t.sqlWhere)??void 0;let d=`new_value`;return l.outPivots=[new u({sourceFields:r,valueFieldName:d})],l.outStatistics=J(e,s,d),Z(l,i),l}function Z(e,t){t&&(e.geometry=t.geometry,e.spatialRelationship=t.spatialRelationship,e.timeExtent=e.timeExtent?.intersection(t.timeExtent)??t.timeExtent,e.distance=t.distance,e.units=t.units)}function Q(e,t){let{field:n,field2:r,field3:i,sqlExpression:a}=t,o=!!(n&&r),s=e.createQuery();return s.where=p(s.where,t.sqlWhere),s.sqlFormat=a?`standard`:null,s.outStatistics=[$(o?null:n,o?`1`:a)].filter(Boolean),s.groupByFieldsForStatistics=[n||a,r,i].filter(Boolean),Z(s,t.filter),s}function $(e,t){let n=`countOF`+(e||`Expr`),r=new l;return r.statisticType=`count`,r.onStatisticField=t?`1`:e,r.outStatisticFieldName=n,r}function ee(e,t,n,r=10,i,a,o){let{min:s,max:c,normTotal:l,excludeZerosExpr:u}=t,d=t.intervals||x(s,c,r);return te(e,d,t.sqlExpr||n,u,i,a,o).then(e=>({bins:e.map((e,t)=>({minValue:d[t][0],maxValue:d[t][1],count:e.status===`fulfilled`?e.value:0})),minValue:s,maxValue:c,normalizationTotal:l}))}function te(e,t,n,r,i,a,o){let s=[],c=t.length;for(let e=0;e<c;e++){let i=p(r,p(n+` >= `+t[e][0],t[e][1]===null?``:n+(e===c-1?` <= `:` < `)+t[e][1]));s.push(i)}return Promise.allSettled(s.map(t=>e.queryFeatureCount({whereClause:t,view:i,filter:a,signal:o})))}export{E as defaultNumBins,D as ensureFeaturesJSON,j as generateBinParams,ee as getBins,z as getDomainsForFields,G as getFeatureReductionFields,M as getFieldExpr,F as getHistogramFromFeatureSet,k as getMissingFields,O as getMissingFieldsForBinning,W as getPredominantCategoriesFromUVInfos,K as getSQLExpressionForDateOrTimeField,A as getSummaryStatisticsFromFeatureSet,X as getSummaryStatsPivotQuery,Y as getSummaryStatsQuery,q as getSummaryStatsQueryForFields,Q as getUVQuery,I as getUniqueValuesFromFeatureSet,U as getViewInfoParams,H as msForTimeOnlyFieldSQL,B as msSinceUnixEpochSQL,Z as updateQueryWithFeatureFilter};
@@ -32,11 +32,12 @@ export interface ElevationInfoProperties<Modes extends ElevationInfoMode = Eleva
32
32
  *
33
33
  * > [!WARNING]
34
34
  * >
35
- * > If `elevationInfo` is not set, the elevation mode is picked on the fly for each feature:
36
- * > - Features with z-values default to `absolute-height`.
37
- * > - Features without z-values:
35
+ * > If `elevationInfo` is not set, the elevation mode is picked on the fly for each element:
36
+ * > - Elements with z-values default to `absolute-height`.
37
+ * > - Elements without z-values:
38
38
  * > - Polylines, polygons, and points drawn with `ObjectSymbol3DLayer` default to `on-the-ground`.
39
39
  * > - Points drawn with `IconSymbol3DLayer` default to `relative-to-ground`.
40
+ * > - Visibility analyses' observers and targets default to `on-the-ground`.
40
41
  * >
41
42
  * > Feature services do not persist `elevationInfo`, so elevation settings from publishing tools such as ArcGIS Pro are lost unless saved in a web scene.
42
43
  *