@arcgis/core 4.33.0-next.20250515 → 4.33.0-next.20250517

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 (484) hide show
  1. package/Basemap.js +1 -1
  2. package/applications/Components/QuantityFormatter.d.ts +4 -0
  3. package/applications/Components/QuantityFormatter.js +5 -0
  4. package/applications/Components/baUtils.js +1 -1
  5. package/arcade/ArcadeDate.js +1 -1
  6. package/arcade/enum.js +5 -0
  7. package/arcade/featureset/actions/GroupBy.js +1 -1
  8. package/arcade/functions/convertdirection.js +1 -1
  9. package/arcade/functions/date.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/geomasync.js +1 -1
  12. package/arcade/functions/geomsync.js +1 -1
  13. package/arcade/functions/string.js +1 -1
  14. package/arcade/geometry/functions.js +1 -1
  15. package/arcade/geometry/unitConversion.js +1 -1
  16. package/assets/esri/core/workers/RemoteClient.js +1 -1
  17. package/assets/esri/core/workers/chunks/{0fd6d80393722132e044.js → 0229c573fa8a2fff2d8b.js} +2 -2
  18. package/assets/esri/core/workers/chunks/{d21d9e8b8c8a2e0485d5.js → 094e8aae6dada24c8115.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{ffaa977cd97a2b7190c5.js → 0c2dccec20c0994366fe.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{8f1fbfdac04e694f621d.js → 0c50ee1f3cdd30d96479.js} +1 -1
  21. package/assets/esri/core/workers/chunks/151d6354e7bc105b25c0.js +346 -0
  22. package/assets/esri/core/workers/chunks/1cf0fae3f2e848a2a738.js +1 -0
  23. package/assets/esri/core/workers/chunks/24327d01cb2c5c55a4b7.js +1 -0
  24. package/assets/esri/core/workers/chunks/{1a010d877b8428e755fb.js → 2841888fdbc2770e90c8.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{7e1dc8e5e18f18dd21e2.js → 29fb64826bb1351aca8d.js} +2 -2
  26. package/assets/esri/core/workers/chunks/{1f4fd9e3849f4e593375.js → 2b1486a466760d2152f5.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{4e0d2458f4d7a35bb97c.js → 2ce5cc797ae0d66c8678.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{9d564f79b82d427fc1da.js → 2fd30428309f4c517d4c.js} +1 -1
  29. package/assets/esri/core/workers/chunks/3ca6f893fd58f5b17af5.js +1 -0
  30. package/assets/esri/core/workers/chunks/{52d160cb7921ae7a4f57.js → 3fc44d8cef392b4b9c7a.js} +1 -1
  31. package/assets/esri/core/workers/chunks/417293f00b2c21cc3175.js +1 -0
  32. package/assets/esri/core/workers/chunks/{4cb199b547e5b97e65fb.js → 48cedef1c926d11164b7.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{563594357f3648652a5c.js → 4b21c4815533a43835c3.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{d166f805990353578494.js → 523046e04679e301797d.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{921c040d0497031fd8ff.js → 54da9c7fd1088a8076ce.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{ab9614555a15f04396f6.js → 54f981fe0f8851767be9.js} +2 -2
  37. package/assets/esri/core/workers/chunks/{28d9e2ffc3059a55311e.js → 59f701c30bcd9088b291.js} +1 -1
  38. package/assets/esri/core/workers/chunks/5d50a8d0427eab0a2514.js +1 -0
  39. package/assets/esri/core/workers/chunks/5f4ca51b82daf0e51010.js +1 -0
  40. package/assets/esri/core/workers/chunks/{05c80002c37002ac99e8.js → 5f6719286a6c9a3ac74b.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{a09b5700c92bb76c3234.js → 638ecabe3e22978af5a3.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{9fff43ffcd5602ccc50f.js → 649caffe8f5dbaad0d7b.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{4480e4b61affb3b2e9d6.js → 6648e68f00d28e12bcf9.js} +1 -1
  44. package/assets/esri/core/workers/chunks/66a1b92358344dd28ee1.js +1 -0
  45. package/assets/esri/core/workers/chunks/{b92a34f88569c481ed10.js → 67338948e470c1251d8a.js} +3 -3
  46. package/assets/esri/core/workers/chunks/{a8d043b73e087bee7c40.js → 67c5f1112a7c65e9eeff.js} +1 -1
  47. package/assets/esri/core/workers/chunks/6a225393b63e1e8c7933.js +1 -0
  48. package/assets/esri/core/workers/chunks/6c29a768f02dc7ce0ed6.js +1 -0
  49. package/assets/esri/core/workers/chunks/{fbd2f45d5adce4ca323f.js → 73ddb356121add556994.js} +2 -2
  50. package/assets/esri/core/workers/chunks/{a6ca68ef6311ffc365b2.js → 73e179b04bb931ca9b86.js} +1 -1
  51. package/assets/esri/core/workers/chunks/7678177555570682154e.js +1 -0
  52. package/assets/esri/core/workers/chunks/7a9a0383f27f4967bcfa.js +1 -0
  53. package/assets/esri/core/workers/chunks/7b9d14cc4a466ef18d71.js +1 -0
  54. package/assets/esri/core/workers/chunks/7e6141b5baae47682f97.js +1 -0
  55. package/assets/esri/core/workers/chunks/{257db39a1ba1a11ebfb4.js → 8365707e408d19988356.js} +1 -1
  56. package/assets/esri/core/workers/chunks/87fc7b6c3e2d4f7775e2.js +1 -0
  57. package/assets/esri/core/workers/chunks/8a2cee726b7843c7408a.js +1 -0
  58. package/assets/esri/core/workers/chunks/{b1e275607d9754079f60.js → 8eadf90d938753691044.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{ff4e7da880b206fd98ec.js → 9049c81445cc044286f1.js} +1 -1
  60. package/assets/esri/core/workers/chunks/9588328d4ed6b0f04166.js +2 -0
  61. package/assets/esri/core/workers/chunks/{dcf5719f38ad40b92941.js → 9826a1c66885dbbdc130.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{3b4b4f84d594db8945f9.js → 9839309d0cd804fe52c2.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{c10885b3a0739708e9e0.js → 9a06476b834584d00d5c.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{4954e0cf4a40e45d237f.js → 9c8e66da6cf32ace0914.js} +1 -1
  65. package/assets/esri/core/workers/chunks/9cac00d4bfac14aaae12.js +1 -0
  66. package/assets/esri/core/workers/chunks/{d60da671aba70485050e.js → 9f18392933c06f1d63b6.js} +1 -1
  67. package/assets/esri/core/workers/chunks/a937076d2f8c2b6a5d8a.js +1 -0
  68. package/assets/esri/core/workers/chunks/{c3b2b05996e2008adbe3.js → a9f16323666042a9d47f.js} +1 -1
  69. package/assets/esri/core/workers/chunks/aad9a693813b47a51530.js +2 -0
  70. package/assets/esri/core/workers/chunks/{654fe135d41af81daa13.js → be1f3cac908c28c64401.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{5e52c1c076a1502f9fe4.js → be2c8c0a8b2bce7979b6.js} +1 -1
  72. package/assets/esri/core/workers/chunks/bf4d9cdcbe6bb8bc9d39.js +1 -0
  73. package/assets/esri/core/workers/chunks/{d49518eb4b351afc5f00.js → ca3851ca2621879eb887.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{56db71ea7eb8a5652d98.js → ca62e7ec102a1bb879dc.js} +1 -1
  75. package/assets/esri/core/workers/chunks/cb16ba9512ae0a09c55d.js +1 -0
  76. package/assets/esri/core/workers/chunks/{8c1242ffd48b3ef800fa.js → d103e184ddf9beec779d.js} +1 -1
  77. package/assets/esri/core/workers/chunks/d3d98ea5b5e56fc60a31.js +1 -0
  78. package/assets/esri/core/workers/chunks/{5719471414810b6a9aec.js → d9d9180689bcf71af00f.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{dcaeb57c69d432118604.js → db13c93b4d708a2481db.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{2c3bfa75286376388806.js → db192728fa0ee08a776a.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{40b8e53c8b1c447eff7e.js → e2d012078d51dc2b2802.js} +1 -1
  82. package/assets/esri/core/workers/chunks/e385a27fd1ac2123a05f.js +1 -0
  83. package/assets/esri/core/workers/chunks/{e85f892ea44d67d53ff0.js → f3b51aa0a1a8fc3b231c.js} +2 -2
  84. package/assets/esri/core/workers/chunks/f74f8ed3f17713a208c3.js +1 -0
  85. package/assets/esri/core/workers/chunks/f9567108862629f25c8b.js +1 -0
  86. package/assets/esri/core/workers/chunks/fa99abc572b382e7e0c7.js +1 -0
  87. package/assets/esri/themes/base/widgets/_Directions.scss +74 -0
  88. package/assets/esri/themes/base/widgets/_Editor.scss +2 -1
  89. package/assets/esri/themes/base/widgets/_SearchResultRenderer.scss +5 -30
  90. package/assets/esri/themes/dark/main.css +1 -1
  91. package/assets/esri/themes/light/main.css +1 -1
  92. package/assets/esri/themes/light/view.css +1 -1
  93. package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
  94. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  95. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  96. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  97. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  98. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  99. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  100. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  101. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  102. package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
  103. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  104. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  105. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  106. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  107. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  108. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  109. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  110. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  111. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  112. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  113. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  114. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  115. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  116. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  117. package/assets/esri/widgets/Directions/t9n/Directions_no.json +1 -1
  118. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  119. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  120. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  121. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  122. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  123. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  124. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  125. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  126. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  127. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  128. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  129. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  130. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  131. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  132. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  133. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  134. package/assets/esri/widgets/Search/t9n/Search.json +1 -1
  135. package/assets/esri/widgets/Search/t9n/Search_ar.json +1 -1
  136. package/assets/esri/widgets/Search/t9n/Search_bg.json +1 -1
  137. package/assets/esri/widgets/Search/t9n/Search_bs.json +1 -1
  138. package/assets/esri/widgets/Search/t9n/Search_ca.json +1 -1
  139. package/assets/esri/widgets/Search/t9n/Search_cs.json +1 -1
  140. package/assets/esri/widgets/Search/t9n/Search_da.json +1 -1
  141. package/assets/esri/widgets/Search/t9n/Search_de.json +1 -1
  142. package/assets/esri/widgets/Search/t9n/Search_el.json +1 -1
  143. package/assets/esri/widgets/Search/t9n/Search_en.json +1 -1
  144. package/assets/esri/widgets/Search/t9n/Search_es.json +1 -1
  145. package/assets/esri/widgets/Search/t9n/Search_et.json +1 -1
  146. package/assets/esri/widgets/Search/t9n/Search_fi.json +1 -1
  147. package/assets/esri/widgets/Search/t9n/Search_fr.json +1 -1
  148. package/assets/esri/widgets/Search/t9n/Search_he.json +1 -1
  149. package/assets/esri/widgets/Search/t9n/Search_hr.json +1 -1
  150. package/assets/esri/widgets/Search/t9n/Search_hu.json +1 -1
  151. package/assets/esri/widgets/Search/t9n/Search_id.json +1 -1
  152. package/assets/esri/widgets/Search/t9n/Search_it.json +1 -1
  153. package/assets/esri/widgets/Search/t9n/Search_ja.json +1 -1
  154. package/assets/esri/widgets/Search/t9n/Search_ko.json +1 -1
  155. package/assets/esri/widgets/Search/t9n/Search_lt.json +1 -1
  156. package/assets/esri/widgets/Search/t9n/Search_lv.json +1 -1
  157. package/assets/esri/widgets/Search/t9n/Search_nl.json +1 -1
  158. package/assets/esri/widgets/Search/t9n/Search_no.json +1 -1
  159. package/assets/esri/widgets/Search/t9n/Search_pl.json +1 -1
  160. package/assets/esri/widgets/Search/t9n/Search_pt-BR.json +1 -1
  161. package/assets/esri/widgets/Search/t9n/Search_pt-PT.json +1 -1
  162. package/assets/esri/widgets/Search/t9n/Search_ro.json +1 -1
  163. package/assets/esri/widgets/Search/t9n/Search_ru.json +1 -1
  164. package/assets/esri/widgets/Search/t9n/Search_sk.json +1 -1
  165. package/assets/esri/widgets/Search/t9n/Search_sl.json +1 -1
  166. package/assets/esri/widgets/Search/t9n/Search_sr.json +1 -1
  167. package/assets/esri/widgets/Search/t9n/Search_sv.json +1 -1
  168. package/assets/esri/widgets/Search/t9n/Search_th.json +1 -1
  169. package/assets/esri/widgets/Search/t9n/Search_tr.json +1 -1
  170. package/assets/esri/widgets/Search/t9n/Search_uk.json +1 -1
  171. package/assets/esri/widgets/Search/t9n/Search_vi.json +1 -1
  172. package/assets/esri/widgets/Search/t9n/Search_zh-CN.json +1 -1
  173. package/assets/esri/widgets/Search/t9n/Search_zh-HK.json +1 -1
  174. package/assets/esri/widgets/Search/t9n/Search_zh-TW.json +1 -1
  175. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ar.json +1 -0
  176. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_bg.json +1 -0
  177. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_bs.json +1 -0
  178. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ca.json +1 -0
  179. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_cs.json +1 -0
  180. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_da.json +1 -0
  181. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_de.json +1 -0
  182. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_el.json +1 -0
  183. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_es.json +1 -0
  184. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_et.json +1 -0
  185. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_fi.json +1 -0
  186. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_fr.json +1 -0
  187. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_he.json +1 -0
  188. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_hr.json +1 -0
  189. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_hu.json +1 -0
  190. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_id.json +1 -0
  191. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_it.json +1 -0
  192. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ja.json +1 -0
  193. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ko.json +1 -0
  194. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_lt.json +1 -0
  195. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_lv.json +1 -0
  196. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_nl.json +1 -0
  197. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_no.json +1 -0
  198. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pl.json +1 -0
  199. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pt-BR.json +1 -0
  200. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pt-PT.json +1 -0
  201. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ro.json +1 -0
  202. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ru.json +1 -0
  203. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sk.json +1 -0
  204. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sl.json +1 -0
  205. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sr.json +1 -0
  206. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sv.json +1 -0
  207. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_th.json +1 -0
  208. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_tr.json +1 -0
  209. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_uk.json +1 -0
  210. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_vi.json +1 -0
  211. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-CN.json +1 -0
  212. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-HK.json +1 -0
  213. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-TW.json +1 -0
  214. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ar.json +1 -0
  215. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_bg.json +1 -0
  216. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_bs.json +1 -0
  217. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ca.json +1 -0
  218. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_cs.json +1 -0
  219. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_da.json +1 -0
  220. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_de.json +1 -0
  221. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_el.json +1 -0
  222. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_es.json +1 -0
  223. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_et.json +1 -0
  224. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_fi.json +1 -0
  225. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_fr.json +1 -0
  226. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_he.json +1 -0
  227. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_hr.json +1 -0
  228. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_hu.json +1 -0
  229. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_id.json +1 -0
  230. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_it.json +1 -0
  231. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ja.json +1 -0
  232. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ko.json +1 -0
  233. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_lt.json +1 -0
  234. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_lv.json +1 -0
  235. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_nl.json +1 -0
  236. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_no.json +1 -0
  237. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pl.json +1 -0
  238. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pt-BR.json +1 -0
  239. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pt-PT.json +1 -0
  240. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ro.json +1 -0
  241. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ru.json +1 -0
  242. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sk.json +1 -0
  243. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sl.json +1 -0
  244. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sr.json +1 -0
  245. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sv.json +1 -0
  246. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_th.json +1 -0
  247. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_tr.json +1 -0
  248. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_uk.json +1 -0
  249. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_vi.json +1 -0
  250. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-CN.json +1 -0
  251. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-HK.json +1 -0
  252. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-TW.json +1 -0
  253. package/chunks/Bufferer-Dw9Qi4T1.js +5 -0
  254. package/chunks/Distance2DCalculator-CXhBP-8I.js +5 -0
  255. package/chunks/Envelope.js +1 -1
  256. package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +5 -0
  257. package/chunks/Geometry.js +1 -1
  258. package/chunks/MultiPathImpl.js +5 -0
  259. package/chunks/OperatorClip.js +1 -1
  260. package/chunks/OperatorCut.js +1 -1
  261. package/chunks/OperatorDensify.js +1 -1
  262. package/chunks/OperatorGeneralize.js +1 -1
  263. package/chunks/OperatorGeodesicBuffer.js +1 -1
  264. package/chunks/OperatorGeodeticArea.js +1 -1
  265. package/chunks/OperatorGeodeticDistance.js +1 -1
  266. package/chunks/OperatorGeodeticLength.js +1 -1
  267. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  268. package/chunks/OperatorProximityGeodesic.js +1 -1
  269. package/chunks/OperatorShapePreservingLength.js +1 -1
  270. package/chunks/OperatorShapePreservingProject.js +1 -1
  271. package/chunks/Point2D.js +1 -1
  272. package/chunks/ProjectionTransformation.js +1 -1
  273. package/chunks/ShadowCastClear.glsl.js +5 -0
  274. package/chunks/distanceOperator.js +1 -1
  275. package/config.js +1 -1
  276. package/geometry/operators/extendOperator.js +1 -1
  277. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  278. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  279. package/geometry/operators/gx/operatorBoundary.js +1 -1
  280. package/geometry/operators/gx/operatorBuffer.js +1 -1
  281. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  282. package/geometry/operators/gx/operatorDifference.js +1 -1
  283. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  284. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  285. package/geometry/operators/gx/operatorIntersection.js +1 -1
  286. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  287. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  288. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  289. package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
  290. package/geometry/operators/gx/operatorOffset.js +1 -1
  291. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  292. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  293. package/geometry/operators/gx/operatorSimplify.js +1 -1
  294. package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
  295. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  296. package/geometry/operators/gx/operatorUnion.js +1 -1
  297. package/geometry/operators/isNearOperator.js +1 -1
  298. package/geometry/operators/reshapeOperator.js +1 -1
  299. package/geometry/operators/support/apiConverter.js +1 -1
  300. package/geometry/operators/support/initNoPeFactory.js +1 -1
  301. package/geometry/operators/support/jsonConverter.js +1 -1
  302. package/geometry/support/aaBoundingBox.js +1 -1
  303. package/geometry.js +1 -1
  304. package/interfaces.d.ts +205 -51
  305. package/layers/KnowledgeGraphLayer.js +1 -1
  306. package/layers/LinkChartLayer.js +1 -1
  307. package/layers/graphics/sources/support/QueryTask.js +1 -1
  308. package/package.json +2 -2
  309. package/pointCloudRenderers.js +1 -1
  310. package/portal/Portal.js +1 -1
  311. package/rasterRenderers.js +1 -1
  312. package/renderers.js +1 -1
  313. package/request.js +1 -1
  314. package/rest/knowledgeGraph/GraphAddNamedTypesResult.js +1 -1
  315. package/rest/knowledgeGraph/GraphAddPropertyResult.js +5 -0
  316. package/rest/knowledgeGraph/GraphApplyEditsResult.js +1 -1
  317. package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +1 -1
  318. package/rest/knowledgeGraph/GraphDeletePropertyResult.js +5 -0
  319. package/rest/knowledgeGraph/GraphUpdateNamedTypesResult.js +5 -0
  320. package/rest/knowledgeGraph/GraphUpdatePropertyResult.js +5 -0
  321. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  322. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
  323. package/rest/knowledgeGraphService.js +1 -1
  324. package/rest/networks/unitIdentifiers/insertGap.js +5 -0
  325. package/rest/networks/unitIdentifiers/queryUnitIdentifiers.js +5 -0
  326. package/rest/networks/unitIdentifiers/reset.js +5 -0
  327. package/rest/networks/unitIdentifiers/resize.js +5 -0
  328. package/rest/networks/unitIdentifiers/support/InsertGapParameters.js +5 -0
  329. package/rest/networks/unitIdentifiers/support/QueryUnitIdentifiersParamters.js +5 -0
  330. package/rest/networks/unitIdentifiers/support/ResetParameters.js +5 -0
  331. package/rest/networks/unitIdentifiers/support/ResizeParameters.js +5 -0
  332. package/rest/networks/unitIdentifiers/support/UnitQueryResult.js +5 -0
  333. package/rest/query/executeForCount.js +1 -1
  334. package/rest/utils.js +1 -1
  335. package/support/apiKeyUtils.js +1 -1
  336. package/support/basemapEnsureType.js +1 -1
  337. package/support/revision.js +1 -1
  338. package/symbols.js +1 -1
  339. package/unionTypes.d.ts +2 -0
  340. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  341. package/views/3d/FocusAreasView.js +1 -1
  342. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementController.js +1 -1
  343. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  344. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  345. package/views/3d/analysis/Dimension/DimensionController.js +1 -1
  346. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  347. package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
  348. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  349. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  350. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  351. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  352. package/views/3d/analysis/support/measurementUtils.js +1 -1
  353. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  354. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  355. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  356. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  357. package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils3D.js +1 -1
  358. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  359. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
  360. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  361. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  362. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  363. package/views/3d/layers/ContentGeometryLayerView.js +5 -0
  364. package/views/3d/layers/DimensionLayerView3D.js +1 -1
  365. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  366. package/views/3d/layers/FlowSubView3D.js +1 -1
  367. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  368. package/views/3d/layers/I3SMeshView3D.js +1 -1
  369. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  370. package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
  371. package/views/3d/layers/RouteLayerView3D.js +1 -1
  372. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  373. package/views/3d/layers/ViewshedLayerView3D.js +1 -1
  374. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  375. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  376. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  377. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  378. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  379. package/views/3d/layers/graphics/Labeler.js +1 -1
  380. package/views/3d/layers/support/LayerViewAnalysisViewManager.js +1 -1
  381. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  382. package/views/3d/support/pointsOfInterest/ContentGeometryUpdates.js +1 -1
  383. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  384. package/views/3d/terrain/TerrainRenderer.js +1 -1
  385. package/views/3d/terrain/TerrainSurface.js +1 -1
  386. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  387. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  388. package/views/3d/webgl-engine/shaders/ShadowCastClear.glsl.js +5 -0
  389. package/views/3d/webgl-engine/shaders/ShadowCastClearTechnique.js +5 -0
  390. package/views/LinkChartView.js +1 -1
  391. package/views/draw/DrawAction.js +1 -1
  392. package/views/draw/DrawGraphicTool.js +1 -1
  393. package/views/draw/DrawOperation.js +1 -1
  394. package/views/draw/DrawScreenTool.js +1 -1
  395. package/views/draw/DrawTool.js +1 -1
  396. package/views/draw/PointDrawAction.js +1 -1
  397. package/views/draw/PolygonDrawAction.js +1 -1
  398. package/views/draw/PolylineDrawAction.js +1 -1
  399. package/views/draw/SegmentDrawAction.js +1 -1
  400. package/views/draw/support/Box.js +1 -1
  401. package/views/draw/support/Reshape.js +1 -1
  402. package/views/draw/support/reshapeTooltipUtils.js +1 -1
  403. package/views/draw/support/tooltipUtils.js +1 -1
  404. package/views/interactive/SegmentLabels.js +1 -1
  405. package/views/interactive/coordinateHelper.js +1 -1
  406. package/views/interactive/snapping/LineSnapper.js +1 -1
  407. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  408. package/views/interactive/snapping/SelfSnappingEngine.js +1 -1
  409. package/views/interactive/snapping/SnappingManager.js +1 -1
  410. package/views/support/automaticAreaMeasurementUtils.js +1 -1
  411. package/views/support/automaticLengthMeasurementUtils.js +1 -1
  412. package/views/support/extentUtils.js +1 -1
  413. package/views/support/geodesicAreaMeasurementUtils.js +1 -1
  414. package/views/support/geodesicLengthMeasurementUtils.js +1 -1
  415. package/views/support/geodesicMeasurementUtils.js +1 -1
  416. package/views/support/layerViewUtils.js +1 -1
  417. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  418. package/widgets/BasemapLayerList.js +1 -1
  419. package/widgets/BatchAttributeForm/VisibleElements.js +1 -1
  420. package/widgets/BatchAttributeForm.js +1 -1
  421. package/widgets/CatalogLayerList.js +1 -1
  422. package/widgets/Directions/css.js +1 -1
  423. package/widgets/Directions.js +1 -1
  424. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  425. package/widgets/Editor/EditorViewModel.js +1 -1
  426. package/widgets/Editor/UpdateFeaturesWorkflow.d.ts +4 -0
  427. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  428. package/widgets/Editor/UpdateFeaturesWorkflowData.d.ts +4 -0
  429. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  430. package/widgets/Editor/UpdateWorkflow.js +1 -1
  431. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  432. package/widgets/Editor/support/SketchController.js +1 -1
  433. package/widgets/Editor/workflowUtils.js +1 -1
  434. package/widgets/Editor.js +1 -1
  435. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  436. package/widgets/LayerList.js +1 -1
  437. package/widgets/Search/SearchResultRenderer.js +1 -1
  438. package/widgets/Search/SearchViewModel.js +1 -1
  439. package/widgets/Search/searchResultRendererCSS.js +1 -1
  440. package/widgets/Sketch/SketchViewModel.js +1 -1
  441. package/widgets/TableList.js +1 -1
  442. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  443. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  444. package/widgets/support/SelectionList/selectionListUtils.js +1 -1
  445. package/widgets/support/SelectionList.js +1 -1
  446. package/widgets/support/SelectionToolbar.js +1 -1
  447. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  448. package/assets/esri/core/workers/chunks/009730713ed9bc7c7388.js +0 -1
  449. package/assets/esri/core/workers/chunks/0817ddd885ce8b2459cb.js +0 -1
  450. package/assets/esri/core/workers/chunks/0cce3770591b0730cf22.js +0 -1
  451. package/assets/esri/core/workers/chunks/1991f0d0f0a12175f849.js +0 -1
  452. package/assets/esri/core/workers/chunks/1f194ffea16cc6595ecc.js +0 -1
  453. package/assets/esri/core/workers/chunks/297d2c0a9d3f1e978318.js +0 -1
  454. package/assets/esri/core/workers/chunks/394b9723d108cff7136e.js +0 -1
  455. package/assets/esri/core/workers/chunks/4a362a35bcdb8405a53a.js +0 -1
  456. package/assets/esri/core/workers/chunks/52a3d0e041717da7697e.js +0 -1
  457. package/assets/esri/core/workers/chunks/62798f66872dc32e77d6.js +0 -346
  458. package/assets/esri/core/workers/chunks/6b42bcfbb60432e3ed1f.js +0 -1
  459. package/assets/esri/core/workers/chunks/7e8f78b96d43c224c7b6.js +0 -1
  460. package/assets/esri/core/workers/chunks/8e82acd1f730571680f4.js +0 -1
  461. package/assets/esri/core/workers/chunks/a0d2bd5d4ed3c90f6b1c.js +0 -1
  462. package/assets/esri/core/workers/chunks/a673128da9e6656ead2e.js +0 -1
  463. package/assets/esri/core/workers/chunks/a9b1f4bf5eaa937943be.js +0 -1
  464. package/assets/esri/core/workers/chunks/b52b28a6f422b10ff166.js +0 -1
  465. package/assets/esri/core/workers/chunks/c07c1bb7ae09136dc1f6.js +0 -1
  466. package/assets/esri/core/workers/chunks/cbbca011f8b176d4b5db.js +0 -1
  467. package/assets/esri/core/workers/chunks/cd5c380196db7fb55242.js +0 -1
  468. package/assets/esri/core/workers/chunks/ce321fd8fc5551e190ec.js +0 -1
  469. package/assets/esri/core/workers/chunks/ce53ddda04e09ba2f860.js +0 -1
  470. package/assets/esri/core/workers/chunks/d6ab65ad864782c50705.js +0 -1
  471. package/assets/esri/core/workers/chunks/da3c62a851a4332f6dda.js +0 -1
  472. package/assets/esri/core/workers/chunks/db3f710d770adf631b28.js +0 -2
  473. package/assets/esri/core/workers/chunks/f4c6ea630cecf0f260d7.js +0 -2
  474. package/chunks/Bufferer-CicaNej1.js +0 -5
  475. package/chunks/Distance2DCalculator-C1KHhZwD.js +0 -5
  476. package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +0 -5
  477. package/chunks/QuadraticBezier.js +0 -5
  478. /package/assets/esri/core/workers/chunks/{0fd6d80393722132e044.js.LICENSE.txt → 0229c573fa8a2fff2d8b.js.LICENSE.txt} +0 -0
  479. /package/assets/esri/core/workers/chunks/{7e1dc8e5e18f18dd21e2.js.LICENSE.txt → 29fb64826bb1351aca8d.js.LICENSE.txt} +0 -0
  480. /package/assets/esri/core/workers/chunks/{ab9614555a15f04396f6.js.LICENSE.txt → 54f981fe0f8851767be9.js.LICENSE.txt} +0 -0
  481. /package/assets/esri/core/workers/chunks/{fbd2f45d5adce4ca323f.js.LICENSE.txt → 73ddb356121add556994.js.LICENSE.txt} +0 -0
  482. /package/assets/esri/core/workers/chunks/{db3f710d770adf631b28.js.LICENSE.txt → 9588328d4ed6b0f04166.js.LICENSE.txt} +0 -0
  483. /package/assets/esri/core/workers/chunks/{f4c6ea630cecf0f260d7.js.LICENSE.txt → aad9a693813b47a51530.js.LICENSE.txt} +0 -0
  484. /package/assets/esri/core/workers/chunks/{e85f892ea44d67d53ff0.js.LICENSE.txt → f3b51aa0a1a8fc3b231c.js.LICENSE.txt} +0 -0
@@ -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"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as a,addMany as n}from"../../core/arrayUtils.js";import{createTask as o}from"../../core/asyncUtils.js";import"../../core/has.js";import i from"../../core/Error.js";import{handlesGroup as s,makeHandle as l,abortHandle as c}from"../../core/handleUtils.js";import{clone as u}from"../../core/lang.js";import p from"../../core/Logger.js";import{getOrCreateMapValue as d}from"../../core/MapUtils.js";import{debounce as f,isPromiseLike as y,throwIfAborted as m,whenOrAbort as h}from"../../core/promiseUtils.js";import{watch as g,on as b,whenOnce as w}from"../../core/reactiveUtils.js";import{px2pt as v}from"../../core/screenUtils.js";import{diff as I}from"../../core/accessorSupport/diffUtils.js";import{isSharedTemplateOrMetadata as T,isSharedGroupTemplate as S,isSharedTemplate as j,isSharedPresetTemplate as F,isStandardFeatureTemplate as k,isSharedFeatureTemplate as A}from"../../editing/templateUtils.js";import{getSharedTemplateProvider as U}from"../../editing/sharedTemplates/SharedTemplateProvider.js";import V from"../../layers/GraphicsLayer.js";import{featureHasFields as L,fixFields as M,getDisplayFieldName as O}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as x}from"../../layers/support/layerUtils.js";import{calculateTolerance as z}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as q}from"../../renderers/support/lengthUtils.js";import{isRenderer as P}from"../../renderers/support/typeUtils.js";import{getTransformationType as E,TransformationType as C}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import R from"../../symbols/SimpleFillSymbol.js";import D from"../../symbols/SimpleLineSymbol.js";import G from"../../symbols/SimpleMarkerSymbol.js";import{to3D as B}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as N}from"../../symbols/support/symbolUtils.js";import{getServices as Z}from"../../undoredo/support/Services.js";import{GraphicState as Q}from"../../views/3d/layers/graphics/GraphicState.js";import{defaultDrawingMode as W}from"../../views/draw/DrawingMode.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{filterGraphicHits as J,hitTestSelectSimilarDistance as H}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as K}from"./support/dependencySort.js";import{isDrawGraphicTool as X}from"../Sketch/support/sketchUtils.js";const Y=()=>p.getLogger("esri.widgets.Editor.workflowUtils");function _(e){return"update"===e.type}function ee(e){if(!(e&&"renderer"in e&&se(e.renderer)))return{rotation:null,size:null};const t=e.renderer.getVisualVariablesForType("rotation").filter((e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression)),r=e.renderer.getVisualVariablesForType("size").filter((e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&E(e)===C.RealWorldSize));return{rotation:1===t.length?t[0]:null,size:1===r.length?r[0]:null}}function te(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&se(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:a}=ee(t);let n=null,o=null;if(r){const e=t.fields?.filter((e=>e.name===r.field)),a=1===e?.length?e[0]:null;n=re(r,a)}if(a){const e=t.fields?.filter((e=>e.name===a.field)),r=1===e?.length?e[0]:null;o=oe(a,r)}return{rotation:n,size:o}}function re(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,a=t?.type??"double",n={initial:0,current:0};return{field:e.field,fieldType:a,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(n.current=n.initial-r*e,ie((n.current+360)%360,a)),setInitialValue:e=>{n.initial=e,n.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function ae(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function ne(e,t,r){if(null==t)return 0;const{symbol:a}=B(t);if(null==a||"web-style"===a.type||"cim"===a.type)return 0;const n=a.symbolLayers.at(0);if(!n)return 0;switch(n.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min($e.icon,(await e(n,$e.icon))[0])||$e.icon}case"text":return $e.text;case"line":return $e.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return ae(await t(n,e.scale/$e.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/$e.viewScaleSizeFactor;default:return 0}}function oe(e,t){const r=e.axis,a=t?.type??"double",n={initial:0,current:0},o=q[e.valueUnit]??1;let i;return i="area"===e.valueRepresentation?e=>(e*o/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*o/2:e=>e*o,{field:e.field,fieldType:a,getDefaultValue:async(e,t)=>ie(i(await ne(t,e,r)),a),getValue:(e,t)=>(n.initial||(n.initial=t.pixelSizeAt(t.center)),n.current=n.initial*e,ie(n.current,a)),setInitialValue:e=>{n.initial=e,n.current=0},isUpdatingInteractively:!1,displayUnit:Ke(e.valueUnit),axis:e.axis}}function ie(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function se(e){if(!P(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function le(e,t,r){const a=await N(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=I(e.symbol,a)&&(e.symbol=a)}function ce(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const a={mode:W,optionsPerTool:r};if(T(t)){const n=t.defaultTool,o=S(t)?t.definition?.inputGeometryType??e:e;switch(n){case"freehand":case"stream-line":return{tool:"polyline"===o?"freehandPolyline":"freehandPolygon",createOptions:a};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:a};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===o?"polygon":"polyline",createOptions:a};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:a};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:a};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:a};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:a};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:a};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:a}}}else{const n=t.drawingTool;if("circle"===n||"ellipse"===n)return r.get("circle").preserveAspectRatio="circle"===n,{tool:"circle",createOptions:a};if("rectangle"===n)return{tool:"rectangle",createOptions:a};if("freehand"===n)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:a}}return{tool:e,createOptions:a}}async function ue(e,t,r){const{creationInfo:a,fullTemplate:n}=t;if(!a)throw new i("featureworkflow","No creation info provided.");const o=a.layer,s=Ue(n,a.attributeOverrides),{view:l}=e,c="2d"===l?.type;S(n)||F(n)||await Ve(e,o,s,r,c?l.scale:null);const{capabilities:u}=o;e.layer.elevationInfo=o.elevationInfo;const p=ce(o.geometryType,n);e.defaultCreateOptions={graphicProperties:{attributes:s,sourceLayer:o},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:u.data.supportsZ,defaultZ:(c?u.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==a.geometryToPlace?await e.create(p.tool):await e.place(a.geometryToPlace,{graphicProperties:{attributes:s,sourceLayer:o}})}async function pe(e){return s([await de(e),await fe(e)])}async function de({creationAttributes:e,data:t,sketchViewModel:r,view:a,webStyleCache:n}){const{creationInfo:o}=t,{fullTemplate:i}=t;if(!o||"2d"!==a?.type||S(i)||F(i))return null;const s=f((t=>Ve(r,o.layer,e,n,t)));return g((()=>a.scale),(e=>s(e)))}async function fe({data:t,sketchViewModel:r,view:a}){const{templateExecutorInfo:n}=t;if(!n)return null;const o=r.activeComponent;if(!a||!X(o))return Y().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new V({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});a.map?.add(c);const{executor:u,serviceLayersById:p}=n,d=a.theme?.accentColor??new e([255,165,0,1]);return s([b((()=>o),["cursor-update","vertex-add"],(()=>{c.removeAll();const e=o.graphic?.geometry;if(!e||!ye(e))return;const t=u(e,"digitizing");if(!y(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=me(e,d);t&&c.add(t)}}})),l((()=>{a.map.remove(c),c.destroy()}))])}function ye(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":return e.paths[0].length>1;case"polygon":{const t=e.rings[0];return a(t.at(0),t.at(-1))?t.length>2:t.length>1}default:return!1}}function me(e,r){let a=null;switch(e.geometry?.type){case"point":case"multipoint":a=new G({angle:0,color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":a=new R({color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":a=new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:a,attributes:{...e.attributes}})}async function he(e,t){const r=await Z(t).load(),a=x(e)?e.parent:e;return r.tablesAndLayersLookup.get(a)}async function ge(e,t){const r=await he(e,t);if(!r)return new Map;const a=new Map;for(const n of r.layersAndTables)d(a,n.layerId,(()=>[])).push(n);return a}function be(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function we(e){const{edits:t,serviceInfo:a,view:n,findOriginalFeature:o}=e,i=ve(a.layersAndTables),s=a.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=Te(t,i,o),p=Se(l,Ie(s,c),c);if(ke(l,p,n),0===p.length)return t;const d=K(p,{continueOnCircularDependency:!0}).map((e=>u.get(e))).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=be(e):h.id!==e.layerId&&(m.push(h),h=be(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find((t=>t.id===e))??be(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function ve(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Ie(e,t){const r=new Map;for(const a of e)for(const e of a.relationships??[])if(r.set(je(a,e),""),t.has(e.relatedTableId)){const n=t.get(e.relatedTableId);if(n.length>0)for(const t of n[0].layer.relationships??[])if(t.id===e.id){r.set(je(a,e),t.keyField);break}}return r}function Te(e,t,r){const a=new Map,n=[],o=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});a.set(c.layerId,e);for(const t of e)n.push(t),o.set(t.uniqueId,t)}return{allEditData:n,editDataByIdMap:o,editDataByLayerIdMap:a}}function Se(e,t,r){const a=[];for(const n of e){const e=n.layer.relationships??[],{uniqueId:o}=n;for(const i of e){const e=i.keyField;if("origin"===i.role){const s=r.get(i.relatedTableId);if(!s||0===s.length)continue;const l=je(n.layer,i),c=t.get(l);if(void 0===c||""===c)continue;switch(n.operationType){case"add":for(const t of s)t!==n&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===n.after.attributes[e]&&a.push([o,t.uniqueId]));break;case"modify":if(n.before.attributes[e]!==n.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==n&&("delete"===t.operationType?t.before.attributes[c]===n.before.attributes[e]?a.push([r,o]):t.before.attributes[c]===n.after.attributes[e]&&a.push([o,r]):"add"===t.operationType?t.after.attributes[c]===n.after.attributes[e]?a.push([o,r]):t.after.attributes[c]===n.before.attributes[e]&&a.push([r,o]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===n.after.attributes[e]?a.push([o,r]):a.push([r,o]):a.push([o,r])))}break;case"delete":for(const t of s)t!==n&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===n.before.attributes[e]&&a.push([t.uniqueId,o]))}}}}return a}function je(e,t){return`${e.layerId}:${t.id}`}function Fe(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some((t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId))))}function ke(e,t,r){const a=[];for(const o of e)Fe(o.layer,r)&&a.push(o);if(0===a.length)return;let n=[];for(const o of a){const r=o.layer;switch(o.operationType){case"delete":n=[...Ae(o.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ae(o.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of n)t.push([o.uniqueId,e.uniqueId]);break;case"add":n=[...Ae(o.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ae(o.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of n)t.push([e.uniqueId,o.uniqueId])}}}function Ae(e,t){const r=[],a=t.filter((({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField));for(const n of a){const t=n.layer.globalIdField;("before"in n&&n.before?.attributes[t]===e||"after"in n&&n.after?.attributes[t]===e)&&r.push(n)}return r}function Ue(e,t={}){return S(e)||F(e)?{}:k(e)?{...e.prototype.attributes,...t}:A(e)?{...e.definition?.defaultValues,...t}:{...t}}async function Ve(e,r,a,n,o){const i=new t({sourceLayer:r,attributes:a}),{rotation:s,size:l}=te(i);let c=await N(i,{useSourceLayer:!0,webStyleCache:n,scale:o}),u=!1;for(const t of[l,s]){if(null==t)continue;null==a[t.field]&&(a[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await N(i,{useSourceLayer:!0,webStyleCache:n,scale:o})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}Le(e.tooltipOptions,l,s)}function Le(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Me(e,t){return e?.find((e=>e.layer===t))}async function Oe(e,t,r,a){switch(t.type){case"3d":return xe(e,t,r,a);case"2d":return ze(e,t,r,a)}}async function xe(e,t,r,a){if(0===e.length)return[];const{updatable:o,graphicsByLayer:i}=await r.defer((async()=>{const{results:n}=await h(H(t,r),a),o=new Map,i=e=>{const t=e.layer,r=o.get(t);if(!r){const e=new Array;return o.set(t,e),e}return r};J(n).forEach((({graphic:e})=>i(e).push(e)));const s=e.filter((({capabilities:e,layer:t})=>e.update.enabled&&o.has(t)));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:o}}));return h(Promise.allSettled(o.map((async({layer:e})=>{const t=i.get(e),r=qe(e);if(t.every((e=>L(r,e))))return t;const o=[];for(const a of t){o.push(a.getObjectId());const e=Object.keys(a.attributes);n(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=o,s.outFields=M(e.fieldsIndex,r),e.queryFeatures(s,{signal:a}).then((({features:e})=>e))}))),a)}async function ze(e,t,r,a){if(0===e.length)return[];const{mapPoint:n}=r;if(null==n)return[];let o=null;const i=await r.defer((async()=>{const{results:n}=await h(t.hitTest(r),a);if(0===n.length)return[];const i=new Set;o=J(n),o.forEach((({graphic:e})=>e&&i.add(e.layer)));const s=e.filter((e=>i.has(e.layer)&&e.supportsUpdateWorkflow));return s.length>0&&r.stopPropagation(),s}));return h(Promise.allSettled(i.map((async({layer:e})=>{const i=e.createQuery();i.returnGeometry=!0,i.outFields=qe(e);const s="renderer"in e?z({renderer:e.renderer,pointerType:r.pointerType}):0;i.geometry=$(n,s,t),i.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(i,{signal:a});return o?.forEach((({graphic:t})=>{t.layer!==e||l.some((e=>e.getObjectId()===t.getObjectId()))||l.push(t)})),l}))),a)}function qe(e){return M(e.fieldsIndex,[e.objectIdField,O({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Pe(e,t,a,n){const o=t.createQuery();o.objectIds=e.map((e=>e.getObjectId())).filter(r),o.outFields=["*"],o.returnM=t.capabilities.data.supportsM,o.returnZ=t.capabilities.data.supportsZ,"scene"===t.type&&null!=t.infoFor3D||(o.outSpatialReference=a);const i=await t.queryFeatures(o,{signal:n});return m(n),i.features}function Ee(e){const t=new Map;for(const r of e){const e=r.sourceLayer,a=x(e)?e.parent:e;d(t,a,(()=>[])).push(r)}return t}async function Ce(e){const{graphic:t,sketchViewModel:r,sourceLayer:a,visualVariables:n}=e;await Re(e);const o={multipleSelectionEnabled:!1};return"point"===a.geometryType&&(o.enableRotation=null!=n.rotation,o.enableScaling=null!=n.size),r.update(t,o)}async function Re(e){const{graphic:t,sketchViewModel:r,sourceLayer:a,visualVariables:n,webStyleCache:o}=e;let i=!1;const{rotation:s,size:l}=n;for(const c of[s,l]){if(null==c)continue;const e=t.getAttribute(c.field);if(null!=e)c.setInitialValue(e);else{const e=await c.getDefaultValue(t.symbol,r.view);c.setInitialValue(e),t.setAttribute(c.field,e),i=!0}}if(i){const e="2d"===r.view?.type?r.view.scale:null;await le(t,o,e)}Le(r.tooltipOptions,l,s),r.layer.elevationInfo=a.elevationInfo}function De(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function Ge(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function Be(e,t,r,a){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const n=t.attributes;let o=!1;const i=a.rotation,s=De(r.toolEventInfo);if(null!=i&&null!=s){const{field:r,getValue:a}=i;if("rotate-stop"===s.type)i.isUpdatingInteractively=!1,i.setInitialValue(t.getAttribute(r));else{i.isUpdatingInteractively=!0;const l=a(s.angle,e);l!==n[r]&&(t.setAttribute(r,l),o=!0)}}const l=a.size,c=Ge(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:a}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const i=a(c.xScale,e);i!==n[r]&&(t.setAttribute(r,i),o=!0)}}return o}async function Ne({feature:e,featureClone:t,visualVariableAttributes:r,sketchViewModel:a,view:n,onUpdate:o,webStyleCache:i,addUpdatingPromise:u,addHandle:p}){await le(t,i,"2d"===n.type?n.scale:null);let d=null;if("2d"===a?.view?.type){const e=f((e=>le(t,i,e)));d=g((()=>a?.view?.scale),(t=>e(t)))}const y=t.sourceLayer,m=_e(n,y);await Ce({graphic:t,sketchViewModel:a,sourceLayer:y,visualVariables:r,webStyleCache:i});let h=null;m.then((e=>h=e)).catch((()=>{}));const b=r.size,v=r.rotation,I=g((()=>e.attributes),(async e=>{let r=!1;for(const a in e){const n=e[a];n!==t.getAttribute(a)&&(t.setAttribute(a,n),null==b||b.isUpdatingInteractively||b.field!==a||b.setInitialValue(n),null==v||v.isUpdatingInteractively||v.field!==a||v.setInitialValue(n),(null==h||h.requiredFields.includes(a))&&(r=!0))}r&&await le(t,i,"2d"===n.type?n.scale:null)})),T=a.on("update",(async e=>{const t=e.graphics[0],s={graphic:t,sketchViewModel:a,sourceLayer:y,visualVariables:r,webStyleCache:i};if("complete"===e.state){if(null===n.activeTool)return Ce(s);const e=new AbortController,t=c(e);return p(t),u(w((()=>null===n.activeTool),e.signal).then((async()=>{if(!e.signal.aborted)return e.abort(),Ce(s)})))}Be(n,t,e,r)&&await le(t,i,"2d"===n.type?n.scale:null),o(tt(t),e)})),S=a.on(["undo","redo"],(async e=>{o(tt(e.graphics[0]),e)}));return s([S,T,l((()=>a.cancel())),I,d])}async function Ze(e,t,r){const a=e.view;e.layer.add(r);const n=t.sourceLayer,i=t.layer,c=t.getAttribute(i.objectIdField);let u=null;function p(e){u?.abort(),u=o((async t=>{const r=await _e(a,n);m(t),r.setVisibility?.(c,e)}))}return await We(a,r),p(!1),s([Qe(a,r,(e=>p(!e))),l((async()=>{p(!0);try{const e=await _e(a,n);await w((()=>!e.updating))}finally{e.layer.remove(r)}}))])}function Qe(e,t,r){if("3d"===e.type){const a=new Q({graphic:t});return s([e.trackGraphicState(a),g((()=>a.displaying),r)])}return g((()=>t.visible),r)}async function We(e,t){if("3d"===e.type){const r=new Q({graphic:t}),a=e.trackGraphicState(r);await w((()=>r.displaying||r.error)),a.remove()}else await w((()=>t.visible))}const $e={icon:v(24),text:v(12),line:v(1),viewScaleSizeFactor:100};function Je(e,t,r){let a=!1;return e.filter((e=>!!a||(a=e===t,a))).map((e=>r[e]()))}function He(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const a=r.layer,n=e.viewModel.getTemplatesForLayer(a);1===n.length&&"scene"!==a.type&&(r.template=n[0],t.shift())}return t}function Ke(e){return"unknown"===e?null:e}function Xe(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const Ye=e=>/-stop/.test(e)||/vertex-/.test(e),_e=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function et(e){return"createInteractiveEditSession"in e}function tt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=u(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function rt(e){const t=e.cursor;return e.cursor="progress",l((()=>e.cursor=t))}async function at(e,t){const{template:r}=e;if(null==r)return null;if(j(r))return r.load();if(T(r)){const e=(await import("../../editing/sharedTemplates/SharedTemplate.js")).default,a=U(t,{makeSharedTemplateFromJSON:t=>e.fromJSON(t)}),n=await a.getTemplates({templateIds:[r.templateId],featureService:r.featureService});if(0===n.length)throw new i("editor:failed-to-load-template","Unable to load the provided template");return n[0].load()}return r}function nt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:a,sourceField:n}=t;e.setAttribute(r,a.getAttribute(n))}}function ot(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach((e=>nt(e.relationships))),t.flatMap((e=>e.edits))):null}export{ke as appendAllUtilityNetworkAssociationRelationships,He as avoidFeatureTemplateSelectionWithOnlyOneItem,et as canCreateInteractiveEditSession,tt as cloneGraphicExceptMesh,ve as createLayerIdMap,Ie as createRelationshipKeyMap,ce as createToolFromGeometryType,Je as createWorkflowSteps,Oe as fetchCandidates,Pe as fetchFullFeatures,Se as findAllDependencies,Ae as findChangesByGlobalId,Me as findLayerInfo,je as generateHashForRelationship,Ue as getCreationAttributes,at as getFullTemplateForCreationInfo,re as getRotationVariableAttribute,ot as getServiceEditsFromWorkflowData,he as getServiceInfoForLayer,ge as getServiceLayersById,oe as getSizeVariableAttribute,te as getVisualVariableAttributes,ee as getVisualVariablesForLayer,Ee as groupFeaturesByLayer,Ye as isTerminalUpdateEventType,_ as isUpdateWorkflow,Fe as isUtilityNetworkAssociationsTable,we as orderEditsByRelationshipDependencies,Xe as prepareAttachmentsForCreateFeaturesWorkflow,nt as setRelationshipFields,Ne as setUpGeometryUpdate,pe as setUpSketchCreateWatchers,Re as setVisualVariablesAndElevationInfoForUpdate,rt as showProgressCursor,$e as sizeDefaults,Ke as sizeVariableUnitToLengthUnit,ue as startCreatingNewFeature,Ce as startUpdatingFeatureGeometry,Ze as swapForEditingSession,le as updateGraphicSymbolWhenRequired,Be as visualVariableInteractiveUpdate,_e as whenEditorLayerView,We as whenGraphicDisplayed};
5
+ import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as a}from"../../core/arrayUtils.js";import{createTask as o}from"../../core/asyncUtils.js";import"../../core/has.js";import i from"../../core/Error.js";import{handlesGroup as s,makeHandle as l,abortHandle as c}from"../../core/handleUtils.js";import{clone as u}from"../../core/lang.js";import p from"../../core/Logger.js";import{getOrCreateMapValue as d}from"../../core/MapUtils.js";import{debounce as f,isPromiseLike as y,throwIfAborted as m,whenOrAbort as h}from"../../core/promiseUtils.js";import{watch as g,on as b,whenOnce as w}from"../../core/reactiveUtils.js";import{px2pt as v}from"../../core/screenUtils.js";import{diff as I}from"../../core/accessorSupport/diffUtils.js";import{isSharedTemplateOrMetadata as T,isSharedGroupTemplate as S,isSharedTemplate as j,isSharedPresetTemplate as F,isStandardFeatureTemplate as k,isSharedFeatureTemplate as A}from"../../editing/templateUtils.js";import{getSharedTemplateProvider as U}from"../../editing/sharedTemplates/SharedTemplateProvider.js";import V from"../../layers/GraphicsLayer.js";import{featureHasFields as L,fixFields as M,getDisplayFieldName as O}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as x}from"../../layers/support/layerUtils.js";import{calculateTolerance as z}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as q}from"../../renderers/support/lengthUtils.js";import{isRenderer as P}from"../../renderers/support/typeUtils.js";import{getTransformationType as E,TransformationType as C}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import R from"../../symbols/SimpleFillSymbol.js";import D from"../../symbols/SimpleLineSymbol.js";import G from"../../symbols/SimpleMarkerSymbol.js";import{to3D as B}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as N}from"../../symbols/support/symbolUtils.js";import{getServices as Z}from"../../undoredo/support/Services.js";import{GraphicState as W}from"../../views/3d/layers/graphics/GraphicState.js";import{defaultDrawingMode as Q}from"../../views/draw/DrawingMode.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{filterGraphicHits as J,hitTestSelectSimilarDistance as H}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as K}from"./support/dependencySort.js";import{isDrawGraphicTool as X}from"../Sketch/support/sketchUtils.js";const Y=()=>p.getLogger("esri.widgets.Editor.workflowUtils");function _(e){return!!e&&"features"in e}function ee(e){return"update"===e.type}function te(e){return"update-features"===e.type}function re(e){if(!(e&&"renderer"in e&&ce(e.renderer)))return{rotation:null,size:null};const t=e.renderer.getVisualVariablesForType("rotation").filter((e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression)),r=e.renderer.getVisualVariablesForType("size").filter((e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&E(e)===C.RealWorldSize));return{rotation:1===t.length?t[0]:null,size:1===r.length?r[0]:null}}function ne(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&ce(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=re(t);let a=null,o=null;if(r){const e=t.fields?.filter((e=>e.name===r.field)),n=1===e?.length?e[0]:null;a=ae(r,n)}if(n){const e=t.fields?.filter((e=>e.name===n.field)),r=1===e?.length?e[0]:null;o=se(n,r)}return{rotation:a,size:o}}function ae(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",a={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(a.current=a.initial-r*e,le((a.current+360)%360,n)),setInitialValue:e=>{a.initial=e,a.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function oe(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function ie(e,t,r){if(null==t)return 0;const{symbol:n}=B(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const a=n.symbolLayers.at(0);if(!a)return 0;switch(a.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(He.icon,(await e(a,He.icon))[0])||He.icon}case"text":return He.text;case"line":return He.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return oe(await t(a,e.scale/He.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/He.viewScaleSizeFactor;default:return 0}}function se(e,t){const r=e.axis,n=t?.type??"double",a={initial:0,current:0},o=q[e.valueUnit]??1;let i;return i="area"===e.valueRepresentation?e=>(e*o/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*o/2:e=>e*o,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>le(i(await ie(t,e,r)),n),getValue:(e,t)=>(a.initial||(a.initial=t.pixelSizeAt(t.center)),a.current=a.initial*e,le(a.current,n)),setInitialValue:e=>{a.initial=e,a.current=0},isUpdatingInteractively:!1,displayUnit:Ye(e.valueUnit),axis:e.axis}}function le(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function ce(e){if(!P(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function ue(e,t,r){const n=await N(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=I(e.symbol,n)&&(e.symbol=n)}function pe(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:Q,optionsPerTool:r};if(T(t)){const a=t.defaultTool,o=S(t)?t.definition?.inputGeometryType??e:e;switch(a){case"freehand":case"stream-line":return{tool:"polyline"===o?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===o?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const a=t.drawingTool;if("circle"===a||"ellipse"===a)return r.get("circle").preserveAspectRatio="circle"===a,{tool:"circle",createOptions:n};if("rectangle"===a)return{tool:"rectangle",createOptions:n};if("freehand"===a)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function de(e,t,r){const{creationInfo:n,fullTemplate:a}=t;if(!n)throw new i("featureworkflow","No creation info provided.");const o=n.layer,s=Le(a,n.attributeOverrides),{view:l}=e,c="2d"===l?.type;S(a)||F(a)||await Me(e,o,s,r,c?l.scale:null);const{capabilities:u}=o;e.layer.elevationInfo=o.elevationInfo;const p=pe(o.geometryType,a);e.defaultCreateOptions={graphicProperties:{attributes:s,sourceLayer:o},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:u.data.supportsZ,defaultZ:(c?u.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==n.geometryToPlace?await e.create(p.tool):await e.place(n.geometryToPlace,{graphicProperties:{attributes:s,sourceLayer:o}})}async function fe(e){return s([await ye(e),await me(e)])}async function ye({creationAttributes:e,data:t,sketchViewModel:r,view:n,webStyleCache:a}){const{creationInfo:o}=t,{fullTemplate:i}=t;if(!o||"2d"!==n?.type||S(i)||F(i))return null;const s=f((t=>Me(r,o.layer,e,a,t)));return g((()=>n.scale),(e=>s(e)))}async function me({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:a}=t;if(!a)return null;const o=r.activeComponent;if(!n||!X(o))return Y().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new V({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:p}=a,d=n.theme?.accentColor??new e([255,165,0,1]);return s([b((()=>o),["cursor-update","vertex-add"],(()=>{c.removeAll();const e=o.graphic?.geometry;if(!e||!he(e))return;const t=u(e,"digitizing");if(!y(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=ge(e,d);t&&c.add(t)}}})),l((()=>{n.map.remove(c),c.destroy()}))])}function he(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":return e.paths[0].length>1;case"polygon":{const t=e.rings[0];return n(t.at(0),t.at(-1))?t.length>2:t.length>1}default:return!1}}function ge(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new G({angle:0,color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new R({color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}async function be(e,t){const r=await Z(t).load(),n=x(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}async function we(e,t){const r=await be(e,t);if(!r)return new Map;const n=new Map;for(const a of r.layersAndTables)d(n,a.layerId,(()=>[])).push(a);return n}function ve(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Ie(e){const{edits:t,serviceInfo:n,view:a,findOriginalFeature:o}=e,i=Te(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=je(t,i,o),p=Fe(l,Se(s,c),c);if(a&&Ue(l,p,a),0===p.length)return t;const d=K(p,{continueOnCircularDependency:!0}).map((e=>u.get(e))).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=ve(e):h.id!==e.layerId&&(m.push(h),h=ve(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find((t=>t.id===e))??ve(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function Te(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Se(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(ke(n,e),""),t.has(e.relatedTableId)){const a=t.get(e.relatedTableId);if(a.length>0)for(const t of a[0].layer.relationships??[])if(t.id===e.id){r.set(ke(n,e),t.keyField);break}}return r}function je(e,t,r){const n=new Map,a=[],o=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)a.push(t),o.set(t.uniqueId,t)}return{allEditData:a,editDataByIdMap:o,editDataByLayerIdMap:n}}function Fe(e,t,r){const n=[];for(const a of e){const e=a.layer.relationships??[],{uniqueId:o}=a;for(const i of e){const e=i.keyField;if("origin"===i.role){const s=r.get(i.relatedTableId);if(!s||0===s.length)continue;const l=ke(a.layer,i),c=t.get(l);if(void 0===c||""===c)continue;switch(a.operationType){case"add":for(const t of s)t!==a&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===a.after.attributes[e]&&n.push([o,t.uniqueId]));break;case"modify":if(a.before.attributes[e]!==a.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==a&&("delete"===t.operationType?t.before.attributes[c]===a.before.attributes[e]?n.push([r,o]):t.before.attributes[c]===a.after.attributes[e]&&n.push([o,r]):"add"===t.operationType?t.after.attributes[c]===a.after.attributes[e]?n.push([o,r]):t.after.attributes[c]===a.before.attributes[e]&&n.push([r,o]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===a.after.attributes[e]?n.push([o,r]):n.push([r,o]):n.push([o,r])))}break;case"delete":for(const t of s)t!==a&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===a.before.attributes[e]&&n.push([t.uniqueId,o]))}}}}return n}function ke(e,t){return`${e.layerId}:${t.id}`}function Ae(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some((t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId))))}function Ue(e,t,r){const n=[];for(const o of e)Ae(o.layer,r)&&n.push(o);if(0===n.length)return;let a=[];for(const o of n){const r=o.layer;switch(o.operationType){case"delete":a=[...Ve(o.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ve(o.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of a)t.push([o.uniqueId,e.uniqueId]);break;case"add":a=[...Ve(o.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ve(o.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of a)t.push([e.uniqueId,o.uniqueId])}}}function Ve(e,t){const r=[],n=t.filter((({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField));for(const a of n){const t=a.layer.globalIdField;("before"in a&&a.before?.attributes[t]===e||"after"in a&&a.after?.attributes[t]===e)&&r.push(a)}return r}function Le(e,t={}){return S(e)||F(e)?{}:k(e)?{...e.prototype.attributes,...t}:A(e)?{...e.definition?.defaultValues,...t}:{...t}}async function Me(e,r,n,a,o){const i=new t({sourceLayer:r,attributes:n}),{rotation:s,size:l}=ne(i);let c=await N(i,{useSourceLayer:!0,webStyleCache:a,scale:o}),u=!1;for(const t of[l,s]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await N(i,{useSourceLayer:!0,webStyleCache:a,scale:o})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}Oe(e.tooltipOptions,l,s)}function Oe(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function xe(e,t){return e?.find((e=>e.layer===t))}async function ze(e,t,r,n){switch(t.type){case"3d":return qe(e,t,r,n);case"2d":return Pe(e,t,r,n)}}async function qe(e,t,r,n){if(0===e.length)return[];const{updatable:o,graphicsByLayer:i}=await r.defer((async()=>{const{results:a}=await h(H(t,r),n),o=new Map,i=e=>{const t=e.layer,r=o.get(t);if(!r){const e=new Array;return o.set(t,e),e}return r};J(a).forEach((({graphic:e})=>i(e).push(e)));const s=e.filter((({capabilities:e,layer:t})=>e.update.enabled&&o.has(t)));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:o}}));return h(Promise.allSettled(o.map((async({layer:e})=>{const t=i.get(e),r=Ee(e);if(t.every((e=>L(r,e))))return t;const o=[];for(const n of t){o.push(n.getObjectId());const e=Object.keys(n.attributes);a(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=o,s.outFields=M(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then((({features:e})=>e))}))),n)}async function Pe(e,t,r,n){if(0===e.length)return[];const{mapPoint:a}=r;if(null==a)return[];let o=null;const i=await r.defer((async()=>{const{results:a}=await h(t.hitTest(r),n);if(0===a.length)return[];const i=new Set;o=J(a),o.forEach((({graphic:e})=>e&&i.add(e.layer)));const s=e.filter((e=>i.has(e.layer)&&e.supportsUpdateWorkflow));return s.length>0&&r.stopPropagation(),s}));return h(Promise.allSettled(i.map((async({layer:e})=>{const i=e.createQuery();i.returnGeometry=!0,i.outFields=Ee(e);const s="renderer"in e?z({renderer:e.renderer,pointerType:r.pointerType}):0;i.geometry=$(a,s,t),i.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(i,{signal:n});return o?.forEach((({graphic:t})=>{t.layer!==e||l.some((e=>e.getObjectId()===t.getObjectId()))||l.push(t)})),l}))),n)}function Ee(e){return M(e.fieldsIndex,[e.objectIdField,O({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Ce(e,t,n,a){const o=t.createQuery();o.objectIds=e.map((e=>e.getObjectId())).filter(r),o.outFields=["*"],o.returnM=t.capabilities.data.supportsM,o.returnZ=t.capabilities.data.supportsZ,"scene"===t.type&&null!=t.infoFor3D||(o.outSpatialReference=n);const i=await t.queryFeatures(o,{signal:a});return m(a),i.features}function Re(e){const t=new Map;for(const r of e){const e=r.sourceLayer,n=x(e)?e.parent:e;d(t,n,(()=>[])).push(r)}return t}async function De(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,visualVariables:a}=e;await Ge(e);const o={multipleSelectionEnabled:!1};return"point"===n.geometryType&&(o.enableRotation=null!=a.rotation,o.enableScaling=null!=a.size),r.update(t,o)}async function Ge(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,visualVariables:a,webStyleCache:o}=e;let i=!1;const{rotation:s,size:l}=a;for(const c of[s,l]){if(null==c)continue;const e=t.getAttribute(c.field);if(null!=e)c.setInitialValue(e);else{const e=await c.getDefaultValue(t.symbol,r.view);c.setInitialValue(e),t.setAttribute(c.field,e),i=!0}}if(i){const e="2d"===r.view?.type?r.view.scale:null;await ue(t,o,e)}Oe(r.tooltipOptions,l,s),r.layer.elevationInfo=n.elevationInfo}function Be(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function Ne(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function Ze(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const a=t.attributes;let o=!1;const i=n.rotation,s=Be(r.toolEventInfo);if(null!=i&&null!=s){const{field:r,getValue:n}=i;if("rotate-stop"===s.type)i.isUpdatingInteractively=!1,i.setInitialValue(t.getAttribute(r));else{i.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==a[r]&&(t.setAttribute(r,l),o=!0)}}const l=n.size,c=Ne(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const i=n(c.xScale,e);i!==a[r]&&(t.setAttribute(r,i),o=!0)}}return o}async function We({feature:e,featureClone:t,visualVariableAttributes:r,sketchViewModel:n,view:a,onUpdate:o,webStyleCache:i,addUpdatingPromise:u,addHandle:p}){await ue(t,i,"2d"===a.type?a.scale:null);let d=null;if("2d"===n?.view?.type){const e=f((e=>ue(t,i,e)));d=g((()=>n?.view?.scale),(t=>e(t)))}const y=t.sourceLayer,m=tt(a,y);await De({graphic:t,sketchViewModel:n,sourceLayer:y,visualVariables:r,webStyleCache:i});let h=null;m.then((e=>h=e)).catch((()=>{}));const b=r.size,v=r.rotation,I=g((()=>e.attributes),(async e=>{let r=!1;for(const n in e){const a=e[n];a!==t.getAttribute(n)&&(t.setAttribute(n,a),null==b||b.isUpdatingInteractively||b.field!==n||b.setInitialValue(a),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(a),(null==h||h.requiredFields.includes(n))&&(r=!0))}r&&await ue(t,i,"2d"===a.type?a.scale:null)})),T=n.on("update",(async e=>{const t=e.graphics[0],s={graphic:t,sketchViewModel:n,sourceLayer:y,visualVariables:r,webStyleCache:i};if("complete"===e.state){if(null===a.activeTool)return De(s);const e=new AbortController,t=c(e);return p(t),u(w((()=>null===a.activeTool),e.signal).then((async()=>{if(!e.signal.aborted)return e.abort(),De(s)})))}Ze(a,t,e,r)&&await ue(t,i,"2d"===a.type?a.scale:null),o(nt(t),e)})),S=n.on(["undo","redo"],(async e=>{o(nt(e.graphics[0]),e)}));return s([S,T,l((()=>n.cancel())),I,d])}async function Qe(e,t,r){const n=e.view;e.layer.add(r);const a=t.sourceLayer,i=t.layer,c=t.getAttribute(i.objectIdField);let u=null;function p(e){u?.abort(),u=o((async t=>{const r=await tt(n,a);m(t),r.setVisibility?.(c,e)}))}return await Je(n,r),p(!1),s([$e(n,r,(e=>p(!e))),l((async()=>{p(!0);try{const e=await tt(n,a);await w((()=>!e.updating))}finally{e.layer.remove(r)}}))])}function $e(e,t,r){if("3d"===e.type){const n=new W({graphic:t});return s([e.trackGraphicState(n),g((()=>n.displaying),r)])}return g((()=>t.visible),r)}async function Je(e,t){if("3d"===e.type){const r=new W({graphic:t}),n=e.trackGraphicState(r);await w((()=>r.displaying||r.error)),n.remove()}else await w((()=>t.visible))}const He={icon:v(24),text:v(12),line:v(1),viewScaleSizeFactor:100};function Ke(e,t,r){let n=!1;return e.filter((e=>!!n||(n=e===t,n))).map((e=>r[e]()))}function Xe(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,a=e.viewModel.getTemplatesForLayer(n);1===a.length&&"scene"!==n.type&&(r.template=a[0],t.shift())}return t}function Ye(e){return"unknown"===e?null:e}function _e(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const et=e=>/-stop/.test(e)||/vertex-/.test(e),tt=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function rt(e){return"createInteractiveEditSession"in e}function nt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=u(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function at(e){const t=e.cursor;return e.cursor="progress",l((()=>e.cursor=t))}async function ot(e,t){const{template:r}=e;if(null==r)return null;if(j(r))return r.load();if(T(r)){const e=(await import("../../editing/sharedTemplates/SharedTemplate.js")).default,n=U(t,{makeSharedTemplateFromJSON:t=>e.fromJSON(t)}),a=await n.getTemplates({templateIds:[r.templateId],featureService:r.featureService});if(0===a.length)throw new i("editor:failed-to-load-template","Unable to load the provided template");return a[0].load()}return r}function it(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:a}=t;e.setAttribute(r,n.getAttribute(a))}}function st(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach((e=>it(e.relationships))),t.flatMap((e=>e.edits))):null}function lt(e){if(null==e)return[];if(te(e))return e.data.layers;const t=ee(e)?e.activeWorkflow:e,r=t?.layer;return r?[r]:[]}export{Ue as appendAllUtilityNetworkAssociationRelationships,Xe as avoidFeatureTemplateSelectionWithOnlyOneItem,rt as canCreateInteractiveEditSession,nt as cloneGraphicExceptMesh,Te as createLayerIdMap,Se as createRelationshipKeyMap,pe as createToolFromGeometryType,Ke as createWorkflowSteps,ze as fetchCandidates,Ce as fetchFullFeatures,Fe as findAllDependencies,Ve as findChangesByGlobalId,xe as findLayerInfo,ke as generateHashForRelationship,Le as getCreationAttributes,ot as getFullTemplateForCreationInfo,lt as getLayersFromWorkflow,ae as getRotationVariableAttribute,st as getServiceEditsFromWorkflowData,be as getServiceInfoForLayer,we as getServiceLayersById,se as getSizeVariableAttribute,ne as getVisualVariableAttributes,re as getVisualVariablesForLayer,Re as groupFeaturesByLayer,_ as isBatchAttributeFormViewModel,et as isTerminalUpdateEventType,te as isUpdateFeaturesWorkflow,ee as isUpdateWorkflow,Ae as isUtilityNetworkAssociationsTable,Ie as orderEditsByRelationshipDependencies,_e as prepareAttachmentsForCreateFeaturesWorkflow,it as setRelationshipFields,We as setUpGeometryUpdate,fe as setUpSketchCreateWatchers,Ge as setVisualVariablesAndElevationInfoForUpdate,at as showProgressCursor,He as sizeDefaults,Ye as sizeVariableUnitToLengthUnit,de as startCreatingNewFeature,De as startUpdatingFeatureGeometry,Qe as swapForEditingSession,ue as updateGraphicSymbolWhenRequired,Ze as visualVariableInteractiveUpdate,tt as whenEditorLayerView,Je as whenGraphicDisplayed};
package/widgets/Editor.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"../intl.js";import{destroyMaybe as t,mappedFind as s,abortMaybe as o}from"../core/maybe.js";import{createResolver as i}from"../core/promiseUtils.js";import{watch as a,on as r,when as n,initial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../core/support/UpdatingHandles.js";import h from"../views/interactive/sketch/SketchValueOptions.js";import p from"./Attachments.js";import u from"./FeatureForm.js";import g from"./FeatureTemplates.js";import w from"./Spinner.js";import _ from"./Widget.js";import{css as v}from"./Editor/css.js";import f from"./Editor/EditorViewModel.js";import{isModelUpload as y}from"./Editor/modelUploadUtils.js";import k from"./Editor/VisibleElements.js";import{loadCreateFeaturesPanelContentComponents as b,CreateFeaturesPanelContent as A}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as F,FeatureList as M}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as T,FooterActions as C}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as W,Notice as E}from"./Editor/components/Notices.js";import{loadPanelContentComponents as P,PanelContent as L,PanelContentSection as S,PanelContentMessage as I}from"./Editor/components/PanelContent.js";import{PanelToolbar as j,loadPanelToolbarComponents as U}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as D,Prompt as V}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as O,UpdateFeaturePanelContent as x}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as B,UploadDetails as N}from"./Editor/components/UploadDetails.js";import{VisibleElements as z,CreateToolVisibilityMap as H}from"./Sketch/VisibleElements.js";import{loadCalciteComponents as R}from"./support/componentsUtils.js";import{globalCss as G}from"./support/globalCss.js";import{incrementHeadingLevel as q,Heading as Z}from"./support/Heading.js";import{renderItem as K}from"./support/ItemList.js";import{connectDelayedLoading as $}from"./support/loaderUtils.js";import"./support/widgetUtils.js";import{messageBundle as J}from"./support/decorators/messageBundle.js";import{vmEvent as Q}from"./support/decorators/vmEvent.js";import{tsx as X}from"./support/jsxFactory.js";import{substitute as Y}from"../intl/substitute.js";const ee=Symbol("sketch-setup-handles");let te=class extends _{constructor(e,t){super(e,t),this._featureForm=new u,this._sketchToolbar=null,this._attachments=new p({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new g({enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?X("calcite-icon",{class:v.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new w,this._loading=!1,this._updatingHandles=new m,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=new f,this.visibleElements=new k,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSketch=()=>this._sketchToolbar?X("div",{class:v.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>X("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:s},...o)=>{const{visibleElements:i}=this;return X("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:s,onCalciteFlowItemBack:this._onBack},i.zoomToButton&&this.viewModel.canZoomTo?X("calcite-action",{alignment:"center",appearance:"transparent",icon:"zoom-to-object",key:"zoom-to-button",onclick:()=>this.viewModel.zoomTo(),slot:"header-actions-end",text:this.messages.zoomTo,title:this.messages.zoomTo}):null,i.settingsMenu?X(j,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:i}):null,...o)},this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,s={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&y(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&t.activeFeatureFormViewModel?.activeAssociation?this._showPromptAndWait({...s,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(s)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then((()=>e.back())))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then((()=>e.back())))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([a((()=>q(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),r((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then((t=>t?e.allow():e.deny()))})),n((()=>this.viewModel.featureFormViewModel),(e=>{this._featureForm.viewModel=e}),l),n((()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel),(e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.addPromise(this._initializeAssociationItemList(e))}),l),n((()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association),(()=>{this._setUpAssociationSettings()})),a((()=>this.viewModel),(e=>{this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt}),l),a((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)}),l),a((()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel]),(([e])=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel?.set(e.sketch))}),l),n((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),n((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:o,cancel:i}]=e;this._showPrompt({title:t.errorWarningTitle,message:Y(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{i(),this._clearPrompt()}}}})})),a((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),a((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),a((()=>this.visibleElements.sketch),(()=>this._setupSketch()),l),$({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._sketchToolbar=t(this._sketchToolbar)}loadDependencies(){return Promise.all([R({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),b(),F(),T(),W(),P(),U(),D(),O(),B()])}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get activeWorkflow(){return this.viewModel.activeWorkflow}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,s=this.classes(v.base,G.widget,G.panel);if(!t)return X("div",{class:s,key:"empty"});const{pageStack:o}=t,i=o.length-1,a=o.map(((e,t)=>this._renderPage(e,t===i)));return X("div",{class:s,key:"base"},e.flow?X("calcite-flow",{inert:!!this._prompt,key:"flow"},a):a,this._prompt?X(V,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const s={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(s);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(s);case"creating-features-upload-details":return this._renderUploadDetails(s);case"creating-features":return this._renderCreatingFeatures(s);case"editing-existing-feature":case"editing-attributes":return this._renderUpdateFeature(s);case"awaiting-update-feature-candidate":return this._renderFeatureList(s);case"adding-attachment":return this._renderAttachmentAdding(s);case"editing-attachment":return this._renderAttachmentEditing(s);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(s);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(s);case"add-association-create-association":return this._renderAddAssociation(s)}return X("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:s}=this;return X(t,{heading:s.selectTemplate,key:"templates-panel",...e},X(L,{key:"feature-templates"},X(S,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:s,messages:o}=this;if("create-features"!==s?.type)return null;const i=s.data.upload;return i?X(t,{heading:o.createFeatures,key:"upload-details-panel",...e},X(N,{helpMessage:this._helpMessage,messages:o,upload:i})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:s,messages:o,messagesCommon:i,headingLevel:a,viewModel:r}=this;if(!s)return null;const n="create-features"===s.type&&s.numPendingFeatures>0||"update"===s.type&&"create-features"===s?.activeWorkflow?.type&&s.activeWorkflow?.numPendingFeatures>0;return X(t,{heading:o.createFeatures,key:"create-features-panel",...e},n?X(x,{editorViewModel:r,headingLevel:a,messages:o,messagesCommon:i,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):X(A,{helpMessage:this._helpMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:s,messagesCommon:o,headingLevel:i,viewModel:a}=this;return X(t,{heading:s.editFeature,key:"update-feature-panel",...e},X(x,{editorViewModel:a,headingLevel:i,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.editFeature;if(e.title)return e.title;const{messagesFeature:s}=this;switch(e.type){case"attachment":return s.associationsAttachments;case"connectivity":return s.associationsConnectivity;case"structure":return s.associationsStructure;case"content":return s.associationsContents;case"container":return s.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.editFeature;const s=t.associations;switch(e.type){case"attachment":return s.addAttachment;case"connectivity":return s.addConnectivity;case"structure":return s.addStructure;case"content":return s.addContent;case"container":return s.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:s,messagesCommon:o,headingLevel:i,viewModel:a}=this,r=a.featureFormViewModel?.activeAssociationInput?.activeAssociationType,n=this._getAssociationTypeTitle(r);return X(t,{heading:n,key:"viewing-associated-layers-panel",...e},X(x,{editorViewModel:a,headingLevel:i,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:s,viewModel:o,messagesCommon:i}=this,a=o.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state;return t?X(s,{heading:r,key:"add-association-select-feature",...e},X(L,{key:"select-feature"},X(S,null,t.render())),X(C,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:i.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:i.cancel,disabled:n,onClick:()=>{"update"===o.activeWorkflow?.type&&(a?.reset(),o.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):X(s,{heading:r,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),s=e.utilityNetworkAssociationAddAssociationViewModel,o="update"===e.activeWorkflow?.type?e.activeWorkflow:null,i=o?o.activeWorkflow:null,a="add-association"===i?.type?i.sourceFeatureItem:null,r=s?.selectedFeature,n=s?.association,l=s?.utilityNetwork;a&&r&&n&&l&&(t.sourceFeature=a,t.targetFeature=r,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:s,viewModel:o,messagesCommon:i}=this;if(!t)return null;const a=o.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state;return X(s,{heading:r,key:"add-association",...e},X(L,{key:"add-association-content"},X(S,null,t.render())),X(C,{buttons:[{label:i.add,disabled:n||!a.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:i.cancel,disabled:n,onClick:()=>{"update"===o.activeWorkflow?.type&&o.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:o}=this,i=s(e.group.items,(e=>o.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0));return i?X(E,{kind:"warning",message:i}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:s,messages:o,messagesCommon:i}=this;return X(t,{heading:o.addAttachment,key:"attachment-adding-panel",...e},X(L,{key:"attachments"},this._renderAttachments()),X(C,{buttons:[{label:s.submitting?i.cancel:i.add,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:s,activeWorkflow:o,messages:i,messagesCommon:a}=this;return o?X(t,{heading:i.editAttachment,key:"attachment-editing-panel",...e},X(L,{key:"attachments"},this._renderAttachments()),o.shouldAllowAttachmentEditing?X(C,{buttons:[{label:a.update,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:s.submitting,label:a.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:s,viewModel:o,visibleElements:i}=this,a=this._helpMessage;return X(t,{heading:s.widgetLabel,key:"landing-panel",...e},X(L,{key:"landing-content"},o.editorItems.length?[i.editFeaturesSection?X(S,{key:"edit-actions"},this._renderUpdateActions()):null,i.createFeaturesSection&&o.canCreateVisible?X(S,{key:"create-actions"},this._renderCreateActions()):null]:X(I,{key:"no-content"},s.noEditableLayers)),a?X("div",{class:v.helpMessage,key:"footer-actions",slot:"footer"},a):void 0)}get _helpMessage(){const{activeWorkflow:e,messages:t,view:s}=this,o=e?.helpMessage;return o?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[o]:void 0}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:s}=this,o={id:"select",label:t.select};return X("div",{class:v.updateActions,key:"update-actions"},X(Z,{level:q(this.headingLevel)},e.editFeatures),X("calcite-list",{class:v.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},K({disabled:!s.canUpdateVisible,grouped:!1,item:o,selectedItem:"awaiting-feature-to-update"===s.activeWorkflow?.stepId?o:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return X("div",{key:"create-actions"},X(Z,{level:q(this.headingLevel)},this.messages.createFeatures),X("div",{class:v.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:t,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const i=o.data.candidates,a=Y(this.messages.multipleFeaturesTemplate,{total:i.length});return X(t,{heading:a,key:"feature-list",...e},X(M,{editorItems:s.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:s,noLabel:o}){const a=i(),{view:r}=this,n=r?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:s,action:()=>a.resolve(!0)},secondary:{label:o,action:()=>a.resolve(!1)}}}),a.promise.finally((()=>{this._clearPrompt(),n&&r?.focus()}))}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=o(this._sketchImportAbortController),this._sketchToolbar=t(this._sketchToolbar),void this.removeHandles(ee);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const s=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new s.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",visibleElements:new z({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,createTools:new H({freehandPolygon:!0,freehandPolyline:!0})})}),this.addHandles([a((()=>this.viewModel.activeLeafWorkflow?.availableCreateTools),(e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)}),l),a((()=>this.visibleElements.undoRedoButtons),(e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)}),l),n((()=>this.viewModel?.sketchViewModel),(e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)}),l)],ee)}finally{this._sketchImportAbortController=null}}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([c()],te.prototype,"_featureForm",void 0),e([c()],te.prototype,"_sketchToolbar",void 0),e([c()],te.prototype,"_attachments",void 0),e([c()],te.prototype,"_associationItemList",void 0),e([c()],te.prototype,"_associationSettings",void 0),e([c()],te.prototype,"_featureTemplates",void 0),e([c()],te.prototype,"_filterText",void 0),e([c()],te.prototype,"_prompt",void 0),e([c()],te.prototype,"_spinner",void 0),e([c()],te.prototype,"_deleteButtonCommonInfo",null),e([c()],te.prototype,"_loading",void 0),e([c({readOnly:!0})],te.prototype,"activeWorkflow",null),e([c()],te.prototype,"headingLevel",void 0),e([c()],te.prototype,"hideTemplatesForInactiveLayers",null),e([c()],te.prototype,"icon",null),e([c()],te.prototype,"label",null),e([c()],te.prototype,"labelOptions",null),e([c()],te.prototype,"layerInfos",null),e([c(),J("esri/widgets/Editor/t9n/Editor")],te.prototype,"messages",void 0),e([c(),J("esri/t9n/common")],te.prototype,"messagesCommon",void 0),e([c(),J("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],te.prototype,"messagesTemplates",void 0),e([c(),J("esri/widgets/Feature/t9n/Feature")],te.prototype,"messagesFeature",void 0),e([c()],te.prototype,"snappingOptions",null),e([c()],te.prototype,"tooltipOptions",null),e([c()],te.prototype,"supportingWidgetDefaults",void 0),e([c({type:h,nonNullable:!0})],te.prototype,"valueOptions",null),e([c()],te.prototype,"view",null),e([c(),Q(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],te.prototype,"viewModel",void 0),e([c({type:k,nonNullable:!0})],te.prototype,"visibleElements",void 0),e([c()],te.prototype,"_helpMessage",null),te=e([d("esri.widgets.Editor")],te);const se=te;export{se as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{destroyMaybe as t,mappedFind as s,abortMaybe as i}from"../core/maybe.js";import{createResolver as o}from"../core/promiseUtils.js";import{watch as a,on as r,when as n,initial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../core/support/UpdatingHandles.js";import h from"../views/interactive/sketch/SketchValueOptions.js";import p from"./Attachments.js";import u from"./BatchAttributeForm.js";import g from"./FeatureForm.js";import w from"./FeatureTemplates.js";import _ from"./Spinner.js";import v from"./Widget.js";import{VisibleElements as f}from"./BatchAttributeForm/VisibleElements.js";import{css as y}from"./Editor/css.js";import k from"./Editor/EditorViewModel.js";import{isModelUpload as b}from"./Editor/modelUploadUtils.js";import A from"./Editor/VisibleElements.js";import{isBatchAttributeFormViewModel as F}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as M,CreateFeaturesPanelContent as T}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as C,FeatureList as E}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as W,FooterActions as P}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as L,Notice as S}from"./Editor/components/Notices.js";import{loadPanelContentComponents as I,PanelContent as j,PanelContentSection as U,PanelContentMessage as D}from"./Editor/components/PanelContent.js";import{PanelToolbar as V,loadPanelToolbarComponents as B}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as O,Prompt as x}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as N,UpdateFeaturePanelContent as z}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as H,UploadDetails as R}from"./Editor/components/UploadDetails.js";import{VisibleElements as G,CreateToolVisibilityMap as q}from"./Sketch/VisibleElements.js";import{loadCalciteComponents as Z}from"./support/componentsUtils.js";import{globalCss as K}from"./support/globalCss.js";import{incrementHeadingLevel as $,Heading as J}from"./support/Heading.js";import{renderItem as Q}from"./support/ItemList.js";import{connectDelayedLoading as X}from"./support/loaderUtils.js";import"./support/widgetUtils.js";import{messageBundle as Y}from"./support/decorators/messageBundle.js";import{vmEvent as ee}from"./support/decorators/vmEvent.js";import{tsx as te}from"./support/jsxFactory.js";import{substitute as se}from"../intl/substitute.js";const ie=Symbol("sketch-setup-handles");let oe=class extends v{constructor(e,t){super(e,t),this._batchAttributeForm=new u({visibleElements:new f({loadingIndicator:!1})}),this._featureForm=new g,this._sketchToolbar=null,this._attachments=new p({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new w({enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?te("calcite-icon",{class:y.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new _,this._loading=!1,this._updatingHandles=new m,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=new k,this.visibleElements=new A,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderBatchAttributeForm=()=>this._batchAttributeForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSketch=()=>this._sketchToolbar?te("div",{class:y.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>te("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:s},...i)=>{const{visibleElements:o}=this;return te("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:s,onCalciteFlowItemBack:this._onBack},o.zoomToButton&&this.viewModel.canZoomTo?te("calcite-action",{alignment:"center",appearance:"transparent",icon:"zoom-to-object",key:"zoom-to-button",onclick:()=>this.viewModel.zoomTo(),slot:"header-actions-end",text:this.messages.zoomTo,title:this.messages.zoomTo}):null,o.settingsMenu?te(V,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...i)},this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,s={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&b(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&t.activeFeatureFormViewModel?.activeAssociation?this._showPromptAndWait({...s,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(s)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then((()=>e.back())))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then((()=>e.back())))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([a((()=>$(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),r((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then((t=>t?e.allow():e.deny()))})),n((()=>this.viewModel.formViewModel),(e=>{F(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e}),l),n((()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel),(e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.addPromise(this._initializeAssociationItemList(e))}),l),n((()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association),(()=>{this._setUpAssociationSettings()})),a((()=>this.viewModel),(e=>{this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt}),l),a((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)}),l),a((()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel]),(([e])=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel?.set(e.sketch))}),l),n((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),n((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:i,cancel:o}]=e;this._showPrompt({title:t.errorWarningTitle,message:se(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{i(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{o(),this._clearPrompt()}}}})})),a((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),a((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),a((()=>this.visibleElements.sketch),(()=>this._setupSketch()),l),X({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._sketchToolbar=t(this._sketchToolbar)}loadDependencies(){return Promise.all([Z({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),M(),C(),W(),L(),I(),B(),O(),N(),H()])}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get activeWorkflow(){return this.viewModel.activeWorkflow}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,s=this.classes(y.base,K.widget,K.panel);if(!t)return te("div",{class:s,key:"empty"});const{pageStack:i}=t,o=i.length-1,a=i.map(((e,t)=>this._renderPage(e,t===o)));return te("div",{class:s,key:"base"},e.flow?te("calcite-flow",{inert:!!this._prompt,key:"flow"},a):a,this._prompt?te(x,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const s={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(s);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(s);case"creating-features-upload-details":return this._renderUploadDetails(s);case"creating-features":return this._renderCreatingFeatures(s);case"editing-existing-feature":case"editing-features":case"editing-attributes":return this._renderUpdateFeature(s);case"awaiting-update-feature-candidate":return this._renderFeatureList(s);case"adding-attachment":return this._renderAttachmentAdding(s);case"editing-attachment":return this._renderAttachmentEditing(s);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(s);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(s);case"add-association-create-association":return this._renderAddAssociation(s)}return te("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:s}=this;return te(t,{heading:s.selectTemplate,key:"templates-panel",...e},te(j,{key:"feature-templates"},te(U,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:s,messages:i}=this;if("create-features"!==s?.type)return null;const o=s.data.upload;return o?te(t,{heading:i.createFeatures,key:"upload-details-panel",...e},te(R,{helpMessage:this._helpMessage,messages:i,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:s,messages:i,messagesCommon:o,headingLevel:a,viewModel:r}=this;if(!s)return null;const n="create-features"===s.type&&s.numPendingFeatures>0||"update"===s.type&&"create-features"===s?.activeWorkflow?.type&&s.activeWorkflow?.numPendingFeatures>0;return te(t,{heading:i.createFeatures,key:"create-features-panel",...e},n?te(z,{editorViewModel:r,headingLevel:a,messages:i,messagesCommon:o,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):te(T,{helpMessage:this._helpMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:s,messagesCommon:i,headingLevel:o,viewModel:a}=this;return te(t,{heading:s.editFeature,key:"update-feature-panel",...e},te(z,{editorViewModel:a,headingLevel:o,messages:s,messagesCommon:i,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.editFeature;if(e.title)return e.title;const{messagesFeature:s}=this;switch(e.type){case"attachment":return s.associationsAttachments;case"connectivity":return s.associationsConnectivity;case"structure":return s.associationsStructure;case"content":return s.associationsContents;case"container":return s.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.editFeature;const s=t.associations;switch(e.type){case"attachment":return s.addAttachment;case"connectivity":return s.addConnectivity;case"structure":return s.addStructure;case"content":return s.addContent;case"container":return s.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:s,messagesCommon:i,headingLevel:o,viewModel:a}=this,r=a.featureFormViewModel?.activeAssociationInput?.activeAssociationType,n=this._getAssociationTypeTitle(r);return te(t,{heading:n,key:"viewing-associated-layers-panel",...e},te(z,{editorViewModel:a,headingLevel:o,messages:s,messagesCommon:i,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:s,viewModel:i,messagesCommon:o}=this,a=i.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state;return t?te(s,{heading:r,key:"add-association-select-feature",...e},te(j,{key:"select-feature"},te(U,null,t.render())),te(P,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===i.activeWorkflow?.type&&(a?.reset(),i.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):te(s,{heading:r,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),s=e.utilityNetworkAssociationAddAssociationViewModel,i="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=i?i.activeWorkflow:null,a="add-association"===o?.type?o.sourceFeatureItem:null,r=s?.selectedFeature,n=s?.association,l=s?.utilityNetwork;a&&r&&n&&l&&(t.sourceFeature=a,t.targetFeature=r,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:s,viewModel:i,messagesCommon:o}=this;if(!t)return null;const a=i.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state;return te(s,{heading:r,key:"add-association",...e},te(j,{key:"add-association-content"},te(U,null,t.render())),te(P,{buttons:[{label:o.add,disabled:n||!a.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===i.activeWorkflow?.type&&i.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:i}=this,o=s(e.group.items,(e=>i.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0));return o?te(S,{kind:"warning",message:o}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:s,messages:i,messagesCommon:o}=this;return te(t,{heading:i.addAttachment,key:"attachment-adding-panel",...e},te(j,{key:"attachments"},this._renderAttachments()),te(P,{buttons:[{label:s.submitting?o.cancel:o.add,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:s,activeWorkflow:i,messages:o,messagesCommon:a}=this;return i?te(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},te(j,{key:"attachments"},this._renderAttachments()),i.shouldAllowAttachmentEditing?te(P,{buttons:[{label:a.update,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:s.submitting,label:a.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:s,viewModel:i,visibleElements:o}=this,a=this._helpMessage;return te(t,{heading:s.widgetLabel,key:"landing-panel",...e},te(j,{key:"landing-content"},i.editorItems.length?[o.editFeaturesSection?te(U,{key:"edit-actions"},this._renderUpdateActions()):null,o.createFeaturesSection&&i.canCreateVisible?te(U,{key:"create-actions"},this._renderCreateActions()):null]:te(D,{key:"no-content"},s.noEditableLayers)),a?te("div",{class:y.helpMessage,key:"footer-actions",slot:"footer"},a):void 0)}get _helpMessage(){const{activeWorkflow:e,messages:t,view:s}=this,i=e?.helpMessage;return i?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[i]:void 0}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:s}=this,i={id:"select",label:t.select};return te("div",{class:y.updateActions,key:"update-actions"},te(J,{level:$(this.headingLevel)},e.editFeatures),te("calcite-list",{class:y.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},Q({disabled:!s.canUpdateVisible,grouped:!1,item:i,selectedItem:"awaiting-feature-to-update"===s.activeWorkflow?.stepId?i:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return te("div",{key:"create-actions"},te(J,{level:$(this.headingLevel)},this.messages.createFeatures),te("div",{class:y.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:t,viewModel:s}=this,{activeWorkflow:i}=s;if("update"!==i?.type)return null;const o=i.data.candidates,a=se(this.messages.multipleFeaturesTemplate,{total:o.length});return te(t,{heading:a,key:"feature-list",...e},te(E,{editorItems:s.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:i,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:s,noLabel:i}){const a=o(),{view:r}=this,n=r?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:s,action:()=>a.resolve(!0)},secondary:{label:i,action:()=>a.resolve(!1)}}}),a.promise.finally((()=>{this._clearPrompt(),n&&r?.focus()}))}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=i(this._sketchImportAbortController),this._sketchToolbar=t(this._sketchToolbar),void this.removeHandles(ie);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const s=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new s.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",visibleElements:new G({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,createTools:new q({freehandPolygon:!0,freehandPolyline:!0})})}),this.addHandles([a((()=>this.viewModel.activeLeafWorkflow?.availableCreateTools),(e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)}),l),a((()=>this.visibleElements.undoRedoButtons),(e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)}),l),n((()=>this.viewModel?.sketchViewModel),(e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)}),l)],ie)}finally{this._sketchImportAbortController=null}}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([c()],oe.prototype,"_batchAttributeForm",void 0),e([c()],oe.prototype,"_featureForm",void 0),e([c()],oe.prototype,"_sketchToolbar",void 0),e([c()],oe.prototype,"_attachments",void 0),e([c()],oe.prototype,"_associationItemList",void 0),e([c()],oe.prototype,"_associationSettings",void 0),e([c()],oe.prototype,"_featureTemplates",void 0),e([c()],oe.prototype,"_filterText",void 0),e([c()],oe.prototype,"_prompt",void 0),e([c()],oe.prototype,"_spinner",void 0),e([c()],oe.prototype,"_deleteButtonCommonInfo",null),e([c()],oe.prototype,"_loading",void 0),e([c({readOnly:!0})],oe.prototype,"activeWorkflow",null),e([c()],oe.prototype,"headingLevel",void 0),e([c()],oe.prototype,"hideTemplatesForInactiveLayers",null),e([c()],oe.prototype,"icon",null),e([c()],oe.prototype,"label",null),e([c()],oe.prototype,"labelOptions",null),e([c()],oe.prototype,"layerInfos",null),e([c(),Y("esri/widgets/Editor/t9n/Editor")],oe.prototype,"messages",void 0),e([c(),Y("esri/t9n/common")],oe.prototype,"messagesCommon",void 0),e([c(),Y("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],oe.prototype,"messagesTemplates",void 0),e([c(),Y("esri/widgets/Feature/t9n/Feature")],oe.prototype,"messagesFeature",void 0),e([c()],oe.prototype,"snappingOptions",null),e([c()],oe.prototype,"tooltipOptions",null),e([c()],oe.prototype,"supportingWidgetDefaults",void 0),e([c({type:h,nonNullable:!0})],oe.prototype,"valueOptions",null),e([c()],oe.prototype,"view",null),e([c(),ee(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],oe.prototype,"viewModel",void 0),e([c({type:A,nonNullable:!0})],oe.prototype,"visibleElements",void 0),e([c()],oe.prototype,"_helpMessage",null),oe=e([d("esri.widgets.Editor")],oe);const ae=oe;export{ae 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{floatEqualUlp as e,lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{distance as s,lerp as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{m as a}from"../../../chunks/vec32.js";import i from"../../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../../geometry/projection.js";import l from"../../../geometry/SpatialReference.js";import{geodesicLengths as f,isSupported as h,inverseGeodeticSolver as p,directGeodeticSolver as m}from"../../../geometry/support/geodesicUtils.js";import{getElevationOffset as d}from"../../../support/elevationInfoUtils.js";import{ProfileGenerationError as g,ProfileGenerationErrorCause as w}from"./ProfileGenerationError.js";async function y(e,t,s,o,a,i,h){let p,m,d;const y=e.spatialReference,v=y.isGeographic||y.isWebMercator;let P=0;if(!v){const{planarLength:t}=await import("../../../geometry/geometryEngineAsync.js");n(h),P=await t(e,"meters"),n(h)}const Z=1/r(o);if(v){await c([{source:y,dest:o},{source:y,dest:l.WGS84}],h);const n=L(e);p=f([n],"meters")[0];const r=R(p,a);if(D(e,p,r)>i)throw new g(w.TooComplex);const v=j(n,t,s);({densifiedPath:m,distances:d}=U(v,r,Z)),m=u(m,o)}else{await c([{source:y,dest:o}],h),p=P;const r=R(p,a);if(D(e,p,r)>i)throw new g(w.TooComplex);const l=j(e,t,s);({densifiedPath:m,distances:d}=b(l,r,Z)),n(h),m=u(m,o)}return{densifiedPath:m,pathLength:p*Z,distances:d}}function R(e,t){const n=e/t.densificationMaxSamples;return Math.max(t.samplingDistance,n)}function j(e,t,n){if(null==t)return Z(e);const r=e.spatialReference,s=t.mode,o=d(t,r);let a=null;switch(n.type){case"2d":a=v(e,s,o);break;case"3d":a=P(e,s,o,n)}return null==a?Z(e):new i({hasZ:!0,hasM:!1,spatialReference:r,paths:x(e.paths,a)})}function v({hasZ:e},t,n){return"absolute-height"===t?e?([e,t,r])=>[e,t,r+n]:([e,t])=>[e,t,n]:null}function P({spatialReference:e,hasZ:t},n,r,{elevationProvider:s}){const o=(t,n,r,o)=>s?.getElevation(t,n,r,e,o)??0;switch(n){case"on-the-ground":return([e,t])=>[e,t,o(e,t,0,"ground")];case"absolute-height":return t?([e,t,n])=>[e,t,n+r]:([e,t])=>[e,t,r];case"relative-to-ground":return t?([e,t,n])=>[e,t,n+o(e,t,n,"ground")+r]:([e,t])=>[e,t,o(e,t,0,"ground")+r];case"relative-to-scene":return t?([e,t,n])=>[e,t,n+o(e,t,n,"scene")+r]:([e,t])=>[e,t,o(e,t,0,"scene")+r];default:return null}}function Z(e){return e.hasZ?new i({hasZ:!1,hasM:!1,spatialReference:e.spatialReference,paths:x(e.paths,(([e,t])=>[e,t]))}):e}function x(e,t){const n=e.length,r=new Array(n);for(let s=0;s<n;++s){const n=e[s],o=n.length,a=new Array(n.length);r[s]=a;for(let e=0;e<o;++e)a[e]=t(n[e])}return r}function M(e){return A(e)&&e.paths.length>0&&e.paths.every((e=>e.length>=2))}function A(e){return null!=e&&"polyline"===e.type}function S(t,n,s,o,a){const{spatialReference:c,hasZ:u}=t,l={from:null,to:null,distance:0,azimuth:0,reverseAzimuth:0,spatialReference:c,metersPerSR:r(c)},f=[],h=[];let p=0;for(let r=0;r<t.paths.length;++r){const i=t.paths[r],c=new Array,u=new Array;let m=0;for(let t=1;t<i.length;++t){const r=i[t-1],f=i[t],h=o(l,r,f);let d;for(d=m;d<h.distance&&!e(d,h.distance);d+=n)c.push(a(h,d)),u.push((p+d)*s);m=d-h.distance,p+=h.distance,c.push(f),u.push(p*s)}f[r]=c,h[r]=u}return{densifiedPath:new i({spatialReference:c,hasZ:u,paths:f}),distances:h}}function b(e,t,n){const{hasZ:r}=e;return S(e,t,n,G,r?C:k)}function U(e,t,n){const{hasZ:r}=e;return S(e,t,n,z,r?W:E)}function z(e,t,n){return e.distance=0,p(e,t,n,e.spatialReference),e.from=t,e.to=n,e}function G(e,t,n){return e.from=t,e.to=n,e.distance=s(n,t)*e.metersPerSR,e}function E({from:e,azimuth:t,spatialReference:n},r){return m([0,0],e,t,r,n)}function W({from:e,to:n,azimuth:r,distance:s,spatialReference:o},a){const i=a/s,c=[0,0,t(e[2],n[2],i)];return m(c,e,r,a,o),c}function k({from:e,to:t,distance:n},r){return o([0,0],e,t,r/n)}function C({from:e,to:t,distance:n},r){return a([0,0,0],e,t,r/n)}function L(e){return h(e.spatialReference)?e:u(e,l.WGS84)}function T(e){return e.paths.reduce(((e,t)=>e+t.length),0)}function D(e,t,n){return T(e)+Math.floor(t/n)+Math.max(0,e.paths.reduce((e=>1+e),0)-1)}export{T as countPoints,y as densifyPath,A as isPolyline,M as isValidInputPath,j as toAbsoluteHeightElevation};
5
+ import{floatEqualUlp as e,lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{distance as s,lerp as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{m as a}from"../../../chunks/vec32.js";import i from"../../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../../geometry/projection.js";import l from"../../../geometry/SpatialReference.js";import{geodesicLengths as f,isSupported as h,inverseGeodeticSolver as p,directGeodeticSolver as m}from"../../../geometry/support/geodesicUtils.js";import{getElevationOffset as d}from"../../../support/elevationInfoUtils.js";import{ProfileGenerationError as g,ProfileGenerationErrorCause as w}from"./ProfileGenerationError.js";async function R(e,t,s,o,a,i,h){let p,m,d;const R=e.spatialReference,v=R.isGeographic||R.isWebMercator;let P=0;if(!v){const{execute:t}=await import("../../../geometry/operators/lengthOperator.js");n(h),P=await t(e,{unit:"meters"}),n(h)}const Z=1/r(o);if(v){await c([{source:R,dest:o},{source:R,dest:l.WGS84}],h);const n=T(e);p=f([n],"meters")[0];const r=y(p,a);if(I(e,p,r)>i)throw new g(w.TooComplex);const v=j(n,t,s);({densifiedPath:m,distances:d}=U(v,r,Z)),m=u(m,o)}else{await c([{source:R,dest:o}],h),p=P;const r=y(p,a);if(I(e,p,r)>i)throw new g(w.TooComplex);const l=j(e,t,s);({densifiedPath:m,distances:d}=A(l,r,Z)),n(h),m=u(m,o)}return{densifiedPath:m,pathLength:p*Z,distances:d}}function y(e,t){const n=e/t.densificationMaxSamples;return Math.max(t.samplingDistance,n)}function j(e,t,n){if(null==t)return Z(e);const r=e.spatialReference,s=t.mode,o=d(t,r);let a=null;switch(n.type){case"2d":a=v(e,s,o);break;case"3d":a=P(e,s,o,n)}return null==a?Z(e):new i({hasZ:!0,hasM:!1,spatialReference:r,paths:x(e.paths,a)})}function v({hasZ:e},t,n){return"absolute-height"===t?e?([e,t,r])=>[e,t,r+n]:([e,t])=>[e,t,n]:null}function P({spatialReference:e,hasZ:t},n,r,{elevationProvider:s}){const o=(t,n,r,o)=>s?.getElevation(t,n,r,e,o)??0;switch(n){case"on-the-ground":return([e,t])=>[e,t,o(e,t,0,"ground")];case"absolute-height":return t?([e,t,n])=>[e,t,n+r]:([e,t])=>[e,t,r];case"relative-to-ground":return t?([e,t,n])=>[e,t,n+o(e,t,n,"ground")+r]:([e,t])=>[e,t,o(e,t,0,"ground")+r];case"relative-to-scene":return t?([e,t,n])=>[e,t,n+o(e,t,n,"scene")+r]:([e,t])=>[e,t,o(e,t,0,"scene")+r];default:return null}}function Z(e){return e.hasZ?new i({hasZ:!1,hasM:!1,spatialReference:e.spatialReference,paths:x(e.paths,(([e,t])=>[e,t]))}):e}function x(e,t){const n=e.length,r=new Array(n);for(let s=0;s<n;++s){const n=e[s],o=n.length,a=new Array(n.length);r[s]=a;for(let e=0;e<o;++e)a[e]=t(n[e])}return r}function M(e){return S(e)&&e.paths.length>0&&e.paths.every((e=>e.length>=2))}function S(e){return null!=e&&"polyline"===e.type}function b(t,n,s,o,a){const{spatialReference:c,hasZ:u}=t,l={from:null,to:null,distance:0,azimuth:0,reverseAzimuth:0,spatialReference:c,metersPerSR:r(c)},f=[],h=[];let p=0;for(let r=0;r<t.paths.length;++r){const i=t.paths[r],c=new Array,u=new Array;let m=0;for(let t=1;t<i.length;++t){const r=i[t-1],f=i[t],h=o(l,r,f);let d;for(d=m;d<h.distance&&!e(d,h.distance);d+=n)c.push(a(h,d)),u.push((p+d)*s);m=d-h.distance,p+=h.distance,c.push(f),u.push(p*s)}f[r]=c,h[r]=u}return{densifiedPath:new i({spatialReference:c,hasZ:u,paths:f}),distances:h}}function A(e,t,n){const{hasZ:r}=e;return b(e,t,n,G,r?E:C)}function U(e,t,n){const{hasZ:r}=e;return b(e,t,n,z,r?k:W)}function z(e,t,n){return e.distance=0,p(e,t,n,e.spatialReference),e.from=t,e.to=n,e}function G(e,t,n){return e.from=t,e.to=n,e.distance=s(n,t)*e.metersPerSR,e}function W({from:e,azimuth:t,spatialReference:n},r){return m([0,0],e,t,r,n)}function k({from:e,to:n,azimuth:r,distance:s,spatialReference:o},a){const i=a/s,c=[0,0,t(e[2],n[2],i)];return m(c,e,r,a,o),c}function C({from:e,to:t,distance:n},r){return o([0,0],e,t,r/n)}function E({from:e,to:t,distance:n},r){return a([0,0,0],e,t,r/n)}function T(e){return h(e.spatialReference)?e:u(e,l.WGS84)}function D(e){return e.paths.reduce(((e,t)=>e+t.length),0)}function I(e,t,n){return D(e)+Math.floor(t/n)+Math.max(0,e.paths.reduce((e=>1+e),0)-1)}export{D as countPoints,R as densifyPath,S as isPolyline,M as isValidInputPath,j as toAbsoluteHeightElevation};
@@ -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"../core/Collection.js";import i from"../core/Identifiable.js";import o from"../core/ReactiveMap.js";import{on as s,watch as l,initial as r}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 n}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import{css as p}from"./LayerList/css.js";import c from"./LayerList/LayerListItem.js";import m from"./LayerList/LayerListViewModel.js";import h from"./LayerList/LayerListVisibleElements.js";import y from"./LayerList/ListItem.js";import{minDragEnabledItems as u,minFilterItems as g,getItem as _,getLayerType as L,removeDestroyedListItems as f,setFilterPredicate as v,sortLayersToIds as I,sortChildLayersToIds as b}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as w}from"./support/componentsUtils.js";import{globalCss as C}from"./support/globalCss.js";import{calciteListFilterProps as E}from"./support/listUtils.js";import{setFocus as F}from"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as O}from"./support/decorators/vmEvent.js";import{tsx as T}from"./support/jsxFactory.js";const P=t.ofType(y),A="nested";let j=class extends(i.IdentifiableMixin(d)){constructor(e,i){super(e,i),this._rootListEl=null,this._activeItem=null,this._tooltipReferenceMap=new o,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new o,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=u,this.minFilterItems=g,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new P,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new m,this.visibilityAppearance="default",this.visibleElements=new h,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=_(e);if(!l?.sortable)return!1;const r=_(t),a=L(t),n=_(i),d=L(i),p=!!a&&!!d&&a===d,c={selected:l,from:r,to:n},m=t.group,h=i.group,y=r?.layer?.type??"",u=n?.layer?.type??"",g=new Set(["map-image","catalog","knowledge-graph"]),f="sublayer";return m&&h&&"function"==typeof s?s.call(null,c):p&&!g.has(y)&&!g.has(u)&&l?.layer?.type!==f},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(p.item)));this._activeItem=_(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o))if(this._lastDragDetail=e,this._selectedDragItemLayerUid=s.value,o!==i)this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l});else{const e=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(o,e)}}}initialize(){this.addHandles([s((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),r),s((()=>this.viewModel.operationalItems),"change",(()=>f(this.selectedItems)),r),l((()=>[this.filterPredicate,this._rootListEl]),(()=>v(this._rootListEl,this.filterPredicate)))])}loadDependencies(){return w({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _totalItems(){return this.viewModel.operationalItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer?.type)))).length}get _visibleItems(){return this.operationalItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleItems.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get _dragEnabled(){return this._totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this._totalItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map(((t,i)=>this._renderLayerFlowItem(t,i===e.length-1)))}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,{_visibleItems:t}=this,i={[C.hidden]:"loading"===e,[C.disabled]:"disabled"===e};return T("div",{class:this.classes(p.base,C.widget,C.panel,i)},t?.length?[this._renderItemTooltips(),this._renderItems()]:this._renderNoItems())}async _createFlowList(e,t){const{_layerListMap:i}=this,o=i.get(e);if(o)return o;const s="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const o=new AbortController,{signal:s}=o;this._openedLayersController=o,e.forEach(((i,o)=>{t.includes(o)||(i.destroy(),e.delete(o))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,s))));if(s.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?T("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:t.get(e.layer?.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(){return this._visibleItems?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return T("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return T("div",{class:p.itemMessage,key:"esri-layer-list__no-items"},T("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:o,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,_onCatalogOpen:p,_onTablesOpen:c,layerTablesEnabled:m}=this;return new t({headingLevel:i,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,...o,catalogLayer:e,layerTablesEnabled:m,onCatalogOpen:p,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:o,dragEnabled:s}=this;return new t({headingLevel:i,selectionMode:o,dragEnabled:s,...this._getTableListParams(e)})}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:o}=this,s=e.title||this.messages.untitledLayer;return T("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),o.pop();const t=o.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map((({title:i,panel:o},s)=>{const l=()=>this._handlePanelFlowItemBack(o);return T("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:o.title,headingLevel:this.headingLevel,key:`flow-panel-${o.uid}`,selected:!t.length&&s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},o.render(),T("calcite-button",{appearance:"transparent",onclick:l,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,F(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,F(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,F(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:i,_openedPanelItems:o,_filterEnabled:s,_rootGroupUid:l,visibleElements:{closeButton:r,collapseButton:a,heading:n,flow:d},_dragEnabled:c,selectionMode:m,filterText:h,openedLayers:y,filterPlaceholder:u,messages:g}=this,_=[T("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:r,closed:!e,collapsed:t,collapsible:a,heading:n?g.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!y.length&&!o.length,onCalciteFlowItemClose:()=>this.visible=!1},T("calcite-list",{afterCreate:e=>{this._rootListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{this._rootListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":l,displayMode:A,dragEnabled:c,filterEnabled:s,filterPlaceholder:u,filterProps:E,filterText:s?h:"",group:l,key:"root-list",label:g.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:m,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},i?.toArray().map((e=>this._renderItem(e))),i?.length&&s?T("div",{class:p.filterNoResults,slot:"filter-no-results"},T("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?d?T("calcite-flow",{key:"root-flow"},_):_:null}_renderItem(e,t,i){return T(c,{activeItem:this._activeItem,canMove:this._canMove,css:p,displayMode:A,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=_(i),l=_(e),r=_(t);this.viewModel.moveListItem(s,r,l,o)}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_sortLayers(e,t){if(e)if(e===this._rootListEl)I(this.view?.map?.layers,t);else{const i=_(e);if(!i)return;b(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>_(e))).filter(Boolean);i.removeAll(),i.addMany(o)}};e([a()],j.prototype,"_rootListEl",void 0),e([a()],j.prototype,"_activeItem",void 0),e([a()],j.prototype,"_tooltipReferenceMap",void 0),e([a()],j.prototype,"_focusRootFlowItem",void 0),e([a()],j.prototype,"_focusPanelFlowItem",void 0),e([a()],j.prototype,"_focusLayerFlowItem",void 0),e([a()],j.prototype,"_layerListMap",void 0),e([a()],j.prototype,"_totalItems",null),e([a()],j.prototype,"_visibleItems",null),e([a()],j.prototype,"_openedPanelItems",null),e([a()],j.prototype,"_dragEnabled",null),e([a()],j.prototype,"_filterEnabled",null),e([a()],j.prototype,"_renderedOpenLayerFlowItems",null),e([a({readOnly:!0})],j.prototype,"catalogLayerList",void 0),e([a()],j.prototype,"catalogOptions",void 0),e([a()],j.prototype,"collapsed",void 0),e([a()],j.prototype,"dragEnabled",void 0),e([a()],j.prototype,"filterPlaceholder",void 0),e([a()],j.prototype,"filterPredicate",void 0),e([a()],j.prototype,"filterText",void 0),e([a()],j.prototype,"headingLevel",void 0),e([a()],j.prototype,"icon",null),e([a()],j.prototype,"knowledgeGraphOptions",void 0),e([a()],j.prototype,"label",null),e([a()],j.prototype,"layerTablesEnabled",void 0),e([a()],j.prototype,"listItemCanGiveFunction",void 0),e([a()],j.prototype,"listItemCanReceiveFunction",void 0),e([a()],j.prototype,"listItemCreatedFunction",null),e([a()],j.prototype,"mapImageOptions",void 0),e([a(),M("esri/widgets/LayerList/t9n/LayerList")],j.prototype,"messages",void 0),e([a(),M("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([a()],j.prototype,"minDragEnabledItems",void 0),e([a()],j.prototype,"minFilterItems",void 0),e([a({readOnly:!0})],j.prototype,"openedLayers",void 0),e([a({readOnly:!0})],j.prototype,"openedLayerLists",void 0),e([a()],j.prototype,"operationalItems",null),e([a()],j.prototype,"selectedItems",void 0),e([a()],j.prototype,"selectionMode",void 0),e([a({readOnly:!0})],j.prototype,"tableList",void 0),e([a()],j.prototype,"tileOptions",void 0),e([a()],j.prototype,"view",null),e([O("trigger-action"),a({type:m})],j.prototype,"viewModel",void 0),e([a()],j.prototype,"visibilityAppearance",void 0),e([a({type:h,nonNullable:!0})],j.prototype,"visibleElements",void 0),j=e([n("esri.widgets.LayerList")],j);const D=j;export{D as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import i from"../core/Identifiable.js";import o from"../core/ReactiveMap.js";import{on as s,watch as l,initial as r}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 n}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import{css as p}from"./LayerList/css.js";import c from"./LayerList/LayerListItem.js";import m from"./LayerList/LayerListViewModel.js";import h from"./LayerList/LayerListVisibleElements.js";import y from"./LayerList/ListItem.js";import{minDragEnabledItems as u,minFilterItems as g,getItem as _,getLayerType as L,removeDestroyedListItems as f,setFilterPredicate as v,sortLayersToIds as I,sortChildLayersToIds as w}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as C}from"./support/globalCss.js";import{calciteListFilterProps as E}from"./support/listUtils.js";import{setFocus as F}from"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as O}from"./support/decorators/vmEvent.js";import{tsx as T}from"./support/jsxFactory.js";const P=t.ofType(y),A="nested";let j=class extends(i.IdentifiableMixin(d)){constructor(e,i){super(e,i),this._rootListEl=null,this._activeItem=null,this._tooltipReferenceMap=new o,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new o,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=u,this.minFilterItems=g,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new P,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new m,this.visibilityAppearance="default",this.visibleElements=new h,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=_(e);if(!l?.sortable)return!1;const r=_(t),a=L(t),n=_(i),d=L(i),p=!!a&&!!d&&a===d,c={selected:l,from:r,to:n},m=t.group,h=i.group,y=r?.layer?.type??"",u=n?.layer?.type??"",g=new Set(["map-image","catalog","knowledge-graph"]),f="sublayer";return m&&h&&"function"==typeof s?s.call(null,c):p&&!g.has(y)&&!g.has(u)&&l?.layer?.type!==f},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(p.item)));this._activeItem=_(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o))if(this._lastDragDetail=e,this._selectedDragItemLayerUid=s.value,o!==i)this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l});else{const e=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(o,e)}}}initialize(){this.addHandles([s((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),r),s((()=>this.viewModel.operationalItems),"change",(()=>f(this.selectedItems)),r),l((()=>[this.filterPredicate,this._rootListEl]),(()=>v(this._rootListEl,this.filterPredicate)))])}loadDependencies(){return b({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _totalItems(){return this.viewModel.operationalItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer?.type)))).length}get _visibleItems(){return this.operationalItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleItems.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get _dragEnabled(){return this._totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this._totalItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map(((t,i)=>this._renderLayerFlowItem(t,i===e.length-1)))}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[C.hidden]:"loading"===e,[C.disabled]:"disabled"===e};return T("div",{class:this.classes(p.base,C.widget,C.panel,t)},this._renderItemTooltips(),this._renderItems())}async _createFlowList(e,t){const{_layerListMap:i}=this,o=i.get(e);if(o)return o;const s="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const o=new AbortController,{signal:s}=o;this._openedLayersController=o,e.forEach(((i,o)=>{t.includes(o)||(i.destroy(),e.delete(o))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,s))));if(s.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?T("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:t.get(e.layer?.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(){return this._visibleItems?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return T("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return T("div",{class:p.itemMessage,key:"esri-layer-list__no-items"},T("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:o,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,_onCatalogOpen:p,_onTablesOpen:c,layerTablesEnabled:m}=this;return new t({headingLevel:i,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,...o,catalogLayer:e,layerTablesEnabled:m,onCatalogOpen:p,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:o,dragEnabled:s}=this;return new t({headingLevel:i,selectionMode:o,dragEnabled:s,...this._getTableListParams(e)})}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:o}=this,s=e.title||this.messages.untitledLayer;return T("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),o.pop();const t=o.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map((({title:i,panel:o},s)=>{const l=()=>this._handlePanelFlowItemBack(o);return T("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:o.title,headingLevel:this.headingLevel,key:`flow-panel-${o.uid}`,selected:!t.length&&s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},o.render(),T("calcite-button",{appearance:"transparent",onclick:l,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,F(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,F(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,F(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:i,_openedPanelItems:o,_filterEnabled:s,_rootGroupUid:l,visibleElements:{closeButton:r,collapseButton:a,heading:n,flow:d},_dragEnabled:c,selectionMode:m,filterText:h,openedLayers:y,filterPlaceholder:u,messages:g}=this,_=[T("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:r,closed:!e,collapsed:t,collapsible:a,heading:n?g.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!y.length&&!o.length,onCalciteFlowItemClose:()=>this.visible=!1},i?.length?T("calcite-list",{afterCreate:e=>{this._rootListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{this._rootListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":l,displayMode:A,dragEnabled:c,filterEnabled:s,filterPlaceholder:u,filterProps:E,filterText:s?h:"",group:l,key:"root-list",label:g.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:m,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},i.toArray().map((e=>this._renderItem(e))),s?T("div",{class:p.filterNoResults,slot:"filter-no-results"},T("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null):this._renderNoItems()),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?d?T("calcite-flow",{key:"root-flow"},_):_:null}_renderItem(e,t,i){return T(c,{activeItem:this._activeItem,canMove:this._canMove,css:p,displayMode:A,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=_(i),l=_(e),r=_(t);this.viewModel.moveListItem(s,r,l,o)}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_sortLayers(e,t){if(e)if(e===this._rootListEl)I(this.view?.map?.layers,t);else{const i=_(e);if(!i)return;w(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>_(e))).filter(Boolean);i.removeAll(),i.addMany(o)}};e([a()],j.prototype,"_rootListEl",void 0),e([a()],j.prototype,"_activeItem",void 0),e([a()],j.prototype,"_tooltipReferenceMap",void 0),e([a()],j.prototype,"_focusRootFlowItem",void 0),e([a()],j.prototype,"_focusPanelFlowItem",void 0),e([a()],j.prototype,"_focusLayerFlowItem",void 0),e([a()],j.prototype,"_layerListMap",void 0),e([a()],j.prototype,"_totalItems",null),e([a()],j.prototype,"_visibleItems",null),e([a()],j.prototype,"_openedPanelItems",null),e([a()],j.prototype,"_dragEnabled",null),e([a()],j.prototype,"_filterEnabled",null),e([a()],j.prototype,"_renderedOpenLayerFlowItems",null),e([a({readOnly:!0})],j.prototype,"catalogLayerList",void 0),e([a()],j.prototype,"catalogOptions",void 0),e([a()],j.prototype,"collapsed",void 0),e([a()],j.prototype,"dragEnabled",void 0),e([a()],j.prototype,"filterPlaceholder",void 0),e([a()],j.prototype,"filterPredicate",void 0),e([a()],j.prototype,"filterText",void 0),e([a()],j.prototype,"headingLevel",void 0),e([a()],j.prototype,"icon",null),e([a()],j.prototype,"knowledgeGraphOptions",void 0),e([a()],j.prototype,"label",null),e([a()],j.prototype,"layerTablesEnabled",void 0),e([a()],j.prototype,"listItemCanGiveFunction",void 0),e([a()],j.prototype,"listItemCanReceiveFunction",void 0),e([a()],j.prototype,"listItemCreatedFunction",null),e([a()],j.prototype,"mapImageOptions",void 0),e([a(),M("esri/widgets/LayerList/t9n/LayerList")],j.prototype,"messages",void 0),e([a(),M("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([a()],j.prototype,"minDragEnabledItems",void 0),e([a()],j.prototype,"minFilterItems",void 0),e([a({readOnly:!0})],j.prototype,"openedLayers",void 0),e([a({readOnly:!0})],j.prototype,"openedLayerLists",void 0),e([a()],j.prototype,"operationalItems",null),e([a()],j.prototype,"selectedItems",void 0),e([a()],j.prototype,"selectionMode",void 0),e([a({readOnly:!0})],j.prototype,"tableList",void 0),e([a()],j.prototype,"tileOptions",void 0),e([a()],j.prototype,"view",null),e([O("trigger-action"),a({type:m})],j.prototype,"viewModel",void 0),e([a()],j.prototype,"visibilityAppearance",void 0),e([a({type:h,nonNullable:!0})],j.prototype,"visibleElements",void 0),j=e([n("esri.widgets.LayerList")],j);const D=j;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{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import t from"../Widget.js";import{css as o}from"./searchResultRendererCSS.js";import l from"./SearchViewModel.js";import{globalCss as i}from"../support/globalCss.js";import{accessibleHandler as u}from"../support/decorators/accessibleHandler.js";import{messageBundle as n}from"../support/decorators/messageBundle.js";import{tsx as c}from"../support/jsxFactory.js";import"../support/widgetUtils.js";let d=class extends t{constructor(e,s){super(e,s),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}destroy(){this.viewModel=null}render(){const e={[o.showMoreResults]:this.showMoreResultsOpen};return c("div",{class:this.classes(o.base,i.widget)},c("div",{class:this.classes(o.moreResults,e),key:"esri-search-renderer__container"},this._renderSearchResultName(),this._renderMoreResults()))}_renderMoreResults(){return c("div",{key:"esri-search-renderer__more-results"},this._renderMoreResultsButton(),this._renderMoreResultsLists())}_renderSearchResultName(){const e=this.viewModel?.selectedResult,s=e?.name||"";return c("div",{class:o.moreResultsItem,key:"esri-search-renderer__result-name"},s)}_renderMoreResultsLists(){const{viewModel:e}=this;if(!e)return[];const s=e.results;if((e.resultCount??0)<2)return null;const r=s?.map((e=>this._renderMoreResultsList(e)));return c("div",{class:o.moreResultsList,key:"esri-search-renderer__more-results-container"},r)}_renderMoreResultsButton(){const{messages:e,viewModel:s}=this;if(!s)return null;return(s.resultCount??0)<2?null:c("div",{class:o.moreResultsItem,key:"esri-search-renderer__more-results-button"},c("a",{bind:this,class:i.anchor,href:"#",onclick:this._showMoreResultsClick,onkeydown:this._showMoreResultsClick},this.showMoreResultsOpen?e.hideMoreResults:e.showMoreResults))}_renderMoreResultsHeader(e,s){return c("div",{class:o.moreResultsListHeader,key:`esri-search-result-renderer__header-${s}`},e)}_renderMoreResultsList(e){const{results:s}=e,r=s?.length??0,t=r>0,o=this.viewModel?.selectedResult,l=1===r&&s[0]===o,i=this._getSourceName(e.source,e.sourceIndex),u=(this.viewModel?.results?.length??0)>1&&!l?this._renderMoreResultsHeader(i,e.sourceIndex):null,n=t&&s.map(((e,s)=>this._renderMoreResultsListItem(e,s))),d=t&&!l?c("ul",{key:`esri-search-result-renderer__list-${e.sourceIndex}`},n):null;return t?c("div",{key:`esri-search-result-renderer__results-${e.sourceIndex}`},u,d):null}_renderMoreResultsListItem(e,s){const r=this.viewModel?.selectedResult;return e!==r?c("li",{key:`esri-search-result-renderer__list-item-${s}`},c("a",{bind:this,class:i.anchor,"data-result":e,href:"#",onclick:this._selectResultClick,onkeydown:this._selectResultClick,tabIndex:0},e.name)):null}_showMoreResultsClick(e){e.preventDefault(),this.showMoreResultsOpen=!this.showMoreResultsOpen;const s=this.viewModel?.view?.popup;s&&"reposition"in s&&s.reposition()}_selectResultClick(e){e.preventDefault();const s=e.currentTarget["data-result"];this.viewModel?.select(s)}_getSourceName(e,s){return s===l.ALL_INDEX?this.messages.all:e.name}};e([s(),n("esri/widgets/Search/t9n/Search")],d.prototype,"messages",void 0),e([s()],d.prototype,"showMoreResultsOpen",void 0),e([s()],d.prototype,"viewModel",void 0),e([u()],d.prototype,"_showMoreResultsClick",null),e([u()],d.prototype,"_selectResultClick",null),d=e([r("esri.widgets.Search.SearchResultRenderer")],d);const a=d;export{a as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import o from"../Widget.js";import{css as r}from"./searchResultRendererCSS.js";import i from"./SearchViewModel.js";import{loadCalciteComponents as l}from"../support/componentsUtils.js";import{globalCss as c}from"../support/globalCss.js";import"../support/widgetUtils.js";import{messageBundle as n}from"../support/decorators/messageBundle.js";import{tsx as p}from"../support/jsxFactory.js";import{substitute as u}from"../../intl/substitute.js";let m=class extends o{constructor(e,s){super(e,s),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}loadDependencies(){return l({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),"list-item-group":()=>import("@esri/calcite-components/dist/components/calcite-list-item-group")})}destroy(){this.viewModel=null}render(){return p("div",{class:this.classes(r.base,c.widget)},this.viewModel?.selectedResult?.name??"",this._renderMoreResults())}_renderMoreResults(){if(!this.viewModel)return null;const{resultCount:e,results:s}=this.viewModel;return!e||e<2||!s?null:p("calcite-block",{class:r.moreResults,collapsible:!0,expanded:this.showMoreResultsOpen,heading:u(this.messages.showMoreResults,{count:e-1}),onCalciteBlockClose:()=>this._toggleShowMoreResults(!1),onCalciteBlockOpen:()=>this._toggleShowMoreResults(!0)},s.map((e=>this._renderMoreResultsList(e,s?.length>1))))}_renderListItem(e){return p("calcite-list-item",{key:`result-${e.sourceIndex}-${e.key}`,label:e.name,onCalciteListItemSelect:()=>this._selectResult(e)})}_renderMoreResultsList(e,s){const{results:t}=e;if(!(t?.length??0)||!t)return null;const o=this.viewModel?.selectedResult,r=this._getSourceName(e.source,e.sourceIndex),i=t.filter((e=>e!==o)).map((e=>this._renderListItem(e)));return p("calcite-list",{label:r},s?p("calcite-list-item-group",{heading:r,key:`group-${e.sourceIndex}`},i):i)}_selectResult(e){this.showMoreResultsOpen=!1,this.viewModel?.select(e)}_toggleShowMoreResults(e){this.showMoreResultsOpen=e;const s=this.viewModel?.view?.popup;s&&"reposition"in s&&s.reposition()}_getSourceName(e,s){return s===i.ALL_INDEX?this.messages.all:e.name}};e([s(),n("esri/widgets/Search/t9n/Search")],m.prototype,"messages",void 0),e([s()],m.prototype,"showMoreResultsOpen",void 0),e([s()],m.prototype,"viewModel",void 0),m=e([t("esri.widgets.Search.SearchResultRenderer")],m);const a=m;export{a 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{getAssetUrl as t}from"../../assets.js";import r from"../../config.js";import s from"../../Graphic.js";import o from"../../PopupTemplate.js";import i from"../../core/Accessor.js";import{isSome as l}from"../../core/arrayUtils.js";import a from"../../core/Collection.js";import n from"../../core/Error.js";import u from"../../core/Evented.js";import c from"../../core/Logger.js";import{mappedFind as h}from"../../core/maybe.js";import{eachAlways as p,after as g}from"../../core/promiseUtils.js";import{watch as d,initial as m,whenOnce as y}from"../../core/reactiveUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as S}from"../../core/accessorSupport/decorators/subclass.js";import _ from"../../geometry/Point.js";import v from"../../geometry/SpatialReference.js";import{getPointFromGeometry as w,getPointWithElevation as b}from"../../geometry/support/geometryUtils.js";import{onLocaleChange as x}from"../../intl/locale.js";import{fetchMessageBundle as L}from"../../intl/messages.js";import I from"../../portal/Portal.js";import T from"../../symbols/PictureMarkerSymbol.js";import R from"../../symbols/SimpleFillSymbol.js";import E from"../../symbols/SimpleLineSymbol.js";import F from"../../symbols/TextSymbol.js";import{highlightsSupported as j}from"../../views/support/layerViewUtils.js";import P from"./LayerSearchSource.js";import C from"./LocatorSearchSource.js";import G from"./SearchSource.js";import{isArcGISWorldGeocoder as O,meteredArcGISLocatorUrl as A,isProxiedArcGISWorldGeocoder as N,isMeteredArcGISWorldGeocoder as D}from"./support/locatorUtils.js";import{supported as M,getCurrentPosition as V,positionToPoint as k}from"../support/geolocationUtils.js";import J from"../support/GoTo.js";function H(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const U=()=>L("esri/widgets/Search/t9n/Search"),B="highlight",Q=a.ofType({key:e=>e.layer?"layer":"locator",base:G,typeMap:{layer:P,locator:C}}),Z=v.WGS84,q="esri/images/search/search-symbol-32.png",z=/<[\s\S]*?>/g,K=-1;let W=class extends(J(u.EventedMixin(i))){constructor(e){super(e),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new Q,this.defaultSymbols={point:new T({url:t(q),size:24,width:24,height:24}),polyline:new E({color:[130,130,130,1],width:2}),polygon:new R({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=I.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new Q,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const e=await U();this.messages=e,this.defaultPopupTemplate=new o({title:e.searchResult,content:"{Match_addr}"})};e(),this.addHandles([d((()=>[this.includeDefaultSources,this.view,this.portal]),(()=>this._update()),m),x(e)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=K}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:K}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new Q;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get locationEnabled(){return this._get("locationEnabled")||M()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=M();if(e&&!t){const e=new n("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});c.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===K)return r??"";const s=e.at(t);return s?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),s=(async()=>{try{await this.when();const e=await this._getResultsFromSources(r,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(s,e,r);const o=this._getFirstResult(s.results),i=r.location&&o?o.name:r.text,l=i?.replace(z,"");return this._set("searchTerm",l),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",s.results),this._set("resultCount",s.results.reduce(((e,t)=>e+(t.results?.length??0)),0)),this.emit("search-complete",s),await this._selectFirstResult(o),s}finally{this._clearSearching()}})();return this._searching=s,s}async searchNearby(e){if(!this.locationEnabled){const e=new n("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw c.getLogger(this).error(e),e}const t=(async()=>{try{const t=await V(),r=await k({position:t,view:this.view},e);return await this.search(r,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new n("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});throw c.getLogger(this).error(t),t}const{view:t}=this,r=H(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=r?this.allSources.at(r):null;if(!o){const e=new n("select:missing-source","Cannot select without a source.",{source:o});throw c.getLogger(this).error(e),e}const i=o instanceof P?this._getLayerSourcePopupTemplate(o):o.popupTemplate,l=o.resultSymbol||this._getDefaultSymbol(e),a=H(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,u=H(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,h=H(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,g=h?i||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new n("select:missing-feature","Cannot select without a feature.",{feature:d});throw c.getLogger(this).error(e),e}const{attributes:m,geometry:y,layer:f,sourceLayer:S}=d,_=y?w(y):null,v={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=_?b(_,t):Promise.resolve(_)},x=await p(v),L=x.layerViewQuery.value,I=x.elevationQuery.value;l instanceof F&&(l.text=e.name);const T=t&&u?e.target||e.extent:null,R=null!=T?this._goToSearchResult(T):Promise.resolve();await R;const E=L?d:new s({geometry:y,symbol:l,attributes:m,layer:f,sourceLayer:S,popupTemplate:g}),C=t?.popup,G=C&&h&&E.getEffectivePopupTemplate(C.defaultPopupTemplateEnabled);return G&&await t.openPopup({features:[E],location:I}),L&&j(L)&&!G&&this._highlightFeature({graphic:E,layerView:L}),!L&&a&&t&&t.graphics.push(E),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",E),this.emit("select-result",{result:e,source:o,sourceIndex:r}),e}async suggest(e,t,r){const s=e||this.searchTerm;this.emit("suggest-start",{searchTerm:s}),await this._suggestTimer(t,r);const o=await this._suggestImmediate(s,r);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce(((e,t)=>e+(t.results?.length??0)),0)??null),this.emit("suggest-complete",o),o}async when(){await y((()=>!this.updating))}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=p([e?.load(),t?.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}await y((()=>this.messages)),this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map((e=>{if(!1===e.placefinding)return;const t=r.apiKey&&O(e.url)?{url:A}:null,s=C.fromJSON({...e,...t}),o=s.url;if(O(o)||N(o)||D(o)){const e=s.outFields??["Addr_type","Match_addr","StAddr","City"],t=(s.placeholder||this.messages?.placeholder)??"",r="number"==typeof s.defaultZoomScale?s.defaultZoomScale:2500;s.singleLineFieldName="SingleLine",s.outFields=e,s.placeholder=t,s.defaultZoomScale=r}return s.singleLineFieldName?s:void 0})).filter(l)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach((e=>e?.destroy())),this._createdFeatureLayers=[]}_getLayerSources(e,t){const r=this.view?.map;return e.map((e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(l).toArray()}_getTableSources(e,t){const r=this.view?.map;return e.map((e=>{if(!e.id)return;const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(l).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:r,hintText:s,layers:o,tables:i}=t;if(!r)return[];return[...this._getLayerSources(o,s),...this._getTableSources(i,s)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find((e=>e.id===t.subLayer));if(!r)throw new Error;const s=await(r.createFeatureLayer?.());if(!s)throw new Error;return this._createdFeatureLayers.push(s),s}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find((e=>e.id===t.subLayer));if("building-component"!==r?.type)throw new Error;if(await r.load(),null==r.associatedLayer)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,t){if("feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type)return e;if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(r){const t=new n("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return c.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):null}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){const e=this.view?.popup,{resultGraphic:t}=this;if(!e||!t)return;const r="selectedFeature"in e,s=r?e.selectedFeature:null;r&&(s&&s===t)&&e.close()}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return g(r,null,t?.signal)}_createLocationForSearch(e){return e instanceof s&&e.geometry?w(e.geometry):e instanceof _?e:Array.isArray(e)&&2===e.length?new _({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&H(e,"key")&&H(e,"text")&&H(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,i=!e&&s&&o,l=i&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=i&&s.location;return l||a?s:{location:t,text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){return h(e,(({results:e})=>e?.[0]))??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const r=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(s,r),s}_formatSourceResponse(e,t,r){const s=t?.value||[],o=t?.error,i=this.allSources.at(r);if(o){const t={sourceIndex:r,source:i,error:o};e.errors.push(t),c.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:r,source:i,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===K){const s=r&&H(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach(((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)}))}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&H(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new n("search:no-sources-defined","At least one source is required.",{allSources:r});throw c.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getResultsFromSource(e,s,t))})):o.push(this._getResultsFromSource(e,s,t)),p(o)}async _getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new n("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw c.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))})):o.push(this._getSuggestionsFromSource(e,s,t)),p(o)}async _getResultsFromSource(e,t,r){const s=null!=t?this.allSources.at(t):null;if(!s)return null;const{location:o=null}=e,i=this.view?.spatialReference||Z,l=H(s,"maxResults")?s.maxResults:this.maxResults,a=!!(s instanceof P&&H(s,"exactMatch"))&&s.exactMatch,{view:n}=this;return s.getResults?.({view:n,sourceIndex:t,location:o,suggestResult:e,spatialReference:i,exactMatch:a,maxResults:l},r)}async _getSuggestionsFromSource(e,t,r){const s=this.allSources.at(t);if(!s)return null;e??="";const o=H(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=H(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||Z,i=H(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(s instanceof P&&H(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return H(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return h(this.results??[],(({results:t,sourceIndex:r})=>{const s=t?.includes(e);return s?r:null}))??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const r={target:{target:e},options:{signal:t.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,r=e.feature?.geometry;if(null==r)return null;switch(r.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(B)}async _getLayerView(e){const{view:t}=this;if(!e||!t||"building-component"===e.layer?.type||"subtype-sublayer"===e.layer?.type)return null;const{layer:r}=e;return r?(await t.when(),t.whenLayerView(r)):null}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o}=t,{objectIdField:i}=o,l=(i&&s?.[i])??null,a=r.highlight(l??t);this.addHandles(a,B)}_setResultFloor(e){const{view:t}=this,r=e.feature?.attributes,s=e.feature?.sourceLayer;if(s&&"floorInfo"in s&&s?.floorInfo?.floorField&&r){const e=r[s.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([f()],W.prototype,"_searching",void 0),e([f()],W.prototype,"_updatingPromise",void 0),e([f({readOnly:!0,value:null})],W.prototype,"activeSource",null),e([f()],W.prototype,"activeSourceIndex",null),e([f()],W.prototype,"allPlaceholder",null),e([f({readOnly:!0})],W.prototype,"allSources",null),e([f()],W.prototype,"autoNavigate",void 0),e([f()],W.prototype,"autoSelect",void 0),e([f({type:o})],W.prototype,"defaultPopupTemplate",void 0),e([f({readOnly:!0})],W.prototype,"defaultSources",void 0),e([f()],W.prototype,"defaultSymbols",void 0),e([f()],W.prototype,"includeDefaultSources",void 0),e([f()],W.prototype,"locationEnabled",null),e([f()],W.prototype,"maxInputLength",void 0),e([f()],W.prototype,"maxResults",void 0),e([f()],W.prototype,"maxSuggestions",void 0),e([f()],W.prototype,"messages",void 0),e([f()],W.prototype,"minSuggestCharacters",void 0),e([f({readOnly:!0})],W.prototype,"placeholder",null),e([f()],W.prototype,"popupEnabled",void 0),e([f({type:o})],W.prototype,"popupTemplate",void 0),e([f({type:I})],W.prototype,"portal",void 0),e([f()],W.prototype,"resultCount",void 0),e([f()],W.prototype,"resultGraphicEnabled",void 0),e([f({readOnly:!0})],W.prototype,"resultGraphic",void 0),e([f({readOnly:!0})],W.prototype,"results",void 0),e([f({readOnly:!0})],W.prototype,"selectedSuggestion",void 0),e([f()],W.prototype,"searchAllEnabled",void 0),e([f({readOnly:!0})],W.prototype,"selectedResult",void 0),e([f()],W.prototype,"searchTerm",null),e([f({type:Q})],W.prototype,"sources",void 0),e([f({readOnly:!0})],W.prototype,"state",null),e([f()],W.prototype,"suggestionDelay",void 0),e([f()],W.prototype,"suggestionCount",void 0),e([f({readOnly:!0})],W.prototype,"suggestions",void 0),e([f()],W.prototype,"suggestionsEnabled",void 0),e([f({readOnly:!0})],W.prototype,"updating",null),e([f()],W.prototype,"view",void 0),e([f()],W.prototype,"clear",null),W=e([S("esri.widgets.Search.SearchViewModel")],W);const X=W;export{X as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{getAssetUrl as t}from"../../assets.js";import r from"../../Graphic.js";import s from"../../PopupTemplate.js";import o from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import l from"../../core/Collection.js";import a from"../../core/Error.js";import n from"../../core/Evented.js";import u from"../../core/Logger.js";import{mappedFind as c}from"../../core/maybe.js";import{eachAlways as h,after as p}from"../../core/promiseUtils.js";import{watch as g,initial as d,whenOnce as m}from"../../core/reactiveUtils.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import S from"../../geometry/Point.js";import _ from"../../geometry/SpatialReference.js";import{getPointFromGeometry as v,getPointWithElevation as w}from"../../geometry/support/geometryUtils.js";import{onLocaleChange as b}from"../../intl/locale.js";import{fetchMessageBundle as x}from"../../intl/messages.js";import L from"../../portal/Portal.js";import{isApiKeyApplicable as I}from"../../support/apiKeyUtils.js";import T from"../../symbols/PictureMarkerSymbol.js";import R from"../../symbols/SimpleFillSymbol.js";import E from"../../symbols/SimpleLineSymbol.js";import F from"../../symbols/TextSymbol.js";import{highlightsSupported as j}from"../../views/support/layerViewUtils.js";import P from"./LayerSearchSource.js";import C from"./LocatorSearchSource.js";import G from"./SearchSource.js";import{isArcGISWorldGeocoder as O,meteredArcGISLocatorUrl as A,isProxiedArcGISWorldGeocoder as N,isMeteredArcGISWorldGeocoder as D}from"./support/locatorUtils.js";import{supported as M,getCurrentPosition as V,positionToPoint as k}from"../support/geolocationUtils.js";import J from"../support/GoTo.js";function U(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const H=()=>x("esri/widgets/Search/t9n/Search"),B="highlight",Q=l.ofType({key:e=>e.layer?"layer":"locator",base:G,typeMap:{layer:P,locator:C}}),Z=_.WGS84,q="esri/images/search/search-symbol-32.png",z=/<[\s\S]*?>/g,K=-1;let W=class extends(J(n.EventedMixin(o))){constructor(e){super(e),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new Q,this.defaultSymbols={point:new T({url:t(q),size:24,width:24,height:24}),polyline:new E({color:[130,130,130,1],width:2}),polygon:new R({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=L.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new Q,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const e=await H();this.messages=e,this.defaultPopupTemplate=new s({title:e.searchResult,content:"{Match_addr}"})};e(),this.addHandles([g((()=>[this.includeDefaultSources,this.view,this.portal]),(()=>this._update()),d),b(e)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=K}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:K}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new Q;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get locationEnabled(){return this._get("locationEnabled")||M()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=M();if(e&&!t){const e=new a("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});u.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===K)return r??"";const s=e.at(t);return s?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),s=(async()=>{try{await this.when();const e=await this._getResultsFromSources(r,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(s,e,r);const o=this._getFirstResult(s.results),i=r.location&&o?o.name:r.text,l=i?.replace(z,"");return this._set("searchTerm",l),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",s.results),this._set("resultCount",s.results.reduce(((e,t)=>e+(t.results?.length??0)),0)),this.emit("search-complete",s),await this._selectFirstResult(o),s}finally{this._clearSearching()}})();return this._searching=s,s}async searchNearby(e){if(!this.locationEnabled){const e=new a("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw u.getLogger(this).error(e),e}const t=(async()=>{try{const t=await V(),r=await k({position:t,view:this.view},e);return await this.search(r,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new a("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});throw u.getLogger(this).error(t),t}const{view:t}=this,s=U(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=s?this.allSources.at(s):null;if(!o){const e=new a("select:missing-source","Cannot select without a source.",{source:o});throw u.getLogger(this).error(e),e}const i=o instanceof P?this._getLayerSourcePopupTemplate(o):o.popupTemplate,l=o.resultSymbol||this._getDefaultSymbol(e),n=U(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,c=U(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,p=U(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,g=p?i||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new a("select:missing-feature","Cannot select without a feature.",{feature:d});throw u.getLogger(this).error(e),e}const{attributes:m,geometry:y,layer:f,sourceLayer:S}=d,_=y?v(y):null,b={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=_?w(_,t):Promise.resolve(_)},x=await h(b),L=x.layerViewQuery.value,I=x.elevationQuery.value;l instanceof F&&(l.text=e.name);const T=t&&c?e.target||e.extent:null,R=null!=T?this._goToSearchResult(T):Promise.resolve();await R;const E=L?d:new r({geometry:y,symbol:l,attributes:m,layer:f,sourceLayer:S,popupTemplate:g}),C=t?.popup,G=C&&p&&E.getEffectivePopupTemplate(C.defaultPopupTemplateEnabled);return G&&await t.openPopup({features:[E],location:I}),L&&j(L)&&!G&&this._highlightFeature({graphic:E,layerView:L}),!L&&n&&t&&t.graphics.push(E),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",E),this.emit("select-result",{result:e,source:o,sourceIndex:s}),e}async suggest(e,t,r){const s=e||this.searchTerm;this.emit("suggest-start",{searchTerm:s}),await this._suggestTimer(t,r);const o=await this._suggestImmediate(s,r);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce(((e,t)=>e+(t.results?.length??0)),0)??null),this.emit("suggest-complete",o),o}async when(){await m((()=>!this.updating))}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=h([e?.load(),t?.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}await m((()=>this.messages)),this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map((e=>{if(!1===e.placefinding)return;const t=O(e.url)&&I(e.url)?{url:A}:null,r=C.fromJSON({...e,...t}),s=r.url;if(O(s)||N(s)||D(s)){const e=r.outFields??["Addr_type","Match_addr","StAddr","City"],t=(r.placeholder||this.messages?.placeholder)??"",s="number"==typeof r.defaultZoomScale?r.defaultZoomScale:2500;r.singleLineFieldName="SingleLine",r.outFields=e,r.placeholder=t,r.defaultZoomScale=s}return r.singleLineFieldName?r:void 0})).filter(i)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach((e=>e?.destroy())),this._createdFeatureLayers=[]}_getLayerSources(e,t){const r=this.view?.map;return e.map((e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(i).toArray()}_getTableSources(e,t){const r=this.view?.map;return e.map((e=>{if(!e.id)return;const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(i).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:r,hintText:s,layers:o,tables:i}=t;if(!r)return[];return[...this._getLayerSources(o,s),...this._getTableSources(i,s)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find((e=>e.id===t.subLayer));if(!r)throw new Error;const s=await(r.createFeatureLayer?.());if(!s)throw new Error;return this._createdFeatureLayers.push(s),s}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find((e=>e.id===t.subLayer));if("building-component"!==r?.type)throw new Error;if(await r.load(),null==r.associatedLayer)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,t){if("feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type)return e;if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(r){const t=new a("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return u.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):null}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){const e=this.view?.popup,{resultGraphic:t}=this;if(!e||!t)return;const r="selectedFeature"in e,s=r?e.selectedFeature:null;r&&(s&&s===t)&&e.close()}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return p(r,null,t?.signal)}_createLocationForSearch(e){return e instanceof r&&e.geometry?v(e.geometry):e instanceof S?e:Array.isArray(e)&&2===e.length?new S({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&U(e,"key")&&U(e,"text")&&U(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,i=!e&&s&&o,l=i&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=i&&s.location;return l||a?s:{location:t,text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){return c(e,(({results:e})=>e?.[0]))??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const r=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(s,r),s}_formatSourceResponse(e,t,r){const s=t?.value||[],o=t?.error,i=this.allSources.at(r);if(o){const t={sourceIndex:r,source:i,error:o};e.errors.push(t),u.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:r,source:i,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===K){const s=r&&U(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach(((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)}))}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&U(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new a("search:no-sources-defined","At least one source is required.",{allSources:r});throw u.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getResultsFromSource(e,s,t))})):o.push(this._getResultsFromSource(e,s,t)),h(o)}async _getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new a("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw u.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))})):o.push(this._getSuggestionsFromSource(e,s,t)),h(o)}async _getResultsFromSource(e,t,r){const s=null!=t?this.allSources.at(t):null;if(!s)return null;const{location:o=null}=e,i=this.view?.spatialReference||Z,l=U(s,"maxResults")?s.maxResults:this.maxResults,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch,{view:n}=this;return s.getResults?.({view:n,sourceIndex:t,location:o,suggestResult:e,spatialReference:i,exactMatch:a,maxResults:l},r)}async _getSuggestionsFromSource(e,t,r){const s=this.allSources.at(t);if(!s)return null;e??="";const o=U(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=U(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||Z,i=U(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return U(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return c(this.results??[],(({results:t,sourceIndex:r})=>{const s=t?.includes(e);return s?r:null}))??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const r={target:{target:e},options:{signal:t.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,r=e.feature?.geometry;if(null==r)return null;switch(r.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(B)}async _getLayerView(e){const{view:t}=this;if(!e||!t||"building-component"===e.layer?.type||"subtype-sublayer"===e.layer?.type)return null;const{layer:r}=e;return r?(await t.when(),t.whenLayerView(r)):null}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o}=t,{objectIdField:i}=o,l=(i&&s?.[i])??null,a=r.highlight(l??t);this.addHandles(a,B)}_setResultFloor(e){const{view:t}=this,r=e.feature?.attributes,s=e.feature?.sourceLayer;if(s&&"floorInfo"in s&&s?.floorInfo?.floorField&&r){const e=r[s.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([y()],W.prototype,"_searching",void 0),e([y()],W.prototype,"_updatingPromise",void 0),e([y({readOnly:!0,value:null})],W.prototype,"activeSource",null),e([y()],W.prototype,"activeSourceIndex",null),e([y()],W.prototype,"allPlaceholder",null),e([y({readOnly:!0})],W.prototype,"allSources",null),e([y()],W.prototype,"autoNavigate",void 0),e([y()],W.prototype,"autoSelect",void 0),e([y({type:s})],W.prototype,"defaultPopupTemplate",void 0),e([y({readOnly:!0})],W.prototype,"defaultSources",void 0),e([y()],W.prototype,"defaultSymbols",void 0),e([y()],W.prototype,"includeDefaultSources",void 0),e([y()],W.prototype,"locationEnabled",null),e([y()],W.prototype,"maxInputLength",void 0),e([y()],W.prototype,"maxResults",void 0),e([y()],W.prototype,"maxSuggestions",void 0),e([y()],W.prototype,"messages",void 0),e([y()],W.prototype,"minSuggestCharacters",void 0),e([y({readOnly:!0})],W.prototype,"placeholder",null),e([y()],W.prototype,"popupEnabled",void 0),e([y({type:s})],W.prototype,"popupTemplate",void 0),e([y({type:L})],W.prototype,"portal",void 0),e([y()],W.prototype,"resultCount",void 0),e([y()],W.prototype,"resultGraphicEnabled",void 0),e([y({readOnly:!0})],W.prototype,"resultGraphic",void 0),e([y({readOnly:!0})],W.prototype,"results",void 0),e([y({readOnly:!0})],W.prototype,"selectedSuggestion",void 0),e([y()],W.prototype,"searchAllEnabled",void 0),e([y({readOnly:!0})],W.prototype,"selectedResult",void 0),e([y()],W.prototype,"searchTerm",null),e([y({type:Q})],W.prototype,"sources",void 0),e([y({readOnly:!0})],W.prototype,"state",null),e([y()],W.prototype,"suggestionDelay",void 0),e([y()],W.prototype,"suggestionCount",void 0),e([y({readOnly:!0})],W.prototype,"suggestions",void 0),e([y()],W.prototype,"suggestionsEnabled",void 0),e([y({readOnly:!0})],W.prototype,"updating",null),e([y()],W.prototype,"view",void 0),e([y()],W.prototype,"clear",null),W=e([f("esri.widgets.Search.SearchViewModel")],W);const X=W;export{X 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
- const e="esri-search-result-renderer",s={base:e,showMoreResults:`${e}__more-results--show-more-results`,moreResults:`${e}__more-results`,moreResultsList:`${e}__more-results-list`,moreResultsHeader:`${e}__more-results-header`,moreResultsItem:`${e}__more-results-item`,moreResultsListHeader:`${e}__more-results-list-header`};export{s as css};
5
+ const e="esri-search-result-renderer",r={base:e,moreResults:`${e}--more-results`};export{r as css};