@arcgis/core 4.33.0-next.20250521 → 4.33.0-next.20250523

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 (520) hide show
  1. package/Map.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/analysis/DimensionAnalysis.js +1 -1
  4. package/analysis/LineOfSightAnalysis.js +1 -1
  5. package/analysis/ViewshedAnalysis.js +1 -1
  6. package/applications/Components/analysisUtils.d.ts +2 -0
  7. package/applications/Components/analysisUtils.js +1 -1
  8. package/arcade/Voxel.js +1 -1
  9. package/arcade/featureset/actions/GroupBy.js +1 -1
  10. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  11. package/arcade/functions/knowledgegraph.js +1 -1
  12. package/assets/esri/core/workers/RemoteClient.js +1 -1
  13. package/assets/esri/core/workers/chunks/{253bcc3cc7bc4c2dc6ea.js → 03db109e9b695528c35d.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{f74f8ed3f17713a208c3.js → 07e58dff44fcbb3b3539.js} +1 -1
  15. package/assets/esri/core/workers/chunks/09da6b3085fc84cd69d5.js +1 -0
  16. package/assets/esri/core/workers/chunks/09f76ca9b47b465c934f.js +1 -0
  17. package/assets/esri/core/workers/chunks/0a770f283eb77c8dc97a.js +1 -0
  18. package/assets/esri/core/workers/chunks/0b70b2ee62904318a12c.js +1 -0
  19. package/assets/esri/core/workers/chunks/0dcab04dd1feeb5521cf.js +1 -0
  20. package/assets/esri/core/workers/chunks/{8a2cee726b7843c7408a.js → 0fb5de3f8a4d69b2d514.js} +1 -1
  21. package/assets/esri/core/workers/chunks/0fd826e7f64a37aaaa1e.js +1 -0
  22. package/assets/esri/core/workers/chunks/28b1819bf744ce957dfd.js +2 -0
  23. package/assets/esri/core/workers/chunks/28b1819bf744ce957dfd.js.LICENSE.txt +33 -0
  24. package/assets/esri/core/workers/chunks/{7c819b3e6d69c526f4b2.js → 28e31ac00dc95a1318e9.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{234117cc5cb7c6863313.js → 2d90806faa4269828948.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{b53a7040a71b0f1f3854.js → 330f1996cfc3e9c952cc.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{0d23610475c85385fbff.js → 355e6bcdb401ada71f39.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{bba6d7615d8f3862fe70.js → 36f0046ff6b46adce7b7.js} +1 -1
  29. package/assets/esri/core/workers/chunks/397b15d46f22718c9f38.js +1 -0
  30. package/assets/esri/core/workers/chunks/{b0522dffa5600345c07e.js → 3e85e63148b5e93d3074.js} +1 -1
  31. package/assets/esri/core/workers/chunks/40f54c4f8ae63c6f3df9.js +1 -0
  32. package/assets/esri/core/workers/chunks/4193c52799aa3b6337c9.js +2 -0
  33. package/assets/esri/core/workers/chunks/{9588328d4ed6b0f04166.js.LICENSE.txt → 4193c52799aa3b6337c9.js.LICENSE.txt} +0 -34
  34. package/assets/esri/core/workers/chunks/{14b3c18581b31c93af82.js → 41cbba9b286cf5558a9c.js} +1 -1
  35. package/assets/esri/core/workers/chunks/42bb9bb6fe44a47d9b81.js +1 -0
  36. package/assets/esri/core/workers/chunks/4dd0a5f327fa5fc7249d.js +1 -0
  37. package/assets/esri/core/workers/chunks/{e2cada6644c49b1b6e79.js → 51ba7345c31e6eb79060.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{8a6aac37b3133de74cce.js → 51c31e6d014005107d42.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{66e79aa02b3aa12b3778.js → 5200be8bce60fa831026.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{6b23ca6570357f9fb724.js → 52a57106a41b8c9483d7.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{585c7b485c42555ec554.js → 61f9747c960d959b571b.js} +2 -2
  42. package/assets/esri/core/workers/chunks/{9fc35ec8185beba96715.js → 632d1a1287dde980479e.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{5c8d52b72a3bea4202ac.js → 634a418310e44e2436e0.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{1d043965dcdc11b3aeaa.js → 63852887b3f07d50f7c9.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{c16e0da7a19310c71e8b.js → 677af0281e4fc9f3bd98.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{6ecc3a3737ae8622dfa4.js → 7b12607633bbdc318936.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{83fcc6f770ad084b8ab9.js → 86023cc5ccbc7ac43479.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{d839a237d5edc243d645.js → 8aa8f9986b966ccb64e2.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{12e99071f6582f6caeaf.js → 8b3d1973eb75b81b0fb4.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{67338948e470c1251d8a.js → 8d14e957219364a81d5f.js} +3 -3
  51. package/assets/esri/core/workers/chunks/92a5dccb328229a9336b.js +1 -0
  52. package/assets/esri/core/workers/chunks/{631205dc4d73d49ec9ed.js → 95507ff0a243e451b99e.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{1051a5a57b2fb843a555.js → 9cd55043f3d789f41815.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{2b1486a466760d2152f5.js → a0f2df8ca7cd14bfa013.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{06eb4832b6c86744e52e.js → aba19485b6cdcb70dac6.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{cc4a6f4000cb6680be48.js → ac2607f1e8cd2e99907c.js} +2 -2
  57. package/assets/esri/core/workers/chunks/{9a06476b834584d00d5c.js → b160dcbea6256e0cf689.js} +1 -1
  58. package/assets/esri/core/workers/chunks/b2a6afa0cd537805b4b8.js +1 -0
  59. package/assets/esri/core/workers/chunks/{571252c9822d73cf7b01.js → b845586219f284a215b2.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{97c148adf0347c69a79c.js → c9604f8df909ec4fad46.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{b87fec1753f164c845c5.js → ca76950d81ab4ebb65e1.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{faa40ef04604c7cce706.js → cb63ea6a53d3c2fc3179.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{55f087bca75c3f2a4515.js → d3c0d7799c92c6f0e7d3.js} +1 -1
  64. package/assets/esri/core/workers/chunks/dbe10c20df7e0e563a0b.js +1 -0
  65. package/assets/esri/core/workers/chunks/{ca60b34c3e1ed2ff5934.js → dd2b316baae02bbdddac.js} +1 -1
  66. package/assets/esri/core/workers/chunks/df933eac03dc63064723.js +1 -0
  67. package/assets/esri/core/workers/chunks/e77371ddbaf4b2d9be8d.js +1 -0
  68. package/assets/esri/core/workers/chunks/{80b596496800e8d60eb8.js → ed75e0962358523f4439.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{19a58adc75a34f84b0ef.js → ee6240636d04d7d37b7b.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{0cf979a093e9744d1e80.js → ef7955a2509be0f03ca2.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{b5d68d8460b7c15001dd.js → f1c6df5cf2ccb6ac47a1.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{523046e04679e301797d.js → f3d97a4c4f433adbdab5.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{6c29a768f02dc7ce0ed6.js → fb9e9b9e567e32f37042.js} +1 -1
  74. package/assets/esri/themes/base/widgets/_Editor.scss +41 -2
  75. package/assets/esri/themes/base/widgets/_FeatureForm.scss +4 -0
  76. package/assets/esri/themes/base/widgets/_SelectionList.scss +21 -15
  77. package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +1 -0
  78. package/assets/esri/themes/dark/main.css +1 -1
  79. package/assets/esri/themes/light/main.css +1 -1
  80. package/assets/esri/themes/light/view.css +1 -1
  81. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_no.json +1 -1
  82. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  83. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  84. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  85. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  86. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  87. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  88. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  89. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  90. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  91. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  92. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  93. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  94. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  95. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  96. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  97. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  98. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  99. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  100. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  101. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  102. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  103. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  104. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  105. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  106. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  107. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  108. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  109. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  110. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  111. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  112. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  113. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  114. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  115. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  116. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  117. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  118. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  119. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  120. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  121. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  122. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  123. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  124. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  125. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  126. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  127. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  128. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  129. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  130. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  131. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  132. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  133. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  134. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  135. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  136. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  137. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  138. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  139. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  140. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  141. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  142. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  143. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  144. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  145. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  146. package/assets/esri/widgets/Editor/t9n/Editor_no.json +1 -1
  147. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  148. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  149. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  150. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  151. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  152. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  153. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  154. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  155. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  156. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  157. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  158. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  159. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  160. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  161. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  162. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  163. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm.json +1 -1
  164. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ar.json +1 -1
  165. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bg.json +1 -1
  166. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bs.json +1 -1
  167. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ca.json +1 -1
  168. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_cs.json +1 -1
  169. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_da.json +1 -1
  170. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_de.json +1 -1
  171. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_el.json +1 -1
  172. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_en.json +1 -1
  173. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_es.json +1 -1
  174. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_et.json +1 -1
  175. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fi.json +1 -1
  176. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fr.json +1 -1
  177. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_he.json +1 -1
  178. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hr.json +1 -1
  179. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hu.json +1 -1
  180. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_id.json +1 -1
  181. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_it.json +1 -1
  182. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ja.json +1 -1
  183. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ko.json +1 -1
  184. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lt.json +1 -1
  185. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lv.json +1 -1
  186. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_nl.json +1 -1
  187. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_no.json +1 -1
  188. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pl.json +1 -1
  189. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-BR.json +1 -1
  190. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-PT.json +1 -1
  191. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ro.json +1 -1
  192. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ru.json +1 -1
  193. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sk.json +1 -1
  194. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sl.json +1 -1
  195. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sr.json +1 -1
  196. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sv.json +1 -1
  197. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_th.json +1 -1
  198. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_tr.json +1 -1
  199. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_uk.json +1 -1
  200. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_vi.json +1 -1
  201. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-CN.json +1 -1
  202. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-HK.json +1 -1
  203. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-TW.json +1 -1
  204. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
  205. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
  206. package/assets/esri/widgets/Home/t9n/Home_pt-BR.json +1 -1
  207. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  208. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  209. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  210. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  211. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  212. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  213. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  214. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  215. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  216. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  217. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  218. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  219. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  220. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  221. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  222. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  223. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  224. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  225. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  226. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  227. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  228. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  229. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  230. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  231. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  232. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  233. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  234. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  235. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  236. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  237. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  238. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  239. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  240. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  241. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  242. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  243. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  244. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  245. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  246. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  247. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  248. package/chunks/ComponentShader.glsl.js +24 -15
  249. package/chunks/FocusAreaColor.glsl.js +10 -8
  250. package/chunks/persistableUrlUtils.js +1 -1
  251. package/core/accessorSupport/decorators/persistable.js +1 -1
  252. package/core/sanitizerUtils.js +5 -0
  253. package/editing/sharedTemplates/SharedTemplate.js +1 -1
  254. package/editing/sharedTemplates/templateDefinitions/FeatureTemplateDefinition.js +1 -1
  255. package/editing/sharedTemplates/templateDefinitions/GroupTemplateDefinition.js +1 -1
  256. package/editing/sharedTemplates/templateDefinitions/PresetTemplateDefinition.js +1 -1
  257. package/editing/sharedTemplates/templateDefinitions/parts/FeatureTemplateRelationshipPart.js +1 -1
  258. package/editing/sharedTemplates/templateDefinitions/parts/GroupTemplatePart.js +1 -1
  259. package/editing/sharedTemplates/templateDefinitions/parts/PresetTemplatePart.js +1 -1
  260. package/geometry/projection/projectPointToVector.js +1 -1
  261. package/geometry/projection/projectVectorToPoint.js +1 -1
  262. package/geometry/projection/projectVectorToVector.js +1 -1
  263. package/geometry/projection.js +1 -1
  264. package/geometry/projectionUtils.js +5 -0
  265. package/geometry/support/meshUtils/elevation.js +1 -1
  266. package/geometry/support/meshUtils/extent.js +1 -1
  267. package/interfaces.d.ts +436 -80
  268. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  269. package/layers/IntegratedMeshLayer.js +1 -1
  270. package/layers/MapNotesLayer.js +1 -1
  271. package/layers/OrientedImageryLayer.js +1 -1
  272. package/layers/RouteLayer.js +1 -1
  273. package/layers/VideoLayer.js +1 -1
  274. package/layers/WMSLayer.js +1 -1
  275. package/layers/graphics/applyEditsUtils.js +1 -1
  276. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  277. package/layers/graphics/data/QueryEngine.js +1 -1
  278. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  279. package/layers/graphics/data/projectionSupport.js +1 -1
  280. package/layers/graphics/data/queryUtils.js +1 -1
  281. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  282. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  283. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  284. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  285. package/layers/mixins/ArcGISImageService.js +1 -1
  286. package/layers/ogc/wfsUtils.js +1 -1
  287. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  288. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  289. package/layers/orientedImagery/core/utils.js +1 -1
  290. package/layers/orientedImagery/queries.js +1 -1
  291. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  292. package/layers/orientedImagery/transformations/utils.js +1 -1
  293. package/layers/support/ControlPointsGeoreference.js +1 -1
  294. package/layers/support/CornersGeoreference.js +1 -1
  295. package/layers/support/ElevationQuery.js +1 -1
  296. package/layers/support/ExtentAndRotationGeoreference.js +1 -1
  297. package/layers/support/GeoreferenceBase.js +1 -1
  298. package/layers/support/LocalMediaElementSource.js +1 -1
  299. package/layers/support/MediaElementView.js +1 -1
  300. package/layers/support/PolygonCollection.js +1 -1
  301. package/layers/support/SceneModification.js +1 -1
  302. package/layers/support/Sublayer.js +1 -1
  303. package/layers/support/VideoElement.js +1 -1
  304. package/layers/support/capabilities.js +1 -1
  305. package/layers/support/rasterFunctions/clipUtils.js +1 -1
  306. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  307. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  308. package/layers/video/VideoController.js +1 -1
  309. package/libs/maquette/projection.js +1 -1
  310. package/networks/UnitIdentifierManager.js +5 -0
  311. package/networks/support/UNTraceConfiguration.js +1 -1
  312. package/package.json +1 -1
  313. package/portal/schemas/definitions.js +1 -1
  314. package/portal/schemas/webScene.js +1 -1
  315. package/portal/support/portalItemUtils.js +1 -1
  316. package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
  317. package/rest/featureService/FeatureService.js +1 -1
  318. package/rest/knowledgeGraph/GraphAddNamedTypesResult.d.ts +4 -0
  319. package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.d.ts +4 -0
  320. package/rest/knowledgeGraphService.d.ts +2 -0
  321. package/rest/networks/unitIdentifiers/support/UnitQueryResult.js +1 -1
  322. package/rest/query/executeQuery.js +1 -1
  323. package/rest/query/executeQueryJSON.js +1 -1
  324. package/rest/query/executeQueryPBF.js +1 -1
  325. package/rest/query.js +1 -1
  326. package/smartMapping/renderers/size.js +1 -1
  327. package/smartMapping/renderers/support/spikeUtils.d.ts +4 -0
  328. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  329. package/smartMapping/statistics/histogram.js +1 -1
  330. package/smartMapping/statistics/summaryStatistics.js +1 -1
  331. package/support/persistableUrlUtils.js +1 -1
  332. package/support/revision.js +1 -1
  333. package/views/2d/LabelManager.js +1 -1
  334. package/views/2d/ViewStateManager.js +1 -1
  335. package/views/2d/constraints/GeometryConstraint.js +1 -1
  336. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  337. package/views/2d/engine/vectorTiles/decluttering/SymbolDeclutterer.js +1 -1
  338. package/views/2d/engine/vectorTiles/decluttering/core.js +1 -1
  339. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  340. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  341. package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
  342. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  343. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  344. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
  345. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
  346. package/views/2d/grid/GridView2D.js +1 -1
  347. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  348. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  349. package/views/2d/layers/KMLLayerView2D.js +1 -1
  350. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  351. package/views/2d/layers/VideoLayerView2D.js +1 -1
  352. package/views/2d/layers/features/FeatureContainer.js +1 -1
  353. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  354. package/views/2d/layers/support/vectorTileDebugUtils.js +1 -1
  355. package/views/2d/viewpointUtils.js +1 -1
  356. package/views/3d/FocusAreasView.js +1 -1
  357. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  358. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  359. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  360. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  361. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  362. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  363. package/views/3d/analysis/support/projectionUtils.js +1 -1
  364. package/views/3d/environment/EnvironmentManager.js +1 -1
  365. package/views/3d/interactive/Manipulator3D.js +1 -1
  366. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  367. package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
  368. package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
  369. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  370. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  371. package/views/3d/layers/FeatureLayerView3D.js +1 -1
  372. package/views/3d/layers/FlowSubView3D.js +1 -1
  373. package/views/3d/layers/I3SMeshView3D.js +1 -1
  374. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  375. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  376. package/views/3d/layers/SceneLayerWorker.js +1 -1
  377. package/views/3d/layers/TileLayerView3D.js +1 -1
  378. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  379. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  380. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  381. package/views/3d/layers/graphics/focusAreaStyle.js +1 -1
  382. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  383. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  384. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  385. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  386. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  387. package/views/3d/layers/i3s/enums.js +1 -1
  388. package/views/3d/layers/support/FeatureTile.js +1 -1
  389. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  390. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  391. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  392. package/views/3d/state/ViewStateManager.js +1 -1
  393. package/views/3d/support/cameraUtils.js +1 -1
  394. package/views/3d/support/viewpointUtils.js +1 -1
  395. package/views/3d/terrain/ExtentHelper.js +1 -1
  396. package/views/3d/terrain/TerrainRenderer.js +1 -1
  397. package/views/3d/terrain/TextureFader.js +1 -1
  398. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  399. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  400. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  401. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  402. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  403. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  404. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  405. package/views/3d/webgl-engine/effects/focusArea/FocusAreaEffect.js +5 -0
  406. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  407. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  408. package/views/3d/webgl-engine/lib/RenderSlot.js +1 -1
  409. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  410. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  411. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  412. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  413. package/views/3d/webgl-engine/shaders/FocusAreaColor.glsl.js +1 -1
  414. package/views/FocusArea.js +1 -1
  415. package/views/FocusAreaOutline.js +1 -1
  416. package/views/FocusAreas.js +1 -1
  417. package/views/SceneView.js +1 -1
  418. package/views/VideoView.js +1 -1
  419. package/views/View2D.js +1 -1
  420. package/views/interactive/GraphicManipulator.js +1 -1
  421. package/views/interactive/dragEventPipeline.js +1 -1
  422. package/views/interactive/snapping/GridSnappingEngine.js +1 -1
  423. package/views/interactive/snapping/SnappingManager.js +1 -1
  424. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  425. package/views/layers/SceneLayerView.js +1 -1
  426. package/views/support/geodesicAreaMeasurementUtils.js +1 -1
  427. package/views/support/projectionUtils.js +1 -1
  428. package/views/ui/UI.js +1 -1
  429. package/views/webgl/FramebufferObject.js +1 -1
  430. package/views/webgl/RenderingContext.js +1 -1
  431. package/views/webgl/Texture.js +1 -1
  432. package/views/webgl/rasterUtils.js +1 -1
  433. package/webscene/Slide.js +1 -1
  434. package/webscene/support/analysisUtils.js +1 -1
  435. package/widgets/AreaMeasurement3D.js +1 -1
  436. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  437. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  438. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  439. package/widgets/CoordinateConversion/support/Format.js +1 -1
  440. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  441. package/widgets/DirectLineMeasurement3D.js +1 -1
  442. package/widgets/DirectionalPad.js +1 -1
  443. package/widgets/Editor/EditorViewModel.js +1 -1
  444. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  445. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  446. package/widgets/Editor/UpdateRecordWorkflowData.js +1 -1
  447. package/widgets/Editor/UpdateWorkflow.js +1 -1
  448. package/widgets/Editor/Upload.js +1 -1
  449. package/widgets/Editor/VisibleElements.js +1 -1
  450. package/widgets/Editor/components/FooterActions.js +1 -1
  451. package/widgets/Editor/components/Notices.js +1 -1
  452. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  453. package/widgets/Editor/css.js +1 -1
  454. package/widgets/Editor/workflowUtils.js +1 -1
  455. package/widgets/Editor.js +1 -1
  456. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  457. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  458. package/widgets/FeatureForm/TextElementInput.js +1 -1
  459. package/widgets/FeatureForm/css.js +1 -1
  460. package/widgets/FeatureForm.js +1 -1
  461. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  462. package/widgets/FeatureTable/FieldColumn.js +1 -1
  463. package/widgets/FeatureTable/Grid/Column.js +1 -1
  464. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  465. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
  466. package/widgets/FeatureTable/support/exportUtils.js +1 -1
  467. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  468. package/widgets/FeatureTable.js +1 -1
  469. package/widgets/Features/FeaturesViewModel.js +1 -1
  470. package/widgets/LineOfSight.js +1 -1
  471. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  472. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
  473. package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
  474. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  475. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  476. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  477. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  478. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  479. package/widgets/OrientedImageryViewer/components/NavigationAction.js +5 -0
  480. package/widgets/OrientedImageryViewer/components/NavigationActions.js +1 -1
  481. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +5 -0
  482. package/widgets/OrientedImageryViewer/constants.js +1 -1
  483. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  484. package/widgets/OrientedImageryViewer.js +1 -1
  485. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  486. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  487. package/widgets/Sketch/SketchViewModel.js +1 -1
  488. package/widgets/Sketch.js +1 -1
  489. package/widgets/Slice.js +1 -1
  490. package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
  491. package/widgets/support/AnalysisViewModel.js +1 -1
  492. package/widgets/support/AnchorElementViewModel.js +1 -1
  493. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  494. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  495. package/widgets/support/SelectionList/VisibleElements.js +1 -1
  496. package/widgets/support/SelectionList.js +1 -1
  497. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  498. package/widgets/support/SelectionToolbar/VisibleElements.js +1 -1
  499. package/widgets/support/SelectionToolbar.js +1 -1
  500. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  501. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  502. package/widgets/support/tests.js +1 -1
  503. package/widgets/support/widget.js +1 -1
  504. package/widgets/support/widgetUtils.js +1 -1
  505. package/assets/esri/core/workers/chunks/0c50ee1f3cdd30d96479.js +0 -1
  506. package/assets/esri/core/workers/chunks/133e4bde346828d4510b.js +0 -1
  507. package/assets/esri/core/workers/chunks/3a743653b786b010a57f.js +0 -1
  508. package/assets/esri/core/workers/chunks/5228d39c05d660a135b6.js +0 -1
  509. package/assets/esri/core/workers/chunks/5f4ca51b82daf0e51010.js +0 -1
  510. package/assets/esri/core/workers/chunks/6d1e1a4fcb90ea8b6848.js +0 -1
  511. package/assets/esri/core/workers/chunks/7e6141b5baae47682f97.js +0 -1
  512. package/assets/esri/core/workers/chunks/87fc7b6c3e2d4f7775e2.js +0 -1
  513. package/assets/esri/core/workers/chunks/8fda0a5b247385e68dc0.js +0 -1
  514. package/assets/esri/core/workers/chunks/938f1eebc48871be64e9.js +0 -1
  515. package/assets/esri/core/workers/chunks/9588328d4ed6b0f04166.js +0 -2
  516. package/assets/esri/core/workers/chunks/9839309d0cd804fe52c2.js +0 -1
  517. package/assets/esri/core/workers/chunks/9b610fbfcd47c3dde34d.js +0 -1
  518. package/assets/esri/core/workers/chunks/be2c8c0a8b2bce7979b6.js +0 -1
  519. package/assets/esri/core/workers/chunks/f218a190015de1444018.js +0 -1
  520. package/assets/esri/core/workers/chunks/f9567108862629f25c8b.js +0 -1
package/Map.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as s}from"./chunks/tslib.es6.js";import e from"./Basemap.js";import r from"./Ground.js";import o from"./core/Accessor.js";import t from"./core/CollectionFlattener.js";import a from"./core/Evented.js";import{destroyMaybe as i}from"./core/maybe.js";import{property as p}from"./core/accessorSupport/decorators/property.js";import{cast as l}from"./core/accessorSupport/decorators/cast.js";import"./core/has.js";import"./core/RandomLCG.js";import{subclass as n}from"./core/accessorSupport/decorators/subclass.js";import{isEditableLayer as m}from"./layers/support/editableLayers.js";import{createCache as d,destroyCache as c,basemapEnsureType as u}from"./support/basemapEnsureType.js";import{createFlattenedTablesCollection as y}from"./support/collectionUtils.js";import{ensureType as h}from"./support/groundUtils.js";import{LayersMixin as b}from"./support/LayersMixin.js";import{TablesMixin as f}from"./support/TablesMixin.js";import{FocusAreas as j}from"./views/FocusAreas.js";let L=class extends(f(b(a.EventedMixin(o)))){constructor(s){super(s),this.allLayers=new t({getCollections:()=>[this.basemap?.baseLayers,this.ground?.layers,this.layers,this.basemap?.referenceLayers],getChildrenFunction:s=>"layers"in s?s.layers:null}),this.focusAreas=new j,this.allTables=y(this),this.basemap=null,this.editableLayers=new t({getCollections:()=>[this.allLayers],itemFilterFunction:m}),this.ground=new r,this._basemapCache=d()}destroy(){c(this._basemapCache),this._basemapCache=null,this.allLayers.destroy(),this.allTables.destroy(),this.editableLayers.destroy(),this.basemap=i(this.basemap),i(this.ground),this._set("ground",null)}castBasemap(s){return u(s,this._basemapCache)}castGround(s){const e=h(s);return e??this._get("ground")}findLayerById(s){return this.allLayers.find((e=>e.id===s))}findTableById(s){return this.allTables.find((e=>e.id===s))}};s([p({readOnly:!0,dependsOn:[]})],L.prototype,"allLayers",void 0),s([p({type:j,json:{write:!1}})],L.prototype,"focusAreas",void 0),s([p({readOnly:!0})],L.prototype,"allTables",void 0),s([p({type:e,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],L.prototype,"basemap",void 0),s([l("basemap")],L.prototype,"castBasemap",null),s([p({readOnly:!0})],L.prototype,"editableLayers",void 0),s([p({type:r,nonNullable:!0})],L.prototype,"ground",void 0),s([l("ground")],L.prototype,"castGround",null),s([p()],L.prototype,"undoRedo",void 0),L=s([n("esri.Map")],L);const g=L;export{g as default};
5
+ import{_ as s}from"./chunks/tslib.es6.js";import e from"./Basemap.js";import r from"./Ground.js";import o from"./core/Accessor.js";import t from"./core/CollectionFlattener.js";import a from"./core/Evented.js";import{destroyMaybe as i}from"./core/maybe.js";import{property as p}from"./core/accessorSupport/decorators/property.js";import{cast as l}from"./core/accessorSupport/decorators/cast.js";import"./core/has.js";import"./core/RandomLCG.js";import{subclass as n}from"./core/accessorSupport/decorators/subclass.js";import{isEditableLayer as m}from"./layers/support/editableLayers.js";import{createCache as d,destroyCache as c,basemapEnsureType as u}from"./support/basemapEnsureType.js";import{createFlattenedTablesCollection as y}from"./support/collectionUtils.js";import{ensureType as h}from"./support/groundUtils.js";import{LayersMixin as b}from"./support/LayersMixin.js";import{TablesMixin as f}from"./support/TablesMixin.js";import{FocusAreas as j}from"./views/FocusAreas.js";let L=class extends(f(b(a.EventedMixin(o)))){constructor(s){super(s),this.allLayers=new t({getCollections:()=>[this.basemap?.baseLayers,this.ground?.layers,this.layers,this.basemap?.referenceLayers],getChildrenFunction:s=>"layers"in s?s.layers:null}),this.focusAreas=new j,this.allTables=y(this),this.basemap=null,this.editableLayers=new t({getCollections:()=>[this.allLayers],itemFilterFunction:m}),this.ground=new r,this._basemapCache=d()}destroy(){c(this._basemapCache),this._basemapCache=null,this.focusAreas.destroy(),this.allLayers.destroy(),this.allTables.destroy(),this.editableLayers.destroy(),this.basemap=i(this.basemap),i(this.ground),this._set("ground",null)}castBasemap(s){return u(s,this._basemapCache)}castGround(s){const e=h(s);return e??this._get("ground")}findLayerById(s){return this.allLayers.find((e=>e.id===s))}findTableById(s){return this.allTables.find((e=>e.id===s))}};s([p({readOnly:!0,dependsOn:[]})],L.prototype,"allLayers",void 0),s([p({type:j,nonNullable:!0,json:{write:!0}})],L.prototype,"focusAreas",void 0),s([p({readOnly:!0})],L.prototype,"allTables",void 0),s([p({type:e,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],L.prototype,"basemap",void 0),s([l("basemap")],L.prototype,"castBasemap",null),s([p({readOnly:!0})],L.prototype,"editableLayers",void 0),s([p({type:r,nonNullable:!0})],L.prototype,"ground",void 0),s([l("ground")],L.prototype,"castGround",null),s([p()],L.prototype,"undoRedo",void 0),L=s([n("esri.Map")],L);const g=L;export{g as default};
package/WebScene.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./core/Collection.js";import o from"./core/Error.js";import{clone as s}from"./core/lang.js";import a from"./core/Loadable.js";import{loadAll as n}from"./core/loadAll.js";import l from"./core/Logger.js";import{destroyMaybe as p}from"./core/maybe.js";import{MultiOriginJSONMixin as c,MultiOriginJSONSupport as d}from"./core/MultiOriginJSONSupport.js";import h from"./core/Promise.js";import{debounce as u}from"./core/promiseUtils.js";import{on as m,watch as y}from"./core/reactiveUtils.js";import{urlToObject as w,addQueryParameter as f}from"./core/urlUtils.js";import g from"./core/Warning.js";import{property as b}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import{reader as v}from"./core/accessorSupport/decorators/reader.js";import{subclass as _}from"./core/accessorSupport/decorators/subclass.js";import{writer as S}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as A}from"./core/accessorSupport/originUtils.js";import{readLoadable as I}from"./core/accessorSupport/read.js";import j from"./geometry/Extent.js";import L from"./geometry/HeightModelInfo.js";import{canProjectWithoutEngine as V}from"./geometry/projection.js";import P from"./geometry/SpatialReference.js";import{validateWebSceneError as R}from"./geometry/support/heightModelInfoUtils.js";import{fromJSON as E}from"./geometry/support/jsonUtils.js";import{isEarth as M}from"./geometry/support/spatialReferenceUtils.js";import O from"./portal/Portal.js";import U from"./portal/PortalItem.js";import{createForItemWrite as C}from"./portal/support/jsonContext.js";import{toggleTypeKeyword as T,typeKeyword as N}from"./portal/support/portalItemUtils.js";import{hasDeveloperBasemapLayer as x}from"./support/basemapUtils.js";import G from"./support/MapFloorInfo.js";import{WebSceneTag as F}from"./support/tagSymbols.js";import{createSchemaValidationError as W}from"./support/webSceneUtils.js";import{ViewingMode as $}from"./views/ViewingMode.js";import{isSpatialReferenceSupported as J}from"./views/support/spatialReferenceSupport.js";import{SaveOperationType as k}from"./webdoc/interfaces.js";import B from"./webdoc/Widgets.js";import{updateItemWithResources as q,saveResources as H}from"./webdoc/support/resourceUtils.js";import{evaluateWriteErrors as D}from"./webdoc/support/saveUtils.js";import{getOptimalThumbnailSize as z}from"./webdoc/support/thumbnailUtils.js";import{isCopyAllowed as K,initializeNewItem as Q}from"./webdoc/support/webdocSaveUtils.js";import X from"./webscene/ApplicationProperties.js";import Y from"./webscene/Environment.js";import Z from"./webscene/InitialViewProperties.js";import ee from"./webscene/Presentation.js";import te from"./webscene/TransportationNetwork.js";import{Version as re}from"./webscene/Version.js";import{alphaCutoff as ie}from"./webscene/support/AlphaCutoff.js";import{getLoader as oe}from"./webscene/support/schemaValidatorLoader.js";var se;const ae=new re(1,37),ne=()=>{const e=8,t=[],r=ae.major;for(let i=e;i<=ae.minor;i++)t.push(`${r}.${i}`);return t},le="Web Scene";let pe=class extends(a.LoadableMixin(h.EsriPromiseMixin(c(r)))){static{se=F}constructor(e){super(e),this[se]=!0,this._layersIdGCTimeoutId=void 0,this._updateFromPromise=null,this._afterLoadHooks=[],this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=void 0,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new ee,this.initialViewProperties=new Z,this.portalItem=null,this.resourceInfo=null,this.widgets=null,this._debouncedSaveOperations=u((async(e,t,r)=>{switch(e){case k.SAVE:return this._saveImpl(t);case k.SAVE_AS:return this._saveAsImpl(r,t)}})),this._loadContext={origin:"web-scene",initiator:this,hooks:{onAfterLoad:e=>{this._afterLoadHooks.push(e)}}},this._resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch((e=>{l.getLogger(this).error("#load()","Failed to load web scene",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this.addHandles(m((()=>this.allLayers),"change",(()=>this._scheduleLayersIdGC())))}destroy(){this._unscheduleLayersIdGC(),this.presentation&&this.presentation.destroy(),this.portalItem=p(this.portalItem)}writeClippingArea(e,t){t.clippingArea||(t.clippingArea={}),t.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,t){return!!t.clippingArea&&!!t.clippingArea.clip}writeClippingEnabled(e,t){this.clippingArea&&(t.clippingArea||(t.clippingArea={}),t.clippingArea.clip=e)}writeLayers(e,t,r,i){t[r]=this._layersToJSON(e,"operational-layers",i)}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new re(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${ae.major}.${ae.minor}`}writeTables(e,t,r,i){const o=this._layersToJSON(e,"tables",i);o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem?.thumbnailUrl??null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}writeGround(e,t,r,i){t[r]=e?e.write({},i):{transparency:0,layers:[]}}readInitialViewProperties(e,t,r){const{viewingMode:i,spatialReference:o}=t,s=new Z,a={...t.initialState};return void 0!==o&&(a.spatialReference=o),void 0!==i&&(a.viewingMode=i),s.read(a,r),s}get spatialReference(){return this.initialViewProperties?.spatialReference??P.WebMercator}get viewingMode(){return this.initialViewProperties?.viewingMode??"global"}load(e){const t=this.ground;return this.addResolvingPromise(this._loadFromSource().then((()=>{t&&t!==this.ground&&t.destroy(),this._validateFeatureLayerSymbolVisibility()}))),Promise.resolve(this)}loadAll(){return n(this,(e=>{const t=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,t&&t.map((e=>e.basemap)),this.tables)}))}read(e,t){t??=this._loadContext,t.origin="web-scene";const r=this._isAuthoringAppVersionSetByUser,i=this._isAuthoringAppSetByUser;if(I(this,e,(t=>super.read(e,t)),t),i||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&this.sourceVersion?.supportsVisibleElevationLayersInSlides){const t=e.baseMap.elevationLayers.map((e=>({id:e.id}))),r=this.presentation.slides,i=t.filter((e=>!r.some((t=>t.visibleLayers.some((t=>t.id===e.id))))));r.forEach((e=>e.visibleLayers.addMany(i)))}}_writeBasemapElevationLayers(e){const t=e.ground?.layers;!e.baseMap&&t?.length&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=s(t))}_layersToJSON(e,t,r){const i={...r,layerContainerType:t};return e.map((e=>this._verifyWritableLayer(e,r)?e.write({},i):null)).filter((e=>!!e)).toArray()}_verifyWritableLayer(e,t){return!!e.persistenceEnabled&&("write"in e||(t?.messages&&t.messages.push(new o("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1))}write(e,t){if("loaded"!==this.loadStatus){const e=new o("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw l.getLogger(this).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),e}this._runLayersIdGC();const r=!t?.messages;t={messages:[],...t,origin:"web-scene"};const i=super.write(e,t);if(r){const e=t.messages?.filter((e=>"web-document-write:property-required"===e.name))??[];if(e.length){const t=new o("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:e});throw l.getLogger(this).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",e),t}}return this._writeBasemapElevationLayers(i),i}async save(e){return this._debouncedSaveOperations(k.SAVE,e)}async _saveImpl(e){if(!this.portalItem)throw new o("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene");if(this.portalItem?.type!==le)throw new o("webscene:portal-item-wrong-type",`Portal item needs to have type "${le}"`);const t=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls(C(this.portalItem,"web-scene",!0)),i=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(i,r,k.SAVE,e),this._updateTypeKeywords(this.portalItem),await q(this.portalItem,i,this._resourceReferences,r),A(r),t&&await t,await this._saveThumbnail(),this.portalItem}async saveAs(e,t){return this._debouncedSaveOperations(k.SAVE_AS,t,e)}async _saveAsImpl(e,t){let r=U.from(e);if(!r)throw new o("webscene:portal-item-required","saveAs requires a portal item to save to");r.id&&(r=r.clone(),r.id=null);const i=r.portal||O.getDefault();await this._ensureLoadBeforeSave(),r.type=le,r.portal=i;const s=this._enableVerifyItemRelativeUrls(C(r,"web-scene",!0)),a=this.write({},s);await Promise.all(s.resources.pendingOperations),await this._verifySaveAs(a,s,t);const n=this.thumbnailUrl,l=!this._isOverridden("thumbnailUrl");this._updateTypeKeywords(r),await i.signIn();const p=this.portalItem,c={item:p,authenticated:!(!p?.id||!p.portal.user)},{copyAllowed:h,itemReloaded:u}=await K(c,i);if(c.authenticated||=u,!h)throw new o(`${s.name}:save-as-copy-not-allowed`,"Owner of this map does not allow others to save a copy");const m={...t,copyAllResources:!0};return await Q(r,c,a,m)&&(this._resourceReferences.portalItem=r),await H(this._resourceReferences,s),this.portalItem=r,d.prototype.read.call(this,{version:a.version,authoringApp:a.authoringApp,authoringAppVersion:a.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl?w(r.itemUrl):void 0}),A(s),n&&(this.thumbnailUrl=l?f(n,"w","8192"):n),s.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl})),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}async _verifySave(e,t,r,i){if(!M(this.spatialReference))throw new o("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently.");const{ignoreUnsupported:s,requiredPropertyChecksDisabled:a,strictSchemaValidationEnabled:n}=i||{};D(t,{errorName:"webscene:save"},{ignoreUnsupported:s,supplementalUnsupportedErrors:["scenemodification:unsupported"],requiredPropertyChecksDisabled:a});const p=oe();if(n&&p){const t=(await p()).validate(e);if(!t.length)return;const i=`webscene did not validate:\n${t.join("\n")}`;l.getLogger(this).error(`${r===k.SAVE_AS?"saveAs":"save"}(): ${i}`);const s=t.map((e=>new o("webscene:schema-validation",e)));throw W(s)}}_verifySaveAs(e,t,r){return this._verifySave(e,t,k.SAVE_AS,r)}verifySaveAs(e){const t=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},t);return this._verifySaveAs(r,t,e)}canNotSaveAs(){return!1}async updateFrom(e,t={}){const r=this._updateFrom(e,t);this._updateFromPromise=r,await r;this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,t={}){if(await e.whenReady(),!t.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=Y.prototype.clone.apply(e.environment)),!t.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,this.initialViewProperties.timeExtent=e.timeExtent?.clone()??null,this.initialViewProperties.analyses.updateFrom(e),null!=e.clippingArea?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const e="visible";e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e])}if(!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this);(!1===t.thumbnailExcluded||null==t.thumbnailExcluded&&!t.viewpointExcluded)&&await this.updateThumbnail(e,{size:t.thumbnailSize})}async updateThumbnail(e,t){const r=z(e,t?.size),i=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=i.dataUrl}async _loadFromSource(){this.resourceInfo?await this._loadFromJSON(this.resourceInfo):this.portalItem?.id?await this._loadFromItem(this.portalItem):await this._loadObjectsWithLayers(),await this._afterLoad()}async _afterLoad(){for(;this._afterLoadHooks.length;){const e=this._afterLoadHooks.slice();this._afterLoadHooks.length=0,await Promise.allSettled(e.map((e=>e(this._loadContext))))}}_readAndLoadFromJSON(e){const t=this._loadContext,r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r)}_extractOperationalLayers(e){const t=[];if(!this.sourceVersion?.supportsGround&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)t.push(o);const r=[],i=e=>(e.layers&&(e.layers=e.layers.filter(i)),"ArcGISTiledElevationServiceLayer"!==e.layerType||(this.sourceVersion?.supportsGround||r.push(e),!1));return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(i):[],operationalElevationLayers:r,basemapElevationLayers:t}}async _loadFromJSON(e){const t=new i;await this._validateSpatialReference(),await this._validateHeightModelInfo();const{populateOperationalLayers:r}=await import("./layers/support/layersCreator.js"),{operationalLayers:o,operationalElevationLayers:s,basemapElevationLayers:a}=this._extractOperationalLayers(e),n=[],l={context:{...this._loadContext,layerContainerType:"operational-layers"}};if(this.portalItem&&(l.context.portal=this.portalItem.portal||O.getDefault()),a.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(r(this.ground.layers,a,e))}if(s.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(r(t,s,e))}o&&o.length>0&&n.push(r(this.layers,o,l)),e.tables?.length&&n.push(r(this.tables,e.tables,{...l,context:{...l.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"})),await Promise.allSettled(n),await this._loadObjectsWithLayers(),this.ground.layers.addMany(t.filter((e=>"base-elevation"===e.type||"elevation"===e.type)))}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[],t=[...this.allLayers.items];for(const{basemap:r}of this.presentation.slides.items)r&&(t.push(...r.baseLayers.items),t.push(...r.referenceLayers.items));for(const r of t)if("beforeSave"in r&&"function"==typeof r.beforeSave){const t=r.beforeSave();t&&e.push(t)}await Promise.allSettled(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach((t=>{t.basemap&&e.push(t.basemap.load())})),await Promise.allSettled(e)}async _loadFromItem(e){if(await e.load().catch((e=>{throw new o("webscene:load-portal-item","Failed to load portal item",{error:e})})),"Web Scene"!==e.type)throw new o("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r=this._loadContext;r.url=w(e.itemUrl),r.portal=e.portal||O.getDefault(),r.portalItem=e,r.readResourcePaths=[],await this._readAndLoadFromJSON(t),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]}}_validateSpatialReference(){const e=this.initialViewProperties,t=this._sceneSpatialReference;let r;if("local"!==e.viewingMode){if(!J(t,$.Global))return Promise.reject(new o("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||V(e,t)}else{if(!J(t,$.Local))return Promise.reject(new o("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||e.equals(t)}const i=e=>e?.camera?.position.spatialReference??e?.targetGeometry?.spatialReference,s=e.viewpoint,a=i(s);if(a&&!r(a))return Promise.reject(new o("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:a,sceneSpatialReference:t,viewingMode:e.viewingMode}));const n=this.presentation.slides.find((e=>!r(i(e.viewpoint))));if(n){const r=i(n.viewpoint);return Promise.reject(new o("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:r,sceneSpatialReference:t,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,t=R(this.heightModelInfo,e);return t?Promise.reject(t):Promise.resolve()}_validateFeatureLayerSymbolVisibility(){this.sourceVersion?.greaterEqual(1,35)||this.layers.forEach((e=>{"feature"===e.type&&e.addHandles(y((()=>e.loaded),(()=>{"on-the-ground"===e.elevationInfo?.mode&&"simple"===e.renderer?.type&&"polygon-3d"===e.renderer.symbol?.type&&e.renderer.symbol.symbolLayers.some((t=>"fill"===t.type&&null!=t.material&&((!t.material.color||t.material.color.a*e.opacity<ie)&&(e.loadWarnings.push(new g("feature-layer:invisible-draped-symbols","FeatureLayer has fully transparent symbols which will no longer render or highlight",{layer:e})),!0))))}),{once:!0,sync:!0}))}))}_validateJSON(e){const t=re.parse(e.version||"","webscene");return ae.validate(t),e.version=`${t.major}.${t.minor}`,1===t.major&&t.minor<=2&&(e.spatialReference=P.WebMercator.toJSON()),e}_updateTypeKeywords(e){T(e,N.LOCAL_SCENE,"local"===this.initialViewProperties.viewingMode),T(e,N.DEVELOPER_BASEMAP,x(this.basemap)||this.presentation.slides.some((({basemap:e})=>!!e&&x(e)))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||P.WebMercator}get _verifyItemRelativeRootPath(){return this.portalItem?.itemUrl?w(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const t=this._verifyItemRelativeRootPath;return t&&(e.verifyItemRelativeUrls={rootPath:t,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout((()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()}),3e3)}_runLayersIdGC(){this._unscheduleLayersIdGC();const e=this.applicationProperties?.viewing?.search,t=e=>this.allLayers.some((t=>t.id===e&&t.persistenceEnabled));e?.layers&&(e.layers=e.layers.filter((e=>t(e.id))));const r=this.presentation&&this.presentation.slides;r&&r.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>t(e.id))))}))}static fromJSON(e){if(!e)throw new o("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}static{this.version=`${ae.major}.${ae.minor}`}};e([b({type:X,json:{write:!0}})],pe.prototype,"applicationProperties",void 0),e([b({type:j,json:{read:{source:"clippingArea.geometry",reader:E},write:{target:"clippingArea.geometry"}}})],pe.prototype,"clippingArea",void 0),e([S("clippingArea")],pe.prototype,"writeClippingArea",null),e([b({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],pe.prototype,"clippingEnabled",void 0),e([v("clippingEnabled",["clippingArea"])],pe.prototype,"readClippingEnabled",null),e([S("clippingEnabled")],pe.prototype,"writeClippingEnabled",null),e([b({type:G,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],pe.prototype,"floorInfo",void 0),e([b({type:L,json:{write:!0}})],pe.prototype,"heightModelInfo",void 0),e([b({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],pe.prototype,"layers",void 0),e([S("layers")],pe.prototype,"writeLayers",null),e([b({readOnly:!0,type:re,json:{type:ne(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],pe.prototype,"sourceVersion",void 0),e([v("sourceVersion",["version"])],pe.prototype,"readSourceVersion",null),e([S("sourceVersion")],pe.prototype,"writeSourceVersion",null),e([b({json:{read:!1,write:{enabled:!0,ignoreOrigin:!0}}})],pe.prototype,"tables",void 0),e([S("tables")],pe.prototype,"writeTables",null),e([b()],pe.prototype,"thumbnailUrl",null),e([b({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],pe.prototype,"authoringApp",null),e([S("authoringApp")],pe.prototype,"writeAuthoringApp",null),e([b({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],pe.prototype,"authoringAppVersion",null),e([S("authoringAppVersion")],pe.prototype,"writeAuthoringAppVersion",null),e([b({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],pe.prototype,"ground",void 0),e([S("ground")],pe.prototype,"writeGround",null),e([b({type:i.ofType(te),json:{write:!0}})],pe.prototype,"transportationNetworks",void 0),e([b({type:ee,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(e,t,r,i)=>{if(e.slides&&e.slides.length>0){const r={...i,isPresentation:!0};t.presentation=e.write({},r)}}}}})],pe.prototype,"presentation",void 0),e([b({type:Z,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new Z({viewingMode:"global",spatialReference:P.WebMercator})}})],pe.prototype,"initialViewProperties",void 0),e([v("initialViewProperties",["initialState","spatialReference","viewingMode"])],pe.prototype,"readInitialViewProperties",null),e([b({type:P,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],pe.prototype,"spatialReference",null),e([b({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],pe.prototype,"viewingMode",null),e([b({type:U})],pe.prototype,"portalItem",void 0),e([b()],pe.prototype,"resourceInfo",void 0),e([b({type:B,json:{write:!0}})],pe.prototype,"widgets",void 0),pe=e([_("esri.WebScene")],pe);const ce=pe;export{ce as default};
5
+ import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./core/Collection.js";import o from"./core/Error.js";import{clone as s}from"./core/lang.js";import a from"./core/Loadable.js";import{loadAll as n}from"./core/loadAll.js";import l from"./core/Logger.js";import{destroyMaybe as p}from"./core/maybe.js";import{MultiOriginJSONMixin as c,MultiOriginJSONSupport as d}from"./core/MultiOriginJSONSupport.js";import h from"./core/Promise.js";import{debounce as u}from"./core/promiseUtils.js";import{on as m,watch as y}from"./core/reactiveUtils.js";import{urlToObject as w,addQueryParameter as f}from"./core/urlUtils.js";import g from"./core/Warning.js";import{property as b}from"./core/accessorSupport/decorators/property.js";import"./core/has.js";import{reader as v}from"./core/accessorSupport/decorators/reader.js";import{subclass as _}from"./core/accessorSupport/decorators/subclass.js";import{writer as S}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as A}from"./core/accessorSupport/originUtils.js";import{readLoadable as I}from"./core/accessorSupport/read.js";import j from"./geometry/Extent.js";import L from"./geometry/HeightModelInfo.js";import{canProjectWithoutEngine as V}from"./geometry/projectionUtils.js";import P from"./geometry/SpatialReference.js";import{validateWebSceneError as R}from"./geometry/support/heightModelInfoUtils.js";import{fromJSON as E}from"./geometry/support/jsonUtils.js";import{isEarth as M}from"./geometry/support/spatialReferenceUtils.js";import U from"./portal/Portal.js";import O from"./portal/PortalItem.js";import{createForItemWrite as C}from"./portal/support/jsonContext.js";import{toggleTypeKeyword as T,typeKeyword as N}from"./portal/support/portalItemUtils.js";import{hasDeveloperBasemapLayer as x}from"./support/basemapUtils.js";import G from"./support/MapFloorInfo.js";import{WebSceneTag as F}from"./support/tagSymbols.js";import{createSchemaValidationError as W}from"./support/webSceneUtils.js";import{ViewingMode as $}from"./views/ViewingMode.js";import{isSpatialReferenceSupported as J}from"./views/support/spatialReferenceSupport.js";import{SaveOperationType as k}from"./webdoc/interfaces.js";import B from"./webdoc/Widgets.js";import{updateItemWithResources as q,saveResources as H}from"./webdoc/support/resourceUtils.js";import{evaluateWriteErrors as D}from"./webdoc/support/saveUtils.js";import{getOptimalThumbnailSize as z}from"./webdoc/support/thumbnailUtils.js";import{isCopyAllowed as K,initializeNewItem as Q}from"./webdoc/support/webdocSaveUtils.js";import X from"./webscene/ApplicationProperties.js";import Y from"./webscene/Environment.js";import Z from"./webscene/InitialViewProperties.js";import ee from"./webscene/Presentation.js";import te from"./webscene/TransportationNetwork.js";import{Version as re}from"./webscene/Version.js";import{alphaCutoff as ie}from"./webscene/support/AlphaCutoff.js";import{getLoader as oe}from"./webscene/support/schemaValidatorLoader.js";var se;const ae=new re(1,37),ne=()=>{const e=8,t=[],r=ae.major;for(let i=e;i<=ae.minor;i++)t.push(`${r}.${i}`);return t},le="Web Scene";let pe=class extends(a.LoadableMixin(h.EsriPromiseMixin(c(r)))){static{se=F}constructor(e){super(e),this[se]=!0,this._layersIdGCTimeoutId=void 0,this._updateFromPromise=null,this._afterLoadHooks=[],this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=void 0,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new ee,this.initialViewProperties=new Z,this.portalItem=null,this.resourceInfo=null,this.widgets=null,this._debouncedSaveOperations=u((async(e,t,r)=>{switch(e){case k.SAVE:return this._saveImpl(t);case k.SAVE_AS:return this._saveAsImpl(r,t)}})),this._loadContext={origin:"web-scene",initiator:this,hooks:{onAfterLoad:e=>this._afterLoadHooks.push(e)}},this._resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch((e=>{l.getLogger(this).error("#load()","Failed to load web scene",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this.addHandles(m((()=>this.allLayers),"change",(()=>this._scheduleLayersIdGC())))}destroy(){this._unscheduleLayersIdGC(),this.presentation&&this.presentation.destroy(),this.portalItem=p(this.portalItem)}writeClippingArea(e,t){t.clippingArea||(t.clippingArea={}),t.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,t){return!!t.clippingArea&&!!t.clippingArea.clip}writeClippingEnabled(e,t){this.clippingArea&&(t.clippingArea||(t.clippingArea={}),t.clippingArea.clip=e)}writeLayers(e,t,r,i){t[r]=this._layersToJSON(e,"operational-layers",i)}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new re(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${ae.major}.${ae.minor}`}writeTables(e,t,r,i){const o=this._layersToJSON(e,"tables",i);o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem?.thumbnailUrl??null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}writeGround(e,t,r,i){t[r]=e?e.write({},i):{transparency:0,layers:[]}}readInitialViewProperties(e,t,r){const{viewingMode:i,spatialReference:o}=t,s=new Z,a={...t.initialState};return void 0!==o&&(a.spatialReference=o),void 0!==i&&(a.viewingMode=i),s.read(a,r),s}get spatialReference(){return this.initialViewProperties?.spatialReference??P.WebMercator}get viewingMode(){return this.initialViewProperties?.viewingMode??"global"}load(e){const t=this.ground;return this.addResolvingPromise(this._loadFromSource().then((()=>{t&&t!==this.ground&&t.destroy(),this._validateFeatureLayerSymbolVisibility()}))),Promise.resolve(this)}loadAll(){return n(this,(e=>{const t=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,t&&t.map((e=>e.basemap)),this.tables)}))}read(e,t){t??=this._loadContext,t.origin="web-scene";const r=this._isAuthoringAppVersionSetByUser,i=this._isAuthoringAppSetByUser;if(I(this,e,(t=>super.read(e,t)),t),i||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&this.sourceVersion?.supportsVisibleElevationLayersInSlides){const t=e.baseMap.elevationLayers.map((e=>({id:e.id}))),r=this.presentation.slides,i=t.filter((e=>!r.some((t=>t.visibleLayers.some((t=>t.id===e.id))))));r.forEach((e=>e.visibleLayers.addMany(i)))}}_writeBasemapElevationLayers(e){const t=e.ground?.layers;!e.baseMap&&t?.length&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=s(t))}_layersToJSON(e,t,r){const i={...r,layerContainerType:t};return e.map((e=>this._verifyWritableLayer(e,r)?e.write({},i):null)).filter((e=>!!e)).toArray()}_verifyWritableLayer(e,t){return!!e.persistenceEnabled&&("write"in e||(t?.messages&&t.messages.push(new o("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1))}write(e,t){if("loaded"!==this.loadStatus){const e=new o("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw l.getLogger(this).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),e}this._runLayersIdGC();const r=!t?.messages;t={messages:[],...t,origin:"web-scene"};const i=super.write(e,t);if(r){const e=t.messages?.filter((e=>"web-document-write:property-required"===e.name))??[];if(e.length){const t=new o("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:e});throw l.getLogger(this).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",e),t}}return this._writeBasemapElevationLayers(i),i}async save(e){return this._debouncedSaveOperations(k.SAVE,e)}async _saveImpl(e){if(!this.portalItem)throw new o("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene");if(this.portalItem?.type!==le)throw new o("webscene:portal-item-wrong-type",`Portal item needs to have type "${le}"`);const t=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls(C(this.portalItem,"web-scene",!0)),i=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(i,r,k.SAVE,e),this._updateTypeKeywords(this.portalItem),await q(this.portalItem,i,this._resourceReferences,r),A(r),t&&await t,await this._saveThumbnail(),this.portalItem}async saveAs(e,t){return this._debouncedSaveOperations(k.SAVE_AS,t,e)}async _saveAsImpl(e,t){let r=O.from(e);if(!r)throw new o("webscene:portal-item-required","saveAs requires a portal item to save to");r.id&&(r=r.clone(),r.id=null);const i=r.portal||U.getDefault();await this._ensureLoadBeforeSave(),r.type=le,r.portal=i;const s=this._enableVerifyItemRelativeUrls(C(r,"web-scene",!0)),a=this.write({},s);await Promise.all(s.resources.pendingOperations),await this._verifySaveAs(a,s,t);const n=this.thumbnailUrl,l=!this._isOverridden("thumbnailUrl");this._updateTypeKeywords(r),await i.signIn();const p=this.portalItem,c={item:p,authenticated:!(!p?.id||!p.portal.user)},{copyAllowed:h,itemReloaded:u}=await K(c,i);if(c.authenticated||=u,!h)throw new o(`${s.name}:save-as-copy-not-allowed`,"Owner of this map does not allow others to save a copy");const m={...t,copyAllResources:!0};return await Q(r,c,a,m)&&(this._resourceReferences.portalItem=r),await H(this._resourceReferences,s),this.portalItem=r,d.prototype.read.call(this,{version:a.version,authoringApp:a.authoringApp,authoringAppVersion:a.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl?w(r.itemUrl):void 0}),A(s),n&&(this.thumbnailUrl=l?f(n,"w","8192"):n),s.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl})),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}async _verifySave(e,t,r,i){if(!M(this.spatialReference))throw new o("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently.");const{ignoreUnsupported:s,requiredPropertyChecksDisabled:a,strictSchemaValidationEnabled:n}=i||{};D(t,{errorName:"webscene:save"},{ignoreUnsupported:s,supplementalUnsupportedErrors:["scenemodification:unsupported"],requiredPropertyChecksDisabled:a});const p=oe();if(n&&p){const t=(await p()).validate(e);if(!t.length)return;const i=`webscene did not validate:\n${t.join("\n")}`;l.getLogger(this).error(`${r===k.SAVE_AS?"saveAs":"save"}(): ${i}`);const s=t.map((e=>new o("webscene:schema-validation",e)));throw W(s)}}_verifySaveAs(e,t,r){return this._verifySave(e,t,k.SAVE_AS,r)}verifySaveAs(e){const t=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},t);return this._verifySaveAs(r,t,e)}canNotSaveAs(){return!1}async updateFrom(e,t={}){const r=this._updateFrom(e,t);this._updateFromPromise=r,await r;this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,t={}){if(await e.whenReady(),!t.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=Y.prototype.clone.apply(e.environment)),!t.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,this.initialViewProperties.timeExtent=e.timeExtent?.clone()??null,this.initialViewProperties.analyses.updateFrom(e),null!=e.clippingArea?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const e="visible";e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e])}if(!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this);(!1===t.thumbnailExcluded||null==t.thumbnailExcluded&&!t.viewpointExcluded)&&await this.updateThumbnail(e,{size:t.thumbnailSize})}async updateThumbnail(e,t){const r=z(e,t?.size),i=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=i.dataUrl}async _loadFromSource(){this.resourceInfo?await this._loadFromJSON(this.resourceInfo):this.portalItem?.id?await this._loadFromItem(this.portalItem):await this._loadObjectsWithLayers(),await this._afterLoad()}async _afterLoad(){for(;this._afterLoadHooks.length;){const e=this._afterLoadHooks.slice();this._afterLoadHooks.length=0,await Promise.allSettled(e.map((e=>e(this._loadContext))))}}_readAndLoadFromJSON(e){const t=this._loadContext,r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r)}_extractOperationalLayers(e){const t=[];if(!this.sourceVersion?.supportsGround&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)t.push(o);const r=[],i=e=>(e.layers&&(e.layers=e.layers.filter(i)),"ArcGISTiledElevationServiceLayer"!==e.layerType||(this.sourceVersion?.supportsGround||r.push(e),!1));return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(i):[],operationalElevationLayers:r,basemapElevationLayers:t}}async _loadFromJSON(e){const t=new i;await this._validateSpatialReference(),await this._validateHeightModelInfo();const{populateOperationalLayers:r}=await import("./layers/support/layersCreator.js"),{operationalLayers:o,operationalElevationLayers:s,basemapElevationLayers:a}=this._extractOperationalLayers(e),n=[],l={context:{...this._loadContext,layerContainerType:"operational-layers"}};if(this.portalItem&&(l.context.portal=this.portalItem.portal||U.getDefault()),a.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(r(this.ground.layers,a,e))}if(s.length>0){const e={...l,context:{...l.context,layerContainerType:"ground"}};e.defaultLayerType="ArcGISTiledElevationServiceLayer",n.push(r(t,s,e))}o&&o.length>0&&n.push(r(this.layers,o,l)),e.tables?.length&&n.push(r(this.tables,e.tables,{...l,context:{...l.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"})),await Promise.allSettled(n),await this._loadObjectsWithLayers(),this.ground.layers.addMany(t.filter((e=>"base-elevation"===e.type||"elevation"===e.type)))}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[],t=[...this.allLayers.items];for(const{basemap:r}of this.presentation.slides.items)r&&(t.push(...r.baseLayers.items),t.push(...r.referenceLayers.items));for(const r of t)if("beforeSave"in r&&"function"==typeof r.beforeSave){const t=r.beforeSave();t&&e.push(t)}await Promise.allSettled(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach((t=>{t.basemap&&e.push(t.basemap.load())})),await Promise.allSettled(e)}async _loadFromItem(e){if(await e.load().catch((e=>{throw new o("webscene:load-portal-item","Failed to load portal item",{error:e})})),"Web Scene"!==e.type)throw new o("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r=this._loadContext;r.url=w(e.itemUrl),r.portal=e.portal||U.getDefault(),r.portalItem=e,r.readResourcePaths=[],await this._readAndLoadFromJSON(t),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]}}_validateSpatialReference(){const e=this.initialViewProperties,t=this._sceneSpatialReference;let r;if("local"!==e.viewingMode){if(!J(t,$.Global))return Promise.reject(new o("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||V(e,t)}else{if(!J(t,$.Local))return Promise.reject(new o("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:t,viewingMode:e.viewingMode}));r=e=>!e||e.equals(t)}const i=e=>e?.camera?.position.spatialReference??e?.targetGeometry?.spatialReference,s=e.viewpoint,a=i(s);if(a&&!r(a))return Promise.reject(new o("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:a,sceneSpatialReference:t,viewingMode:e.viewingMode}));const n=this.presentation.slides.find((e=>!r(i(e.viewpoint))));if(n){const r=i(n.viewpoint);return Promise.reject(new o("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:r,sceneSpatialReference:t,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,t=R(this.heightModelInfo,e);return t?Promise.reject(t):Promise.resolve()}_validateFeatureLayerSymbolVisibility(){this.sourceVersion?.greaterEqual(1,35)||this.layers.forEach((e=>{"feature"===e.type&&e.addHandles(y((()=>e.loaded),(()=>{"on-the-ground"===e.elevationInfo?.mode&&"simple"===e.renderer?.type&&"polygon-3d"===e.renderer.symbol?.type&&e.renderer.symbol.symbolLayers.some((t=>"fill"===t.type&&null!=t.material&&((!t.material.color||t.material.color.a*e.opacity<ie)&&(e.loadWarnings.push(new g("feature-layer:invisible-draped-symbols","FeatureLayer has fully transparent symbols which will no longer render or highlight",{layer:e})),!0))))}),{once:!0,sync:!0}))}))}_validateJSON(e){const t=re.parse(e.version||"","webscene");return ae.validate(t),e.version=`${t.major}.${t.minor}`,1===t.major&&t.minor<=2&&(e.spatialReference=P.WebMercator.toJSON()),e}_updateTypeKeywords(e){T(e,N.LOCAL_SCENE,"local"===this.initialViewProperties.viewingMode),T(e,N.DEVELOPER_BASEMAP,x(this.basemap)||this.presentation.slides.some((({basemap:e})=>!!e&&x(e)))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||P.WebMercator}get _verifyItemRelativeRootPath(){return this.portalItem?.itemUrl?w(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const t=this._verifyItemRelativeRootPath;return t&&(e.verifyItemRelativeUrls={rootPath:t,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout((()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()}),3e3)}_runLayersIdGC(){this._unscheduleLayersIdGC();const e=this.applicationProperties?.viewing?.search,t=e=>this.allLayers.some((t=>t.id===e&&t.persistenceEnabled));e?.layers&&(e.layers=e.layers.filter((e=>t(e.id))));const r=this.presentation&&this.presentation.slides;r&&r.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>t(e.id))))}))}static fromJSON(e){if(!e)throw new o("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}static{this.version=`${ae.major}.${ae.minor}`}};e([b({type:X,json:{write:!0}})],pe.prototype,"applicationProperties",void 0),e([b({type:j,json:{read:{source:"clippingArea.geometry",reader:E},write:{target:"clippingArea.geometry"}}})],pe.prototype,"clippingArea",void 0),e([S("clippingArea")],pe.prototype,"writeClippingArea",null),e([b({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],pe.prototype,"clippingEnabled",void 0),e([v("clippingEnabled",["clippingArea"])],pe.prototype,"readClippingEnabled",null),e([S("clippingEnabled")],pe.prototype,"writeClippingEnabled",null),e([b({type:G,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],pe.prototype,"floorInfo",void 0),e([b({type:L,json:{write:!0}})],pe.prototype,"heightModelInfo",void 0),e([b({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],pe.prototype,"layers",void 0),e([S("layers")],pe.prototype,"writeLayers",null),e([b({readOnly:!0,type:re,json:{type:ne(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],pe.prototype,"sourceVersion",void 0),e([v("sourceVersion",["version"])],pe.prototype,"readSourceVersion",null),e([S("sourceVersion")],pe.prototype,"writeSourceVersion",null),e([b({json:{read:!1,write:{enabled:!0,ignoreOrigin:!0}}})],pe.prototype,"tables",void 0),e([S("tables")],pe.prototype,"writeTables",null),e([b()],pe.prototype,"thumbnailUrl",null),e([b({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],pe.prototype,"authoringApp",null),e([S("authoringApp")],pe.prototype,"writeAuthoringApp",null),e([b({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],pe.prototype,"authoringAppVersion",null),e([S("authoringAppVersion")],pe.prototype,"writeAuthoringAppVersion",null),e([b({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],pe.prototype,"ground",void 0),e([S("ground")],pe.prototype,"writeGround",null),e([b({type:i.ofType(te),json:{write:!0}})],pe.prototype,"transportationNetworks",void 0),e([b({type:ee,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(e,t,r,i)=>{if(e.slides&&e.slides.length>0){const r={...i,isPresentation:!0};t.presentation=e.write({},r)}}}}})],pe.prototype,"presentation",void 0),e([b({type:Z,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new Z({viewingMode:"global",spatialReference:P.WebMercator})}})],pe.prototype,"initialViewProperties",void 0),e([v("initialViewProperties",["initialState","spatialReference","viewingMode"])],pe.prototype,"readInitialViewProperties",null),e([b({type:P,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],pe.prototype,"spatialReference",null),e([b({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],pe.prototype,"viewingMode",null),e([b({type:O})],pe.prototype,"portalItem",void 0),e([b()],pe.prototype,"resourceInfo",void 0),e([b({type:B,json:{write:!0}})],pe.prototype,"widgets",void 0),pe=e([_("esri.WebScene")],pe);const ce=pe;export{ce as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"./Analysis.js";import n from"./DimensionSimpleStyle.js";import o from"./LengthDimension.js";import s from"../core/Collection.js";import{referenceSetter as i,castForReferenceSetter as r}from"../core/collectionUtils.js";import{watch as l,syncAndInitial as p}from"../core/reactiveUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import a from"../geometry/Extent.js";import{projectOrLoadMany as c}from"../geometry/projection.js";const d=s.ofType(o);let y=class extends t{constructor(e){super(e),this.type="dimension",this.style=new n,this.extent=null}initialize(){this.addHandles(l((()=>this._computeExtent()),(e=>{null==e?.pending&&this._set("extent",null!=e?e.extent:null)}),p))}get dimensions(){return this._get("dimensions")||new d}set dimensions(e){this._set("dimensions",i(e,this.dimensions,d))}get spatialReference(){for(const e of this.dimensions){if(null!=e.startPoint)return e.startPoint.spatialReference;if(null!=e.endPoint)return e.endPoint.spatialReference}return null}get valid(){return this.dimensions.every((e=>e.valid))}async waitComputeExtent(){const e=this._computeExtent();return null!=e?e.pending:Promise.resolve()}_computeExtent(){const e=this.spatialReference;if(null==e)return{pending:null,extent:null};const t=[];for(const s of this.dimensions)null!=s.startPoint&&t.push(s.startPoint),null!=s.endPoint&&t.push(s.endPoint);const n=c(t,e);if(null!=n.pending)return{pending:n.pending,extent:null};let o=null;return null!=n.geometries&&(o=n.geometries.reduce(((e,t)=>null==e?null!=t?a.fromPoint(t):null:null!=t?e.union(a.fromPoint(t)):e),null)),{pending:null,extent:o}}clear(){this.dimensions.removeAll()}};e([m({type:["dimension"]})],y.prototype,"type",void 0),e([m({cast:r,type:d,nonNullable:!0})],y.prototype,"dimensions",null),e([m({readOnly:!0})],y.prototype,"spatialReference",null),e([m({types:{key:"type",base:null,typeMap:{simple:n}},nonNullable:!0})],y.prototype,"style",void 0),e([m({value:null,readOnly:!0})],y.prototype,"extent",void 0),e([m({readOnly:!0})],y.prototype,"valid",null),y=e([u("esri.analysis.DimensionAnalysis")],y);export{y as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"./Analysis.js";import n from"./DimensionSimpleStyle.js";import o from"./LengthDimension.js";import s from"../core/Collection.js";import{referenceSetter as i,castForReferenceSetter as l}from"../core/collectionUtils.js";import{watch as r,syncAndInitial as p}from"../core/reactiveUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import a from"../geometry/Extent.js";import{projectOrLoadMany as c}from"../geometry/projectionUtils.js";const d=s.ofType(o);let y=class extends t{constructor(e){super(e),this.type="dimension",this.style=new n,this.extent=null}initialize(){this.addHandles(r((()=>this._computeExtent()),(e=>{null==e?.pending&&this._set("extent",null!=e?e.extent:null)}),p))}get dimensions(){return this._get("dimensions")||new d}set dimensions(e){this._set("dimensions",i(e,this.dimensions,d))}get spatialReference(){for(const e of this.dimensions){if(null!=e.startPoint)return e.startPoint.spatialReference;if(null!=e.endPoint)return e.endPoint.spatialReference}return null}get valid(){return this.dimensions.every((e=>e.valid))}async waitComputeExtent(){const e=this._computeExtent();return null!=e?e.pending:Promise.resolve()}_computeExtent(){const e=this.spatialReference;if(null==e)return{pending:null,extent:null};const t=[];for(const s of this.dimensions)null!=s.startPoint&&t.push(s.startPoint),null!=s.endPoint&&t.push(s.endPoint);const n=c(t,e);if(null!=n.pending)return{pending:n.pending,extent:null};let o=null;return null!=n.geometries&&(o=n.geometries.reduce(((e,t)=>null==e?null!=t?a.fromPoint(t):null:null!=t?e.union(a.fromPoint(t)):e),null)),{pending:null,extent:o}}clear(){this.dimensions.removeAll()}};e([m({type:["dimension"]})],y.prototype,"type",void 0),e([m({cast:l,type:d,nonNullable:!0})],y.prototype,"dimensions",null),e([m({readOnly:!0})],y.prototype,"spatialReference",null),e([m({types:{key:"type",base:null,typeMap:{simple:n}},nonNullable:!0})],y.prototype,"style",void 0),e([m({value:null,readOnly:!0})],y.prototype,"extent",void 0),e([m({readOnly:!0})],y.prototype,"valid",null),y=e([u("esri.analysis.DimensionAnalysis")],y);export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import e from"./Analysis.js";import o from"./LineOfSightAnalysisObserver.js";import r from"./LineOfSightAnalysisTarget.js";import s from"../core/Collection.js";import{referenceSetter as i,castForReferenceSetter as n}from"../core/collectionUtils.js";import{watch as l,syncAndInitial as p}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{projectOrLoad as c}from"../geometry/projection.js";import{fromValues as m,expandWithVec3 as g,toExtent as f}from"../geometry/support/aaBoundingBox.js";import{getGeometryEffectiveElevationMode as h}from"../support/elevationInfoUtils.js";const y=s.ofType(r);let d=class extends e{constructor(t){super(t),this.type="line-of-sight",this.observer=null,this.extent=null}initialize(){this.addHandles(l((()=>this._computeExtent()),(t=>{null==t?.pending&&this._set("extent",null!=t?t.extent:null)}),p))}get targets(){return this._get("targets")||new y}set targets(t){this._set("targets",i(t,this.targets,y))}get spatialReference(){return null!=this.observer?.position?this.observer.position.spatialReference:null}get valid(){return null!=this.observer?.position}async waitComputeExtent(){const t=this._computeExtent();return null!=t?t.pending:Promise.resolve()}_computeExtent(){const t=this.spatialReference;if(null==this.observer?.position||null==t)return null;const e=t=>"absolute-height"===h(t.position,t.elevationInfo),o=this.observer.position,r=m(o.x,o.y,o.z,o.x,o.y,o.z);for(const i of this.targets)if(null!=i.position){const e=c(i.position,t);if(null!=e.pending)return{pending:e.pending,extent:null};if(null!=e.geometry){const{x:t,y:o,z:s}=e.geometry;g(r,[t,o,s])}}const s=f(r,t);return e(this.observer)&&this.targets.every(e)||(s.zmin=void 0,s.zmax=void 0),{pending:null,extent:s}}clear(){this.observer=null,this.targets.removeAll()}};t([a({type:["line-of-sight"]})],d.prototype,"type",void 0),t([a({type:o,json:{read:!0,write:!0}})],d.prototype,"observer",void 0),t([a({cast:n,type:y,nonNullable:!0,json:{read:!0,write:!0}})],d.prototype,"targets",null),t([a({value:null,readOnly:!0})],d.prototype,"extent",void 0),t([a()],d.prototype,"spatialReference",null),t([a({readOnly:!0})],d.prototype,"valid",null),d=t([u("esri.analysis.LineOfSightAnalysis")],d);export{d as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import e from"./Analysis.js";import o from"./LineOfSightAnalysisObserver.js";import r from"./LineOfSightAnalysisTarget.js";import s from"../core/Collection.js";import{referenceSetter as i,castForReferenceSetter as n}from"../core/collectionUtils.js";import{watch as l,syncAndInitial as p}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{projectOrLoad as c}from"../geometry/projectionUtils.js";import{fromValues as m,expandWithVec3 as g,toExtent as f}from"../geometry/support/aaBoundingBox.js";import{getGeometryEffectiveElevationMode as h}from"../support/elevationInfoUtils.js";const y=s.ofType(r);let d=class extends e{constructor(t){super(t),this.type="line-of-sight",this.observer=null,this.extent=null}initialize(){this.addHandles(l((()=>this._computeExtent()),(t=>{null==t?.pending&&this._set("extent",null!=t?t.extent:null)}),p))}get targets(){return this._get("targets")||new y}set targets(t){this._set("targets",i(t,this.targets,y))}get spatialReference(){return null!=this.observer?.position?this.observer.position.spatialReference:null}get valid(){return null!=this.observer?.position}async waitComputeExtent(){const t=this._computeExtent();return null!=t?t.pending:Promise.resolve()}_computeExtent(){const t=this.spatialReference;if(null==this.observer?.position||null==t)return null;const e=t=>"absolute-height"===h(t.position,t.elevationInfo),o=this.observer.position,r=m(o.x,o.y,o.z,o.x,o.y,o.z);for(const i of this.targets)if(null!=i.position){const e=c(i.position,t);if(null!=e.pending)return{pending:e.pending,extent:null};if(null!=e.geometry){const{x:t,y:o,z:s}=e.geometry;g(r,[t,o,s])}}const s=f(r,t);return e(this.observer)&&this.targets.every(e)||(s.zmin=void 0,s.zmax=void 0),{pending:null,extent:s}}clear(){this.observer=null,this.targets.removeAll()}};t([a({type:["line-of-sight"]})],d.prototype,"type",void 0),t([a({type:o,json:{read:!0,write:!0}})],d.prototype,"observer",void 0),t([a({cast:n,type:y,nonNullable:!0,json:{read:!0,write:!0}})],d.prototype,"targets",null),t([a({value:null,readOnly:!0})],d.prototype,"extent",void 0),t([a()],d.prototype,"spatialReference",null),t([a({readOnly:!0})],d.prototype,"valid",null),d=t([u("esri.analysis.LineOfSightAnalysis")],d);export{d as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"./Analysis.js";import r from"./Viewshed.js";import n from"../core/Collection.js";import{referenceSetter as s,castForReferenceSetter as i}from"../core/collectionUtils.js";import{cyclicalDegrees as o}from"../core/Cyclical.js";import{deg2rad as l,clamp as a}from"../core/mathUtils.js";import{watch as p,syncAndInitial as c}from"../core/reactiveUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import h from"../geometry/Extent.js";import{projectOrLoadMany as d}from"../geometry/projection.js";const f=n.ofType(r);let v=class extends t{constructor(e){super(e),this.type="viewshed",this._extent=null}initialize(){this.addHandles(p((()=>this._computeExtent()),(e=>{null==e.pending&&(this._extent=e.extent)}),c))}get viewsheds(){return this._get("viewsheds")||new f}set viewsheds(e){this._set("viewsheds",s(e,this.viewsheds,f))}get spatialReference(){for(const e of this.viewsheds)if(null!=e.observer)return e.observer.spatialReference;return null}get extent(){return this._extent}get valid(){return this.viewsheds.every((e=>e.valid))}async waitComputeExtent(){const e=this._computeExtent();null!=e.pending&&await e.pending}_computeExtent(){const{spatialReference:e}=this;if(null==e)return{pending:null,extent:null};const t=this.viewsheds.filter((e=>null!=e.observer)),r=t.map((e=>e.observer)).toArray(),n=d(r,e);if(null!=n.pending)return{pending:n.pending,extent:null};return{pending:null,extent:n.geometries.map(((e,r)=>{const n=t.at(r);return null!=e&&null!=n?this._computeViewshedExtent(this.viewsheds.at(r),e):null})).filter((e=>null!=e)).reduce(((e,t)=>x(e,t)),null)}}_computeViewshedExtent(e,t){const{farDistance:r,heading:n,tilt:s,horizontalFieldOfView:i,verticalFieldOfView:p}=e,{spatialReference:c}=t,u=i/2,m=p/2,d=r/c.metersPerUnit,f=[o.normalize(n-u),n,o.normalize(n+u)],v=h.fromPoint(t),x=e=>{const t=f.map((t=>o.normalize(t-e)));if(t[0]>t[2]||360===i)return d;const r=t.map((e=>Math.abs(e>180?360-e:e))).reduce(((e,t)=>e>t?t:e));return r>90?0:d*Math.cos(l(r))};v.xmax+=x(90),v.xmin-=x(-90),v.ymax+=x(0),v.ymin-=x(180);const g=t.z;if(null!=g){let e=g,t=g;const n=s-90,i=a(n+m,-90,90),o=a(n-m,-90,90),l=c?.isGeographic?r:d;e+=l*w(i),t+=l*w(o);const p=y(m)*l,h=w(n)*p*(1-y(u));s<90&&(e-=h),s>90&&(t-=h),v.zmax=Math.max(e,g),v.zmin=Math.min(t,g)}return v}clear(){this.viewsheds.removeAll()}};function x(e,t){return null==e?t:null==t?e:e.union(t)}function y(e){return Math.cos(l(e))}function w(e){return Math.sin(l(e))}e([u({type:["viewshed"]})],v.prototype,"type",void 0),e([u({cast:i,type:f,nonNullable:!0})],v.prototype,"viewsheds",null),e([u({readOnly:!0})],v.prototype,"spatialReference",null),e([u()],v.prototype,"_extent",void 0),e([u()],v.prototype,"extent",null),e([u({readOnly:!0})],v.prototype,"valid",null),v=e([m("esri.analysis.ViewshedAnalysis")],v);export{v as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"./Analysis.js";import r from"./Viewshed.js";import n from"../core/Collection.js";import{referenceSetter as s,castForReferenceSetter as i}from"../core/collectionUtils.js";import{cyclicalDegrees as o}from"../core/Cyclical.js";import{deg2rad as l,clamp as a}from"../core/mathUtils.js";import{watch as p,syncAndInitial as c}from"../core/reactiveUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import h from"../geometry/Extent.js";import{projectOrLoadMany as d}from"../geometry/projectionUtils.js";const f=n.ofType(r);let v=class extends t{constructor(e){super(e),this.type="viewshed",this._extent=null}initialize(){this.addHandles(p((()=>this._computeExtent()),(e=>{null==e.pending&&(this._extent=e.extent)}),c))}get viewsheds(){return this._get("viewsheds")||new f}set viewsheds(e){this._set("viewsheds",s(e,this.viewsheds,f))}get spatialReference(){for(const e of this.viewsheds)if(null!=e.observer)return e.observer.spatialReference;return null}get extent(){return this._extent}get valid(){return this.viewsheds.every((e=>e.valid))}async waitComputeExtent(){const e=this._computeExtent();null!=e.pending&&await e.pending}_computeExtent(){const{spatialReference:e}=this;if(null==e)return{pending:null,extent:null};const t=this.viewsheds.filter((e=>null!=e.observer)),r=t.map((e=>e.observer)).toArray(),n=d(r,e);if(null!=n.pending)return{pending:n.pending,extent:null};return{pending:null,extent:n.geometries.map(((e,r)=>{const n=t.at(r);return null!=e&&null!=n?this._computeViewshedExtent(this.viewsheds.at(r),e):null})).filter((e=>null!=e)).reduce(((e,t)=>x(e,t)),null)}}_computeViewshedExtent(e,t){const{farDistance:r,heading:n,tilt:s,horizontalFieldOfView:i,verticalFieldOfView:p}=e,{spatialReference:c}=t,u=i/2,m=p/2,d=r/c.metersPerUnit,f=[o.normalize(n-u),n,o.normalize(n+u)],v=h.fromPoint(t),x=e=>{const t=f.map((t=>o.normalize(t-e)));if(t[0]>t[2]||360===i)return d;const r=t.map((e=>Math.abs(e>180?360-e:e))).reduce(((e,t)=>e>t?t:e));return r>90?0:d*Math.cos(l(r))};v.xmax+=x(90),v.xmin-=x(-90),v.ymax+=x(0),v.ymin-=x(180);const g=t.z;if(null!=g){let e=g,t=g;const n=s-90,i=a(n+m,-90,90),o=a(n-m,-90,90),l=c?.isGeographic?r:d;e+=l*w(i),t+=l*w(o);const p=y(m)*l,h=w(n)*p*(1-y(u));s<90&&(e-=h),s>90&&(t-=h),v.zmax=Math.max(e,g),v.zmin=Math.min(t,g)}return v}clear(){this.viewsheds.removeAll()}};function x(e,t){return null==e?t:null==t?e:e.union(t)}function y(e){return Math.cos(l(e))}function w(e){return Math.sin(l(e))}e([u({type:["viewshed"]})],v.prototype,"type",void 0),e([u({cast:i,type:f,nonNullable:!0})],v.prototype,"viewsheds",null),e([u({readOnly:!0})],v.prototype,"spatialReference",null),e([u()],v.prototype,"_extent",void 0),e([u()],v.prototype,"extent",null),e([u({readOnly:!0})],v.prototype,"valid",null),v=e([m("esri.analysis.ViewshedAnalysis")],v);export{v as default};
@@ -1,3 +1,5 @@
1
1
  import "../../interfaces";
2
2
 
3
3
  export const forceInteractive: __esri.analysisUtils["forceInteractive"];
4
+ export const hasValidAreaResult: __esri.analysisUtils["hasValidAreaResult"];
5
+ export const isAboveGeodesicDistanceThreshold: __esri.analysisUtils["isAboveGeodesicDistanceThreshold"];
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- function e(e){return e.forceInteractive()}export{e as forceInteractive};
5
+ import{toUnit as e}from"../../core/quantityUtils.js";import{geodesicDistanceThreshold as t}from"../../views/support/geodesicMeasurementUtils.js";function r(e){return e.forceInteractive()}function i(r){return e(r,"meters").value>t}function n(e){return 0===e.viewData.intersectingSegments.size}export{r as forceInteractive,n as hasValidAreaResult,i as isAboveGeodesicDistanceThreshold};
package/arcade/Voxel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ArcadeDate as t}from"./ArcadeDate.js";import{ArcadeExecutionError as e,ExecutionErrorCodes as i}from"./executionError.js";import r from"./ImmutableArray.js";import{c as s}from"../chunks/languageUtils.js";import{isDate as o}from"../support/guards.js";const n="Voxel.Position",a="Voxel.LocalTime";function l(t){const s=t.getAttribute(n);if("string"!=typeof s)throw new e(null,i.InvalidParameter,null);const o=JSON.parse(s);if(!Array.isArray(o)||"number"!=typeof o[0]||"number"!=typeof o[1]||"number"!=typeof o[2])throw new e(null,i.InvalidParameter,null);return new r(o)}function u(r,s){const n=r.getAttribute(a);if(null==n)return null;if(!o(n))throw new e(null,i.InvalidParameter,null);return t.dateJSAndZoneToArcadeDate(n,s)}class c{constructor(t,e){this._graphic=t,this._timeZone=e,this.arcadeDeclaredClass="esri.arcade.Voxel",this._layer=t.layer}getPosition(){return void 0!==this._position?this._position:this._position=l(this._graphic)}getLocalTime(){return void 0!==this._localTime?this._localTime:this._localTime=u(this._graphic,this._timeZone??"system")}keys(){return this._layer.fields.map((t=>t.name)).sort()}hasField(t){return this._layer.fieldsIndex.has(t)}field(t){const r=this._layer.fieldsIndex?.get(t)?.name;if(null==r)throw new e(null,i.FieldNotFound,null,{key:t});switch(r){case n:return this.getPosition();case a:return this.getLocalTime()}return this._graphic.attributes[r]??null}castToText(t=!1){const e={...this._graphic.attributes};e[n]=this.getPosition(),a in e&&(e[a]=this.getLocalTime());for(const i of Object.keys(e))this._layer.fieldsIndex?.has(i)||delete e[i];return s(e,{useNumbersForDates:t})}}export{c as Voxel};
5
+ import{ArcadeDate as t}from"./ArcadeDate.js";import{ArcadeExecutionError as e,ExecutionErrorCodes as r}from"./executionError.js";import i from"./ImmutableArray.js";import{c as s}from"../chunks/languageUtils.js";import{isDate as o}from"../support/guards.js";const n="Voxel.Position",a="Voxel.LocalTime";function l(t){const s=t.getAttribute(n);if("string"!=typeof s)throw new e(null,r.InvalidParameter,null);const o=JSON.parse(s);if(!Array.isArray(o)||"number"!=typeof o[0]||"number"!=typeof o[1]||"number"!=typeof o[2])throw new e(null,r.InvalidParameter,null);return new i(o)}function u(i,s){const n=i.getAttribute(a);if(null==n)return null;if(!o(n))throw new e(null,r.InvalidParameter,null);return t.dateJSAndZoneToArcadeDate(n,s)}class c{constructor(t,e){this._graphic=t,this._timeZone=e,this.arcadeDeclaredClass="esri.arcade.Voxel",this._layer=t.sourceLayer}getPosition(){return void 0!==this._position?this._position:this._position=l(this._graphic)}getLocalTime(){return void 0!==this._localTime?this._localTime:this._localTime=u(this._graphic,this._timeZone??"system")}keys(){return this._layer.fields.map((t=>t.name)).sort()}hasField(t){return this._layer.fieldsIndex.has(t)}field(t){const i=this._layer.fieldsIndex?.get(t)?.name;if(null==i)throw new e(null,r.FieldNotFound,null,{key:t});switch(i){case n:return this.getPosition();case a:return this.getLocalTime()}return this._graphic.attributes[i]??null}castToText(t=!1){const e={...this._graphic.attributes};e[n]=this.getPosition(),a in e&&(e[a]=this.getLocalTime());for(const r of Object.keys(e))this._layer.fieldsIndex?.has(r)||delete e[r];return s(e,{useNumbersForDates:t})}}export{c as Voxel};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Graphic.js";import{StringEnum as t}from"../../enum.js";import{a0 as i}from"../../../chunks/languageUtils.js";import{SqlExpressionAdapted as s,OriginalField as n,AdaptedFeatureSet as r}from"./Adapted.js";import a from"./AttributeFilter.js";import o from"./OrderBy.js";import{FeatureSetError as l,FeatureSetErrorCodes as d}from"../support/errorsupport.js";import u from"../support/FeatureSet.js";import f from"../support/IdSet.js";import p from"../support/OrderbyClause.js";import{IdState as h,layerGeometryEsriConstants as c,FeatureServiceDatabaseType as g}from"../support/shared.js";import{isSingleField as _,toWhereClause as m,predictType as y,scanForField as b,reformulateWithoutField as w}from"../support/sqlUtils.js";import F from"../support/StatsField.js";import{createMD5Hash as I,outputTypes as S}from"../../../core/MD5.js";import{aggregateFunction as x}from"../../../core/sql/AggregateFunctions.js";import{DateOnly as D}from"../../../core/sql/DateOnly.js";import{SqlTimeStampOffset as A}from"../../../core/sql/SqlTimestampOffset.js";import{TimeOnly as j}from"../../../core/sql/TimeOnly.js";import k from"../../../core/sql/WhereClause.js";import C from"../../../geometry/SpatialReference.js";import T from"../../../layers/support/Field.js";import G from"../../../layers/support/FieldsIndex.js";const R=new t(["MIN","MAX","VAR","STDDEV","COUNT","SUM","AVG"],[["VARIANCE","VAR"],["AVERAGE","AVG"],["MEAN","AVG"],["STDEV","STDDEV"]]);class q extends u{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="esri.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(null===this._wset){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return h.InFeatureSet}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,i=1;const r=this._parent?this._parent.getFieldsIndex():new G([]);for(this.objectIdField="ROW__ID",this.globalIdField="";!1===t;){let e=!1;for(let t=0;t<this._config.groupbyfields.length;t++)if(this._config.groupbyfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}if(!1===e)for(let t=0;t<this._config.statsfields.length;t++)if(this._config.statsfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}!1===e?t=!0:(this.objectIdField="ROW__ID"+i.toString(),i++)}for(const s of this._config.statsfields){const e=new F;e.field=s.name,e.tofieldname=s.name,e.workingexpr=s.expression instanceof k?s.expression:k.create(s.expression,{fieldsIndex:r,timeZone:this.dateFieldsTimeZoneDefaultUTC}),e.typeofstat=R.lookup(s.statistic)??"COUNT",this._decodedStatsfield.push(e)}this._decodedGroupbyfield=[];for(const s of this._config.groupbyfields){const e={name:s.name,singlefield:null,tofieldname:s.name,expression:s.expression instanceof k?s.expression:k.create(s.expression,{fieldsIndex:r,timeZone:this.dateFieldsTimeZoneDefaultUTC}),sqlType:null};this._decodedGroupbyfield.push(e)}if(null!==this._parent){this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(const t of this._parent.fields)e[t.name.toUpperCase()]=1;this.types=null,this.subtypes=null,this.subtypeField=""}else this.geometryType=c.point,this.typeIdField="",this.types=null,this.subtypes=null,this.subtypeField="",this.spatialReference=new C({wkid:4326});this.fields=[];const a=new F;a.field=this._nextUniqueName(e),a.tofieldname=this.objectIdField,a.workingexpr=k.create(this._parent.objectIdField,{fieldsIndex:this._parent.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),a.typeofstat="MIN",this._decodedStatsfield.push(a);for(const n of this._decodedGroupbyfield){const t=new T;if(n.name=this._nextUniqueName(e),t.name=n.tofieldname,t.alias=t.name,_(n.expression)){const e=this._parent.getField(m(n.expression,g.Standardised));if(!e)throw new l(d.AggregationFieldNotFound);n.name=e.name,n.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),t.type=e.type,n.sqlType=e.type}else{t.type=this._convertToEsriFieldType(y(n.expression,this._parent.fields));const e=new T;e.name=n.name,e.alias=e.name,this.phsyicalgroupbyfields.push(n.name),this._adaptedFields.push(new s(e,n.expression)),this._candosimplegroupby=!1,n.sqlType=t.type}this.fields.push(t)}if(this._adaptedFields.length>0)for(const s of this._parent.fields)this._adaptedFields.push(new n(s));for(let s=0;s<this._decodedStatsfield.length;s++){const t=new T;let i=null;const n=this._decodedStatsfield[s];n.field=this._nextUniqueName(e),n.tofieldname===this.objectIdField&&(this._internalObjectIdField=n.field),t.name=n.tofieldname,t.alias=t.name;const r=null!==n.workingexpr&&_(n.workingexpr)?m(n.workingexpr,g.Standardised):"";switch(this._decodedStatsfield[s].typeofstat){case"SUM":if(""!==r){if(i=this._parent.getField(r),!i)throw new l(d.AggregationFieldNotFound);t.type=i.type}else t.type="double";break;case"MIN":case"MAX":if(""!==r){if(i=this._parent.getField(r),!i)throw new l(d.AggregationFieldNotFound);t.type=i.type}else t.type="double";break;case"COUNT":t.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==r&&(i=this._parent.getField(r),!i))throw new l(d.AggregationFieldNotFound);t.type="double"}this.fields.push(t)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,i,s){-1!==t&&this._featureCache[t];const n=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,n)?(await this._expandPagedSet(e,n,0,0,s),this._getFeatures(e,t,i,s)):"success"}async _getFilteredSet(e,t,i,s,n){if(""!==e)return new f([],[],!0,null);let l=null;const d={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),null!==i)for(let r=0;r<this._decodedStatsfield.length;r++)if(!0===b(i,this._decodedStatsfield[r].tofieldname)){d.nowhereclause=!0,i=null;break}if(null!==s){d.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===s.scanForField(this._decodedStatsfield[e].tofieldname)){s=null,d.ordered=!1;break}if(null!==s)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===s.scanForField(e.tofieldname)){s=null,d.ordered=!1;break}}if(!1!==this._candosimplegroupby&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let e=null;i&&(e=this._reformulateWhereClauseWithoutGroupByFields(i));let t=null;s&&(t=this._reformulateOrderClauseWithoutGroupByFields(s));const r=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(n),l=!0===d.nowhereclause?new f(r._candidates.slice().concat(r._known.slice()),[],!0===d.ordered&&r._ordered,this._clonePageDefinition(r.pagesDefinition)):new f(r._candidates.slice(),r._known.slice(),!0===d.ordered&&r._ordered,this._clonePageDefinition(r.pagesDefinition)),l}let u=this._parent;if(this._adaptedFields.length>0&&(u=new r({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===d.nowhereclause)l=new f(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new o({parentfeatureset:u,orderbyclause:new p(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let e=u;if(null!==i){let t=null;i&&(t=this._reformulateWhereClauseWithoutGroupByFields(i)),e=new a({parentfeatureset:e,whereclause:t})}l=new f(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new o({parentfeatureset:e,orderbyclause:new p(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return l}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=w(e,t.tofieldname,m(t.workingexpr,g.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=w(e,t.tofieldname,m(t.expression,g.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const i of this._decodedGroupbyfield)i.tofieldname!==i.name&&t.push({field:i.tofieldname,newfield:i.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,i){if(!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery))return await this._expandPagedSet(e,this._maxQuery,0,0,i),this._refineSetBlock(e,t,i);this._checkCancelled(i);const s=e._candidates.length;this._refineKnowns(e,t);e._candidates.length;return e._candidates.length,e}_expandPagedSet(e,t,i,s,n){return this._expandPagedSetFeatureSet(e,t,i,s,n)}async _getPhysicalPage(t,i,s){if(!0===t.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(t,t.pagesDefinition.resultRecordCount,s,[]);const n=await this._getAgregagtePhysicalPage(t,i,s);for(const r of n){const t={geometry:r.geometry,attributes:{}},i={};for(const e in r.attributes)i[e.toLowerCase()]=r.attributes[e];for(const e of this._decodedGroupbyfield)t.attributes[e.tofieldname]=i[e.name.toLowerCase()];for(const e of this._decodedStatsfield)t.attributes[e.tofieldname]=i[e.field.toLowerCase()];this._featureCache[t.attributes[this.objectIdField]]=new e(t)}return n.length}_sequentialGetPhysicalItem(e,t,i,s){return new Promise(((n,r)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),!0===e.pagesDefinition.internal.fullyResolved||0===t?n(s.length):this._nextAggregateItem(e,t,i,s,(r=>{null===r?n(s.length):(t-=1,n(this._sequentialGetPhysicalItem(e,t,i,s)))}),r)}))}_nextAggregateItem(e,t,s,n,r,a){try{i(e.pagesDefinition.internal.iterator.next()).then((i=>{if(null===i)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);n.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,r(null)}else e.pagesDefinition.internal.fullyResolved=!0,r(null);else{const o=this._generateAggregateHash(i);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[i],id:o};else{if(o!==e.pagesDefinition.internal.workingItem.id){const s=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return n.push(s),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(s.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[i],id:o},void r(s)}e.pagesDefinition.internal.workingItem.features.push(i)}this._nextAggregateItem(e,t,s,n,r,a)}}),a)}catch(o){a(o)}}_calculateFieldStat(e,t,i){const s=[];for(const n of e.features)if(null!==t.workingexpr){const e=t.workingexpr.calculateValue(n);null!==e&&(e instanceof D||e instanceof j?s.push(e.toNumber()):e instanceof A?s.push(e.toMilliseconds()):s.push(e))}else s.push(null);i.attributes[t.tofieldname]=x(t.typeofstat,[s])}_calculateAndAppendAggregateItem(t){const i={attributes:{},geometry:null};for(const e of this._decodedGroupbyfield){const s=e.singlefield?t.features[0].attributes[e.singlefield]:k.convertValueToStorageFormat(e.expression.calculateValue(t.features[0]),e.sqlType);i.attributes[e.tofieldname]=s}for(const e of this._decodedStatsfield)this._calculateFieldStat(t,e,i);const s=[];for(let e=0;e<this._decodedStatsfield.length;e++)s.push(this._calculateFieldStat(t,this._decodedStatsfield[e],i));return this._featureCache[i.attributes[this.objectIdField]]=new e({attributes:i.attributes,geometry:i.geometry}),i}_generateAggregateHash(e){let t="";for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.attributes[i.singlefield]:i.expression.calculateValue(e);t+=null==s?":":":"+s.toString()}return I(t,S.String)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){u._featuresetFunctions.groupby=function(e,t){return new q({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}export{q as default};
5
+ import e from"../../../Graphic.js";import{StringEnum as t}from"../../enum.js";import{a0 as i}from"../../../chunks/languageUtils.js";import{SqlExpressionAdapted as s,OriginalField as n,AdaptedFeatureSet as r}from"./Adapted.js";import a from"./AttributeFilter.js";import o from"./OrderBy.js";import{FeatureSetError as l,FeatureSetErrorCodes as d}from"../support/errorsupport.js";import u from"../support/FeatureSet.js";import f from"../support/IdSet.js";import h from"../support/OrderbyClause.js";import{IdState as p,layerGeometryEsriConstants as c,FeatureServiceDatabaseType as g}from"../support/shared.js";import{isSingleField as _,toWhereClause as m,predictType as y,scanForField as b,reformulateWithoutField as w}from"../support/sqlUtils.js";import F from"../support/StatsField.js";import I from"../../../core/Logger.js";import{createMD5Hash as S,outputTypes as x}from"../../../core/MD5.js";import{aggregateFunction as j}from"../../../core/sql/AggregateFunctions.js";import{DateOnly as D}from"../../../core/sql/DateOnly.js";import{SqlTimeStampOffset as A}from"../../../core/sql/SqlTimestampOffset.js";import{TimeOnly as k}from"../../../core/sql/TimeOnly.js";import C from"../../../core/sql/WhereClause.js";import T from"../../../geometry/SpatialReference.js";import G from"../../../layers/support/Field.js";import R from"../../../layers/support/FieldsIndex.js";const q=new t(["MIN","MAX","VAR","STDDEV","COUNT","SUM","AVG"],[["VARIANCE","VAR"],["AVERAGE","AVG"],["MEAN","AVG"],["STDEV","STDDEV"]]);class O extends u{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="esri.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(null===this._wset){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return p.InFeatureSet}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,i=1;const r=this._parent?this._parent.getFieldsIndex():new R([]);for(this.objectIdField="ROW__ID",this.globalIdField="";!1===t;){let e=!1;for(let t=0;t<this._config.groupbyfields.length;t++)if(this._config.groupbyfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}if(!1===e)for(let t=0;t<this._config.statsfields.length;t++)if(this._config.statsfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}!1===e?t=!0:(this.objectIdField="ROW__ID"+i.toString(),i++)}for(const s of this._config.statsfields){const e=new F;e.field=s.name,e.tofieldname=s.name,e.workingexpr=s.expression instanceof C?s.expression:C.create(s.expression,{fieldsIndex:r,timeZone:this.dateFieldsTimeZoneDefaultUTC}),e.typeofstat=q.lookup(s.statistic)??"COUNT",this._decodedStatsfield.push(e)}this._decodedGroupbyfield=[];for(const s of this._config.groupbyfields){const e={name:s.name,singlefield:null,tofieldname:s.name,expression:s.expression instanceof C?s.expression:C.create(s.expression,{fieldsIndex:r,timeZone:this.dateFieldsTimeZoneDefaultUTC}),sqlType:null};this._decodedGroupbyfield.push(e)}if(null!==this._parent){this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(const t of this._parent.fields)e[t.name.toUpperCase()]=1;this.types=null,this.subtypes=null,this.subtypeField=""}else this.geometryType=c.point,this.typeIdField="",this.types=null,this.subtypes=null,this.subtypeField="",this.spatialReference=new T({wkid:4326});this.fields=[];const a=new F;a.field=this._nextUniqueName(e),a.tofieldname=this.objectIdField,a.workingexpr=C.create(this._parent.objectIdField,{fieldsIndex:this._parent.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),a.typeofstat="MIN",this._decodedStatsfield.push(a);for(const n of this._decodedGroupbyfield){const t=new G;if(n.name=this._nextUniqueName(e),t.name=n.tofieldname,t.alias=t.name,_(n.expression)){const e=this._parent.getField(m(n.expression,g.Standardised));if(!e)throw new l(d.AggregationFieldNotFound);n.name=e.name,n.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),t.type=e.type,n.sqlType=e.type}else{t.type=this._convertToEsriFieldType(y(n.expression,this._parent.fields));const e=new G;e.name=n.name,e.alias=e.name,this.phsyicalgroupbyfields.push(n.name),this._adaptedFields.push(new s(e,n.expression)),this._candosimplegroupby=!1,n.sqlType=t.type}this.fields.push(t)}if(this._adaptedFields.length>0)for(const s of this._parent.fields)this._adaptedFields.push(new n(s));for(let s=0;s<this._decodedStatsfield.length;s++){const t=new G;let i=null;const n=this._decodedStatsfield[s];n.field=this._nextUniqueName(e),n.tofieldname===this.objectIdField&&(this._internalObjectIdField=n.field),t.name=n.tofieldname,t.alias=t.name;const r=null!==n.workingexpr&&_(n.workingexpr)?m(n.workingexpr,g.Standardised):"";switch(this._decodedStatsfield[s].typeofstat){case"SUM":if(""!==r){if(i=this._parent.getField(r),!i)throw new l(d.AggregationFieldNotFound);t.type=i.type}else t.type="double";break;case"MIN":case"MAX":if(""!==r){if(i=this._parent.getField(r),!i)throw new l(d.AggregationFieldNotFound);t.type=i.type}else t.type="double";break;case"COUNT":t.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==r&&(i=this._parent.getField(r),!i))throw new l(d.AggregationFieldNotFound);t.type="double"}this.fields.push(t)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,i,s){-1!==t&&this._featureCache[t];const n=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,n)?(await this._expandPagedSet(e,n,0,0,s),this._getFeatures(e,t,i,s)):"success"}async _getFilteredSet(e,t,i,s,n){if(""!==e)return new f([],[],!0,null);let l=null;const d={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),null!==i)for(let r=0;r<this._decodedStatsfield.length;r++)if(!0===b(i,this._decodedStatsfield[r].tofieldname)){d.nowhereclause=!0,i=null;break}if(null!==s){d.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===s.scanForField(this._decodedStatsfield[e].tofieldname)){s=null,d.ordered=!1;break}if(null!==s)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===s.scanForField(e.tofieldname)){s=null,d.ordered=!1;break}}if(!1!==this._candosimplegroupby&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let e=null;i&&(e=this._reformulateWhereClauseWithoutGroupByFields(i));let t=null;s&&(t=this._reformulateOrderClauseWithoutGroupByFields(s));const r=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(n),l=!0===d.nowhereclause?new f(r._candidates.slice().concat(r._known.slice()),[],!0===d.ordered&&r._ordered,this._clonePageDefinition(r.pagesDefinition)):new f(r._candidates.slice(),r._known.slice(),!0===d.ordered&&r._ordered,this._clonePageDefinition(r.pagesDefinition)),l}let u=this._parent;if(this._adaptedFields.length>0&&(u=new r({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===d.nowhereclause)l=new f(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new o({parentfeatureset:u,orderbyclause:new h(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let e=u;if(null!==i){let t=null;i&&(t=this._reformulateWhereClauseWithoutGroupByFields(i)),e=new a({parentfeatureset:e,whereclause:t})}l=new f(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new o({parentfeatureset:e,orderbyclause:new h(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return l}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=w(e,t.tofieldname,m(t.workingexpr,g.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=w(e,t.tofieldname,m(t.expression,g.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const i of this._decodedGroupbyfield)i.tofieldname!==i.name&&t.push({field:i.tofieldname,newfield:i.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,i){if(!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery))return await this._expandPagedSet(e,this._maxQuery,0,0,i),this._refineSetBlock(e,t,i);this._checkCancelled(i);const s=e._candidates.length;this._refineKnowns(e,t);e._candidates.length;return e._candidates.length,e}_expandPagedSet(e,t,i,s,n){return this._expandPagedSetFeatureSet(e,t,i,s,n)}async _getPhysicalPage(t,i,s){if(!0===t.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(t,t.pagesDefinition.resultRecordCount,s,[]);const n=await this._getAgregagtePhysicalPage(t,i,s);for(const r of n){const t={geometry:r.geometry,attributes:{}},i={};for(const e in r.attributes)i[e.toLowerCase()]=r.attributes[e];for(const e of this._decodedGroupbyfield)t.attributes[e.tofieldname]=i[e.name.toLowerCase()];for(const e of this._decodedStatsfield)t.attributes[e.tofieldname]=i[e.field.toLowerCase()];if(null!=this._featureCache[t.attributes[this.objectIdField]])throw I.getLogger("esri.arcade.featureset.actions.GroupBy").error(`Duplicate object id returned: ${t.attributes[this.objectIdField]}`),new l(d.NeverReach);this._featureCache[t.attributes[this.objectIdField]]=new e(t)}return n.length}_sequentialGetPhysicalItem(e,t,i,s){return new Promise(((n,r)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),!0===e.pagesDefinition.internal.fullyResolved||0===t?n(s.length):this._nextAggregateItem(e,t,i,s,(r=>{null===r?n(s.length):(t-=1,n(this._sequentialGetPhysicalItem(e,t,i,s)))}),r)}))}_nextAggregateItem(e,t,s,n,r,a){try{i(e.pagesDefinition.internal.iterator.next()).then((i=>{if(null===i)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);n.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,r(null)}else e.pagesDefinition.internal.fullyResolved=!0,r(null);else{const o=this._generateAggregateHash(i);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[i],id:o};else{if(o!==e.pagesDefinition.internal.workingItem.id){const s=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return n.push(s),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(s.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[i],id:o},void r(s)}e.pagesDefinition.internal.workingItem.features.push(i)}this._nextAggregateItem(e,t,s,n,r,a)}}),a)}catch(o){a(o)}}_calculateFieldStat(e,t,i){const s=[];for(const n of e.features)if(null!==t.workingexpr){const e=t.workingexpr.calculateValue(n);null!==e&&(e instanceof D||e instanceof k?s.push(e.toNumber()):e instanceof A?s.push(e.toMilliseconds()):s.push(e))}else s.push(null);i.attributes[t.tofieldname]=j(t.typeofstat,[s])}_calculateAndAppendAggregateItem(t){const i={attributes:{},geometry:null};for(const e of this._decodedGroupbyfield){const s=e.singlefield?t.features[0].attributes[e.singlefield]:C.convertValueToStorageFormat(e.expression.calculateValue(t.features[0]),e.sqlType);i.attributes[e.tofieldname]=s}for(const e of this._decodedStatsfield)this._calculateFieldStat(t,e,i);const s=[];for(let e=0;e<this._decodedStatsfield.length;e++)s.push(this._calculateFieldStat(t,this._decodedStatsfield[e],i));if(null!=this._featureCache[i.attributes[this.objectIdField]])throw I.getLogger("esri.arcade.featureset.actions.GroupBy").error(`Duplicate object id returned: ${i.attributes[this.objectIdField]}`),new l(d.NeverReach);return this._featureCache[i.attributes[this.objectIdField]]=new e({attributes:i.attributes,geometry:i.geometry}),i}_generateAggregateHash(e){let t="";for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.attributes[i.singlefield]:i.expression.calculateValue(e);t+=null==s?":":":"+s.toString()}return S(t,x.String)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){u._featuresetFunctions.groupby=function(e,t){return new O({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}export{O as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Graphic.js";import{id as t}from"../../../kernel.js";import r from"../../../request.js";import i from"../../Attachment.js";import s from"../../Dictionary.js";import{FeatureSetError as a,FeatureSetErrorCodes as n}from"../support/errorsupport.js";import l from"../support/FeatureSet.js";import o from"../support/IdSet.js";import{defaultMaxRecords as u,stableStringify as d,FeatureServiceDatabaseType as c,IdState as h,extractServiceUrl as p}from"../support/shared.js";import{toWhereClause as y,isSingleField as f}from"../support/sqlUtils.js";import{decodeStatType as _}from"../support/stats.js";import{createMD5Hash as g,outputTypes as m}from"../../../core/MD5.js";import{sqlAnd as R}from"../../../core/sql.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{srToRESTValue as b}from"../../../geometry/support/spatialReferenceUtils.js";import S from"../../../layers/FeatureLayer.js";import F from"../../../rest/support/AttachmentQuery.js";import I from"../../../rest/support/Query.js";import D from"../../../rest/support/StatisticDefinition.js";class P extends l{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return u}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+d(e.toJSON());return g(t,m.String)}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType??"",this.fields=this._layer.fields.slice(),this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const r of this.fields)if("oid"===r.type)e.push(r),t.push(r.name);else for(const i of this._overrideFields)if(i.toLowerCase()===r.name.toLowerCase()){e.push(r),t.push(r.name);break}this.fields=e,this._overrideFields=t}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=c.StandardisedNoInterval,null!=e&&e>=10.61&&(this._databaseType=c.Standardised)):null!=e&&(e>=10.5&&(this._databaseType=c.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=c.Standardised))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}_isInFeatureSet(){return h.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new I;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch(r){return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)}_cacheableFeatureSetSourceKey(){return this._layer.url}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,this.datesInUnknownTimezone&&(e.timeReferenceUnknownClient=!0),this._requestStandardised&&(e.sqlFormat="standard"),this._useDefinitionExpression?"subtype-group"===this._layer.type&&(e.where=this._layer.definitionExpression):e.where=null,e}executeQuery(e,t){const r="execute"===t?this._layer.queryFeatures.bind(this._layer):"executeForCount"===t?this._layer.queryFeatureCount.bind(this._layer):this._layer.queryObjectIds.bind(this._layer);let i=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);i=this.recentlyUsedQueries.getFromCache(t),null===i&&(i=r(e),this.recentlyUsedQueries.addToCache(t,i),i=i.catch((e=>{throw this.recentlyUsedQueries?.removeFromCache(t),e})))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===i&&(i=r(e)),i}async _getFilteredSet(e,t,r,i,s){const a=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e){return new o([],[],!0,null)}if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,r,i,s);let n="",l=!1;null!==i&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(n=i.constructClause(),l=!0);const u=this._createQuery();u.where=R(u.where,null===r?null===t?"1=1":"":y(r,a)),u.spatialRelationship=this._makeRelationshipEnum(e),u.outSpatialReference=this.spatialReference,u.orderByFields=""!==n?n.split(","):null,u.geometry=null===t?null:t,u.relationParameter=this._makeRelationshipParam(e);let d=await this.executeQuery(u,"executeForIds");null===d&&(d=[]),this._checkCancelled(s);return new o([],d,l,null)}_expandPagedSet(e,t,r,i,s){return this._expandPagedSetFeatureSet(e,t,r,i,s)}async _getFilteredSetUsingPaging(e,t,r,i,s){let a="",n=!1;null!==i&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=i.constructClause(),n=!0);const l=await this.databaseType(),u=null===r?null===t?"1=1":"":y(r,l);let d=this._maxQueryRate();const c=this._layer.capabilities?.query.maxRecordCount;null!=c&&c<d&&(d=c);let h=null;if(!0===this._pageJustIds)h=new o([],["GETPAGES"],n,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:this._layer.objectIdField,resultRecordCount:d,resultOffset:0,geometry:null===t?null:t,where:u,orderByFields:a,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let r=!0;!0===this._removeGeometry&&(r=!1);const i=this._overrideFields??this._fieldsIncludingObjectId(["*"]);h=new o([],["GETPAGES"],n,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:i.join(","),resultRecordCount:d,resultOffset:0,geometry:null===t?null:t,where:u,orderByFields:a,returnGeometry:r,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(h,d,0,1,s),h}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,r){const i=e.pagesDefinition.internal.lastRetrieved,s=i,a=e.pagesDefinition.internal.lastPage,n=this._createQuery();n.spatialRelationship=e.pagesDefinition.spatialRel,n.relationParameter=e.pagesDefinition.relationParam,n.outFields=e.pagesDefinition.outFields.split(","),n.num=e.pagesDefinition.resultRecordCount,n.start=e.pagesDefinition.internal.lastPage,n.geometry=e.pagesDefinition.geometry,n.where=R(n.where,e.pagesDefinition.where),n.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,n.returnGeometry=e.pagesDefinition.returnGeometry,n.outSpatialReference=this.spatialReference;const l=await this.executeQuery(n,"execute");if(this._checkCancelled(r),e.pagesDefinition.internal.lastPage!==a)return"done";const o=this._layer.objectIdField;for(let u=0;u<l.features.length;u++)e.pagesDefinition.internal.set[s+u]=l.features[u].attributes[o];if(!1===this._pageJustIds)for(let u=0;u<l.features.length;u++)this._featureCache[l.features[u].attributes[o]]=l.features[u];return(void 0===l.exceededTransferLimit&&l.features.length!==e.pagesDefinition.resultRecordCount||!1===l.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=i+l.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let r=!1;for(const i of t)if(i.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return!1===r&&t.push(this.objectIdField),t}async _getFeatures(e,t,r,i){const s=[];if(-1!==t&&void 0===this._featureCache[t]&&s.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,i),this._getFeatures(e,t,r,i);let l=0;for(let a=e._lastFetchedIndex;a<e._known.length;a++){if(e._lastFetchedIndex+=1,l++,void 0===this._featureCache[e._known[a]]){let r=!1;if(null!==this._layer._mode&&void 0!==this._layer._mode){const t=this._layer._mode;if(void 0!==t._featureMap[e._known[a]]){const i=t._featureMap[e._known[a]];null!==i&&(r=!0,this._featureCache[e._known[a]]=i)}}if(!1===r&&(e._known[a]!==t&&s.push(e._known[a]),s.length>=this._maxProcessingRate()-1))break}if(l>=r&&0===s.length)break}if(0===s.length)return"success";const o=this._createQuery();o.objectIds=s,o.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),o.returnGeometry=!0,!0===this._removeGeometry&&(o.returnGeometry=!1),o.outSpatialReference=this.spatialReference;const u=await this.executeQuery(o,"execute");if(this._checkCancelled(i),void 0!==u.error)throw new a(n.RequestFailed,{reason:u.error});const d=this._layer.objectIdField;for(let a=0;a<u.features.length;a++)this._featureCache[u.features[a].attributes[d]]=u.features[a];return"success"}async _getDistinctPages(e,t,r,i,s,l,o,u,d){await this._ensureLoaded();const c=await this.databaseType();let h=r.parseTree.column;const p=this._layer.fields??[];for(let a=0;a<p.length;a++)if(p[a].name.toLowerCase()===h.toLowerCase()){h=p[a].name;break}const f=this._createQuery();f.where=R(f.where,null===l?null===s?"1=1":"":y(l,c)),f.spatialRelationship=this._makeRelationshipEnum(i),f.relationParameter=this._makeRelationshipParam(i),f.geometry=null===s?null:s,f.returnDistinctValues=!0,f.returnGeometry=!1,f.outFields=[h];const _=await this.executeQuery(f,"execute");if(this._checkCancelled(d),!_.hasOwnProperty("features"))throw new a(n.InvalidStatResponse);let g=!1;for(let a=0;a<p.length;a++)if(p[a].name===h){"date"===p[a].type&&(g=!0);break}for(let a=0;a<_.features.length;a++){if(g){const e=_.features[a].attributes[h];null!==e?u.push(new Date(e)):u.push(e)}else u.push(_.features[a].attributes[h]);if(u.length>=o)break}if(0===_.features.length)return u;if(_.features.length===this._layer.capabilities?.query.maxRecordCount&&u.length<o){return{calculated:!0,result:await this._getDistinctPages(e+_.features.length,t,r,i,s,l,o,u,d)}}return u}async _distinctStat(e,t,r,i,s,a,n){return{calculated:!0,result:await this._getDistinctPages(0,e,t,r,i,s,a,[],n)}}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType||"esriGeometryNull"===this._layer.geometryType}async _countstat(e,t,r,i){const s=await this.databaseType();if(this.isTable()&&r&&null!==t&&""!==t)return{calculated:!0,result:0};const a=this._createQuery();a.where=R(a.where,null===i?null===r?"1=1":"":y(i,s)),a.spatialRelationship=this._makeRelationshipEnum(t),a.relationParameter=this._makeRelationshipParam(t),a.geometry=null===r?null:r,a.returnGeometry=!1;return{calculated:!0,result:await this.executeQuery(a,"executeForCount")}}async _stats(e,t,r,i,s,l,o){await this._ensureLoaded();const u=this._layer.capabilities?.query,d=!!u?.supportsSqlExpression,c=!!u?.supportsStatistics,h=!!u?.supportsDistinct;if("count"===e)return h?this._countstat(e,r,i,s):{calculated:!1};if(!1===c||!1===f(t)&&!1===d||!1===t.isStandardized)return""!==r||null!==s?{calculated:!1}:this._manualStat(e,t,l,o);if("distinct"===e)return!1===h?""!==r||null!==s?{calculated:!1}:this._manualStat(e,t,l,o):this._distinctStat(e,t,r,i,s,l,o);const p=await this.databaseType();if(this.isTable()&&i&&null!==r&&""!==r)return{calculated:!0,result:null};const g=this._createQuery();g.where=R(g.where,null===s?null===i?"1=1":"":y(s,p)),g.spatialRelationship=this._makeRelationshipEnum(r),g.relationParameter=this._makeRelationshipParam(r),g.geometry=null===i?null:i;const m=new D;m.statisticType=_(e),m.onStatisticField=y(t,p),m.outStatisticFieldName="ARCADE_STAT_RESULT",g.returnGeometry=!1;let w="ARCADE_STAT_RESULT";g.outStatistics=[m];const b=await this.executeQuery(g,"execute");if(!b.hasOwnProperty("features")||0===b.features.length)throw new a(n.InvalidStatResponse);let S=!1;const F=b.fields??[];for(let a=0;a<F.length;a++)if("ARCADE_STAT_RESULT"===F[a].name.toUpperCase()){w=F[a].name,"date"===F[a].type&&(S=!0);break}if(S){let e=b.features[0].attributes[w];return null!==e&&(e=new Date(b.features[0].attributes[w])),{calculated:!0,result:e}}return{calculated:!0,result:b.features[0].attributes[w]}}_stat(e,t,r,i,s,a,n){return this._stats(e,t,r,i,s,a,n)}async _canDoAggregates(e,t){await this._ensureLoaded();let r=!1;const i=this._layer.capabilities?.query,s=!0===i?.supportsSqlExpression;if(null!=i&&!0===i.supportsStatistics&&!0===i.supportsOrderBy&&(r=!0),r)for(let a=0;a<t.length-1;a++)(!1===t[a].workingexpr?.isStandardized||!1===f(t[a].workingexpr)&&!1===s)&&(r=!1);return!1!==r}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _getAggregatePagesDataSourceDefinition(e,t,r,i,s,a,n){await this._ensureLoaded();const l=await this.databaseType();let u="",d=!1,c=!1;null!==a&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(u=a.constructClause(),c=!0),this._layer.capabilities&&this._layer.capabilities.query&&!1===this._layer.capabilities.query.supportsPagination&&(c=!1,d=!0,u=this._layer.objectIdField);const h=[];for(let o=0;o<t.length;o++){const e=new D;e.onStatisticField=null!==t[o].workingexpr?y(t[o].workingexpr,l):"",e.outStatisticFieldName=t[o].field,e.statisticType=t[o].toStatisticsName(),h.push(e)}""===u&&(u=e.join(","));let p=this._maxQueryRate();const f=this._layer.capabilities?.query.maxRecordCount;null!=f&&f<p&&(p=f);const _=null===s?null===i?"1=1":"":y(s,l);return new o([],["GETPAGES"],c,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(r),relationParam:this._makeRelationshipParam(r),outFields:["*"],useOIDpagination:d,generatedOid:n,resultRecordCount:p,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:h,geometry:null===i?null:i,where:_,orderByFields:u,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}async _getAgregagtePhysicalPage(t,r,i){let s=t.pagesDefinition.where;!0===t.pagesDefinition.useOIDpagination&&(s=R(s,t.pagesDefinition.generatedOid+">"+t.pagesDefinition.internal.lastMaxId.toString()));const l=t.pagesDefinition.internal.lastRetrieved,o=l,u=t.pagesDefinition.internal.lastPage,d=this._createQuery();if(d.where=R(d.where,s),d.spatialRelationship=t.pagesDefinition.spatialRel,d.relationParameter=t.pagesDefinition.relationParam,d.outFields=t.pagesDefinition.outFields,d.outStatistics=t.pagesDefinition.outStatistics,d.geometry=t.pagesDefinition.geometry,d.groupByFieldsForStatistics=t.pagesDefinition.groupByFieldsForStatistics,d.num=t.pagesDefinition.resultRecordCount,d.start=t.pagesDefinition.internal.lastPage,d.returnGeometry=t.pagesDefinition.returnGeometry,d.orderByFields=""!==t.pagesDefinition.orderByFields?t.pagesDefinition.orderByFields.split(","):null,this.isTable()&&d.geometry&&d.spatialRelationship)return[];const c=await this.executeQuery(d,"execute");if(this._checkCancelled(i),!c.hasOwnProperty("features"))throw new a(n.InvalidStatResponse);const h=[];if(t.pagesDefinition.internal.lastPage!==u)return[];c.features.length>0&&void 0===c.features[0].attributes[t.pagesDefinition.generatedOid]&&(t.pagesDefinition.generatedOid=t.pagesDefinition.generatedOid.toLowerCase());for(let e=0;e<c.features.length;e++)t.pagesDefinition.internal.set[o+e]=c.features[e].attributes[t.pagesDefinition.generatedOid];for(let a=0;a<c.features.length;a++)h.push(new e({attributes:c.features[a].attributes,geometry:null}));return!0===t.pagesDefinition.useOIDpagination?0===c.features.length?t.pagesDefinition.internal.fullyResolved=!0:t.pagesDefinition.internal.lastMaxId=c.features[c.features.length-1].attributes[t.pagesDefinition.generatedOid]:(void 0===c.exceededTransferLimit&&c.features.length!==t.pagesDefinition.resultRecordCount||!1===c.exceededTransferLimit)&&(t.pagesDefinition.internal.fullyResolved=!0),t.pagesDefinition.internal.lastRetrieved=l+c.features.length,t.pagesDefinition.internal.lastPage+=t.pagesDefinition.resultRecordCount,h}static create(e,t,r,i,s){const a=new S({url:e,outFields:null===t?["*"]:t});return new P({layer:a,spatialReference:r,lrucache:i,interceptor:s})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON?.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return p(this._layer.parsedUrl.path)}async queryAttachments(e,t,r,a,n){function l(e){const t=e.capabilities;return t?.data.supportsAttachment&&t?.operations.supportsQueryAttachments}const o=this._layer;if(l(o)){const l={objectIds:[e],returnMetadata:n};(t&&t>0||r&&r>0)&&(l.size=[t&&t>0?t:0,r&&r>0?r:t+1]),a&&a.length>0&&(l.attachmentTypes=a),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:o,query:l,method:"attachments"});const u=await o.queryAttachments(new F(l)),d=[];return u&&u[e]&&u[e].forEach((t=>{const r=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let a=null;n&&t.exifInfo&&(a=s.convertJsonToArcade(t.exifInfo,"system",!0)),d.push(new i(t.id,t.name,t.contentType,t.size,r,a,t.keywords??null))})),d}return[]}async queryRelatedFeatures(t){const i={f:"json",relationshipId:t.relationshipId.toString(),definitionExpression:t.where,outFields:t.outFields?.join(","),returnGeometry:t.returnGeometry.toString()};void 0!==t.resultOffset&&null!==t.resultOffset&&(i.resultOffset=t.resultOffset.toString()),void 0!==t.resultRecordCount&&null!==t.resultRecordCount&&(i.resultRecordCount=t.resultRecordCount.toString()),t.orderByFields&&(i.orderByFields=t.orderByFields.join(",")),t.objectIds&&t.objectIds.length>0&&(i.objectIds=t.objectIds.join(",")),t.outSpatialReference&&(i.outSR=b(t.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:i,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const s=await r(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:i});if(s.data){const t={},r=s.data;if(r?.relatedRecordGroups){const i=r.spatialReference;for(const s of r.relatedRecordGroups){const a=s.objectId,n=[];for(const t of s.relatedRecords){t.geometry&&(t.geometry.spatialReference=i);const r=new e({geometry:t.geometry?w(t.geometry):null,attributes:t.attributes});n.push(r)}t[a]={features:n,exceededTransferLimit:!0===r.exceededTransferLimit}}}return t}throw new a(n.InvalidRequest)}async getFeatureByObjectId(e,t){const r=this._createQuery();r.outFields=t,r.returnGeometry=!1,r.outSpatialReference=this.spatialReference,r.where=R(r.where,this.objectIdField+"="+e.toString()),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:r,method:"execute"});const i=await this._layer.queryFeatures(r);return 1===i.features.length?i.features[0]:null}async getIdentityUser(){await this.load();const e=t?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=t?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let i=this._layer.url;const s=i.toLowerCase().indexOf("/rest/services");if(i=s>-1?i.slice(0,s):i,i){i+="/rest/info";try{const e=await r(i,{query:{f:"json"}});let t="";return e.data?.owningSystemUrl&&(t=e.data.owningSystemUrl),t}catch(a){return""}}return""}getDataSourceFeatureSet(){const e=new P({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone??!1}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){if(this.fsetInfo)return this.fsetInfo;let e=null,t="serviceItemId"in this._layer?this._layer.serviceItemId:null;const i=this._layer.parsedUrl?.path??null;if(i){const s=await r(i,{responseType:"json",query:{f:"json"}});e=s?.data?.name??null,t=s?.data?.serviceItemId??null}const s=this._layer.title&&null!==(this._layer.parent??null);return this.featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===t?null:t,serviceLayerUrl:""===i?null:i,webMapLayerId:s?this._layer.id??null:null,webMapLayerTitle:s?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}}export{P as default};
5
+ import e from"../../../Graphic.js";import{id as t}from"../../../kernel.js";import r from"../../../request.js";import i from"../../Attachment.js";import s from"../../Dictionary.js";import{FeatureSetError as a,FeatureSetErrorCodes as n}from"../support/errorsupport.js";import l from"../support/FeatureSet.js";import o from"../support/IdSet.js";import{defaultMaxRecords as u,stableStringify as d,FeatureServiceDatabaseType as c,IdState as h,extractServiceUrl as p}from"../support/shared.js";import{toWhereClause as y,isSingleField as f}from"../support/sqlUtils.js";import{decodeStatType as g}from"../support/stats.js";import{sliceEquals as _}from"../../../core/arrayUtils.js";import{createMD5Hash as m,outputTypes as w}from"../../../core/MD5.js";import{sqlAnd as R}from"../../../core/sql.js";import F from"../../../core/sql/WhereClause.js";import{fromJSON as S}from"../../../geometry/support/jsonUtils.js";import{srToRESTValue as b}from"../../../geometry/support/spatialReferenceUtils.js";import I from"../../../layers/FeatureLayer.js";import D from"../../../rest/support/AttachmentQuery.js";import P from"../../../rest/support/Query.js";import C from"../../../rest/support/StatisticDefinition.js";function v(e){if(0===e.length)throw new a(n.NeverReach);const t=[];for(let i=0;i<e.length;i++){const r=e[i],s=[`"${r.name.replace('"','""')}" ${r.asc?">":"<"} @last_${i}`];for(let t=0;t<i;t++){const r=e[t];s.push(`"${r.name.replace('"','""')}" = @last_${t}`)}t.push(s.join(" AND "))}const r=t.join(" OR ");return F.create(r)}function T(e,t){null==e.clause&&(e.clause=v(e.keyFields));for(let r=0;r<e.keyFields.length;r++){const i=e.keyFields[r].name;e.clause.parameters[`last_${r}`]=t.attributes[i]}}class k extends l{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return u}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+d(e.toJSON());return m(t,w.String)}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType??"",this.fields=this._layer.fields.slice(),this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const r of this.fields)if("oid"===r.type)e.push(r),t.push(r.name);else for(const i of this._overrideFields)if(i.toLowerCase()===r.name.toLowerCase()){e.push(r),t.push(r.name);break}this.fields=e,this._overrideFields=t}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=c.StandardisedNoInterval,null!=e&&e>=10.61&&(this._databaseType=c.Standardised)):null!=e&&(e>=10.5&&(this._databaseType=c.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=c.Standardised))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}_isInFeatureSet(){return h.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new P;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch(r){return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)}_cacheableFeatureSetSourceKey(){return this._layer.url}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,this.datesInUnknownTimezone&&(e.timeReferenceUnknownClient=!0),this._requestStandardised&&(e.sqlFormat="standard"),this._useDefinitionExpression?"subtype-group"===this._layer.type&&(e.where=this._layer.definitionExpression):e.where=null,e}executeQuery(e,t){const r="execute"===t?this._layer.queryFeatures.bind(this._layer):"executeForCount"===t?this._layer.queryFeatureCount.bind(this._layer):this._layer.queryObjectIds.bind(this._layer);let i=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);i=this.recentlyUsedQueries.getFromCache(t),null===i&&(i=r(e),this.recentlyUsedQueries.addToCache(t,i),i=i.catch((e=>{throw this.recentlyUsedQueries?.removeFromCache(t),e})))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===i&&(i=r(e)),i}async _getFilteredSet(e,t,r,i,s){const a=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e){return new o([],[],!0,null)}if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,r,i,s);let n="",l=!1;null!==i&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(n=i.constructClause(),l=!0);const u=this._createQuery();u.where=R(u.where,null===r?null===t?"1=1":"":y(r,a)),u.spatialRelationship=this._makeRelationshipEnum(e),u.outSpatialReference=this.spatialReference,u.orderByFields=""!==n?n.split(","):null,u.geometry=null===t?null:t,u.relationParameter=this._makeRelationshipParam(e);let d=await this.executeQuery(u,"executeForIds");null===d&&(d=[]),this._checkCancelled(s);return new o([],d,l,null)}_expandPagedSet(e,t,r,i,s){return this._expandPagedSetFeatureSet(e,t,r,i,s)}async _getFilteredSetUsingPaging(e,t,r,i,s){let a="",n=!1;null!==i&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=i.constructClause(),n=!0);const l=await this.databaseType(),u=null===r?null===t?"1=1":"":y(r,l);let d=this._maxQueryRate();const c=this._layer.capabilities?.query.maxRecordCount;null!=c&&c<d&&(d=c);let h=null;if(!0===this._pageJustIds)h=new o([],["GETPAGES"],n,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:this._layer.objectIdField,resultRecordCount:d,resultOffset:0,geometry:null===t?null:t,where:u,orderByFields:a,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let r=!0;!0===this._removeGeometry&&(r=!1);const i=this._overrideFields??this._fieldsIncludingObjectId(["*"]);h=new o([],["GETPAGES"],n,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:i.join(","),resultRecordCount:d,resultOffset:0,geometry:null===t?null:t,where:u,orderByFields:a,returnGeometry:r,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(h,d,0,1,s),h}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,r){const i=e.pagesDefinition.internal.lastRetrieved,s=i,a=e.pagesDefinition.internal.lastPage,n=this._createQuery();n.spatialRelationship=e.pagesDefinition.spatialRel,n.relationParameter=e.pagesDefinition.relationParam,n.outFields=e.pagesDefinition.outFields.split(","),n.num=e.pagesDefinition.resultRecordCount,n.start=e.pagesDefinition.internal.lastPage,n.geometry=e.pagesDefinition.geometry,n.where=R(n.where,e.pagesDefinition.where),n.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,n.returnGeometry=e.pagesDefinition.returnGeometry,n.outSpatialReference=this.spatialReference;const l=await this.executeQuery(n,"execute");if(this._checkCancelled(r),e.pagesDefinition.internal.lastPage!==a)return"done";const o=this._layer.objectIdField;for(let u=0;u<l.features.length;u++)e.pagesDefinition.internal.set[s+u]=l.features[u].attributes[o];if(!1===this._pageJustIds)for(let u=0;u<l.features.length;u++)this._featureCache[l.features[u].attributes[o]]=l.features[u];return(void 0===l.exceededTransferLimit&&l.features.length!==e.pagesDefinition.resultRecordCount||!1===l.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=i+l.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let r=!1;for(const i of t)if(i.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return!1===r&&t.push(this.objectIdField),t}async _getFeatures(e,t,r,i){const s=[];if(-1!==t&&void 0===this._featureCache[t]&&s.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,i),this._getFeatures(e,t,r,i);let l=0;for(let a=e._lastFetchedIndex;a<e._known.length;a++){if(e._lastFetchedIndex+=1,l++,void 0===this._featureCache[e._known[a]]){let r=!1;if(null!==this._layer._mode&&void 0!==this._layer._mode){const t=this._layer._mode;if(void 0!==t._featureMap[e._known[a]]){const i=t._featureMap[e._known[a]];null!==i&&(r=!0,this._featureCache[e._known[a]]=i)}}if(!1===r&&(e._known[a]!==t&&s.push(e._known[a]),s.length>=this._maxProcessingRate()-1))break}if(l>=r&&0===s.length)break}if(0===s.length)return"success";const o=this._createQuery();o.objectIds=s,o.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),o.returnGeometry=!0,!0===this._removeGeometry&&(o.returnGeometry=!1),o.outSpatialReference=this.spatialReference;const u=await this.executeQuery(o,"execute");if(this._checkCancelled(i),void 0!==u.error)throw new a(n.RequestFailed,{reason:u.error});const d=this._layer.objectIdField;for(let a=0;a<u.features.length;a++)this._featureCache[u.features[a].attributes[d]]=u.features[a];return"success"}async _getDistinctPages(e,t,r,i,s,l,o,u,d){await this._ensureLoaded();const c=await this.databaseType();let h=r.parseTree.column;const p=this._layer.fields??[];for(let a=0;a<p.length;a++)if(p[a].name.toLowerCase()===h.toLowerCase()){h=p[a].name;break}const f=this._createQuery();f.where=R(f.where,null===l?null===s?"1=1":"":y(l,c)),f.spatialRelationship=this._makeRelationshipEnum(i),f.relationParameter=this._makeRelationshipParam(i),f.geometry=null===s?null:s,f.returnDistinctValues=!0,f.returnGeometry=!1,f.outFields=[h];const g=await this.executeQuery(f,"execute");if(this._checkCancelled(d),!g.hasOwnProperty("features"))throw new a(n.InvalidStatResponse);let _=!1;for(let a=0;a<p.length;a++)if(p[a].name===h){"date"===p[a].type&&(_=!0);break}for(let a=0;a<g.features.length;a++){if(_){const e=g.features[a].attributes[h];null!==e?u.push(new Date(e)):u.push(e)}else u.push(g.features[a].attributes[h]);if(u.length>=o)break}if(0===g.features.length)return u;if(g.features.length===this._layer.capabilities?.query.maxRecordCount&&u.length<o){return{calculated:!0,result:await this._getDistinctPages(e+g.features.length,t,r,i,s,l,o,u,d)}}return u}async _distinctStat(e,t,r,i,s,a,n){return{calculated:!0,result:await this._getDistinctPages(0,e,t,r,i,s,a,[],n)}}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType||"esriGeometryNull"===this._layer.geometryType}async _countstat(e,t,r,i){const s=await this.databaseType();if(this.isTable()&&r&&null!==t&&""!==t)return{calculated:!0,result:0};const a=this._createQuery();a.where=R(a.where,null===i?null===r?"1=1":"":y(i,s)),a.spatialRelationship=this._makeRelationshipEnum(t),a.relationParameter=this._makeRelationshipParam(t),a.geometry=null===r?null:r,a.returnGeometry=!1;return{calculated:!0,result:await this.executeQuery(a,"executeForCount")}}async _stats(e,t,r,i,s,l,o){await this._ensureLoaded();const u=this._layer.capabilities?.query,d=!!u?.supportsSqlExpression,c=!!u?.supportsStatistics,h=!!u?.supportsDistinct;if("count"===e)return h?this._countstat(e,r,i,s):{calculated:!1};if(!1===c||!1===f(t)&&!1===d||!1===t.isStandardized)return""!==r||null!==s?{calculated:!1}:this._manualStat(e,t,l,o);if("distinct"===e)return!1===h?""!==r||null!==s?{calculated:!1}:this._manualStat(e,t,l,o):this._distinctStat(e,t,r,i,s,l,o);const p=await this.databaseType();if(this.isTable()&&i&&null!==r&&""!==r)return{calculated:!0,result:null};const _=this._createQuery();_.where=R(_.where,null===s?null===i?"1=1":"":y(s,p)),_.spatialRelationship=this._makeRelationshipEnum(r),_.relationParameter=this._makeRelationshipParam(r),_.geometry=null===i?null:i;const m=new C;m.statisticType=g(e),m.onStatisticField=y(t,p),m.outStatisticFieldName="ARCADE_STAT_RESULT",_.returnGeometry=!1;let w="ARCADE_STAT_RESULT";_.outStatistics=[m];const F=await this.executeQuery(_,"execute");if(!F.hasOwnProperty("features")||0===F.features.length)throw new a(n.InvalidStatResponse);let S=!1;const b=F.fields??[];for(let a=0;a<b.length;a++)if("ARCADE_STAT_RESULT"===b[a].name.toUpperCase()){w=b[a].name,"date"===b[a].type&&(S=!0);break}if(S){let e=F.features[0].attributes[w];return null!==e&&(e=new Date(F.features[0].attributes[w])),{calculated:!0,result:e}}return{calculated:!0,result:F.features[0].attributes[w]}}_stat(e,t,r,i,s,a,n){return this._stats(e,t,r,i,s,a,n)}async _canDoAggregates(e,t){await this._ensureLoaded();let r=!1;const i=this._layer.capabilities?.query,s=!0===i?.supportsSqlExpression;if(null!=i&&!0===i.supportsStatistics&&!0===i.supportsOrderBy&&(r=!0),r)for(let a=0;a<t.length-1;a++)(!1===t[a].workingexpr?.isStandardized||!1===f(t[a].workingexpr)&&!1===s)&&(r=!1);return!1!==r}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _getAggregatePagesDataSourceDefinition(e,t,r,i,s,a,n){await this._ensureLoaded();const l=await this.databaseType();let u=null;if(!this._layer.capabilities.query.supportsPaginationOnAggregatedQueries){const t=this.getFieldsIndex();u={keyFields:e.map(((e,r)=>({name:t.normalizeFieldName(e)??e,asc:null==a||1===a._directions[r]})))}}let d="",c=!1;null!=a&&!0===this._layer.capabilities?.query?.supportsOrderBy&&(null==u||_(e,0,e.length,a._fields,0,Math.min(a._fields.length,e.length),((e,t)=>e.toLowerCase()===t.toLowerCase())))&&(d=a.constructClause(),c=!0),""===d&&(d=e.join(","));const h=[];for(let o=0;o<t.length;o++){const e=new C;e.onStatisticField=null!==t[o].workingexpr?y(t[o].workingexpr,l):"",e.outStatisticFieldName=t[o].field,e.statisticType=t[o].toStatisticsName(),h.push(e)}let p=this._maxQueryRate();const f=this._layer.capabilities?.query.maxRecordCount;null!=f&&f<p&&(p=f);const g=null===s?null===i?"1=1":"":y(s,l);return new o([],["GETPAGES"],c,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(r),relationParam:this._makeRelationshipParam(r),outFields:["*"],useOIDpagination:!1,generatedOid:n,resultRecordCount:p,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:h,geometry:null===i?null:i,where:g,orderByFields:d,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1,keysetPagination:u}})}async _getAgregagtePhysicalPage(t,r,i){let s=t.pagesDefinition.where;if(!0===t.pagesDefinition.useOIDpagination&&(s=R(s,t.pagesDefinition.generatedOid+">"+t.pagesDefinition.internal.lastMaxId.toString())),null!=t.pagesDefinition.internal.keysetPagination?.clause){if(!this._layer.capabilities.query.supportsOrderBy)throw new a(n.NotImplemented);s=R(s,y(t.pagesDefinition.internal.keysetPagination.clause,await this.databaseType()))}const l=t.pagesDefinition.internal.lastRetrieved,o=l,u=t.pagesDefinition.internal.lastPage,d=this._createQuery();if(d.where=R(d.where,s),d.spatialRelationship=t.pagesDefinition.spatialRel,d.relationParameter=t.pagesDefinition.relationParam,d.outFields=t.pagesDefinition.outFields,d.outStatistics=t.pagesDefinition.outStatistics,d.geometry=t.pagesDefinition.geometry,d.groupByFieldsForStatistics=t.pagesDefinition.groupByFieldsForStatistics,d.num=t.pagesDefinition.resultRecordCount,d.start=t.pagesDefinition.internal.lastPage,d.returnGeometry=t.pagesDefinition.returnGeometry,d.orderByFields=""!==t.pagesDefinition.orderByFields?t.pagesDefinition.orderByFields.split(","):null,this.isTable()&&d.geometry&&d.spatialRelationship)return[];const c=await this.executeQuery(d,"execute");if(this._checkCancelled(i),!c.hasOwnProperty("features"))throw new a(n.InvalidStatResponse);const h=[];if(t.pagesDefinition.internal.lastPage!==u)return[];c.features.length>0&&void 0===c.features[0].attributes[t.pagesDefinition.generatedOid]&&(t.pagesDefinition.generatedOid=t.pagesDefinition.generatedOid.toLowerCase());for(let e=0;e<c.features.length;e++)t.pagesDefinition.internal.set[o+e]=c.features[e].attributes[t.pagesDefinition.generatedOid];for(let a=0;a<c.features.length;a++)h.push(new e({attributes:c.features[a].attributes,geometry:null}));return t.pagesDefinition.internal.keysetPagination?0!==c.features.length&&c.exceededTransferLimit?T(t.pagesDefinition.internal.keysetPagination,h.at(-1)):t.pagesDefinition.internal.fullyResolved=!0:!0===t.pagesDefinition.useOIDpagination?0===c.features.length?t.pagesDefinition.internal.fullyResolved=!0:t.pagesDefinition.internal.lastMaxId=c.features[c.features.length-1].attributes[t.pagesDefinition.generatedOid]:(void 0===c.exceededTransferLimit&&c.features.length!==t.pagesDefinition.resultRecordCount||!1===c.exceededTransferLimit)&&(t.pagesDefinition.internal.fullyResolved=!0),t.pagesDefinition.internal.lastRetrieved=l+c.features.length,t.pagesDefinition.internal.lastPage+=t.pagesDefinition.resultRecordCount,h}static create(e,t,r,i,s){const a=new I({url:e,outFields:null===t?["*"]:t});return new k({layer:a,spatialReference:r,lrucache:i,interceptor:s})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON?.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return p(this._layer.parsedUrl.path)}async queryAttachments(e,t,r,a,n){function l(e){const t=e.capabilities;return t?.data.supportsAttachment&&t?.operations.supportsQueryAttachments}const o=this._layer;if(l(o)){const l={objectIds:[e],returnMetadata:n};(t&&t>0||r&&r>0)&&(l.size=[t&&t>0?t:0,r&&r>0?r:t+1]),a&&a.length>0&&(l.attachmentTypes=a),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:o,query:l,method:"attachments"});const u=await o.queryAttachments(new D(l)),d=[];return u&&u[e]&&u[e].forEach((t=>{const r=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let a=null;n&&t.exifInfo&&(a=s.convertJsonToArcade(t.exifInfo,"system",!0)),d.push(new i(t.id,t.name,t.contentType,t.size,r,a,t.keywords??null))})),d}return[]}async queryRelatedFeatures(t){const i={f:"json",relationshipId:t.relationshipId.toString(),definitionExpression:t.where,outFields:t.outFields?.join(","),returnGeometry:t.returnGeometry.toString()};void 0!==t.resultOffset&&null!==t.resultOffset&&(i.resultOffset=t.resultOffset.toString()),void 0!==t.resultRecordCount&&null!==t.resultRecordCount&&(i.resultRecordCount=t.resultRecordCount.toString()),t.orderByFields&&(i.orderByFields=t.orderByFields.join(",")),t.objectIds&&t.objectIds.length>0&&(i.objectIds=t.objectIds.join(",")),t.outSpatialReference&&(i.outSR=b(t.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:i,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const s=await r(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:i});if(s.data){const t={},r=s.data;if(r?.relatedRecordGroups){const i=r.spatialReference;for(const s of r.relatedRecordGroups){const a=s.objectId,n=[];for(const t of s.relatedRecords){t.geometry&&(t.geometry.spatialReference=i);const r=new e({geometry:t.geometry?S(t.geometry):null,attributes:t.attributes});n.push(r)}t[a]={features:n,exceededTransferLimit:!0===r.exceededTransferLimit}}}return t}throw new a(n.InvalidRequest)}async getFeatureByObjectId(e,t){const r=this._createQuery();r.outFields=t,r.returnGeometry=!1,r.outSpatialReference=this.spatialReference,r.where=R(r.where,this.objectIdField+"="+e.toString()),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:r,method:"execute"});const i=await this._layer.queryFeatures(r);return 1===i.features.length?i.features[0]:null}async getIdentityUser(){await this.load();const e=t?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=t?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let i=this._layer.url;const s=i.toLowerCase().indexOf("/rest/services");if(i=s>-1?i.slice(0,s):i,i){i+="/rest/info";try{const e=await r(i,{query:{f:"json"}});let t="";return e.data?.owningSystemUrl&&(t=e.data.owningSystemUrl),t}catch(a){return""}}return""}getDataSourceFeatureSet(){const e=new k({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone??!1}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){if(this.fsetInfo)return this.fsetInfo;let e=null,t="serviceItemId"in this._layer?this._layer.serviceItemId:null;const i=this._layer.parsedUrl?.path??null;if(i){const s=await r(i,{responseType:"json",query:{f:"json"}});e=s?.data?.name??null,t=s?.data?.serviceItemId??null}const s=this._layer.title&&null!==(this._layer.parent??null);return this.featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===t?null:t,serviceLayerUrl:""===i?null:i,webMapLayerId:s?this._layer.id??null:null,webMapLayerTitle:s?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}}export{k as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../config.js";import r from"../ArcadePortal.js";import t from"../Dictionary.js";import{ArcadeExecutionError as n,ExecutionErrorCodes as o}from"../executionError.js";import{D as a,f as i,r as s,K as p,L as l,g as c,j as f,k as u,q as m,l as d}from"../../chunks/languageUtils.js";import{getPortal as g}from"../portalUtils.js";import h from"../../geometry/Geometry.js";import{load as w,project as y,isLoaded as j}from"../../geometry/projection.js";import S from"../../geometry/SpatialReference.js";import{webMercatorToGeographic as v,geographicToWebMercator as R}from"../../geometry/support/webMercatorUtils.js";import G from"../../portal/Portal.js";import k from"../../portal/PortalItem.js";import{project as x}from"../../rest/geometryService/project.js";import P from"../../rest/knowledgeGraph/Entity.js";import b from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import I from"../../rest/knowledgeGraph/ObjectValue.js";import D from"../../rest/knowledgeGraph/Path.js";import W from"../../rest/knowledgeGraph/Relationship.js";import T from"../../rest/support/ProjectParameters.js";import{isString as q,isArray as A,isNumber as N,isDate as U}from"../../support/guards.js";let F=null;async function J(r){const t=e.geometryServiceUrl??"";if(!t){j()||await w();for(const e of r)e.container[e.indexer]=y(e.container[e.indexer],S.WGS84);return}const n=r.map((e=>e.container[e.indexer])),o=new T({geometries:n,outSpatialReference:S.WGS84}),a=await x(t,o);for(let e=0;e<a.length;e++){const t=r[e];t.container[t.indexer]=a[e]}}async function M(e,r){const t=new k({portal:e,id:r});return await t.load(),null===F&&(F=await import("../../rest/knowledgeGraphService.js")),await F.fetchKnowledgeGraph(t.url)}function Q(e,r,t,n,o){if(null===e)return null;if(q(e)||N(e))return e;if(c(e))return e.toJSDate();if(c(e))return e.toJSDate();if(f(e))return e.toStorageFormat();if(u(e))return e.toStorageString();if(m(e)){const a={};for(const i of e.keys())a[i]=Q(e.field(i),r,t,n,o),a[i]instanceof h&&o.push({container:a,indexer:i});return a}if(A(e)){const a=e.map((e=>Q(e,r,t,n,o)));for(let e=0;e<a.length;e++)a[e]instanceof h&&o.push({container:a,indexer:e});return a}return d(e)?e.spatialReference.isWGS84?e:e.spatialReference.isWebMercator&&r?v(e):e:void 0}function E(e,r){if(!e)return e;if(e.spatialReference.isWGS84&&r.spatialReference.isWebMercator)return R(e);if(e.spatialReference.equals(r.spatialReference))return e;throw new n(r,o.WrongSpatialReference,null)}function K(e,r){if(!e)return null;const t={};for(const n in e)t[n]=V(e[n],r);return t}function V(e,r){return null===e?null:A(e)?e.map((e=>V(e,r))):e instanceof P?{graphTypeName:e.typeName,id:e.id,graphType:"entity",properties:K(e.properties,r)}:e instanceof I?{graphType:"object",properties:K(e.properties,r)}:e instanceof W?{graphTypeName:e.typeName,id:e.id,graphType:"relationship",originId:e.originId??null,destinationId:e.destinationId??null,properties:K(e.properties,r)}:e instanceof D?{graphType:"path",path:e.path?e.path.map((e=>V(e,r))):null}:d(e)?E(e,r):q(e)||N(e)||U(e)?e:null}function B(e){"async"===e.mode&&(e.functions.knowledgegraphbyportalitem=function(t,s){return e.standardFunctionAsync(t,s,((e,p,l)=>{if(a(l,2,2,t,s),null===l[0])throw new n(t,o.PortalRequired,s);if(l[0]instanceof r){const e=i(l[1]);let r;r=t.services?.portal?t.services.portal:G.getDefault();return M(g(l[0],r),e)}if(!1===q(l[0]))throw new n(t,o.InvalidParameter,s);const c=i(l[0]);return M(t.services?.portal??G.getDefault(),c)}))},e.signatures.push({name:"knowledgegraphbyportalitem",min:2,max:2}),e.functions.querygraph=function(r,i){return e.standardFunctionAsync(r,i,(async(e,c,f)=>{a(f,2,4,r,i);const u=f[0];if(!s(u))throw new n(r,o.InvalidParameter,i);const m=f[1];if(!q(m))throw new n(r,o.InvalidParameter,i);null===F&&(F=await import("../../rest/knowledgeGraphService.js"));let d=null;const g=p(f[2],null);if(!(g instanceof t||null===g))throw new n(r,o.InvalidParameter,i);if(g){let e=[];d=Q(g,!0,!1,r,e),e=e.filter((e=>!e.container[e.indexer].spatialReference.isWGS84)),e.length>0&&await J(e)}const h=p(f[3],!1),w=new b({openCypherQuery:m,bindParameters:d,provenanceBehavior:h?"include":"exclude"});(u?.serviceDefinition?.currentVersion??11.3)>11.2&&(w.outputSpatialReference=r.spatialReference);const y=(await F.executeQueryStreaming(u,w)).resultRowsStream.getReader(),j=[];try{for(;;){const{done:e,value:t}=await y.read();if(e)break;if(A(t))for(const n of t)j.push(V(n,r));else{const e=[];for(const n of t)e.push(V(t[n],r));j.push(e)}}}catch(S){throw S}return t.convertJsonToArcade(j,l(r),!1,!0)}))},e.signatures.push({name:"querygraph",min:2,max:4}))}export{B as registerFunctions};
5
+ import e from"../../config.js";import r from"../ArcadePortal.js";import t from"../Dictionary.js";import{ArcadeExecutionError as n,ExecutionErrorCodes as o}from"../executionError.js";import{D as a,f as i,r as s,K as p,L as l,g as c,j as f,k as u,q as m,l as d}from"../../chunks/languageUtils.js";import{getPortal as g}from"../portalUtils.js";import h from"../../geometry/Geometry.js";import{load as w,project as y,isLoaded as j}from"../../geometry/projectionUtils.js";import S from"../../geometry/SpatialReference.js";import{webMercatorToGeographic as v,geographicToWebMercator as R}from"../../geometry/support/webMercatorUtils.js";import G from"../../portal/Portal.js";import k from"../../portal/PortalItem.js";import{project as x}from"../../rest/geometryService/project.js";import P from"../../rest/knowledgeGraph/Entity.js";import b from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import I from"../../rest/knowledgeGraph/ObjectValue.js";import D from"../../rest/knowledgeGraph/Path.js";import W from"../../rest/knowledgeGraph/Relationship.js";import T from"../../rest/support/ProjectParameters.js";import{isString as q,isArray as U,isNumber as A,isDate as N}from"../../support/guards.js";let F=null;async function J(r){const t=e.geometryServiceUrl??"";if(!t){j()||await w();for(const e of r)e.container[e.indexer]=y(e.container[e.indexer],S.WGS84);return}const n=r.map((e=>e.container[e.indexer])),o=new T({geometries:n,outSpatialReference:S.WGS84}),a=await x(t,o);for(let e=0;e<a.length;e++){const t=r[e];t.container[t.indexer]=a[e]}}async function M(e,r){const t=new k({portal:e,id:r});return await t.load(),null===F&&(F=await import("../../rest/knowledgeGraphService.js")),await F.fetchKnowledgeGraph(t.url)}function Q(e,r,t,n,o){if(null===e)return null;if(q(e)||A(e))return e;if(c(e))return e.toJSDate();if(c(e))return e.toJSDate();if(f(e))return e.toStorageFormat();if(u(e))return e.toStorageString();if(m(e)){const a={};for(const i of e.keys())a[i]=Q(e.field(i),r,t,n,o),a[i]instanceof h&&o.push({container:a,indexer:i});return a}if(U(e)){const a=e.map((e=>Q(e,r,t,n,o)));for(let e=0;e<a.length;e++)a[e]instanceof h&&o.push({container:a,indexer:e});return a}return d(e)?e.spatialReference.isWGS84?e:e.spatialReference.isWebMercator&&r?v(e):e:void 0}function E(e,r){if(!e)return e;if(e.spatialReference.isWGS84&&r.spatialReference.isWebMercator)return R(e);if(e.spatialReference.equals(r.spatialReference))return e;throw new n(r,o.WrongSpatialReference,null)}function K(e,r){if(!e)return null;const t={};for(const n in e)t[n]=V(e[n],r);return t}function V(e,r){return null===e?null:U(e)?e.map((e=>V(e,r))):e instanceof P?{graphTypeName:e.typeName,id:e.id,graphType:"entity",properties:K(e.properties,r)}:e instanceof I?{graphType:"object",properties:K(e.properties,r)}:e instanceof W?{graphTypeName:e.typeName,id:e.id,graphType:"relationship",originId:e.originId??null,destinationId:e.destinationId??null,properties:K(e.properties,r)}:e instanceof D?{graphType:"path",path:e.path?e.path.map((e=>V(e,r))):null}:d(e)?E(e,r):q(e)||A(e)||N(e)?e:null}function B(e){"async"===e.mode&&(e.functions.knowledgegraphbyportalitem=function(t,s){return e.standardFunctionAsync(t,s,((e,p,l)=>{if(a(l,2,2,t,s),null===l[0])throw new n(t,o.PortalRequired,s);if(l[0]instanceof r){const e=i(l[1]);let r;r=t.services?.portal?t.services.portal:G.getDefault();return M(g(l[0],r),e)}if(!1===q(l[0]))throw new n(t,o.InvalidParameter,s);const c=i(l[0]);return M(t.services?.portal??G.getDefault(),c)}))},e.signatures.push({name:"knowledgegraphbyportalitem",min:2,max:2}),e.functions.querygraph=function(r,i){return e.standardFunctionAsync(r,i,(async(e,c,f)=>{a(f,2,4,r,i);const u=f[0];if(!s(u))throw new n(r,o.InvalidParameter,i);const m=f[1];if(!q(m))throw new n(r,o.InvalidParameter,i);null===F&&(F=await import("../../rest/knowledgeGraphService.js"));let d=null;const g=p(f[2],null);if(!(g instanceof t||null===g))throw new n(r,o.InvalidParameter,i);if(g){let e=[];d=Q(g,!0,!1,r,e),e=e.filter((e=>!e.container[e.indexer].spatialReference.isWGS84)),e.length>0&&await J(e)}const h=p(f[3],!1),w=new b({openCypherQuery:m,bindParameters:d,provenanceBehavior:h?"include":"exclude"});(u?.serviceDefinition?.currentVersion??11.3)>11.2&&(w.outputSpatialReference=r.spatialReference);const y=(await F.executeQueryStreaming(u,w)).resultRowsStream.getReader(),j=[];try{for(;;){const{done:e,value:t}=await y.read();if(e)break;if(U(t))for(const n of t)j.push(V(n,r));else{const e=[];for(const n of t)e.push(V(t[n],r));j.push(e)}}}catch(S){throw S}return t.convertJsonToArcade(j,l(r),!1,!0)}))},e.signatures.push({name:"querygraph",min:2,max:4}))}export{B as registerFunctions};