@arcgis/core 4.33.0-next.20250522 → 4.33.0-next.20250524

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/Map.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/analysis/DimensionAnalysis.js +1 -1
  4. package/analysis/LineOfSightAnalysis.js +1 -1
  5. package/analysis/ViewshedAnalysis.js +1 -1
  6. package/arcade/Voxel.js +1 -1
  7. package/arcade/functions/knowledgegraph.js +1 -1
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/{253bcc3cc7bc4c2dc6ea.js → 03db109e9b695528c35d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{fc61d02286b6ff5447cc.js → 09da6b3085fc84cd69d5.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{bf3555f91492a1a3b613.js → 09f76ca9b47b465c934f.js} +1 -1
  12. package/assets/esri/core/workers/chunks/0b70b2ee62904318a12c.js +1 -0
  13. package/assets/esri/core/workers/chunks/{42d9989b2aad3ac28d4d.js → 0d78fc2c2bc1152f84db.js} +1 -1
  14. package/assets/esri/core/workers/chunks/0fd826e7f64a37aaaa1e.js +1 -0
  15. package/assets/esri/core/workers/chunks/{ead5d4e271effc04def3.js → 1415d4e2f5f3193be004.js} +1 -1
  16. package/assets/esri/core/workers/chunks/17e43a050fbf8dc87588.js +1 -0
  17. package/assets/esri/core/workers/chunks/1ee6e9a88f0676032e91.js +1 -0
  18. package/assets/esri/core/workers/chunks/{1c86aa3802d9ae0230ae.js → 28e31ac00dc95a1318e9.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{23f6e98ef22f099f846c.js → 330f1996cfc3e9c952cc.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{ece68a25651ef03fc95d.js → 342f61e784c9364a493b.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{0d23610475c85385fbff.js → 355e6bcdb401ada71f39.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{bba6d7615d8f3862fe70.js → 36f0046ff6b46adce7b7.js} +1 -1
  23. package/assets/esri/core/workers/chunks/3adcf78ed1e7cd82666d.js +1 -0
  24. package/assets/esri/core/workers/chunks/{b0522dffa5600345c07e.js → 3e85e63148b5e93d3074.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{14b3c18581b31c93af82.js → 41cbba9b286cf5558a9c.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{d2ebb72a43d995ed368a.js → 42bb9bb6fe44a47d9b81.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{6ee41e9c92ed8ba4c763.js → 4dd0a5f327fa5fc7249d.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{36b0d6b4089a96475201.js → 51ba7345c31e6eb79060.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{66e79aa02b3aa12b3778.js → 5200be8bce60fa831026.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{6b23ca6570357f9fb724.js → 52a57106a41b8c9483d7.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{fa63b0f7fa799cb2f81d.js → 562800b0af52a38a311b.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{585c7b485c42555ec554.js → 61f9747c960d959b571b.js} +2 -2
  33. package/assets/esri/core/workers/chunks/{9fc35ec8185beba96715.js → 632d1a1287dde980479e.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{1d043965dcdc11b3aeaa.js → 63852887b3f07d50f7c9.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{32ee2708edd307954125.js → 7174150bf7595c22f976.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{e77371ddbaf4b2d9be8d.js → 74c0db9e3a62e9839b23.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{6ecc3a3737ae8622dfa4.js → 7b12607633bbdc318936.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{06eb4832b6c86744e52e.js → 8008f5479f4d16964088.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{d839a237d5edc243d645.js → 8aa8f9986b966ccb64e2.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{12e99071f6582f6caeaf.js → 8b3d1973eb75b81b0fb4.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{67338948e470c1251d8a.js → 8d14e957219364a81d5f.js} +3 -3
  42. package/assets/esri/core/workers/chunks/92a5dccb328229a9336b.js +1 -0
  43. package/assets/esri/core/workers/chunks/{631205dc4d73d49ec9ed.js → 95507ff0a243e451b99e.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{1051a5a57b2fb843a555.js → 9cd55043f3d789f41815.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{40f54c4f8ae63c6f3df9.js → a32dcd5bc4680374d30c.js} +1 -1
  46. package/assets/esri/core/workers/chunks/ad4f65d764654c70a117.js +1 -0
  47. package/assets/esri/core/workers/chunks/b2a6afa0cd537805b4b8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{ac2607f1e8cd2e99907c.js → b70f65ccee01d48a610e.js} +2 -2
  49. package/assets/esri/core/workers/chunks/{571252c9822d73cf7b01.js → b845586219f284a215b2.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{d7b640f7a181bd26c7c7.js → bac5e1d50b69f0d94694.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{9ca480eb8b2312381ccf.js → bcadcb709e622f2aaaf9.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{c16e0da7a19310c71e8b.js → c6cd8784a3e222eb2d4a.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{97c148adf0347c69a79c.js → c9604f8df909ec4fad46.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{b87fec1753f164c845c5.js → ca76950d81ab4ebb65e1.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{faa40ef04604c7cce706.js → cb63ea6a53d3c2fc3179.js} +1 -1
  56. package/assets/esri/core/workers/chunks/cc4fe89e4f604e3c52ae.js +1 -0
  57. package/assets/esri/core/workers/chunks/{54f4a1131f99468db076.js → d33a5d79f2163ad62b1d.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{55f087bca75c3f2a4515.js → d3c0d7799c92c6f0e7d3.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{ca60b34c3e1ed2ff5934.js → dd2b316baae02bbdddac.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{e3c1aea34ece8336dae1.js → e9aa1d9ded8a52a40c57.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{80b596496800e8d60eb8.js → ed75e0962358523f4439.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{0cf979a093e9744d1e80.js → ef7955a2509be0f03ca2.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{b5d68d8460b7c15001dd.js → f1c6df5cf2ccb6ac47a1.js} +1 -1
  64. package/assets/esri/core/workers/chunks/f2aa8090827086c62dde.js +1 -0
  65. package/assets/esri/core/workers/chunks/{523046e04679e301797d.js → f3d97a4c4f433adbdab5.js} +1 -1
  66. package/assets/esri/core/workers/chunks/fd4c020297badcb81947.js +1 -0
  67. package/assets/esri/core/workers/chunks/{9a06476b834584d00d5c.js → feaf79b69d2e2a1f2aa2.js} +1 -1
  68. package/assets/esri/themes/base/widgets/_Editor.scss +1 -0
  69. package/assets/esri/themes/dark/main.css +1 -1
  70. package/assets/esri/themes/light/main.css +1 -1
  71. package/assets/esri/themes/light/view.css +1 -1
  72. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_no.json +1 -1
  73. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  74. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  75. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  76. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  77. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  78. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  79. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  80. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  81. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  82. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  83. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  84. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  85. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  86. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  87. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  88. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  89. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  90. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  91. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  92. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  93. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  94. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  95. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  96. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  97. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  98. package/assets/esri/widgets/Editor/t9n/Editor_no.json +1 -1
  99. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  100. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  101. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  102. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  103. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  104. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  105. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  106. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  107. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  108. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  109. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  110. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  111. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  112. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  113. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  114. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  115. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ar.json +1 -1
  116. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bg.json +1 -1
  117. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bs.json +1 -1
  118. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ca.json +1 -1
  119. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_cs.json +1 -1
  120. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_da.json +1 -1
  121. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_de.json +1 -1
  122. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_el.json +1 -1
  123. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_es.json +1 -1
  124. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_et.json +1 -1
  125. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fi.json +1 -1
  126. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fr.json +1 -1
  127. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_he.json +1 -1
  128. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hr.json +1 -1
  129. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hu.json +1 -1
  130. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_id.json +1 -1
  131. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_it.json +1 -1
  132. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ja.json +1 -1
  133. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ko.json +1 -1
  134. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lt.json +1 -1
  135. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lv.json +1 -1
  136. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_nl.json +1 -1
  137. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_no.json +1 -1
  138. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pl.json +1 -1
  139. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-BR.json +1 -1
  140. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-PT.json +1 -1
  141. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ro.json +1 -1
  142. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ru.json +1 -1
  143. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sk.json +1 -1
  144. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sl.json +1 -1
  145. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sr.json +1 -1
  146. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sv.json +1 -1
  147. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_th.json +1 -1
  148. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_tr.json +1 -1
  149. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_uk.json +1 -1
  150. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_vi.json +1 -1
  151. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-CN.json +1 -1
  152. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-HK.json +1 -1
  153. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-TW.json +1 -1
  154. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
  155. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  156. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  157. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  158. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  159. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  160. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  161. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  162. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  163. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
  164. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  165. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  166. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  167. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  168. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  169. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  170. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  171. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  172. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  173. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  174. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  175. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  176. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  177. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  178. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  179. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  180. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  181. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  182. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  183. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  184. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  185. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  186. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  187. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  188. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  189. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  190. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  191. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  192. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  193. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  194. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  195. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  196. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  197. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  198. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  199. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  200. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  201. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  202. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  203. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  204. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  205. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  206. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  207. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  208. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  209. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  210. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  211. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  212. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  213. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  214. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  215. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  216. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  217. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  218. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  219. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  220. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  221. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  222. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  223. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  224. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  225. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  226. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  227. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  228. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  229. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  230. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  231. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  232. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  233. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  234. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  235. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  236. package/chunks/FocusAreaColor.glsl.js +10 -8
  237. package/chunks/Laserlines.glsl.js +2 -2
  238. package/chunks/aiServices.js +1 -1
  239. package/chunks/cameraUtilsSpherical.js +1 -1
  240. package/chunks/persistableUrlUtils.js +1 -1
  241. package/chunks/sphere.js +1 -1
  242. package/chunks/vec42.js +1 -1
  243. package/core/accessorSupport/decorators/persistable.js +1 -1
  244. package/core/accessorSupport/ensureType.js +1 -1
  245. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  246. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  247. package/effects/FocusArea.js +5 -0
  248. package/effects/FocusAreaOutline.js +5 -0
  249. package/effects/FocusAreas.js +5 -0
  250. package/geometry/projection/projectPointToVector.js +1 -1
  251. package/geometry/projection/projectVectorToPoint.js +1 -1
  252. package/geometry/projection/projectVectorToVector.js +1 -1
  253. package/geometry/projection.js +1 -1
  254. package/geometry/projectionUtils.js +5 -0
  255. package/geometry/support/frustum.js +1 -1
  256. package/geometry/support/meshUtils/elevation.js +1 -1
  257. package/geometry/support/meshUtils/extent.js +1 -1
  258. package/geometry/support/sphere.js +1 -1
  259. package/interfaces.d.ts +282 -133
  260. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  261. package/layers/IntegratedMeshLayer.js +1 -1
  262. package/layers/MapNotesLayer.js +1 -1
  263. package/layers/OrientedImageryLayer.js +1 -1
  264. package/layers/RouteLayer.js +1 -1
  265. package/layers/VideoLayer.js +1 -1
  266. package/layers/graphics/applyEditsUtils.js +1 -1
  267. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  268. package/layers/graphics/data/QueryEngine.js +1 -1
  269. package/layers/graphics/data/projectionSupport.js +1 -1
  270. package/layers/graphics/data/queryUtils.js +1 -1
  271. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  272. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  273. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  274. package/layers/ogc/wfsUtils.js +1 -1
  275. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  276. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  277. package/layers/orientedImagery/core/utils.js +1 -1
  278. package/layers/orientedImagery/queries.js +1 -1
  279. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  280. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  281. package/layers/orientedImagery/transformations/utils.js +1 -1
  282. package/layers/support/ControlPointsGeoreference.js +1 -1
  283. package/layers/support/CornersGeoreference.js +1 -1
  284. package/layers/support/ElevationQuery.js +1 -1
  285. package/layers/support/ExtentAndRotationGeoreference.js +1 -1
  286. package/layers/support/GeoreferenceBase.js +1 -1
  287. package/layers/support/LocalMediaElementSource.js +1 -1
  288. package/layers/support/MediaElementView.js +1 -1
  289. package/layers/support/PolygonCollection.js +1 -1
  290. package/layers/support/SceneModification.js +1 -1
  291. package/layers/support/Sublayer.js +1 -1
  292. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  293. package/layers/video/VideoController.js +1 -1
  294. package/networks/support/UNTraceConfiguration.js +1 -1
  295. package/networks/support/typeUtils.js +1 -1
  296. package/package.json +1 -1
  297. package/portal/schemas/definitions.js +1 -1
  298. package/portal/schemas/webScene.js +1 -1
  299. package/portal/support/portalItemUtils.js +1 -1
  300. package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
  301. package/rest/knowledgeGraph/GraphAddFieldIndexResult.js +5 -0
  302. package/rest/knowledgeGraph/GraphAddNamedTypesResult.js +1 -1
  303. package/rest/knowledgeGraph/GraphAddPropertyResult.js +1 -1
  304. package/rest/knowledgeGraph/GraphDataModelOperationResult.js +5 -0
  305. package/rest/knowledgeGraph/GraphDeleteFieldIndexResult.js +5 -0
  306. package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +1 -1
  307. package/rest/knowledgeGraph/GraphDeletePropertyResult.js +1 -1
  308. package/rest/knowledgeGraph/GraphUpdateNamedTypesResult.js +1 -1
  309. package/rest/knowledgeGraph/GraphUpdatePropertyResult.js +1 -1
  310. package/rest/knowledgeGraph/GraphUpdateSearchIndexResult.js +1 -1
  311. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  312. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
  313. package/rest/knowledgeGraphService.js +1 -1
  314. package/rest/networks/support/CircuitPath.js +5 -0
  315. package/rest/networks/support/CircuitPathConnectivityElement.js +5 -0
  316. package/rest/networks/support/TraceLocation.js +1 -1
  317. package/rest/networks/support/TraceResult.js +1 -1
  318. package/smartMapping/renderers/pieChart.js +1 -1
  319. package/smartMapping/renderers/predominance.js +1 -1
  320. package/smartMapping/renderers/size.js +1 -1
  321. package/smartMapping/renderers/support/rendererUtils.js +1 -1
  322. package/smartMapping/renderers/support/spikeUtils.d.ts +4 -0
  323. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  324. package/smartMapping/statistics/histogram.js +1 -1
  325. package/smartMapping/statistics/summaryStatistics.js +1 -1
  326. package/support/persistableUrlUtils.js +1 -1
  327. package/support/revision.js +1 -1
  328. package/views/2d/ViewStateManager.js +1 -1
  329. package/views/2d/constraints/GeometryConstraint.js +1 -1
  330. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  331. package/views/2d/grid/GridView2D.js +1 -1
  332. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  333. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  334. package/views/2d/layers/KMLLayerView2D.js +1 -1
  335. package/views/2d/layers/VideoLayerView2D.js +1 -1
  336. package/views/2d/viewpointUtils.js +1 -1
  337. package/views/3d/FocusAreasView.js +1 -1
  338. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  339. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  340. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  341. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  342. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  343. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  344. package/views/3d/analysis/support/projectionUtils.js +1 -1
  345. package/views/3d/camera/constraintUtils/distance.js +1 -1
  346. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  347. package/views/3d/environment/EnvironmentManager.js +1 -1
  348. package/views/3d/interactive/Manipulator3D.js +1 -1
  349. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  350. package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
  351. package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
  352. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  353. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  354. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  355. package/views/3d/layers/FeatureLayerView3D.js +1 -1
  356. package/views/3d/layers/FlowSubView3D.js +1 -1
  357. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  358. package/views/3d/layers/SceneLayerWorker.js +1 -1
  359. package/views/3d/layers/TileLayerView3D.js +1 -1
  360. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  361. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  362. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  363. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  364. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  365. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  366. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  367. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  368. package/views/3d/layers/graphics/focusAreaStyle.js +1 -1
  369. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  370. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  371. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  372. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  373. package/views/3d/layers/support/FeatureTile.js +1 -1
  374. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  375. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  376. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  377. package/views/3d/state/NearFarHeuristic.js +1 -1
  378. package/views/3d/state/ViewStateManager.js +1 -1
  379. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  380. package/views/3d/state/utils/navigationUtils.js +1 -1
  381. package/views/3d/support/cameraUtils.js +1 -1
  382. package/views/3d/support/geometryUtils/sphere.js +1 -1
  383. package/views/3d/support/sunUtils.js +1 -1
  384. package/views/3d/support/viewpointUtils.js +1 -1
  385. package/views/3d/terrain/ExtentHelper.js +1 -1
  386. package/views/3d/terrain/OverlayManager.js +1 -1
  387. package/views/3d/terrain/OverlayRenderer.js +1 -1
  388. package/views/3d/terrain/TextureFader.js +1 -1
  389. package/views/3d/webgl/RenderCamera.js +1 -1
  390. package/views/3d/webgl/RenderNode.js +1 -1
  391. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  392. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  393. package/views/3d/webgl-engine/effects/focusArea/FocusAreaEffect.js +5 -0
  394. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  395. package/views/3d/webgl-engine/effects/focusArea/FocusAreaOutlineItem.js +5 -0
  396. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  397. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  398. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  399. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  400. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  401. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  402. package/views/3d/webgl-engine/shaders/CompositingTechniqueConfiguration.js +1 -1
  403. package/views/3d/webgl-engine/shaders/FocusAreaColor.glsl.js +1 -1
  404. package/views/SceneView.js +1 -1
  405. package/views/VideoView.js +1 -1
  406. package/views/View2D.js +1 -1
  407. package/views/interactive/GraphicManipulator.js +1 -1
  408. package/views/interactive/dragEventPipeline.js +1 -1
  409. package/views/interactive/snapping/GridSnappingEngine.js +1 -1
  410. package/views/interactive/snapping/SnappingManager.js +1 -1
  411. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  412. package/views/layers/SceneLayerView.js +1 -1
  413. package/views/support/geodesicAreaMeasurementUtils.js +1 -1
  414. package/views/support/projectionUtils.js +1 -1
  415. package/views/webgl/FramebufferObject.js +1 -1
  416. package/views/webgl/RenderingContext.js +1 -1
  417. package/views/webgl/Texture.js +1 -1
  418. package/webscene/Slide.js +1 -1
  419. package/webscene/support/analysisUtils.js +1 -1
  420. package/widgets/AreaMeasurement3D.js +1 -1
  421. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  422. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  423. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  424. package/widgets/CoordinateConversion/support/Format.js +1 -1
  425. package/widgets/Daylight/DaylightViewModel.js +1 -1
  426. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  427. package/widgets/DirectLineMeasurement3D.js +1 -1
  428. package/widgets/Editor/EditorViewModel.js +1 -1
  429. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  430. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  431. package/widgets/Editor/UpdateWorkflow.js +1 -1
  432. package/widgets/Editor/Upload.js +1 -1
  433. package/widgets/Editor/components/Notices.js +1 -1
  434. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  435. package/widgets/Editor/workflowUtils.js +1 -1
  436. package/widgets/Editor.js +1 -1
  437. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  438. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  439. package/widgets/FeatureTable/FieldColumn.js +1 -1
  440. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  441. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  442. package/widgets/FeatureTable.js +1 -1
  443. package/widgets/Features/FeaturesViewModel.js +1 -1
  444. package/widgets/LineOfSight.js +1 -1
  445. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  446. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
  447. package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
  448. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  449. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  450. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  451. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  452. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  453. package/widgets/OrientedImageryViewer/components/NavigationAction.js +5 -0
  454. package/widgets/OrientedImageryViewer/components/NavigationActions.js +1 -1
  455. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +5 -0
  456. package/widgets/OrientedImageryViewer/constants.js +1 -1
  457. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  458. package/widgets/OrientedImageryViewer.js +1 -1
  459. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  460. package/widgets/Sketch/SketchViewModel.js +1 -1
  461. package/widgets/Sketch.js +1 -1
  462. package/widgets/Slice.js +1 -1
  463. package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
  464. package/widgets/support/AnalysisViewModel.js +1 -1
  465. package/widgets/support/AnchorElementViewModel.js +1 -1
  466. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  467. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  468. package/widgets/support/SelectionToolbar.js +1 -1
  469. package/widgets/support/tests.js +1 -1
  470. package/assets/esri/core/workers/chunks/094e8aae6dada24c8115.js +0 -1
  471. package/assets/esri/core/workers/chunks/24327d01cb2c5c55a4b7.js +0 -1
  472. package/assets/esri/core/workers/chunks/2b1486a466760d2152f5.js +0 -1
  473. package/assets/esri/core/workers/chunks/3a743653b786b010a57f.js +0 -1
  474. package/assets/esri/core/workers/chunks/417293f00b2c21cc3175.js +0 -1
  475. package/assets/esri/core/workers/chunks/62b2d3720693c93a60f2.js +0 -1
  476. package/assets/esri/core/workers/chunks/6d1e1a4fcb90ea8b6848.js +0 -1
  477. package/assets/esri/core/workers/chunks/7e6141b5baae47682f97.js +0 -1
  478. package/assets/esri/core/workers/chunks/87fc7b6c3e2d4f7775e2.js +0 -1
  479. package/assets/esri/core/workers/chunks/b06cb23048c32940f5de.js +0 -1
  480. package/assets/esri/core/workers/chunks/d3d98ea5b5e56fc60a31.js +0 -1
  481. package/views/FocusArea.js +0 -5
  482. package/views/FocusAreaOutline.js +0 -5
  483. package/views/FocusAreaOutlineItem.js +0 -5
  484. package/views/FocusAreas.js +0 -5
@@ -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/Accessor.js";import{filterInPlace as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import o from"../../../../core/ReactiveMap.js";import{on as u,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as h}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as c}from"../../../../core/sql.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as _}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as m,equals as g,clone as F,expand as y,toExtent as T,width as x,height as R}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as v,hasVertices as b,computeAABR as C}from"../../../../layers/graphics/dehydratedFeatures.js";import E from"../../../../rest/support/QuantizationParameters.js";import M from"../../../../rest/support/Query.js";import{ViewingMode as D}from"../../../ViewingMode.js";import{MultiFeatureReference as w,SingleFeatureReference as U}from"./featureReference.js";import{failedFeatureCount as j,FeatureTile as O,ReduceMode as A}from"./FeatureTile.js";import{tilesAreRelated as P}from"../../terrain/tileUtils.js";import{ImmediateTask as I,TaskPriority as z}from"../../../support/Scheduler.js";let q=class extends t{set maximumNumberOfFeatures(e){e=e||1/0;const t=this._get("maximumNumberOfFeatures");e===t||e<1||(this._set("maximumNumberOfFeatures",e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set("memoryFactor",e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set("lodFactor",e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&null!=this.context.query.queryFeatureCount}set useTileCount(e){this._useTileCount=e,this.notifyChange("useTileCount")}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get running(){return this._dirty}get memoryForUnusedFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.estimatedUnusedSize)),e}get totalVertices(){let e=0;return this._featureTiles.forEach((t=>e+=t.numVertices)),e}get totalFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.numFeatures)),e}get hasAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(const e of this._featureTiles.values())if(!this.hasFullGeometries&&0!==e.emptyFeatureRatio||!e.hasAllFeatures)return!1;return!0}get hasFullGeometries(){if(!this._supportsResolution)return!0;return this.tileDescriptors.some(Q)||!this.context.capabilities.supportsQuantization&&"polyline"!==this.context.geometryType}set filterExtent(e){if(null!=e&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void i.getLogger(this).error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||null!=t&&e&&t.equals(e))return;const s=null!=e?e.clone():null;this._set("filterExtent",s),this._reclip(s,t)}_updateTileZQuantization(e){if(this.context.viewingMode===D.Global){const t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._featureTiles=new o,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this._isFetching=!1;const t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??I,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?w:U,this._objectIdField=t.objectIdField}initialize(){this.addHandles([u((()=>this.tileDescriptors),"change",(()=>this._setDirty())),l((()=>this._tileZQuantization),(()=>this.refetch()))]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._removeTile(e)})),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)})),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._resetFetchTile(e)})),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(const t of this._featureTiles.values()){const s=t.missingAttributes?.get(e);if(null!=s)return s}}_pause(){this._paused&&(this._featureTiles.forEach((e=>this._cancelFetchTile(e))),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach((t=>{null!=t.displayingFeatures&&0!==t.displayingFeatures.length&&(null==e?e=new Set(t.availableFields):e.forEach((s=>{t.availableFields?.has(s)||e.delete(s)})))})),null!=e?e:new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this._pendingEdits;t.count++;const s=t.edits.then((()=>e.result.catch((e=>{if(a(e))throw e;return null})).then((e=>e?(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then((()=>e))):e)).then((e=>(0===--t.count&&(this._pendingEdits===t&&(this._pendingEdits=null),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)))));return t.edits=s,this._updated(),s}_applyEditsDeleteFeatures(e){if(0===e.length)return;const t=this.context.globalIdField,s=t&&this.availableFields.has(t),r=new Set,a=this._objectIdField;e.forEach((({objectId:e,globalId:n})=>{(!e||e<0)&&t&&n&&(s||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(n,a,t)),null!=e&&e>=0&&r.add(e)})),this._featureTiles.forEach((e=>{if(!e.features)return;const t=e.features.filter((e=>!r.has(v(e,this._objectIdField))));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())}))}_objectIdFromGlobalId(e,t,s){if(null==e)return null;const i=this.features.find((t=>t.attributes?.[s]===e));return i?v(i,t):null}async _applyEditsAddUpdateFeatures(e,t,s){const{objectIdField:r,globalIdField:a}=this.context,n=a&&this.availableFields.has(a),o=new Set,u=new Set;for(const i of e){const e=i.objectId;null!=e&&o.add(e)}for(const{objectId:h,globalId:d}of t){let e=h;(null==e||e<0)&&a&&(n||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(d,r,a)),null!=e&&e>=0&&(o.add(e),u.add(e))}if(0===o.size)return;const l=[];this._featureTiles.forEach((e=>{const t=this._applyEditsAddUpdateTile(e,o,u,s);t&&l.push(t)})),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,s,i){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=Array.from(t);const a=await this._queryFeatures(r,i);let n=null;if(s.size>0){const t=e.features.filter((e=>!s.has(v(e,this._objectIdField))));t.length!==e.features.length&&(n=t)}if(a.features.length>0){n||(n=e.features.slice());for(const e of a.features)n.push(e)}n&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,n.length)),this._applyEditsTileUpdated(),e.setFeatures(n,0,k(e.availableFields,a.fields),H(e.missingAttributes,a.missingAttributes)),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:X})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){const t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;const s=this._getListOfTiles();if(this._markTilesNotAlive(s),!e.run((()=>this._addTiles(s,e)))||!e.run((()=>this._filterExtentTiles(s,e)))||!e.run((()=>this._removeTiles(s,e)))||e.done)return void this._setDirty();const i=this._sortTiles(s);e.run((()=>this._showTiles(i,e)))&&e.run((()=>this._fetchTiles(i,e)))&&e.run((()=>this._updateMemoryEstimates(i,e)))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!(this._suspended||!this.tileDescriptors)&&(this.tileDescriptors.forEach((s=>{const i=this._featureTiles.get(s.id);i?i.alive=!0:t.done||(e.push(this._addTile(s)),t.madeProgress())})),t.hasProgressed)}_filterExtentTiles(e,t){for(const s of e){if(t.done)break;s.alive&&(s.filtered=!s.intersects(this.filterExtent),s.filtered&&(this._clearTile(s),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let s=e.length-1;s>=0&&!t.done;s--){const i=e[s];i.alive||(this._removeTile(i),s!==e.length-1&&(e[s]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort(((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority)),e}_showTiles(e,t){const s=this._updateRatio(e),i=e=>{const t=this._fullRatio<1?s(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();const{numFeatures:i,fetchingResolution:r,descriptor:a,isFetched:n}=e;return this._supportsResolution&&i>0&&r!==a.resolution&&n&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(const r of e)if(!t.run((()=>i(r)))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let s=!1;for(const i of e){if(!i.needsFetch)continue;const e=null!=this.context.memoryCache?this.context.memoryCache.pop(i.id):null;if(e?.resolution!==i.displayingResolution){if(this._needsNumFeatures(i)){const e=new AbortController,r=this._fetchTileCount(i,e.signal);this._handleRequest(i,r,e,(()=>i.resetFetching()),(()=>i.numFeatures=j)),s=!0,t.madeProgress()}if(t.done)return!0}else i.cache=e,i.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress()}if(s)return t.hasProgressed;for(const r of e){if(!r.needsFetch)continue;const e=new AbortController,s=this._fetchTile(r,e.signal);if(this._handleRequest(r,s,e,(e=>r.fetchDone(e)),(e=>{r.featuresMissing=!0,r.fetchFailed=!0,this.context.logFetchError(i.getLogger(this),e)})),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some((e=>!t.run((()=>e.updateMemoryEstimates()))&&(this._setDirty(),!0))),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;const s=new Array;this._featureTiles.forEach((i=>{null!=i.displayingFeatures&&0!==i.displayingFeatures.length&&(i.intersectionIncludingBorrowed(t,V),i.intersectionIncludingBorrowed(e,G),g(V,G)||s.push(i))})),this._refreshDisplayingFeatures(s),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,s=this._changes.updates;for(const i of e)if(null!=i.displayingFeatures)for(const e of i.displayingFeatures){const i=v(e,this._objectIdField);if(t.has(i))continue;t.add(i);const r=this._displayingFeatureReferences.get(i).feature;s.removes.push(r),s.adds.push(r)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach((t=>t.isFetching?++e:0)),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set("dataUpdating",!1),this.updating){let t=0,s=0,i=0,r=0,a=0;const n=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach((e=>{if(++s,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),s=null!=e.displayingFeatures?e.displayingFeatures.length*n:0;a+=t-s}e.needsFetch?++r:e.numFeatures>0&&(++i,t+=e.numFeatures)})),r+=e;let o=0,u=0;t?(u=t,o=Math.min(r*t/i,t)):(u=s,o=r),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set("updatingTotal",u),this._set("updatingRemaining",o),this._set("expectedFeatureDiff",a)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(const{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e)return void this._set("maximumNumberOfFeaturesExceeded",!0);this._set("maximumNumberOfFeaturesExceeded",!1)}_updateRatio(e){const t=N(e),s=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0]));let i=0,r=0;for(const a of e){const e=a.numFeatures;i+=e,r+=e*s(a)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/i),this._farRatio=this.maximumNumberOfFeatures/r,this._scheduleUpdated(),s}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach((e=>{if(!e.featuresMissing)return;const t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))})),this._setDirty())}_addTile(e){const t=new O(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.displayingResolution;this._featureTiles.forEach((s=>{if(null!=s.displayingFeatures&&e!==s&&P(e.descriptor.lij,s.descriptor.lij)){null==e.displayingFeatures&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=F(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,s.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const i of s.displayingFeatures){e.displayingFeatures.push(i);const s=this._displayingFeatureReferences.get(v(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})),e.featureLimit=null!=e.displayingFeatures?e.displayingFeatures.length:0}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(!1):e.requestFetch()}_cancelFetchTile(e){const t=e.requestController;null!=t&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._getListOfTiles())}async _fetchTile(e,t){e.fetchFailed=!1;const s=this._maximumFeaturesForTile(e);if(s<=0)return e.hasPreciseFeatureCount&&0===e.numFeatures||(e.fetchFailed=!0),S(e),!1;const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(e.fetchingResolution=e.descriptor.resolution,Q(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>M.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=r,e.isRefetching&&e.features&&e.features.length>0){const t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/i);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}const{features:o,exceededTransferLimit:u,fields:l,missingAttributes:h}=await this._queryFeatures(a,t),d=!u||a.maxRecordCountFactor>=M.MAX_MAX_RECORD_COUNT_FACTOR;return await this._frameTask.schedule((()=>{e.featuresMissing=e.hasPreciseFeatureCount&&o.length<e.numFeatures||!!u;const t=this._removeEmptyFeatures(o,this._getEffectiveTileResolution(e));e.setFeatures(o,t,L(l),H(void 0,h)),this._updateTileZQuantization(e)}),t),n(t),this._invalidateCounts(),d}async _fetchCount(e,t){return this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t})}async _fetchPagedTile(e,t){let s,i=0,r=0,a=0,o=this._maximumFeaturesForTile(e)-a;const u=this._getMaxRecordCount(e);let l,h=null;for(;;){const d=this._createQuery(e),c=this._setPagingParameters(d,i,o,u),{features:p,exceededTransferLimit:f,fields:_,missingAttributes:m}=await this._queryFeatures(d,t);if(await this._frameTask.schedule((()=>{c&&(i+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.featuresMissing=c&&e.hasPreciseFeatureCount&&i<e.numFeatures||!!f,s=s?.concat(p)??p,h=k(h,_),l=H(l,m),e.setFeatures(s,r,h,l),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()}),t),n(t),o=this._maximumFeaturesForTile(e)-a,!c||!f||o<=0)return!f}}_createFeatureCountQuery(e){const t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){const t=this.context.createQuery();t.resultType=this._resultType(e);const s=Q(e);return s||(t.geometry=T(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),"tile"!==t.resultType&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),!s&&this.context.effectiveDisplayFilter&&(t.where=c(t.where,this.context.effectiveDisplayFilter.where)),t}_setPagingParameters(e,t,s,i){return!!this.context.capabilities.supportsPagination&&(e.start=t,s>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(s/i),e.num=Math.min(e.maxRecordCountFactor*i,s)):e.num=Math.min(i),!0)}_getEffectiveTileResolution(e){if(Q(e)||!this._supportsResolution)return null;const t=this.context.viewingMode===D.Global?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){const s=this._getEffectiveTileResolution(t);null!=s&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new E({mode:"view",originPosition:"upper-left",tolerance:s,extent:this.context.fullExtent}):"polyline"===this.context.geometryType&&(e.maxAllowableOffset=s))}_removeEmptyFeatures(e,t){const i=e.length;if(t&&this._supportsResolution){const i=t*(1+_());s(e,(({geometry:e})=>!(!e||!b(e))&&(C(e,B),x(B)>i||R(B)>i)))}else s(e,(({geometry:e})=>b(e)));return i-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!Q(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case"tile":if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case"standard":if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Z}_resultType(e){if(this.context.capabilities.supportsResultType)return Q(e)?"standard":"tile"}get _reduceMode(){const e=this.context.geometryType;return"polygon"===e||"polyline"===e?A.SIZE:A.RANDOM}_handleRequest(e,t,s,i,r){e.startFetch(),e.requestController=s;let n=!1;t.then((t=>{e.requestController=null,i(t)})).catch((t=>{e.requestController===s&&(e.requestController=null,e.fetchDone(!1)),a(t)?n=!0:r(t)})).then((()=>{n||this._setDirty(),this._scheduleUpdated()}))}_scheduleUpdated(){this.hasHandles("scheduleUpdated")||this.addHandles(h((()=>{this.removeHandles("scheduleUpdated"),this._updated()})),"scheduleUpdated")}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;const{features:t}=e;if(0===e.featureLimit||!t){const t=null!=e.displayingFeatures&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const s=e.fetchingResolution,{adds:i,updates:r}=this._changes,a=Math.min(e.featureLimit,t.length);e.featureLimit=a;for(let n=0;n<a;++n){const e=t[n],a=v(e,this._objectIdField),o=this._displayingFeatureReferences.get(a);if(o){const{oldVersion:t,newVersion:i}=o.ref(e,s);t!==i&&(t&&r.removes.push(t),i&&r.adds.push(i))}else this._displayingFeatureReferences.set(a,new this.FeatureReferenceClass(e,s)),i.push(e);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(null==e.displayingFeatures)return;const{updates:t,removes:s}=this._changes;for(const i of e.displayingFeatures){const r=v(i,this._objectIdField),a=this._displayingFeatureReferences.get(r);if(!a)continue;const{oldVersion:n,newVersion:o}=a.unref(e.displayingResolution);this._numDisplayingFeatureReferences--,n!==o&&(null==o?(this._displayingFeatureReferences.delete(r),n&&s.push(n)):(t.adds.push(o),n&&t.removes.push(n)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get("dataUpdating")||this._set("dataUpdating",!0)}_applyChanges(){const e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);const t=this._changes.adds,s=this._changes.removes,i=Math.min(t.length,s.length);let r=0;for(;r<i;){const e=Math.min(r+$,i);this._notifyDataUpdating(),this.features.addMany(t.slice(r,e)),this.features.removeMany(s.slice(r,e)),r=e}t.length>i&&(this._notifyDataUpdating(),this.features.addMany(0===r?t:t.slice(r))),s.length>i&&(this._notifyDataUpdating(),this.features.removeMany(0===r?s:s.slice(r))),t.length=0,s.length=0}_clearTile(e){this._hideTile(e),e.features&&null!=this.context.memoryCache&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}_getListOfTiles(){return Array.from(this._featureTiles.values())}get storedFeatures(){return this._getListOfTiles().reduce(((e,t)=>e+(t.features?t.features.length:0)),0)}get missingTiles(){return Array.from(this._featureTiles.values()).reduce(((e,t)=>e+(t.needsFetch||t.isFetching?1:0)),0)}_maximumFeaturesForTile(e){const t=e.hasPreciseFeatureCount?e.numFeatures:1/0,s=e.hasPreciseFeatureCount?t:this.maximumNumberOfFeatures,i=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(s*i/(1-e.emptyFeatureRatio)),t)}get test(){}};function Q(e){return"dummy-tile-full-extent"===e.id}function N(e){let t=0;for(const s of e)s.features&&s.features.length>0&&s.alive&&(t=Math.max(t,s.descriptor.lij[0]));return t}function S(e){e.setFeatures([],0,null,void 0),e.featuresMissing=!1}function L(e){return null==e?new Set:new Set(e.map((e=>e.name)))}function k(e,t){if(null==e||null==t)return L(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}function H(e,t){if(!t?.length)return e;e??=new Map;const s=()=>new Set;for(const{objectId:i,attribute:a}of t)r(e,i,s).add(a);return e}e([p({constructOnly:!0})],q.prototype,"features",void 0),e([p()],q.prototype,"tileDescriptors",void 0),e([p({value:1/0})],q.prototype,"maximumNumberOfFeatures",null),e([p({value:1})],q.prototype,"memoryFactor",null),e([p({value:1})],q.prototype,"lodFactor",null),e([p()],q.prototype,"useTileCount",null),e([p({readOnly:!0})],q.prototype,"updating",null),e([p({readOnly:!0})],q.prototype,"dataUpdating",void 0),e([p({readOnly:!0})],q.prototype,"updatingTotal",void 0),e([p({readOnly:!0})],q.prototype,"updatingRemaining",void 0),e([p({readOnly:!0})],q.prototype,"expectedFeatureDiff",void 0),e([p({readOnly:!0})],q.prototype,"memoryForUnusedFeatures",null),e([p({readOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([p({readOnly:!0})],q.prototype,"totalVertices",null),e([p({readOnly:!0})],q.prototype,"totalFeatures",null),e([p({readOnly:!0})],q.prototype,"hasAllFeatures",null),e([p({readOnly:!0})],q.prototype,"hasFullGeometries",null),e([p()],q.prototype,"filterExtent",null),e([p({constructOnly:!0})],q.prototype,"context",void 0),e([p()],q.prototype,"_dirty",void 0),e([p()],q.prototype,"_suspended",void 0),e([p()],q.prototype,"_pendingEdits",void 0),e([p()],q.prototype,"_applyEditsTilesUpdated",void 0),e([p()],q.prototype,"_paused",null),e([p()],q.prototype,"_isFetching",void 0),q=e([f("esri.views.3d.layers.support.FeatureTileFetcher3D")],q);const Z=2e3,V=m(),G=m(),B=m(),X=6e5,$=200;export{q as FeatureTileFetcher3D};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{filterInPlace as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import o from"../../../../core/ReactiveMap.js";import{on as u,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as h}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as c}from"../../../../core/sql.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as _}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as m,equals as g,clone as F,expand as y,toExtent as T,width as x,height as v}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as R,hasVertices as E,computeAABR as b}from"../../../../layers/graphics/dehydratedFeatures.js";import C from"../../../../rest/support/QuantizationParameters.js";import D from"../../../../rest/support/Query.js";import{ViewingMode as w}from"../../../ViewingMode.js";import{MultiFeatureReference as M,SingleFeatureReference as U}from"./featureReference.js";import{failedFeatureCount as j,FeatureTile as O,FetchStatus as A,ReduceMode as I}from"./FeatureTile.js";import{tilesAreRelated as P}from"../../terrain/tileUtils.js";import{ImmediateTask as z,TaskPriority as N}from"../../../support/Scheduler.js";let q=class extends t{set maximumNumberOfFeatures(e){e=e||1/0;const t=this._get("maximumNumberOfFeatures");e===t||e<1||(this._set("maximumNumberOfFeatures",e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set("memoryFactor",e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set("lodFactor",e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&null!=this.context.query.queryFeatureCount}set useTileCount(e){this._useTileCount=e,this.notifyChange("useTileCount")}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get running(){return this._dirty}get memoryForUnusedFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.estimatedUnusedSize)),e}get totalVertices(){let e=0;return this._featureTiles.forEach((t=>e+=t.numVertices)),e}get totalFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.numFeatures)),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(const e of this._featureTiles.values())if(!this.hasFullGeometries&&0!==e.emptyFeatureRatio||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){if(!this._supportsResolution)return!0;const e=this.tileDescriptors?.some(Q);return e||!this.context.capabilities.supportsQuantization&&"polyline"!==this.context.geometryType}set filterExtent(e){if(null!=e&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void i.getLogger(this).error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||null!=t&&e&&t.equals(e))return;const s=null!=e?e.clone():null;this._set("filterExtent",s),this._reclip(s,t)}_updateTileZQuantization(e){if(this.context.viewingMode===w.Global){const t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._featureTiles=new o,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this._isFetching=!1;const t=e.context;this._frameTask=t.scheduler?.registerTask(N.FEATURE_TILE_FETCHER,this)??z,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?M:U,this._objectIdField=t.objectIdField}initialize(){this.addHandles([u((()=>this.tileDescriptors),"change",(()=>this._setDirty())),l((()=>this._tileZQuantization),(()=>this.refetch()))]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._removeTile(e)})),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)})),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._resetFetchTile(e)})),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(const t of this._featureTiles.values()){const s=t.missingAttributes?.get(e);if(null!=s)return s}}_pause(){this._paused&&(this._featureTiles.forEach((e=>this._cancelFetchTile(e))),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach((t=>{null!=t.displayingFeatures&&0!==t.displayingFeatures.length&&(null==e?e=new Set(t.availableFields):e.forEach((s=>{t.availableFields?.has(s)||e.delete(s)})))})),null!=e?e:new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this._pendingEdits;t.count++;const s=t.edits.then((()=>e.result.catch((e=>{if(a(e))throw e;return null})).then((e=>e?(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then((()=>e))):e)).then((e=>(0===--t.count&&(this._pendingEdits===t&&(this._pendingEdits=null),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)))));return t.edits=s,this._updated(),s}_applyEditsDeleteFeatures(e){if(0===e.length)return;const t=this.context.globalIdField,s=t&&this.availableFields.has(t),r=new Set,a=this._objectIdField;e.forEach((({objectId:e,globalId:n})=>{(!e||e<0)&&t&&n&&(s||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(n,a,t)),null!=e&&e>=0&&r.add(e)})),this._featureTiles.forEach((e=>{if(!e.features)return;const t=e.features.filter((e=>!r.has(R(e,this._objectIdField))));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())}))}_objectIdFromGlobalId(e,t,s){if(null==e)return null;const i=this.features.find((t=>t.attributes?.[s]===e));return i?R(i,t):null}async _applyEditsAddUpdateFeatures(e,t,s){const{objectIdField:r,globalIdField:a}=this.context,n=a&&this.availableFields.has(a),o=new Set,u=new Set;for(const i of e){const e=i.objectId;null!=e&&o.add(e)}for(const{objectId:h,globalId:d}of t){let e=h;(null==e||e<0)&&a&&(n||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(d,r,a)),null!=e&&e>=0&&(o.add(e),u.add(e))}if(0===o.size)return;const l=[];this._featureTiles.forEach((e=>{const t=this._applyEditsAddUpdateTile(e,o,u,s);t&&l.push(t)})),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,s,i){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=Array.from(t);const a=await this._queryFeatures(r,i);let n=null;if(s.size>0){const t=e.features.filter((e=>!s.has(R(e,this._objectIdField))));t.length!==e.features.length&&(n=t)}if(a.features.length>0){n||(n=e.features.slice());for(const e of a.features)n.push(e)}n&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,n.length)),this._applyEditsTileUpdated(),e.setFeatures(n,0,H(e.availableFields,a.fields),Z(e.missingAttributes,a.missingAttributes)),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:X})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){const t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;const s=this._featureTilesArray;if(this._markTilesNotAlive(s),!e.run((()=>this._addTiles(s,e)))||!e.run((()=>this._filterExtentTiles(s,e)))||!e.run((()=>this._removeTiles(s,e)))||e.done)return void this._setDirty();const i=this._sortTiles(s);e.run((()=>this._showTiles(i,e)))&&e.run((()=>this._fetchTiles(i,e)))&&e.run((()=>this._updateMemoryEstimates(i,e)))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!(this._suspended||!this.tileDescriptors)&&(this.tileDescriptors.forEach((s=>{const i=this._featureTiles.get(s.id);i?i.alive=!0:t.done||(e.push(this._addTile(s)),t.madeProgress())})),t.hasProgressed)}_filterExtentTiles(e,t){for(const s of e){if(t.done)break;s.alive&&(s.filtered=!s.intersects(this.filterExtent),s.filtered&&(this._clearTile(s),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let s=e.length-1;s>=0&&!t.done;s--){const i=e[s];i.alive||(this._removeTile(i),s!==e.length-1&&(e[s]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort(((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority)),e}_showTiles(e,t){const s=this._updateRatio(e),i=e=>{const t=this._fullRatio<1?s(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();const{numFeatures:i,fetchingResolution:r,descriptor:a,isFetched:n}=e;return this._supportsResolution&&i>0&&r!==a.resolution&&n&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(const r of e)if(!t.run((()=>i(r)))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let s=!1;for(const i of e){if(!i.needsFetch)continue;const e=null!=this.context.memoryCache?this.context.memoryCache.pop(i.id):null;if(e?.resolution!==i.displayingResolution){if(this._needsNumFeatures(i)){const e=new AbortController,r=this._fetchTileCount(i,e.signal);this._handleRequest(i,r,e,(()=>i.resetFetching()),(()=>i.numFeatures=j)),s=!0,t.madeProgress()}if(t.done)return!0}else i.cache=e,i.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress()}if(s)return t.hasProgressed;for(const r of e){if(!r.needsFetch)continue;const e=new AbortController,s=this._fetchTile(r,e.signal);if(this._handleRequest(r,s,e,(e=>r.fetchDone(e)),(e=>{r.fetchFailed=!0,this.context.logFetchError(i.getLogger(this),e)})),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some((e=>!t.run((()=>e.updateMemoryEstimates()))&&(this._setDirty(),!0))),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;const s=new Array;this._featureTiles.forEach((i=>{null!=i.displayingFeatures&&0!==i.displayingFeatures.length&&(i.intersectionIncludingBorrowed(t,G),i.intersectionIncludingBorrowed(e,$),g(G,$)||s.push(i))})),this._refreshDisplayingFeatures(s),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,s=this._changes.updates;for(const i of e)if(null!=i.displayingFeatures)for(const e of i.displayingFeatures){const i=R(e,this._objectIdField);if(t.has(i))continue;t.add(i);const r=this._displayingFeatureReferences.get(i).feature;s.removes.push(r),s.adds.push(r)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach((t=>t.isFetching?++e:0)),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set("dataUpdating",!1),this.updating){let t=0,s=0,i=0,r=0,a=0;const n=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach((e=>{if(++s,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),s=null!=e.displayingFeatures?e.displayingFeatures.length*n:0;a+=t-s}e.needsFetch?++r:e.numFeatures>0&&(++i,t+=e.numFeatures)})),r+=e;let o=0,u=0;t?(u=t,o=Math.min(r*t/i,t)):(u=s,o=r),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set("updatingTotal",u),this._set("updatingRemaining",o),this._set("expectedFeatureDiff",a)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(const{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e)return void this._set("maximumNumberOfFeaturesExceeded",!0);this._set("maximumNumberOfFeaturesExceeded",!1)}_updateRatio(e){const t=S(e),s=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0]));let i=0,r=0;for(const a of e){const e=a.numFeatures;i+=e,r+=e*s(a)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/i),this._farRatio=this.maximumNumberOfFeatures/r,this._scheduleUpdated(),s}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach((e=>{if(!e.featuresMissing)return;const t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))})),this._setDirty())}_addTile(e){const t=new O(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.displayingResolution;this._featureTiles.forEach((s=>{if(null!=s.displayingFeatures&&e!==s&&P(e.descriptor.lij,s.descriptor.lij)){null==e.displayingFeatures&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=F(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,s.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const i of s.displayingFeatures){e.displayingFeatures.push(i);const s=this._displayingFeatureReferences.get(R(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}}))}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(A.DONE):e.requestFetch()}_cancelFetchTile(e){const t=e.requestController;null!=t&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){e.fetchFailed=!1;const s=this._maximumFeaturesForTile(e);if(s<=0)return e.hasPreciseFeatureCount&&0===e.numFeatures||(e.fetchFailed=!0),L(e),e.fetchInformation.value="Empty tile",A.DONE;const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(e.fetchingResolution=e.descriptor.resolution,Q(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>D.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=r,e.isRefetching&&e.features&&e.features.length>0){const t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/i);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${s} features`;const{features:o,exceededTransferLimit:u,fields:l,missingAttributes:h}=await this._queryFeatures(a,t),d=u||a.maxRecordCountFactor>=D.MAX_MAX_RECORD_COUNT_FACTOR||s===this._totalFeaturesForTile(e)?A.FULL:A.DONE,c=await this._frameTask.schedule((()=>{e.exceededTransferLimit.value=!!u;const t=this._removeEmptyFeatures(o,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${o.length}/${s} features`,e.setFeatures(o,t,k(l),Z(void 0,h)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>s?A.REFETCH_NEEDED:d}),t);return n(t),this._invalidateCounts(),c}async _fetchCount(e,t){return this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t})}async _fetchPagedTile(e,t){let s,i=0,r=0,a=0,o=this._maximumFeaturesForTile(e)-a;const u=this._getMaxRecordCount(e);let l,h=null;for(;;){const d=this._createQuery(e),c=this._setPagingParameters(d,i,o,u);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${o} features`;const{features:p,exceededTransferLimit:f,fields:_,missingAttributes:m}=await this._queryFeatures(d,t);if(await this._frameTask.schedule((()=>{c&&(i+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!f,s=s?.concat(p)??p,h=H(h,_),l=Z(l,m),e.setFeatures(s,r,h,l),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()}),t),n(t),o=this._maximumFeaturesForTile(e)-(s?.length??0),!c||!f||o<=0)return f?A.DONE:A.FULL}}_createFeatureCountQuery(e){const t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){const t=this.context.createQuery();t.resultType=this._resultType(e);const s=Q(e);return s||(t.geometry=T(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),"tile"!==t.resultType&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),!s&&this.context.effectiveDisplayFilter&&(t.where=c(t.where,this.context.effectiveDisplayFilter.where)),t}_setPagingParameters(e,t,s,i){return!!this.context.capabilities.supportsPagination&&(e.start=t,s>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(s/i),e.num=Math.min(e.maxRecordCountFactor*i,s)):e.num=Math.min(i),!0)}_getEffectiveTileResolution(e){if(Q(e)||!this._supportsResolution)return null;const t=this.context.viewingMode===w.Global?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){const s=this._getEffectiveTileResolution(t);null!=s&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new C({mode:"view",originPosition:"upper-left",tolerance:s,extent:this.context.fullExtent}):"polyline"===this.context.geometryType&&(e.maxAllowableOffset=s))}_removeEmptyFeatures(e,t){const i=e.length;if(t&&this._supportsResolution){const i=t*(1+_());s(e,(({geometry:e})=>!(!e||!E(e))&&(b(e,B),x(B)>i||v(B)>i)))}else s(e,(({geometry:e})=>E(e)));return i-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!Q(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case"tile":if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case"standard":if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||V}_resultType(e){if(this.context.capabilities.supportsResultType)return Q(e)?"standard":"tile"}get _reduceMode(){const e=this.context.geometryType;return"polygon"===e||"polyline"===e?I.SIZE:I.RANDOM}_handleRequest(e,t,s,i,r){e.startFetch(),e.requestController=s;let n=!1;t.then((t=>{e.requestController=null,i(t)})).catch((t=>{e.requestController===s&&(e.requestController=null,e.fetchDone(A.DONE)),a(t)?n=!0:r(t)})).then((()=>{n||this._setDirty(),this._scheduleUpdated()}))}_scheduleUpdated(){this.hasHandles("scheduleUpdated")||this.addHandles(h((()=>{this.removeHandles("scheduleUpdated"),this._updated()})),"scheduleUpdated")}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;const t=e.features;if(0===e.featureLimit||!t){const t=null!=e.displayingFeatures&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const s=e.fetchingResolution,{adds:i,updates:r}=this._changes,a=Math.min(e.featureLimit,t.length);for(let n=0;n<a;++n){const e=t[n],a=R(e,this._objectIdField),o=this._displayingFeatureReferences.get(a);if(o){const{oldVersion:t,newVersion:i}=o.ref(e,s);t!==i&&(t&&r.removes.push(t),i&&r.adds.push(i))}else this._displayingFeatureReferences.set(a,new this.FeatureReferenceClass(e,s)),i.push(e);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(null==e.displayingFeatures)return;const{updates:t,removes:s}=this._changes;for(const i of e.displayingFeatures){const r=R(i,this._objectIdField),a=this._displayingFeatureReferences.get(r);if(!a)continue;const{oldVersion:n,newVersion:o}=a.unref(e.displayingResolution);this._numDisplayingFeatureReferences--,n!==o&&(null==o?(this._displayingFeatureReferences.delete(r),n&&s.push(n)):(t.adds.push(o),n&&t.removes.push(n)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get("dataUpdating")||this._set("dataUpdating",!0)}_applyChanges(){const e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);const t=this._changes.adds,s=this._changes.removes,i=Math.min(t.length,s.length);let r=0;for(;r<i;){const e=Math.min(r+J,i);this._notifyDataUpdating(),this.features.addMany(t.slice(r,e)),this.features.removeMany(s.slice(r,e)),r=e}t.length>i&&(this._notifyDataUpdating(),this.features.addMany(0===r?t:t.slice(r))),s.length>i&&(this._notifyDataUpdating(),this.features.removeMany(0===r?s:s.slice(r))),t.length=0,s.length=0}_clearTile(e){this._hideTile(e),e.features&&null!=this.context.memoryCache&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce(((e,t)=>e+(t.features?t.features.length:0)),0)}get missingTiles(){return Array.from(this._featureTiles.values()).reduce(((e,t)=>e+(t.needsFetch||t.isFetching?1:0)),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){const t=this._totalFeaturesForTile(e),s=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*s/(1-e.emptyFeatureRatio)),t)}get test(){}};function Q(e){return"dummy-tile-full-extent"===e.id}function S(e){let t=0;for(const s of e)s.features&&s.features.length>0&&s.alive&&(t=Math.max(t,s.descriptor.lij[0]));return t}function L(e){e.setFeatures([],0,null,void 0)}function k(e){return null==e?new Set:new Set(e.map((e=>e.name)))}function H(e,t){if(null==e||null==t)return k(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}function Z(e,t){if(!t?.length)return e;e??=new Map;const s=()=>new Set;for(const{objectId:i,attribute:a}of t)r(e,i,s).add(a);return e}e([p({constructOnly:!0})],q.prototype,"features",void 0),e([p()],q.prototype,"tileDescriptors",void 0),e([p({value:1/0})],q.prototype,"maximumNumberOfFeatures",null),e([p({value:1})],q.prototype,"memoryFactor",null),e([p({value:1})],q.prototype,"lodFactor",null),e([p()],q.prototype,"useTileCount",null),e([p({readOnly:!0})],q.prototype,"updating",null),e([p({readOnly:!0})],q.prototype,"dataUpdating",void 0),e([p({readOnly:!0})],q.prototype,"updatingTotal",void 0),e([p({readOnly:!0})],q.prototype,"updatingRemaining",void 0),e([p({readOnly:!0})],q.prototype,"expectedFeatureDiff",void 0),e([p({readOnly:!0})],q.prototype,"memoryForUnusedFeatures",null),e([p({readOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([p({readOnly:!0})],q.prototype,"totalVertices",null),e([p({readOnly:!0})],q.prototype,"totalFeatures",null),e([p({readOnly:!0})],q.prototype,"showsAllFeatures",null),e([p({readOnly:!0})],q.prototype,"hasFullGeometries",null),e([p()],q.prototype,"filterExtent",null),e([p({constructOnly:!0})],q.prototype,"context",void 0),e([p()],q.prototype,"_dirty",void 0),e([p()],q.prototype,"_suspended",void 0),e([p()],q.prototype,"_pendingEdits",void 0),e([p()],q.prototype,"_applyEditsTilesUpdated",void 0),e([p()],q.prototype,"_paused",null),e([p()],q.prototype,"_isFetching",void 0),q=e([f("esri.views.3d.layers.support.FeatureTileFetcher3D")],q);const V=2e3,G=m(),$=m(),B=m(),X=6e5,J=200;export{q as FeatureTileFetcher3D};
@@ -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 i from"../../../../core/Collection.js";import s from"../../../../geometry/Polygon.js";import o from"../../../../symbols/FillSymbol3DLayer.js";import r from"../../../../symbols/PointSymbol3D.js";import a from"../../../../symbols/PolygonSymbol3D.js";import l from"../../../../symbols/TextSymbol3DLayer.js";import n from"../../../../symbols/callouts/LineCallout3D.js";import h from"../../../../symbols/callouts/LineCallout3DBorder.js";import c from"../../../../symbols/support/Symbol3DVerticalOffset.js";import{TilingScheme as m}from"../../terrain/TilingScheme.js";const p=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];class y{constructor(e,t,s){this._tileFetcher=e,this._view=s,this._loadingGraphics=new Map,this._loadingSymbols=[new a({symbolLayers:new i([new o({material:{color:[200,200,200,.4]},outline:{color:[30,30,30],size:1}})])})],this._loadedGraphics=new Map,this._loadedSymbols=p.map((e=>new a({symbolLayers:new i([new o({material:{color:[e[0],e[1],e[2],.6]},outline:{color:"black",size:1}})])}))),this._pendingGraphics=new Map,this._pendingSymbols=[new a({symbolLayers:new i([new o({material:{color:[100,100,100,.4]},outline:{color:[30,30,30],size:1}})])})],this._dataExtentGraphic=null,this._dataExtentSymbol=new a({symbolLayers:new i([new o({material:{color:[0,0,0,0]},outline:{color:"green",size:4}})])}),this._enabled=!0,this._tilingScheme=new m(t)}destroy(){this.enabled=!1}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}update(){this._enabled?(this._synchronizeMaps(this._loadingGraphics,{filter:({isFetching:e})=>e,symbols:this._loadingSymbols}),this._synchronizeMaps(this._loadedGraphics,{filter:e=>!e.isFetching,symbols:this._loadedSymbols}),this._synchronizeMaps(this._pendingGraphics,{filter:({isFetching:e})=>!e,symbols:this._pendingSymbols}),this.showDataExtent(this._tileFetcher.filterExtent)):(this._loadingGraphics.forEach((e=>this._view.graphics.removeMany(e))),this._loadingGraphics.clear(),this._loadedGraphics.forEach((e=>this._view.graphics.removeMany(e))),this._loadedGraphics.clear(),this._pendingGraphics.forEach((e=>this._view.graphics.removeMany(e))),this._pendingGraphics.clear(),this._dataExtentGraphic&&(this._view.graphics.remove(this._dataExtentGraphic),this._dataExtentGraphic=null))}showDataExtent(e){if(this._dataExtentGraphic&&(this._view.graphics.remove(this._dataExtentGraphic),this._dataExtentGraphic=null),null==e)return;const i=s.fromExtent(e);this._dataExtentGraphic=new t({geometry:i,symbol:this._dataExtentSymbol}),this._view.graphics.add(this._dataExtentGraphic)}_synchronizeMaps(s,o){s.forEach(((e,t)=>{const i=this._tileFetcher.test.getFeatureTileById(t);i&&o.filter(i)||(this._view.graphics.removeMany(e),s.delete(t))})),this._tileFetcher.test.forEachFeatureTile((a=>{if(!o.filter(a)||s.has(a.id))return;const[m,p,y]=a.descriptor.lij;this._tilingScheme.ensureMaxLod(m);const d=this._tilingScheme.getExtentGeometry(m,p,y),_=[new t({geometry:d,symbol:o.symbols[m%o.symbols.length]}),new t({geometry:d.center,symbol:new r({verticalOffset:new c({screenLength:40/.75}),callout:new n({color:new e("white"),border:new h({color:new e("black")})}),symbolLayers:new i([new l({text:`${m}/${p}/${y}`,halo:{color:"white",size:1/.75},material:{color:"black"},size:16})])})})];s.set(a.id,_),this._view.graphics.addMany(_)}))}}export{y as FeatureTileFetcher3DDebugger};
5
+ import e from"../../../../Color.js";import t from"../../../../Graphic.js";import i from"../../../../core/Collection.js";import s from"../../../../core/Handles.js";import{watch as o,initial as r}from"../../../../core/reactiveUtils.js";import a from"../../../../geometry/Polygon.js";import l from"../../../../symbols/FillSymbol3DLayer.js";import n from"../../../../symbols/PointSymbol3D.js";import h from"../../../../symbols/PolygonSymbol3D.js";import c from"../../../../symbols/TextSymbol3DLayer.js";import m from"../../../../symbols/callouts/LineCallout3D.js";import d from"../../../../symbols/callouts/LineCallout3DBorder.js";import p from"../../../../symbols/support/Symbol3DVerticalOffset.js";import{TilingScheme as y}from"../../terrain/TilingScheme.js";const _=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];class b{constructor(e,t,o){this._tileFetcher=e,this._view=o,this._handles=new s,this._loadingGraphics=new Map,this._loadingSymbols=[new h({symbolLayers:new i([new l({material:{color:[200,200,200,.4]},outline:{color:[30,30,30],size:1}})])})],this._loadedGraphics=new Map,this._loadedSymbols=_.map((e=>new h({symbolLayers:new i([new l({material:{color:[e[0],e[1],e[2],.6]},outline:{color:"black",size:1}})])}))),this._pendingGraphics=new Map,this._pendingSymbols=[new h({symbolLayers:new i([new l({material:{color:[100,100,100,.4]},outline:{color:[30,30,30],size:1}})])})],this._dataExtentGraphic=null,this._dataExtentSymbol=new h({symbolLayers:new i([new l({material:{color:[0,0,0,0]},outline:{color:"green",size:4}})])}),this._enabled=!0,this._tilingScheme=new y(t),this.update()}destroy(){this.enabled=!1,this._handles.destroy()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}update(){this._enabled?(this._synchronizeMaps(this._loadingGraphics,{filter:({isFetching:e})=>e,symbols:this._loadingSymbols}),this._synchronizeMaps(this._loadedGraphics,{filter:e=>!e.isFetching,symbols:this._loadedSymbols}),this._synchronizeMaps(this._pendingGraphics,{filter:({isFetching:e})=>!e,symbols:this._pendingSymbols}),this.showDataExtent(this._tileFetcher.filterExtent)):(this._loadingGraphics.forEach((e=>this._view.graphics.removeMany(e))),this._loadingGraphics.clear(),this._loadedGraphics.forEach((e=>this._view.graphics.removeMany(e))),this._loadedGraphics.clear(),this._pendingGraphics.forEach((e=>this._view.graphics.removeMany(e))),this._pendingGraphics.clear(),this._dataExtentGraphic&&(this._view.graphics.remove(this._dataExtentGraphic),this._dataExtentGraphic=null))}showDataExtent(e){if(this._dataExtentGraphic&&(this._view.graphics.remove(this._dataExtentGraphic),this._dataExtentGraphic=null),null==e)return;const i=a.fromExtent(e);this._dataExtentGraphic=new t({geometry:i,symbol:this._dataExtentSymbol}),this._view.graphics.add(this._dataExtentGraphic)}_synchronizeMaps(e,t){const i=this._tileFetcher.featureTiles;e.forEach(((s,o)=>{const r=i.get(o);r&&t.filter(r)||(this._view.graphics.removeMany(s),e.delete(o))})),this._handles.removeAll(),i.forEach((i=>{t.filter(i)&&!e.has(i.id)&&this._handles.add(o((()=>i.fetchInformation),(()=>this._showTile(i,e,t)),r))}))}_showTile(s,o,r){const[a,l,h]=s.descriptor.lij,{numFeatures:y,featureLimit:_,features:b}=s;this._tilingScheme.ensureMaxLod(a);const g=this._tilingScheme.getExtentGeometry(a,l,h),w=new t({geometry:g,symbol:r.symbols[a%r.symbols.length]}),f=`Tile ${s.id}\nloaded/limit/total\n${b?.length}/${_}/${y}\nres ${Math.round(s.displayingResolution)} ${s.featuresMissing?"some":"all"}\n${s.fetchInformation.value}`,u=new t({geometry:g.center,symbol:new n({verticalOffset:new p({screenLength:40/.75}),callout:new m({color:new e("white"),border:new d({color:new e("black")})}),symbolLayers:new i([new c({text:f,halo:{color:"white",size:1/.75},material:{color:"black"},size:16})])})}),G=o.get(s.id);G&&this._view.graphics.removeMany(G);const v=[w,u];o.set(s.id,v),this._view.graphics.addMany(v)}}export{b as FeatureTileFetcher3DDebugger};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import{makeHandle as r,destroyHandle as o}from"../../../../core/handleUtils.js";import{watch as h,syncAndInitial as p}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as c,project as n}from"../../../../geometry/projection.js";import{GraphicsCollection as g}from"../../../../support/GraphicsCollection.js";import m from"../../../../symbols/SimpleFillSymbol.js";import u from"../../../../symbols/SimpleLineSymbol.js";import d from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as y}from"../../../layers/support/highlightUtils.js";let w=class extends i{get updating(){return this.graphicsView?.updating??!1}constructor(t){super(t),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new g,this.graphicsView=null,this.suspended=!1;const i=new e([255,255,255,1/255]);this._symbols=new Map([["point",new d({size:"2px",style:"square",color:i})],["polyline",new u({width:"2px",color:i})],["polygon",new m({outline:null,color:i})]])}highlight(t,e){const i=y(t);if(0===i.length)return r();let s,o=!1;return this.updatingHandles.addPromise(Promise.all([this._createHighlightGraphics(i),this._ensureGraphicsView3D()]).then((([t,i])=>{!o&&i&&(s=this._addHighlightGraphics(i,t,e))}))),r((()=>{o=!0,s?.remove()}))}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(t,e,i){for(const r of e)this._highlightCounts.set(r,(this._highlightCounts.get(r)??0)+1);this.graphics.addMany(e);const s=t.highlight(e,i);return r((()=>{this._removeHighlightGraphics(e),s.remove()}))}_removeHighlightGraphics(t){this.graphics.removeMany(t.filter((t=>{const e=Math.max(0,(this._highlightCounts.get(t)??0)-1);return 0===e?(this._highlightCounts.delete(t),!0):(this._highlightCounts.set(t,e),!1)})))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||(this._graphicsViewLoader=import("../GraphicsView3D.js"));const{default:t}=await this._graphicsViewLoader;if(this.destroyed)return null;const e=new t({view:this.view,layer:this.layer,getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set("graphicsView",e),this.addHandles([o(this.graphicsView),h((()=>this.suspended),(t=>{e.suspended=t}),p)]),e}async _createHighlightGraphics(t){const e=t.map((({geometry:t})=>t?.spatialReference)).filter(s).reduce(((t,e)=>(0!==t.length&&t.at(-1)?.equals(e)||t.push(e),t)),[]),i=this.view.spatialReference,r=e.map((t=>({source:t,dest:i})));try{await c(r)}catch{return[]}return t.map((t=>{const{geometry:e}=t;try{const s=e?n(e,i):null,r=t.cloneShallow();return r.geometry=s,r.symbol=this._symbols.get(s?.type),r}catch{return t}}))}};t([a()],w.prototype,"graphics",void 0),t([a()],w.prototype,"graphicsView",void 0),t([a()],w.prototype,"view",void 0),t([a()],w.prototype,"layer",void 0),t([a()],w.prototype,"updatingHandles",void 0),t([a()],w.prototype,"suspended",void 0),t([a()],w.prototype,"updating",null),w=t([l("esri.views.3d.layers.support.ImageHighlightHelper3D")],w);export{w as ImageHighlightHelper3D};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import{makeHandle as r,destroyHandle as o}from"../../../../core/handleUtils.js";import{watch as h,syncAndInitial as p}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as c,project as n}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as g}from"../../../../support/GraphicsCollection.js";import m from"../../../../symbols/SimpleFillSymbol.js";import u from"../../../../symbols/SimpleLineSymbol.js";import d from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as y}from"../../../layers/support/highlightUtils.js";let w=class extends i{get updating(){return this.graphicsView?.updating??!1}constructor(t){super(t),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new g,this.graphicsView=null,this.suspended=!1;const i=new e([255,255,255,1/255]);this._symbols=new Map([["point",new d({size:"2px",style:"square",color:i})],["polyline",new u({width:"2px",color:i})],["polygon",new m({outline:null,color:i})]])}highlight(t,e){const i=y(t);if(0===i.length)return r();let s,o=!1;return this.updatingHandles.addPromise(Promise.all([this._createHighlightGraphics(i),this._ensureGraphicsView3D()]).then((([t,i])=>{!o&&i&&(s=this._addHighlightGraphics(i,t,e))}))),r((()=>{o=!0,s?.remove()}))}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(t,e,i){for(const r of e)this._highlightCounts.set(r,(this._highlightCounts.get(r)??0)+1);this.graphics.addMany(e);const s=t.highlight(e,i);return r((()=>{this._removeHighlightGraphics(e),s.remove()}))}_removeHighlightGraphics(t){this.graphics.removeMany(t.filter((t=>{const e=Math.max(0,(this._highlightCounts.get(t)??0)-1);return 0===e?(this._highlightCounts.delete(t),!0):(this._highlightCounts.set(t,e),!1)})))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||(this._graphicsViewLoader=import("../GraphicsView3D.js"));const{default:t}=await this._graphicsViewLoader;if(this.destroyed)return null;const e=new t({view:this.view,layer:this.layer,getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set("graphicsView",e),this.addHandles([o(this.graphicsView),h((()=>this.suspended),(t=>{e.suspended=t}),p)]),e}async _createHighlightGraphics(t){const e=t.map((({geometry:t})=>t?.spatialReference)).filter(s).reduce(((t,e)=>(0!==t.length&&t.at(-1)?.equals(e)||t.push(e),t)),[]),i=this.view.spatialReference,r=e.map((t=>({source:t,dest:i})));try{await c(r)}catch{return[]}return t.map((t=>{const{geometry:e}=t;try{const s=e?n(e,i):null,r=t.cloneShallow();return r.geometry=s,r.symbol=this._symbols.get(s?.type),r}catch{return t}}))}};t([a()],w.prototype,"graphics",void 0),t([a()],w.prototype,"graphicsView",void 0),t([a()],w.prototype,"view",void 0),t([a()],w.prototype,"layer",void 0),t([a()],w.prototype,"updatingHandles",void 0),t([a()],w.prototype,"suspended",void 0),t([a()],w.prototype,"updating",null),w=t([l("esri.views.3d.layers.support.ImageHighlightHelper3D")],w);export{w as ImageHighlightHelper3D};
@@ -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{acosClamped as e,lerp as t,clamp as i}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{l as s,n,g as a,e as o,d as m}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../geometry/ellipsoidUtils.js";import c from"../../../geometry/Extent.js";import{create as f,fromValues as x}from"../../../geometry/support/ray.js";import{b as p,c as u,h as M}from"../../../chunks/sphere.js";import{ViewingMode as d}from"../../ViewingMode.js";import{computeInnerAltitudeFade as _}from"../environment/atmosphereUtils.js";import{DepthRange as y}from"../webgl-engine/lib/DepthRange.js";function v(e,t,i){return e===d.Global?new E(t,i):new g(t,i)}class g{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t),this._unitInMeters=r(t,this._referenceEllipsoid.metersPerDegree)}compute(e,r,s,a){const{eye:h,center:l}=e;let f=h[2]*this._unitInMeters;const x=f,p=f-a,u=this._elevationProvider?.visibleElevationBounds;u&&(f=p>=0?x-this._unitInMeters*u.min:this._unitInMeters*u.max-x),r??=new c({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});const M={x:r.xmax-r.xmin,y:r.ymax-r.ymin,z:4*Math.max(r.xmax-r.xmin,r.ymax-r.ymin)},d=Math.max(M.x,M.y,M.z);m(B,l,h),q[0]=B[0]>0?r.xmax:r.xmin,q[1]=B[1]>0?r.ymax:r.ymin,q[2]=B[2]>0?d/2:-d/2,m(q,q,h),n(B,B);const _=1.1*o(q,B)*this._unitInMeters,y=Math.sqrt(f*(f+2*this._referenceEllipsoid.radius)),v=Math.max(r.xmax-r.xmin,r.ymax-r.ymin),g=v*z*this._unitInMeters,E=v*k*this._unitInMeters,b=i((f-E)/(g-E),0,1)**3,I=Math.min(t(y,_,b),y)*Math.max(Math.log(Math.abs(p)),1);return j(Math.min(I,Math.max(34064e4,d))/this._unitInMeters,w,this._unitInMeters,D)}}class E{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t)}compute(r,h,l,c){const{eye:f}=r,u=s(f),d=u-this._referenceEllipsoid.radius,v=this._referenceEllipsoid.radius+Math.min(0,c),g=Math.abs(d-c),E=Math.max(g,Math.abs(d)),z=this._elevationProvider?.visibleElevationBounds.max??0,k=_(E),H=Math.sqrt(E*(E+2*v)),R=u+this._referenceEllipsoid.radius,V=1.2*t(H,R,k),Y=(Math.log(E)-b)/(I-b);j(V,i(w-Y*(w-P),P,w),1,D);const A=this._referenceEllipsoid.radius+z,C=this._referenceEllipsoid.radius+this._referenceEllipsoid.atmosphereHeight,J=Math.max(A,C),K=u-J;if(k>0&&K>U){const i=n(q,a(q,r.eye,-1)),h=n(B,r.viewForward),c=e(o(i,h)),f=.5*r.fovY,u=Math.cos(f);let d=y.infinite.near;if(c<=f)d=K*u;else{const e=n(q,r.viewUp),t=Math.tan(f),i=a(q,e,t),o=n(q,m(q,h,i)),l=x(r.eye,o,G),c=p(F,J);if(M(c,l,q)){const e=m(q,q,r.eye);d=s(e)*u}}const _=.99*Math.min(l.near,d);if(_<y.infinite.near&&_>D.near){const e=t(D.near,_,k);D.near=e}}return D}}function j(e,t,i,r){const s=U/i,n=e/t;return n>s?(r.far=e,r.near=n):(r.near=s,r.far=r.near*t),r}const b=7.983,I=16.994,w=2e4,P=100,U=2,z=.001,k=1e-4,q=h(),B=h(),D={near:0,far:0},F=u(),G=f();export{v as createNearFarHeuristic,U as minNearDistanceInMeters};
5
+ import{acosClamped as e,lerp as t,clamp as i}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{l as s,n,g as a,e as o,d as m}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as l}from"../../../geometry/ellipsoidUtils.js";import c from"../../../geometry/Extent.js";import{create as f,fromValues as x}from"../../../geometry/support/ray.js";import{b as p,c as u,i as M}from"../../../chunks/sphere.js";import{ViewingMode as d}from"../../ViewingMode.js";import{computeInnerAltitudeFade as _}from"../environment/atmosphereUtils.js";import{DepthRange as y}from"../webgl-engine/lib/DepthRange.js";function v(e,t,i){return e===d.Global?new E(t,i):new g(t,i)}class g{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t),this._unitInMeters=r(t,this._referenceEllipsoid.metersPerDegree)}compute(e,r,s,a){const{eye:h,center:l}=e;let f=h[2]*this._unitInMeters;const x=f,p=f-a,u=this._elevationProvider?.visibleElevationBounds;u&&(f=p>=0?x-this._unitInMeters*u.min:this._unitInMeters*u.max-x),r??=new c({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});const M={x:r.xmax-r.xmin,y:r.ymax-r.ymin,z:4*Math.max(r.xmax-r.xmin,r.ymax-r.ymin)},d=Math.max(M.x,M.y,M.z);m(B,l,h),q[0]=B[0]>0?r.xmax:r.xmin,q[1]=B[1]>0?r.ymax:r.ymin,q[2]=B[2]>0?d/2:-d/2,m(q,q,h),n(B,B);const _=1.1*o(q,B)*this._unitInMeters,y=Math.sqrt(f*(f+2*this._referenceEllipsoid.radius)),v=Math.max(r.xmax-r.xmin,r.ymax-r.ymin),g=v*z*this._unitInMeters,E=v*k*this._unitInMeters,b=i((f-E)/(g-E),0,1)**3,I=Math.min(t(y,_,b),y)*Math.max(Math.log(Math.abs(p)),1);return j(Math.min(I,Math.max(34064e4,d))/this._unitInMeters,w,this._unitInMeters,D)}}class E{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=l(t)}compute(r,h,l,c){const{eye:f}=r,u=s(f),d=u-this._referenceEllipsoid.radius,v=this._referenceEllipsoid.radius+Math.min(0,c),g=Math.abs(d-c),E=Math.max(g,Math.abs(d)),z=this._elevationProvider?.visibleElevationBounds.max??0,k=_(E),H=Math.sqrt(E*(E+2*v)),R=u+this._referenceEllipsoid.radius,V=1.2*t(H,R,k),Y=(Math.log(E)-b)/(I-b);j(V,i(w-Y*(w-P),P,w),1,D);const A=this._referenceEllipsoid.radius+z,C=this._referenceEllipsoid.radius+this._referenceEllipsoid.atmosphereHeight,J=Math.max(A,C),K=u-J;if(k>0&&K>U){const i=n(q,a(q,r.eye,-1)),h=n(B,r.viewForward),c=e(o(i,h)),f=.5*r.fovY,u=Math.cos(f);let d=y.infinite.near;if(c<=f)d=K*u;else{const e=n(q,r.viewUp),t=Math.tan(f),i=a(q,e,t),o=n(q,m(q,h,i)),l=x(r.eye,o,G),c=p(F,J);if(M(c,l,q)){const e=m(q,q,r.eye);d=s(e)*u}}const _=.99*Math.min(l.near,d);if(_<y.infinite.near&&_>D.near){const e=t(D.near,_,k);D.near=e}}return D}}function j(e,t,i,r){const s=U/i,n=e/t;return n>s?(r.far=e,r.near=n):(r.near=s,r.far=r.near*t),r}const b=7.983,I=16.994,w=2e4,P=100,U=2,z=.001,k=1e-4,q=h(),B=h(),D={near:0,far:0},F=u(),G=f();export{v as createNearFarHeuristic,U as minNearDistanceInMeters};
@@ -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"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as v}from"../../../chunks/vec32.js";import{fromArray as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as w}from"../../../chunks/vec42.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../geometry/Extent.js";import _ from"../../../geometry/Point.js";import f from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as C,requiresLoad as x}from"../../../geometry/projection.js";import{ViewingMode as R}from"../../ViewingMode.js";import{applyAll as P}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as S,surfaceElevationBelowRenderLocation as O}from"../camera/intersectionUtils.js";import{ConstraintsManager as T}from"./ConstraintsManager.js";import{Frustum as b}from"./Frustum.js";import{GoToOperation as j}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as I}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as M,externalToInternal as z,toArea as A,toExtent as E,applyTiltAdjustToScale as L,scaleToZoom as H,fromExtentSync as N,OrientationMode as V,getObserverForPointAtDistanceSync as B,viewScaleToCameraDistance as D,zoomToScale as G}from"../support/cameraUtils.js";import{fromCamera as U,toCameraSync as F}from"../support/viewpointUtils.js";import k from"../webgl/RenderCamera.js";import{PaddingSide as q}from"../webgl-engine/lib/rendererUtils.js";import{RenderFeature as W}from"../webgl-engine/lib/RenderFeature.js";import{PropertiesPool as J}from"../../support/PropertiesPool.js";import{RenderState as K}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as Z}from"../../webgl/FramebufferObject.js";let Q=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=ne,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?ne:0}},this._propertiesPool=new J({frustum:b},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new X}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n((()=>this.view.state.events),"before-camera-change",(({camera:e})=>e&&this._updateElevation(e))),o((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),o((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(ae)})),n((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const t=M(this.view,this.view.state.camera,te);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableCache(!0),this.setStateCamera(z(this.view,e),{applyConstraints:!1})||a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=M(this.view,this.view.state.contentCamera,te);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=z(this.view,e);this.view.state.contentCamera=null!=t?t:null}installContentCameraReset(e){if(this.removeHandles(se),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=u(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(se),this.test.contentCameraResetState.clear())})),o((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))})),o((()=>this.view.state.camera),(e=>{const t=v(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)}))],se),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?f.fromExtent(e):null}return A(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=E(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?L(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[q.TOP]/i),s=Math.round(t[q.RIGHT]/i),n=Math.round(t[q.BOTTOM]/i),o=Math.round(t[q.LEFT]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,re),this.view.state.updateCamera((e=>e.padding=re)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?U(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?H(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view.stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&Z(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?.stage?.renderer.isFeatureEnabled(W.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?.stage?.renderer;return e&&(e.isFeatureEnabled(W.PhysicalPixelRendering,K.IDLE)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.INTERACTING)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.ANIMATING))}preinit(e){return!(this._isOverridden("center")&&!C(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!C(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!C(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||C(this.viewpoint.targetGeometry?.spatialReference,e)&&C(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new T({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===R.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(ae),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),ae)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(ae),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:!0,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new j(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(S(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of $){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(z(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=N(this.view,e.targetGeometry,0,.5,V.LOCKED);return void(null!=t&&this.setStateCamera(z(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=N(this.view,e,0,.5,V.LOCKED);null!=r&&this.setStateCamera(z(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Y.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!x(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=ee){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=ie){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=B(this.view,r,a,e,t,V.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=N(this.view,e,t,i,V.ADJUST,te);return r?z(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=D(t,e,t.state.contentCamera,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(G(this.view,e))}_viewpointToCamera(e){return z(this.view,F(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&P(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new I({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||(ie.copyFrom(e),ie.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,re),ie.padding=re),ie.fullWidth=i.width,ie.fullHeight=i.height,ie.pixelRatio=i.pixelRatio,this.view.state.camera=ie),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain?.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,r=t?O(this.view,e.eye):0;e.relativeElevation=i-r}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=K.ANIMATING:this.view.interacting?this.view.state.mode=K.INTERACTING:(this.view.state.mode===K.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=K.INTERACTING:this.view.state.mode=K.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],Q.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],Q.prototype,"contentCamera",null),e([m({type:_})],Q.prototype,"center",null),e([m()],Q.prototype,"visibleArea",null),e([m({type:y})],Q.prototype,"extent",null),e([m({readOnly:!0})],Q.prototype,"frustum",null),e([m()],Q.prototype,"_constraintsManager",void 0),e([m({readOnly:!0})],Q.prototype,"constraintsManager",null),e([m()],Q.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],Q.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],Q.prototype,"ready",void 0),e([m({type:Number})],Q.prototype,"scale",null),e([m()],Q.prototype,"padding",null),e([m({readOnly:!0})],Q.prototype,"screenCenter",null),e([m({constructOnly:!0})],Q.prototype,"view",void 0),e([m({type:i})],Q.prototype,"viewpoint",null),e([m({type:Number})],Q.prototype,"zoom",null),e([m({readOnly:!0})],Q.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],Q.prototype,"_windowDevicePixelRatio",void 0),e([m()],Q.prototype,"_devicePixelRatioOverride",void 0),Q=e([d("esri.views.3d.state.ViewStateManager")],Q);class X{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Y=new Set(["camera","viewpoint","extent","scale","center","zoom"]),$=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],ee={heading:0,tilt:0},te=new t,ie=new k,re=g(),ae="pending-initial-view",se="content-camera-reset",ne=300,oe=100;export{Q as ViewStateManager,oe as interactingTimeout};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as v}from"../../../chunks/vec32.js";import{fromArray as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as w}from"../../../chunks/vec42.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../geometry/Extent.js";import _ from"../../../geometry/Point.js";import f from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as C,requiresLoad as x}from"../../../geometry/projectionUtils.js";import{ViewingMode as R}from"../../ViewingMode.js";import{applyAll as P}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as S,surfaceElevationBelowRenderLocation as O}from"../camera/intersectionUtils.js";import{ConstraintsManager as T}from"./ConstraintsManager.js";import{Frustum as b}from"./Frustum.js";import{GoToOperation as j}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as I}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as M,externalToInternal as z,toArea as A,toExtent as E,applyTiltAdjustToScale as L,scaleToZoom as H,fromExtentSync as N,OrientationMode as V,getObserverForPointAtDistanceSync as B,viewScaleToCameraDistance as D,zoomToScale as G}from"../support/cameraUtils.js";import{fromCamera as U,toCameraSync as F}from"../support/viewpointUtils.js";import k from"../webgl/RenderCamera.js";import{PaddingSide as q}from"../webgl-engine/lib/rendererUtils.js";import{RenderFeature as W}from"../webgl-engine/lib/RenderFeature.js";import{PropertiesPool as J}from"../../support/PropertiesPool.js";import{RenderState as K}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as Z}from"../../webgl/FramebufferObject.js";let Q=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=ne,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?ne:0}},this._propertiesPool=new J({frustum:b},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new X}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n((()=>this.view.state.events),"before-camera-change",(({camera:e})=>e&&this._updateElevation(e))),o((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),o((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(ae)})),n((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const t=M(this.view,this.view.state.camera,te);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableCache(!0),this.setStateCamera(z(this.view,e),{applyConstraints:!1})||a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=M(this.view,this.view.state.contentCamera,te);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=z(this.view,e);this.view.state.contentCamera=null!=t?t:null}installContentCameraReset(e){if(this.removeHandles(se),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=u(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(se),this.test.contentCameraResetState.clear())})),o((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))})),o((()=>this.view.state.camera),(e=>{const t=v(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)}))],se),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?f.fromExtent(e):null}return A(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=E(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?L(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[q.TOP]/i),s=Math.round(t[q.RIGHT]/i),n=Math.round(t[q.BOTTOM]/i),o=Math.round(t[q.LEFT]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,re),this.view.state.updateCamera((e=>e.padding=re)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?U(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?H(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view.stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&Z(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?.stage?.renderer.isFeatureEnabled(W.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?.stage?.renderer;return e&&(e.isFeatureEnabled(W.PhysicalPixelRendering,K.IDLE)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.INTERACTING)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.ANIMATING))}preinit(e){return!(this._isOverridden("center")&&!C(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!C(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!C(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||C(this.viewpoint.targetGeometry?.spatialReference,e)&&C(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new T({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===R.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(ae),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),ae)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(ae),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:!0,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new j(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(S(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of $){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(z(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=N(this.view,e.targetGeometry,0,.5,V.LOCKED);return void(null!=t&&this.setStateCamera(z(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=N(this.view,e,0,.5,V.LOCKED);null!=r&&this.setStateCamera(z(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Y.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!x(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=ee){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=ie){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=B(this.view,r,a,e,t,V.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=N(this.view,e,t,i,V.ADJUST,te);return r?z(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=D(t,e,t.state.contentCamera,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(G(this.view,e))}_viewpointToCamera(e){return z(this.view,F(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&P(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new I({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||(ie.copyFrom(e),ie.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,re),ie.padding=re),ie.fullWidth=i.width,ie.fullHeight=i.height,ie.pixelRatio=i.pixelRatio,this.view.state.camera=ie),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain?.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,r=t?O(this.view,e.eye):0;e.relativeElevation=i-r}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=K.ANIMATING:this.view.interacting?this.view.state.mode=K.INTERACTING:(this.view.state.mode===K.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=K.INTERACTING:this.view.state.mode=K.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],Q.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],Q.prototype,"contentCamera",null),e([m({type:_})],Q.prototype,"center",null),e([m()],Q.prototype,"visibleArea",null),e([m({type:y})],Q.prototype,"extent",null),e([m({readOnly:!0})],Q.prototype,"frustum",null),e([m()],Q.prototype,"_constraintsManager",void 0),e([m({readOnly:!0})],Q.prototype,"constraintsManager",null),e([m()],Q.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],Q.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],Q.prototype,"ready",void 0),e([m({type:Number})],Q.prototype,"scale",null),e([m()],Q.prototype,"padding",null),e([m({readOnly:!0})],Q.prototype,"screenCenter",null),e([m({constructOnly:!0})],Q.prototype,"view",void 0),e([m({type:i})],Q.prototype,"viewpoint",null),e([m({type:Number})],Q.prototype,"zoom",null),e([m({readOnly:!0})],Q.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],Q.prototype,"_windowDevicePixelRatio",void 0),e([m()],Q.prototype,"_devicePixelRatioOverride",void 0),Q=e([d("esri.views.3d.state.ViewStateManager")],Q);class X{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Y=new Set(["camera","viewpoint","extent","scale","center","zoom"]),$=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],ee={heading:0,tilt:0},te=new t,ie=new k,re=g(),ae="pending-initial-view",se="content-camera-reset",ne=300,oe=100;export{Q as ViewStateManager,oe as interactingTimeout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as h,t as p,f as d,g as u,c as _,u as f,l as v,i as C,n as g,h as y,j as w,E as O,e as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{k as L,b as M,t as A}from"../../../../chunks/sphere.js";import{angle as T}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as I}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as D}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as R}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as U}from"../../camera/constraintUtils/TiltMode.js";import{TiltRange as k}from"../Constraints.js";import{InteractiveController as H}from"./InteractiveController.js";import{panMotionToRotationMatrix as N,onSurfaceTiltToEyeTiltGlobal as P,offSurfaceTiltToEyeTiltGlobal as G}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as B}from"../../support/cameraUtils.js";import{createDirectionUp as V}from"../../support/cameraUtilsInternal.js";import K from"../../webgl/RenderCamera.js";import{extractTransformation as X,isZeroTransformation as Z,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let J=class extends H{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new K,this._headingStart=0,this._constraintOptions=new I(D.ALL,R.NONE,0,new K,null,U.LOOK_AROUND)}handleEventGamepad(t){const e=X(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||Z(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce(((t,e)=>e>0?t+1:t),0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);Z(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,at),this._applyDisabledMovementTypes(at),this._applyPan(at.pan),this._applyRotate(at.rotate),this._applyZoom(at.zoom),this._applyAscend(at.ascend),this._constraintOptions.interactionType=R.NONE,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h(rt,e.center,e.eye),p(rt,rt,t.matrix),e.center=d(rt,rt,e.eye),e.up=p(rt,e.up,t.matrix),this._constraintOptions.interactionType=R.LOOK_AROUND,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p(rt,e.eye,t.matrix),e.center=p(rt,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p(rt,e.up,t.matrix)),this._constraintOptions.interactionType=R.PAN,this._constraintOptions.selection=D.ALL,z(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(rt,this.currentCamera.eye,u(E.get(),e,t)),_(ot,e),f(ot,ot),this._constraintOptions.interactionDirection=ot,this._constraintOptions.interactionType=R.ZOOM,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());this._constraintOptions.interactionDirection=_(ot,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(rt,this.currentCamera.eye,i),this.currentCamera.center=u(rt,this.currentCamera.center,i)}else{const i=u(E.get(),e,t);this.currentCamera.eye=d(rt,this.currentCamera.eye,i),this.currentCamera.center=d(rt,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=R.ASCEND,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){nt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,rt)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,m=this._transformation,l=this.view.navigation.gamepad,h=C(E.get(),s[0],s[1],0);g(h,h);const p=m.translation[0]*t.pan;if(0!==p){const t=u(E.get(),o,p);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-m.translation[1]*t.pan;if(0!==e){const t=u(E.get(),h,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=m.zoom*t.zoom;break}case"zoom":r.zoom=(-m.translation[1]+m.zoom)*t.zoom;break;default:e(l.mode)}const d=m.translation[2]*t.ascend;r.ascend=d;const _=-m.heading*t.rotate;0!==_&&(c(r.rotate.matrix,r.rotate.matrix,_,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,E.get())),r.rotate.enabled=!0);const f=m.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+f,k.min,k.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(E.get(),r,a);g(n,n),f(n,n),N(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(at.pan,this._tmpCamera);const m=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,m);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=P(k.min,e.origin,a,r);let s=0,n=0;const c=E.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);s=P(t,e.origin,a,r),n=P(k.max,e.origin,a,r)}else{L(M(A,a+r.radius),e,c);const t=Math.PI+T(e.direction,c);s=G(t,e.origin,a,r),n=G(k.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=B(this.view,e,0,W,st),o=i.intersectManifoldClosestSilhouette(j(e,r),t,E.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,O(E.get(),e,a.center)),t,E.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,E.get());if(o){const e=h(E.get(),t,s),i=v(e);u(e,e,1/i);const r=g(E.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(Y,o))}{const i=_(E.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:tt}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=E.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=$*r.width,h=$*r.width,p=c*Math.tan(.5*r.fovX)/m,d=p/a,u=p/this._computeHeadingRotateRadius(s),_=n-e;return{pan:(o?d:p)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*_-_),zoom:2**(l*t/m)*c-c,rotate:i(u*h,et,it)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&m(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&m(t.rotate.matrix))}static activatesFor(t,e){const i=X(e,t.navigation.gamepad,Q);return!("end"===e.action||Z(i))}};t([o({constructOnly:!0})],J.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],J.prototype,"disableMovements",void 0),J=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],J);const Q={translation:[0,0,0],heading:0,tilt:0,zoom:0},W=80,Y=r(W),$=.75,tt=5,et=r(30),it=r(80),at={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},rt=S(),ot=S(),st=V();function nt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,m(t.pan.matrix),t.rotate.enabled=!1,m(t.rotate.matrix)}export{J as GamepadKeyboardController};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{translate as n,rotate as c,identity as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as h,t as p,f as d,g as u,c as _,u as f,l as v,i as C,n as g,h as y,j as w,E as O,e as b}from"../../../../chunks/vec32.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{wrap as j}from"../../../../geometry/support/ray.js";import{j as L,b as M,t as A}from"../../../../chunks/sphere.js";import{angle as T}from"../../../../geometry/support/vector.js";import{sv3d as E}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as I}from"../../camera/constraintUtils/ConstraintOptions.js";import{ConstraintTypes as D}from"../../camera/constraintUtils/ConstraintTypes.js";import{InteractionType as R}from"../../camera/constraintUtils/InteractionType.js";import{TiltMode as U}from"../../camera/constraintUtils/TiltMode.js";import{TiltRange as k}from"../Constraints.js";import{InteractiveController as H}from"./InteractiveController.js";import{panMotionToRotationMatrix as N,onSurfaceTiltToEyeTiltGlobal as P,offSurfaceTiltToEyeTiltGlobal as G}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as B}from"../../support/cameraUtils.js";import{createDirectionUp as V}from"../../support/cameraUtilsInternal.js";import K from"../../webgl/RenderCamera.js";import{extractTransformation as X,isZeroTransformation as Z,extractTransformationKeyboard as q}from"../../../navigation/gamepadAndKeyboardUtils.js";let J=class extends H{constructor(t){super(t),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new K,this._headingStart=0,this._constraintOptions=new I(D.ALL,R.NONE,0,new K,null,U.LOOK_AROUND)}handleEventGamepad(t){const e=X(t,this.view.navigation.gamepad,this._transformation);("end"===t.action||Z(e))&&this.finishController()}activateDirection(t){this._keysButtonState[t]=1,q(this._keysButtonState,this._transformation)}directionActive(t){return 1===this._keysButtonState[t]}countActiveDirections(){return this._keysButtonState.reduce(((t,e)=>e>0?t+1:t),0)}deactivateDirection(t){this._keysButtonState[t]=0;const e=q(this._keysButtonState,this._transformation);Z(e)&&this.finishController()}onControllerStart(t){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this._filteredSurfaceElevation+=i*(e-this._filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this._constraintOptions.interactionStartCamera?.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,at),this._applyDisabledMovementTypes(at),this._applyPan(at.pan),this._applyRotate(at.rotate),this._applyZoom(at.zoom),this._applyAscend(at.ascend),this._constraintOptions.interactionType=R.NONE,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this._transformation.heading&&(this._headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h(rt,e.center,e.eye),p(rt,rt,t.matrix),e.center=d(rt,rt,e.eye),e.up=p(rt,e.up,t.matrix),this._constraintOptions.interactionType=R.LOOK_AROUND,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,e,this._constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=p(rt,e.eye,t.matrix),e.center=p(rt,e.center,t.matrix);this.view.state.isGlobal&&(e.up=p(rt,e.up,t.matrix)),this._constraintOptions.interactionType=R.PAN,this._constraintOptions.selection=D.ALL,z(this.view,e,this._constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=d(rt,this.currentCamera.eye,u(E.get(),e,t)),_(ot,e),f(ot,ot),this._constraintOptions.interactionDirection=ot,this._constraintOptions.interactionType=R.ZOOM,this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,E.get());this._constraintOptions.interactionDirection=_(ot,e);if(this.view.state.isGlobal){const e=v(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=u(rt,this.currentCamera.eye,i),this.currentCamera.center=u(rt,this.currentCamera.center,i)}else{const i=u(E.get(),e,t);this.currentCamera.eye=d(rt,this.currentCamera.eye,i),this.currentCamera.center=d(rt,this.currentCamera.center,i)}this._updateCameraCenter(),this._constraintOptions.interactionType=R.ASCEND,this._constraintOptions.selection=D.COLLISION,z(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=D.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){nt(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,rt)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,m=this._transformation,l=this.view.navigation.gamepad,h=C(E.get(),s[0],s[1],0);g(h,h);const p=m.translation[0]*t.pan;if(0!==p){const t=u(E.get(),o,p);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-m.translation[1]*t.pan;if(0!==e){const t=u(E.get(),h,e);n(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=m.zoom*t.zoom;break}case"zoom":r.zoom=(-m.translation[1]+m.zoom)*t.zoom;break;default:e(l.mode)}const d=m.translation[2]*t.ascend;r.ascend=d;const _=-m.heading*t.rotate;0!==_&&(c(r.rotate.matrix,r.rotate.matrix,_,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,E.get())),r.rotate.enabled=!0);const f=m.tilt*t.rotate,v=F(this.view.renderCoordsHelper,a.center,a.eye),y=i(v+f,k.min,k.max)-v;y&&(c(r.rotate.matrix,r.rotate.matrix,y,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this._transformation,s=this.view.navigation.gamepad,n=y(E.get(),r,a);g(n,n),f(n,n),N(this.startCamera,e,o,t,this.view.camera.heading,this._headingStart,this.view.camera.tilt,i,s),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(at.pan,this._tmpCamera);const m=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const h=-o.heading*t.rotate;0!==h&&(c(i.rotate.matrix,i.rotate.matrix,h,this._tmpCamera.eye),i.rotate.enabled=!0);const p=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(p,e.ray,m);0!==d&&(c(i.rotate.matrix,i.rotate.matrix,d,this._tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,a){const r=x(this.view.spatialReference),o=P(k.min,e.origin,a,r);let s=0,n=0;const c=E.get();if(this.view.renderCoordsHelper.intersectManifold(e,a,c)){const t=F(this.view.renderCoordsHelper,c,e.origin);s=P(t,e.origin,a,r),n=P(k.max,e.origin,a,r)}else{L(M(A,a+r.radius),e,c);const t=Math.PI+T(e.direction,c);s=G(t,e.origin,a,r),n=G(k.max,e.origin,a,r)}return i(s+t,o,n)-s}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=B(this.view,e,0,W,st),o=i.intersectManifoldClosestSilhouette(j(e,r),t,E.get()),s=w(e,o),n=i.intersectManifoldClosestSilhouette(j(e,O(E.get(),e,a.center)),t,E.get()),c=w(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this._filteredSurfaceElevation,E.get());if(o){const e=h(E.get(),t,s),i=v(e);u(e,e,1/i);const r=g(E.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(Y,o))}{const i=_(E.get(),t);return e.setAltitude(i,this._filteredSurfaceElevation),w(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:tt}_computeVelocities(t){const e=this._filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=E.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=$*r.width,h=$*r.width,p=c*Math.tan(.5*r.fovX)/m,d=p/a,u=p/this._computeHeadingRotateRadius(s),_=n-e;return{pan:(o?d:p)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*_-_),zoom:2**(l*t/m)*c-c,rotate:i(u*h,et,it)*t}}_applyDisabledMovementTypes(t){null==this.disableMovements||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&m(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&m(t.rotate.matrix))}static activatesFor(t,e){const i=X(e,t.navigation.gamepad,Q);return!("end"===e.action||Z(i))}};t([o({constructOnly:!0})],J.prototype,"gamepadDevice",void 0),t([o({constructOnly:!0})],J.prototype,"disableMovements",void 0),J=t([s("esri.views.3d.state.controllers.GamepadKeyboardController")],J);const Q={translation:[0,0,0],heading:0,tilt:0,zoom:0},W=80,Y=r(W),$=.75,tt=5,et=r(30),it=r(80),at={zoom:0,ascend:0,pan:{enabled:!1,matrix:l()},rotate:{enabled:!1,matrix:l()}},rt=S(),ot=S(),st=V();function nt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,m(t.pan.matrix),t.rotate.enabled=!1,m(t.rotate.matrix)}export{J as GamepadKeyboardController};
@@ -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{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as i,exactEquals as s,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as m,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as h,l as M,d as g,t as y,f as b,n as d,s as x,c as v,h as j,g as z,m as P,i as w}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as H,fromPoints as S,axis as k,wrapAxisAngle as A}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as E,vectorCoordinates as T}from"../../../../geometry/support/coordinateSystem.js";import{create as U,fromNormalAndOffset as G,intersectRay as R}from"../../../../geometry/support/plane.js";import{c as q,k as C,h as F,a as V}from"../../../../chunks/sphere.js";import{sm4d as O,sv3d as W}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as B,fromScreen as D}from"../../support/geometryUtils/ray.js";import{intersectScreen as J}from"../../support/geometryUtils/sphere.js";import K from"../../webgl/RenderCamera.js";import{terrainId as L}from"../../webgl-engine/lib/verticalOffsetUtils.js";var N;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(N||(N={}));const Q=30,X=[1,3e8],Y=80,Z=8,$=200,_=1508e5,tt=5,et=50,nt=5,ot=10,rt=90,at={exclude:new Set([L])};function it(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function st(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function ct(t,e,n){const o=i(O.get(),n[3],k(n));null==o||s(o,m)||(g(re,t.eye,e),y(re,re,o),t.eye=b(re,re,e),g(re,t.center,e),y(re,re,o),t.center=b(re,re,e),t.up=y(re,t.up,o))}function lt(t,e,n,o){return R(t,D(e,n,le),o)}function mt(t,e,n,o){return R(t,B(e,n,le),o)}function ut(t,e,n,o){const r=W.get();let a=1-n;g(r,e,t.eye);const i=M(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(z(r,r,a),t.eye=b(re,t.eye,r),t.center=P(re,t.center,e,a))}function ft(t,e,n){e.getScreenCenter(pt),J(t,e,pt,re)&&(e.center=re);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=z(W.get(),e.viewForward,r);e.eye=g(re,e.center,a)}const pt=a();function ht(t,e){w(e,0,0,0);for(const n of t)b(e,e,n);z(e,e,1/t.length)}function Mt(t,e,n,o){return Math.sin(t/M(e))*(n+o.radius)}function gt(t,e,n,o){return Mt(Math.PI/2,e,n,o)+(t-Math.PI/2)}var yt;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(yt||(yt={}));const bt={Elevation:3e4,Angle:e(16)},dt=e(80);function xt(t,e,n,o,r,a){const i=I(),s=q();let c=!0,l=!0;return t.intersectScreen(n,i,a)?s[3]=M(i):(l=!1,e.aboveGround&&r!==N.Ellipsoid?s[3]=Math.max(M(e.center),.9*o.radius):s[3]=M(e.eye)-e.relativeElevation,r===N.Silhouette?Pt(s,e,n,i):c=J(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:l}}function vt(t,e,n,o){const r=t.relativeElevation;if(r>bt.Elevation&&"global"===o)return yt.Horizontal;B(t,e,me);const a=Math.sign(r),i=n.worldUpAtPosition(t.eye,re);return-a*h(i,me.direction)<Math.sin(bt.Angle)*M(me.direction)?yt.Vertical:yt.Horizontal}function jt(t,e,n){g(zt,n,e),t.eye=g(re,t.eye,zt),t.center=g(re,t.center,zt)}const zt=I();function Pt(t,e,n,o){const r=B(e,n,le);return null!=r&&(C(t,r,wt),F(t,r,o)?!(x(wt,r.origin)<x(o,r.origin))||(v(o,wt),!1):(g(It,e.eye,e.center),d(It,It),G(It,-h(d(It,It),wt),Ht),R(Ht,r,o),!1))}const wt=I(),It=I(),Ht=U();function St(a,i,s,c,l,m){let u=0;if(j(se,a,i),g(ae,a,i),M(a)<=l||!c.aboveGround){j(s,ae,c.eye);const f=h(a,i)/(M(a)*M(i));if(f<.9999)u=o(f);else{const t=M(j(I(),a,i))/(M(a)*M(i));u=r(t)}const p=Math.cos(n(t.normalize(e(m)),0,dt));u=-u-Math.max(0,M(i)-l)/(p*l)}else g(kt,c.eye,c.center),j(s,ae,kt),u=-M(ae)/l;return d(s,s),z(s,s,M(se)),u}const kt=I();function At(r,a,i,s){let c,l;const m=Math.cos(n(t.normalize(e(s)),0,dt));return c=a>i?-(a-i)/(m*i):a<-i?Math.PI-(a+i)/(m*i):o(a/i),l=r>i?-(r-i)/(m*i):r<-i?Math.PI-(r+i)/(m*i):o(r/i),(l-c)*i}function Et(t,e,n,o,r,a,i,s,c,l){const m=At(t[2],e[2],a[3],s),u=c?At(t[0],e[0],a[3],180):e[0]-t[0],p=Math.sin(i)*u-Math.cos(i)*m,M=Math.cos(i)*u+Math.sin(i)*m;d(re,r);const g=c?p/Math.sqrt(Math.abs(a[3]**2-h(n,re)**2)):p/a[3],y=M/Math.sqrt(Math.abs(a[3]**2-h(n,o)**2));f(l,g,y)}function Tt(t,e,n,o,r,a,i,s,c,l){j(se,t,e),E(a.up,a.eye,Nt,Qt,Xt),E([0,0,1],a.eye,Jt,Kt,Lt),v(n,Kt),v(o,Jt),d(n,n),z(n,n,M(se)),T(t,d(Qt,Qt),d(Xt,Xt),d(Nt,Nt),Yt),T(e,Qt,Xt,Nt,Zt),Et(Yt,Zt,t,Jt,Kt,i,s,c,l,r)}function Ut(t,e,n,o,r,a,s){i(te,r,o),i(ee,s,a),l(ne,te,ee),g(e,t,n),y(e,e,ne),b(e,e,n)}function Gt(t,e,n,o,r,a){i(te,o,n),i(ee,a,r),l(ne,te,ee),g(re,t.eye,e),y(re,re,ne),t.eye=b(re,re,e),g(re,t.center,e),y(re,re,ne),t.center=b(re,re,e),g(re,t.up,e),y(re,re,ne),t.up=b(re,re,e)}const Rt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let qt=!1;function Ct(t,e,n,o,r,a){const i=Math.abs(o)>Math.PI-Rt.Angle||Math.abs(o)<Rt.Angle,s=(Math.abs(t[2])<n*Rt.Pole||Math.abs(e)>n)&&a;return i&&s?!qt&&r<Rt.Tilt-Rt.TiltHysteresisMargin?qt=!0:qt&&r>Rt.Tilt+Rt.TiltHysteresisMargin&&(qt=!1):qt=!1,qt}function Ft(t,e,n,o,r,a){if(a)S(n,o,_t),ct(e,V(t),_t);else{const a=St(n,o,ce,e,t[3],r);ct(e,V(t),A(ce,a))}}function Vt(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let l,m;v(oe,o),ie.copyFrom(e);for(let u=0;u<s&&x(n,oe)>c&&(l=x(n,oe),Tt(n,oe,Kt,Jt,$t,ie,t,r,a,i),Gt(ie,V(t),Jt,$t[1],Kt,$t[0]),Ut(oe,oe,V(t),Jt,$t[1],Kt,$t[0]),m=x(n,oe),m<l||0===u);u++)e.copyFrom(ie)}function Ot(n,o,r,a,i,s,c){Ct(r,h(o.up,r),n[3],-t.normalize(e(i)),s,o.aboveGround)?Vt(n,o,r,a,-t.normalize(e(i)),s,c):Ft(n,o,r,a,s,c)}function Wt(t,e,n,o,r,a){const{eye:i}=t;E([0,0,1],i,Jt,Kt,Lt);const s=e.translation[0]*n.pan,l="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-h(t.center,Jt)**2/M(t.center)**2)),.5),u=(Math.sin(a)*l+Math.cos(a)*s)/m,f=-Math.cos(a)*l+Math.sin(a)*s;switch(c(o.pan.matrix,o.pan.matrix,u,Jt),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,f,Kt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Bt(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=j(W.get(),i,a),l=e.translation[0]*n.pan;switch(0!==l&&(c(o.pan.matrix,o.pan.matrix,-l,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Dt(n,o,r,a,i,s,c,l,m){Ct(n.center,h(n.up,n.center),M(n.center),-t.normalize(e(s)),c,o.aboveGround)?Wt(o,r,a,l,m,-t.normalize(e(i))):Bt(o,r,a,l,m)}const Jt=I(),Kt=I(),Lt=I(),Nt=I(),Qt=I(),Xt=I(),Yt=I(),Zt=I(),$t=p(),_t=H(),te=u(),ee=u(),ne=u(),oe=I(),re=I(),ae=I(),ie=new K,se=I(),ce=I(),le={origin:I(),direction:I()},me={origin:I(),direction:I()};export{yt as NavigationMode,N as SpherePickPointFallback,dt as TiltThresholdPanningSpeed,bt as VerticalPanTresholds,jt as applyPanPlanar,Ft as applyPanSphericalDirectRotation,Vt as applyPanSphericalPreserveHeading,ct as applyRotation,Gt as applyRotationWithTwoAxes,ft as applyZoomOnSphere,ut as applyZoomToPoint,ht as centroid,at as contentIntersectorOptions,X as distanceClampValues,lt as intersectPlaneFromScreenPoint,mt as intersectPlaneFromScreenPointAtEye,At as lengthFromPoints,et as minHeightLimit,vt as navigationMode,it as normalizeCoordinate,st as normalizeRotationDelta,gt as offSurfaceTiltToEyeTiltGlobal,Mt as onSurfaceTiltToEyeTiltGlobal,tt as panDistanceModifier,Dt as panMotionToRotationMatrix,Ot as panToPosition,xt as pickPointAndInitSphere,Q as pivotDistanceModifier,Rt as preservingHeadingThresholds,nt as rotatePivotDistanceModifier,ot as rotatePivotMinDistanceModifier,Ut as rotatePointAroundTwoAxes,rt as rotateScreenPixelArea,St as rotationAngleAndAxisDirectRotation,Tt as rotationAnglesAndAxesHeadingPreserving,Et as rotationAnglesHeadingPreserving,Y as screenPixelArea,Ct as shouldPreserveHeading,Pt as sphereOrPlanePointFromScreenPoint,Z as zoomDistanceModifier,_ as zoomMaxDistanceModifier,$ as zoomMinDistanceModifier};
5
+ import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o,asinClamped as r}from"../../../../core/mathUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{fromRotation as i,exactEquals as s,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as m,create as u}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as h,l as M,d as g,t as y,f as b,n as d,s as x,c as v,h as j,g as z,m as P,i as w}from"../../../../chunks/vec32.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as H,fromPoints as S,axis as A,wrapAxisAngle as E}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as k,vectorCoordinates as T}from"../../../../geometry/support/coordinateSystem.js";import{create as U,fromNormalAndOffset as G,intersectRay as R}from"../../../../geometry/support/plane.js";import{c as q,j as C,i as F,a as V}from"../../../../chunks/sphere.js";import{sm4d as O,sv3d as W}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as B,fromScreen as D}from"../../support/geometryUtils/ray.js";import{intersectScreen as J}from"../../support/geometryUtils/sphere.js";import K from"../../webgl/RenderCamera.js";import{terrainId as L}from"../../webgl-engine/lib/verticalOffsetUtils.js";var N;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(N||(N={}));const Q=30,X=[1,3e8],Y=80,Z=8,$=200,_=1508e5,tt=5,et=50,nt=5,ot=10,rt=90,at={exclude:new Set([L])};function it(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function st(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function ct(t,e,n){const o=i(O.get(),n[3],A(n));null==o||s(o,m)||(g(re,t.eye,e),y(re,re,o),t.eye=b(re,re,e),g(re,t.center,e),y(re,re,o),t.center=b(re,re,e),t.up=y(re,t.up,o))}function lt(t,e,n,o){return R(t,D(e,n,le),o)}function mt(t,e,n,o){return R(t,B(e,n,le),o)}function ut(t,e,n,o){const r=W.get();let a=1-n;g(r,e,t.eye);const i=M(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(z(r,r,a),t.eye=b(re,t.eye,r),t.center=P(re,t.center,e,a))}function ft(t,e,n){e.getScreenCenter(pt),J(t,e,pt,re)&&(e.center=re);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=z(W.get(),e.viewForward,r);e.eye=g(re,e.center,a)}const pt=a();function ht(t,e){w(e,0,0,0);for(const n of t)b(e,e,n);z(e,e,1/t.length)}function Mt(t,e,n,o){return Math.sin(t/M(e))*(n+o.radius)}function gt(t,e,n,o){return Mt(Math.PI/2,e,n,o)+(t-Math.PI/2)}var yt;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(yt||(yt={}));const bt={Elevation:3e4,Angle:e(16)},dt=e(80);function xt(t,e,n,o,r,a){const i=I(),s=q();let c=!0,l=!0;return t.intersectScreen(n,i,a)?s[3]=M(i):(l=!1,e.aboveGround&&r!==N.Ellipsoid?s[3]=Math.max(M(e.center),.9*o.radius):s[3]=M(e.eye)-e.relativeElevation,r===N.Silhouette?Pt(s,e,n,i):c=J(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:l}}function vt(t,e,n,o){const r=t.relativeElevation;if(r>bt.Elevation&&"global"===o)return yt.Horizontal;B(t,e,me);const a=Math.sign(r),i=n.worldUpAtPosition(t.eye,re);return-a*h(i,me.direction)<Math.sin(bt.Angle)*M(me.direction)?yt.Vertical:yt.Horizontal}function jt(t,e,n){g(zt,n,e),t.eye=g(re,t.eye,zt),t.center=g(re,t.center,zt)}const zt=I();function Pt(t,e,n,o){const r=B(e,n,le);return null!=r&&(C(t,r,wt),F(t,r,o)?!(x(wt,r.origin)<x(o,r.origin))||(v(o,wt),!1):(g(It,e.eye,e.center),d(It,It),G(It,-h(d(It,It),wt),Ht),R(Ht,r,o),!1))}const wt=I(),It=I(),Ht=U();function St(a,i,s,c,l,m){let u=0;if(j(se,a,i),g(ae,a,i),M(a)<=l||!c.aboveGround){j(s,ae,c.eye);const f=h(a,i)/(M(a)*M(i));if(f<.9999)u=o(f);else{const t=M(j(I(),a,i))/(M(a)*M(i));u=r(t)}const p=Math.cos(n(t.normalize(e(m)),0,dt));u=-u-Math.max(0,M(i)-l)/(p*l)}else g(At,c.eye,c.center),j(s,ae,At),u=-M(ae)/l;return d(s,s),z(s,s,M(se)),u}const At=I();function Et(r,a,i,s){let c,l;const m=Math.cos(n(t.normalize(e(s)),0,dt));return c=a>i?-(a-i)/(m*i):a<-i?Math.PI-(a+i)/(m*i):o(a/i),l=r>i?-(r-i)/(m*i):r<-i?Math.PI-(r+i)/(m*i):o(r/i),(l-c)*i}function kt(t,e,n,o,r,a,i,s,c,l){const m=Et(t[2],e[2],a[3],s),u=c?Et(t[0],e[0],a[3],180):e[0]-t[0],p=Math.sin(i)*u-Math.cos(i)*m,M=Math.cos(i)*u+Math.sin(i)*m;d(re,r);const g=c?p/Math.sqrt(Math.abs(a[3]**2-h(n,re)**2)):p/a[3],y=M/Math.sqrt(Math.abs(a[3]**2-h(n,o)**2));f(l,g,y)}function Tt(t,e,n,o,r,a,i,s,c,l){j(se,t,e),k(a.up,a.eye,Nt,Qt,Xt),k([0,0,1],a.eye,Jt,Kt,Lt),v(n,Kt),v(o,Jt),d(n,n),z(n,n,M(se)),T(t,d(Qt,Qt),d(Xt,Xt),d(Nt,Nt),Yt),T(e,Qt,Xt,Nt,Zt),kt(Yt,Zt,t,Jt,Kt,i,s,c,l,r)}function Ut(t,e,n,o,r,a,s){i(te,r,o),i(ee,s,a),l(ne,te,ee),g(e,t,n),y(e,e,ne),b(e,e,n)}function Gt(t,e,n,o,r,a){i(te,o,n),i(ee,a,r),l(ne,te,ee),g(re,t.eye,e),y(re,re,ne),t.eye=b(re,re,e),g(re,t.center,e),y(re,re,ne),t.center=b(re,re,e),g(re,t.up,e),y(re,re,ne),t.up=b(re,re,e)}const Rt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let qt=!1;function Ct(t,e,n,o,r,a){const i=Math.abs(o)>Math.PI-Rt.Angle||Math.abs(o)<Rt.Angle,s=(Math.abs(t[2])<n*Rt.Pole||Math.abs(e)>n)&&a;return i&&s?!qt&&r<Rt.Tilt-Rt.TiltHysteresisMargin?qt=!0:qt&&r>Rt.Tilt+Rt.TiltHysteresisMargin&&(qt=!1):qt=!1,qt}function Ft(t,e,n,o,r,a){if(a)S(n,o,_t),ct(e,V(t),_t);else{const a=St(n,o,ce,e,t[3],r);ct(e,V(t),E(ce,a))}}function Vt(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let l,m;v(oe,o),ie.copyFrom(e);for(let u=0;u<s&&x(n,oe)>c&&(l=x(n,oe),Tt(n,oe,Kt,Jt,$t,ie,t,r,a,i),Gt(ie,V(t),Jt,$t[1],Kt,$t[0]),Ut(oe,oe,V(t),Jt,$t[1],Kt,$t[0]),m=x(n,oe),m<l||0===u);u++)e.copyFrom(ie)}function Ot(n,o,r,a,i,s,c){Ct(r,h(o.up,r),n[3],-t.normalize(e(i)),s,o.aboveGround)?Vt(n,o,r,a,-t.normalize(e(i)),s,c):Ft(n,o,r,a,s,c)}function Wt(t,e,n,o,r,a){const{eye:i}=t;k([0,0,1],i,Jt,Kt,Lt);const s=e.translation[0]*n.pan,l="zoom"===r.mode?0:e.translation[1]*n.pan,m=Math.max(Math.sqrt(Math.abs(1-h(t.center,Jt)**2/M(t.center)**2)),.5),u=(Math.sin(a)*l+Math.cos(a)*s)/m,f=-Math.cos(a)*l+Math.sin(a)*s;switch(c(o.pan.matrix,o.pan.matrix,u,Jt),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,f,Kt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Bt(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=j(W.get(),i,a),l=e.translation[0]*n.pan;switch(0!==l&&(c(o.pan.matrix,o.pan.matrix,-l,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Dt(n,o,r,a,i,s,c,l,m){Ct(n.center,h(n.up,n.center),M(n.center),-t.normalize(e(s)),c,o.aboveGround)?Wt(o,r,a,l,m,-t.normalize(e(i))):Bt(o,r,a,l,m)}const Jt=I(),Kt=I(),Lt=I(),Nt=I(),Qt=I(),Xt=I(),Yt=I(),Zt=I(),$t=p(),_t=H(),te=u(),ee=u(),ne=u(),oe=I(),re=I(),ae=I(),ie=new K,se=I(),ce=I(),le={origin:I(),direction:I()},me={origin:I(),direction:I()};export{yt as NavigationMode,N as SpherePickPointFallback,dt as TiltThresholdPanningSpeed,bt as VerticalPanTresholds,jt as applyPanPlanar,Ft as applyPanSphericalDirectRotation,Vt as applyPanSphericalPreserveHeading,ct as applyRotation,Gt as applyRotationWithTwoAxes,ft as applyZoomOnSphere,ut as applyZoomToPoint,ht as centroid,at as contentIntersectorOptions,X as distanceClampValues,lt as intersectPlaneFromScreenPoint,mt as intersectPlaneFromScreenPointAtEye,Et as lengthFromPoints,et as minHeightLimit,vt as navigationMode,it as normalizeCoordinate,st as normalizeRotationDelta,gt as offSurfaceTiltToEyeTiltGlobal,Mt as onSurfaceTiltToEyeTiltGlobal,tt as panDistanceModifier,Dt as panMotionToRotationMatrix,Ot as panToPosition,xt as pickPointAndInitSphere,Q as pivotDistanceModifier,Rt as preservingHeadingThresholds,nt as rotatePivotDistanceModifier,ot as rotatePivotMinDistanceModifier,Ut as rotatePointAroundTwoAxes,rt as rotateScreenPixelArea,St as rotationAngleAndAxisDirectRotation,Tt as rotationAnglesAndAxesHeadingPreserving,kt as rotationAnglesHeadingPreserving,Y as screenPixelArea,Ct as shouldPreserveHeading,Pt as sphereOrPlanePointFromScreenPoint,Z as zoomDistanceModifier,_ as zoomMaxDistanceModifier,$ as zoomMinDistanceModifier};
@@ -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"../../../Camera.js";import{Cyclical as t}from"../../../core/Cyclical.js";import n from"../../../core/Logger.js";import{rad2deg as r,deg2rad as i,asinClamped as o}from"../../../core/mathUtils.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{c,j as l,F as s,g as u,f,l as m}from"../../../chunks/vec32.js";import{create as p,clone as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import y from"../../../geometry/Point.js";import{projectWithZConversion as g,project as v}from"../../../geometry/projection.js";import w from"../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as R,projectPointToVector as T}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPointAsync as x,projectVectorToPoint as S}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as M}from"../../../geometry/projection/projectVectorToVector.js";import{ViewingMode as j}from"../../ViewingMode.js";import{cameraOnContentAlongViewDirection as z}from"../camera/intersectionUtils.js";import{c as C}from"../../../chunks/cameraUtilsPlanar.js";import{c as A}from"../../../chunks/cameraUtilsSpherical.js";import{getGreatCircleSpanAt as b}from"./earthUtils.js";import{getElevationAtPoint as U}from"./ElevationProvider.js";import{isSpatialReferenceSupported as D}from"../../support/spatialReferenceSupport.js";const L=()=>n.getLogger("esri.views.3d.support.cameraUtils"),P=96*39.37,E=1,G=8,H=5,F=1,J={heading:0,tilt:0},O=p(),q=new t(-20037508.342788905,20037508.342788905),I=new t(-180,180);var k;function V(e){return e.spatialReference??w.WGS84}function X({state:e}){return e.isGlobal?A:C}function K(e,t,n,r,i){return X(e).headingTiltToDirectionUp(t,n,r,i)}function W(e,t){if(null==t)return null;const n=e.renderSpatialReference,r=X(e).headingTiltToDirectionUp,o=p();if(!T(t.position,o,n))return null;const a=r(o,t.heading,t.tilt);u(a.direction,a.direction,e.state.camera.distance),f(a.direction,a.direction,o);const c=z(e,o,a.direction,a.up);return c.fov=i(t.fov),c.row=t.layout.row,c.rows=t.layout.rows,c.column=t.layout.column,c.columns=t.layout.columns,c}!function(e){e[e.LOCKED=0]="LOCKED",e[e.ADJUST=1]="ADJUST"}(k||(k={}));const Y=p();function N(t,n,i){const o=t.renderSpatialReference,a=le(t,n.eye,n.viewForward,n.up,J);let c=V(t);return M(n.eye,o,Y,c)||(c=w.WGS84,M(n.eye,o,Y,c)),null==i?i=new e(new y(Y,c),a.heading,a.tilt,r(n.fov)):(i.position.x=Y[0],i.position.y=Y[1],i.position.z=Y[2],i.position.spatialReference=c,i.heading=a.heading,i.tilt=a.tilt,i.fov=r(n.fov)),i.layout.row=n.row,i.layout.rows=n.rows,i.layout.column=n.column,i.layout.columns=n.columns,i}function Z(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper;t/=r;return n.width/2/n.pixelRatio/(P/t)/Math.tan(n.fovX/2)}function B(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper,i=t*Math.tan(n.fovX/2),o=n.width/2/n.pixelRatio;return P/(o/i)*r}function Q(e,t,n,r){const i=r.levelAtScale(t),o=_(le(e,n.eye,n.viewForward,n.up).tilt),a=Math.max(i-o,0);return r.scaleAtLevel(a)}function $(e,t,n){const r=n.levelAtScale(e),i=_(t);return n.scaleAtLevel(r+i)}function _(e){return 2*((e>90?180-e:e)/90)**2}function ee(e,t,n=0){const r=e.basemapTerrain?.tilingScheme;if(!r)return 0;const i=h(e.spatialReference).radius,o=e.state.viewingMode===j.Local?t.eye[2]:m(t.eye)-i;return Q(e,B(e,Math.abs(o-n)),t,r)}function te(e,t,n=0){const r=W(e,t);return r?ee(e,r,n):0}const ne=1,re=100;function ie(e,t,n,a,c){if(0===t)return 0;const s=l(n.eye,a),u=e.basemapTerrain?.tilingScheme;if(!u)return L().error("#scaleToTargetDistance()","Cannot compute distance from scale without a tiling scheme"),s;let f=s;const p=le(e,n.eye,n.viewForward,n.up),d=p.tilt>90;if(e.state.isLocal){const r=(Z(e,$(t,p.tilt,u))-Math.abs(n.eye[2]-c[2]))/Math.cos(i(p.tilt));return f=d?f-r:f+r,f}let y=1/0,g=0,v=pe(e,p.heading,p.tilt,a,s,k.ADJUST);if(!v)return f;const w=m(c);for(;y>ne&&g<re;){const c=m(v.eye),s=d?180-v.tilt:v.tilt,R=i(s),T=Math.sin(R)*c,x=Math.cos(R)*c,S=Z(e,$(t,v.tilt,u)),M=d?w-S:w+S,j=o(T/M),z=Math.cos(j)*M-x,C=l(v.eye,a);f=d?C-z:C+z,v=pe(e,p.heading,p.tilt,a,f,k.ADJUST);const A=Ee(e,v,r(n.fov));if(!v||!A)return f;const b=te(e,A,w-h(e.spatialReference).radius);y=Math.abs(t-b),++g}return f}async function oe(e,t,n,r,i,o){return ce(e,t,Z(e,n),r,i,o)}function ae(e,t,n,r,i,o){return Ee(e,pe(e,r.heading,r.tilt,t,n,i),r.fov,o)}async function ce(e,t,n,r,i,o){const c=await de(e,r.heading,r.tilt,t,n,i,o);return a(o),Ge(e,c,r.fov,o)}function le(e,t,n,r,i){return X(e).directionToHeadingTilt(t,n,r,i)}function se(e,t){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(t,O,e.spatialReference)&&e.elevationProvider&&(U(e.elevationProvider,O)??0)>O[2]-F)}async function ue(e,t,n){if(se(e,t))return!0;const{elevationProvider:r,spatialReference:i,renderCoordsHelper:o}=e;if(null==r||!o.fromRenderCoords(t,O,i))return!1;const[c,l,s]=O,u=await r.queryElevation(c,l,s,i,"ground",n)??0;return a(n),u>s-F}async function fe(e,t,n){const r=p();if(null==t)return c(r,e.state.camera.center);if(t instanceof y){const{renderSpatialReference:i,basemapTerrain:o,elevationProvider:c}=e,l=t.spatialReference;if(await R(t,r,i,0,{signal:n}),a(n),null==t.z&&null!=o&&null!=c){const i=await c.queryElevation(t.x,t.y,t.z??0,l,"ground",n);a(n),null!=i&&e.renderCoordsHelper.setAltitude(r,i)}return r}return c(r,t)}function me(e,t){const n=p();if(null==t)return c(n,e.state.camera.center);if(t instanceof y){if(!T(t,n,e.renderSpatialReference))return null;const{basemapTerrain:r,elevationProvider:i}=e;if(null==t.z&&null!=r&&null!=i){const r=U(i,t);null!=r&&e.renderCoordsHelper.setAltitude(n,r)}return n}return c(n,t)}function pe(e,t,n,r,i,o){return he(e,t,n,r instanceof y?r:null,me(e,r),i,o)}async function de(e,t,n,r,i,o,c){const l=r instanceof y?r:null,s=await fe(e,r,c);return a(c),ye(e,t,n,l,s,i,o,c)}function he(e,t,n,r,i,o,a){if(null==i)return null;if(!r&&(r=new y({spatialReference:V(e)}),!S(i,e.renderSpatialReference,r)))return null;const c=ge(e,t,n,i,o,a);if(ve(e,n,a)&&se(e,c.eye)){const{tilt:a,mode:c}=we(e,n,i,o);return he(e,t,a,r,i,o,c)}return Re(c,i)}async function ye(e,t,n,r,i,o,c,l){r||(r=new y({spatialReference:V(e)}),await x(i,e.renderSpatialReference,r,{signal:l})||(r=null)),a(l);const s=ge(e,t,n,i,o,c);if(ve(e,n,c)&&await ue(e,s.eye,l)){a(l);const{tilt:c,mode:s}=we(e,n,i,o);return ye(e,t,c,r,i,o,s,l)}return Re(s,i)}function ge(e,t,n,r,i,o){const a=Ae(e,t,n,r,i=Math.max(i,e.state.constraints.minimumPoiDistance),o);return(0,X(e).eyeForCenterWithHeadingTilt)(r,i,a.heading,a.tilt)}function ve(e,t,n){const r=e.map.ground.navigationConstraint;return n===k.ADJUST&&e.state.isGlobal&&t>0&&(null==r||"stay-above"===r.type)}function we(e,t,n,r){const i=Le(e,n,r,De(e,r,t,n));return{tilt:i,mode:t-i<1?k.LOCKED:k.ADJUST}}function Re(e,t){return{...e,center:d(t)}}function Te(e,t){const{state:n,spatialReference:r}=e,i=t.spatialReference;return n.isGlobal&&D(i,j.Global)||n.isLocal&&r.equals(i)}function xe(e,t){let n,r,i;if(e.state.isGlobal){const e=new y(t.xmin,t.ymin,t.spatialReference),o=new y(t.xmax,t.ymax,t.spatialReference),a=t.spatialReference.isGeographic?I:q;n=new y({x:a.center(e.x,o.x),y:(o.y+e.y)/2,z:null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0,spatialReference:t.spatialReference});const c=h(t.spatialReference),l=b(n,e,o);r=l.lon,i=l.lat,a.diff(e.x,o.x)>a.range/2&&(r+=c.halfCircumference),r=Math.min(r,c.halfCircumference),i=Math.min(i,c.halfCircumference)}else{const o=e.renderSpatialReference??t.spatialReference;o.equals(t.spatialReference)||(t=v(t,o)),r=t.xmax-t.xmin,i=t.ymax-t.ymin;const a=null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0;n=new y({x:t.xmin+.5*r,y:t.ymin+.5*i,z:a,spatialReference:o})}const o=null!=t.zmax&&null!=t.zmin?t.zmax-t.zmin:0,a=e.state.camera,c=1/Math.tan(a.fovX/2),l=1/Math.tan(a.fovY/2),s=1/Math.tan(a.fov/2);return{center:n,distance:Math.max(.5*r*c,.5*i*l,.5*o*s)/E}}async function Se(e,t,n,r,i,o){const c=Te(e,t)?t:await g(t,e.spatialReference,{signal:o});a(o);const{center:l,distance:s}=xe(e,c),u=await de(e,n,r,l,s,i,o);return a(o),Ge(e,u,e.camera.fov,o)}function Me(e,t,n,r,i,o){let a;try{a=Te(e,t)?t:v(t,e.spatialReference)}catch(u){return null}const{center:c,distance:l}=xe(e,a),s=pe(e,n,r,c,l,i);return null==s?null:Ee(e,s,e.camera.fov,o)}function je(e,t,n){const r=e.renderSpatialReference,i=new y({spatialReference:V(e)});if(!S(n,r,i))return null;const o=Math.tan(t.fovX/2),a=Math.tan(t.fovY/2),c=s(t.eye,n),l=2*c*o*E,u=2*c*a*E;return X(e).toExtent(e,i,l,u)}function ze(e,t){return X(e).toArea(e,t)}function Ce(e,t,n){const r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(n/r)/Math.LN2>G)return!0;const i=t,o=e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation;return l(i,o)/(Math.tan(.5*e.state.camera.fov)*r)>H}function Ae(e,t,n,r,i,o){let a=0;return o===k.ADJUST&&Ce(e,r,i)?(t=0,a=Ue(e,i,n,r)):a=Pe(e,r,i,n),a=e.state.constraints.clampTilt(i,a),{heading:t,tilt:n=Le(e,r,i,a)}}const be=.7;function Ue(e,t,n,r){const i=Pe(e,r,t,n);if(!e.state.constraints.tilt)return i;const o=e.state.constraints.tilt(t);o.max=Math.min(o.max,.5*Math.PI);const a=o.min*(1-be)+o.max*be;return Math.min(i,a)}function De(e,t,n,r){let i=Pe(e,r,t,n);if(!e.state.constraints.tilt)return i;const o=e.state.constraints.tilt(t);return i=Math.min(i,.5*Math.PI),o.min*(1-be)+i*be}function Le(e,t,n,r){return X(e).lookAtTiltToEyeTilt(r,t,n)}function Pe(e,t,n,r){return X(e).eyeTiltToLookAtTilt(r,t,n)}function Ee(t,n,r,i){if(null==n)return null;const o=t.renderSpatialReference,a=new y({spatialReference:V(t)});return S(n.eye,o,a)?(i??=new e,i.position=a,i.heading=n.heading,i.tilt=n.tilt,i.fov=r,i):null}async function Ge(t,n,r,i){const o=t.renderSpatialReference,c=new y({spatialReference:V(t)});return await x(n.eye,o,c,{signal:i}),a(i),new e(c,n.heading,n.tilt,r)}function He(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.levelAtScale(t);L().error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function Fe(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.scaleAtLevel(t);L().error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}export{k as OrientationMode,Q as applyTiltAdjustToScale,le as directionToHeadingTilt,B as distanceToScale,W as externalToInternal,ce as fromCenterDistanceAsync,ae as fromCenterDistanceSync,oe as fromCenterScale,Se as fromExtentAsync,Me as fromExtentSync,de as getObserverForPointAtDistanceAsync,pe as getObserverForPointAtDistanceSync,V as getViewSR,K as headingTiltToDirectionUp,N as internalToExternal,$ as removeTiltAdjustFromScale,ne as scaleErrorThreshold,Z as scaleToDistance,He as scaleToZoom,ze as toArea,je as toExtent,ie as viewScaleToCameraDistance,Fe as zoomToScale};
5
+ import e from"../../../Camera.js";import{Cyclical as t}from"../../../core/Cyclical.js";import n from"../../../core/Logger.js";import{rad2deg as r,deg2rad as i,asinClamped as o}from"../../../core/mathUtils.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{c,j as l,F as s,g as u,f,l as m}from"../../../chunks/vec32.js";import{create as p,clone as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import y from"../../../geometry/Point.js";import{projectWithZConversion as g,project as v}from"../../../geometry/projectionUtils.js";import w from"../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as R,projectPointToVector as T}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPointAsync as x,projectVectorToPoint as S}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as M}from"../../../geometry/projection/projectVectorToVector.js";import{ViewingMode as j}from"../../ViewingMode.js";import{cameraOnContentAlongViewDirection as z}from"../camera/intersectionUtils.js";import{c as C}from"../../../chunks/cameraUtilsPlanar.js";import{c as A}from"../../../chunks/cameraUtilsSpherical.js";import{getGreatCircleSpanAt as U}from"./earthUtils.js";import{getElevationAtPoint as b}from"./ElevationProvider.js";import{isSpatialReferenceSupported as D}from"../../support/spatialReferenceSupport.js";const L=()=>n.getLogger("esri.views.3d.support.cameraUtils"),P=96*39.37,E=1,G=8,H=5,F=1,J={heading:0,tilt:0},O=p(),q=new t(-20037508.342788905,20037508.342788905),I=new t(-180,180);var k;function V(e){return e.spatialReference??w.WGS84}function X({state:e}){return e.isGlobal?A:C}function K(e,t,n,r,i){return X(e).headingTiltToDirectionUp(t,n,r,i)}function W(e,t){if(null==t)return null;const n=e.renderSpatialReference,r=X(e).headingTiltToDirectionUp,o=p();if(!T(t.position,o,n))return null;const a=r(o,t.heading,t.tilt);u(a.direction,a.direction,e.state.camera.distance),f(a.direction,a.direction,o);const c=z(e,o,a.direction,a.up);return c.fov=i(t.fov),c.row=t.layout.row,c.rows=t.layout.rows,c.column=t.layout.column,c.columns=t.layout.columns,c}!function(e){e[e.LOCKED=0]="LOCKED",e[e.ADJUST=1]="ADJUST"}(k||(k={}));const Y=p();function N(t,n,i){const o=t.renderSpatialReference,a=le(t,n.eye,n.viewForward,n.up,J);let c=V(t);return M(n.eye,o,Y,c)||(c=w.WGS84,M(n.eye,o,Y,c)),null==i?i=new e(new y(Y,c),a.heading,a.tilt,r(n.fov)):(i.position.x=Y[0],i.position.y=Y[1],i.position.z=Y[2],i.position.spatialReference=c,i.heading=a.heading,i.tilt=a.tilt,i.fov=r(n.fov)),i.layout.row=n.row,i.layout.rows=n.rows,i.layout.column=n.column,i.layout.columns=n.columns,i}function Z(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper;t/=r;return n.width/2/n.pixelRatio/(P/t)/Math.tan(n.fovX/2)}function B(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper,i=t*Math.tan(n.fovX/2),o=n.width/2/n.pixelRatio;return P/(o/i)*r}function Q(e,t,n,r){const i=r.levelAtScale(t),o=_(le(e,n.eye,n.viewForward,n.up).tilt),a=Math.max(i-o,0);return r.scaleAtLevel(a)}function $(e,t,n){const r=n.levelAtScale(e),i=_(t);return n.scaleAtLevel(r+i)}function _(e){return 2*((e>90?180-e:e)/90)**2}function ee(e,t,n=0){const r=e.basemapTerrain?.tilingScheme;if(!r)return 0;const i=h(e.spatialReference).radius,o=e.state.viewingMode===j.Local?t.eye[2]:m(t.eye)-i;return Q(e,B(e,Math.abs(o-n)),t,r)}function te(e,t,n=0){const r=W(e,t);return r?ee(e,r,n):0}const ne=1,re=100;function ie(e,t,n,a,c){if(0===t)return 0;const s=l(n.eye,a),u=e.basemapTerrain?.tilingScheme;if(!u)return L().error("#scaleToTargetDistance()","Cannot compute distance from scale without a tiling scheme"),s;let f=s;const p=le(e,n.eye,n.viewForward,n.up),d=p.tilt>90;if(e.state.isLocal){const r=(Z(e,$(t,p.tilt,u))-Math.abs(n.eye[2]-c[2]))/Math.cos(i(p.tilt));return f=d?f-r:f+r,f}let y=1/0,g=0,v=pe(e,p.heading,p.tilt,a,s,k.ADJUST);if(!v)return f;const w=m(c);for(;y>ne&&g<re;){const c=m(v.eye),s=d?180-v.tilt:v.tilt,R=i(s),T=Math.sin(R)*c,x=Math.cos(R)*c,S=Z(e,$(t,v.tilt,u)),M=d?w-S:w+S,j=o(T/M),z=Math.cos(j)*M-x,C=l(v.eye,a);f=d?C-z:C+z,v=pe(e,p.heading,p.tilt,a,f,k.ADJUST);const A=Ee(e,v,r(n.fov));if(!v||!A)return f;const U=te(e,A,w-h(e.spatialReference).radius);y=Math.abs(t-U),++g}return f}async function oe(e,t,n,r,i,o){return ce(e,t,Z(e,n),r,i,o)}function ae(e,t,n,r,i,o){return Ee(e,pe(e,r.heading,r.tilt,t,n,i),r.fov,o)}async function ce(e,t,n,r,i,o){const c=await de(e,r.heading,r.tilt,t,n,i,o);return a(o),Ge(e,c,r.fov,o)}function le(e,t,n,r,i){return X(e).directionToHeadingTilt(t,n,r,i)}function se(e,t){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(t,O,e.spatialReference)&&e.elevationProvider&&(b(e.elevationProvider,O)??0)>O[2]-F)}async function ue(e,t,n){if(se(e,t))return!0;const{elevationProvider:r,spatialReference:i,renderCoordsHelper:o}=e;if(null==r||!o.fromRenderCoords(t,O,i))return!1;const[c,l,s]=O,u=await r.queryElevation(c,l,s,i,"ground",n)??0;return a(n),u>s-F}async function fe(e,t,n){const r=p();if(null==t)return c(r,e.state.camera.center);if(t instanceof y){const{renderSpatialReference:i,basemapTerrain:o,elevationProvider:c}=e,l=t.spatialReference;if(await R(t,r,i,0,{signal:n}),a(n),null==t.z&&null!=o&&null!=c){const i=await c.queryElevation(t.x,t.y,t.z??0,l,"ground",n);a(n),null!=i&&e.renderCoordsHelper.setAltitude(r,i)}return r}return c(r,t)}function me(e,t){const n=p();if(null==t)return c(n,e.state.camera.center);if(t instanceof y){if(!T(t,n,e.renderSpatialReference))return null;const{basemapTerrain:r,elevationProvider:i}=e;if(null==t.z&&null!=r&&null!=i){const r=b(i,t);null!=r&&e.renderCoordsHelper.setAltitude(n,r)}return n}return c(n,t)}function pe(e,t,n,r,i,o){return he(e,t,n,r instanceof y?r:null,me(e,r),i,o)}async function de(e,t,n,r,i,o,c){const l=r instanceof y?r:null,s=await fe(e,r,c);return a(c),ye(e,t,n,l,s,i,o,c)}function he(e,t,n,r,i,o,a){if(null==i)return null;if(!r&&(r=new y({spatialReference:V(e)}),!S(i,e.renderSpatialReference,r)))return null;const c=ge(e,t,n,i,o,a);if(ve(e,n,a)&&se(e,c.eye)){const{tilt:a,mode:c}=we(e,n,i,o);return he(e,t,a,r,i,o,c)}return Re(c,i)}async function ye(e,t,n,r,i,o,c,l){r||(r=new y({spatialReference:V(e)}),await x(i,e.renderSpatialReference,r,{signal:l})||(r=null)),a(l);const s=ge(e,t,n,i,o,c);if(ve(e,n,c)&&await ue(e,s.eye,l)){a(l);const{tilt:c,mode:s}=we(e,n,i,o);return ye(e,t,c,r,i,o,s,l)}return Re(s,i)}function ge(e,t,n,r,i,o){const a=Ae(e,t,n,r,i=Math.max(i,e.state.constraints.minimumPoiDistance),o);return(0,X(e).eyeForCenterWithHeadingTilt)(r,i,a.heading,a.tilt)}function ve(e,t,n){const r=e.map.ground.navigationConstraint;return n===k.ADJUST&&e.state.isGlobal&&t>0&&(null==r||"stay-above"===r.type)}function we(e,t,n,r){const i=Le(e,n,r,De(e,r,t,n));return{tilt:i,mode:t-i<1?k.LOCKED:k.ADJUST}}function Re(e,t){return{...e,center:d(t)}}function Te(e,t){const{state:n,spatialReference:r}=e,i=t.spatialReference;return n.isGlobal&&D(i,j.Global)||n.isLocal&&r.equals(i)}function xe(e,t){let n,r,i;if(e.state.isGlobal){const e=new y(t.xmin,t.ymin,t.spatialReference),o=new y(t.xmax,t.ymax,t.spatialReference),a=t.spatialReference.isGeographic?I:q;n=new y({x:a.center(e.x,o.x),y:(o.y+e.y)/2,z:null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0,spatialReference:t.spatialReference});const c=h(t.spatialReference),l=U(n,e,o);r=l.lon,i=l.lat,a.diff(e.x,o.x)>a.range/2&&(r+=c.halfCircumference),r=Math.min(r,c.halfCircumference),i=Math.min(i,c.halfCircumference)}else{const o=e.renderSpatialReference??t.spatialReference;o.equals(t.spatialReference)||(t=v(t,o)),r=t.xmax-t.xmin,i=t.ymax-t.ymin;const a=null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0;n=new y({x:t.xmin+.5*r,y:t.ymin+.5*i,z:a,spatialReference:o})}const o=null!=t.zmax&&null!=t.zmin?t.zmax-t.zmin:0,a=e.state.camera,c=1/Math.tan(a.fovX/2),l=1/Math.tan(a.fovY/2),s=1/Math.tan(a.fov/2);return{center:n,distance:Math.max(.5*r*c,.5*i*l,.5*o*s)/E}}async function Se(e,t,n,r,i,o){const c=Te(e,t)?t:await g(t,e.spatialReference,{signal:o});a(o);const{center:l,distance:s}=xe(e,c),u=await de(e,n,r,l,s,i,o);return a(o),Ge(e,u,e.camera.fov,o)}function Me(e,t,n,r,i,o){let a;try{a=Te(e,t)?t:v(t,e.spatialReference)}catch(u){return null}const{center:c,distance:l}=xe(e,a),s=pe(e,n,r,c,l,i);return null==s?null:Ee(e,s,e.camera.fov,o)}function je(e,t,n){const r=e.renderSpatialReference,i=new y({spatialReference:V(e)});if(!S(n,r,i))return null;const o=Math.tan(t.fovX/2),a=Math.tan(t.fovY/2),c=s(t.eye,n),l=2*c*o*E,u=2*c*a*E;return X(e).toExtent(e,i,l,u)}function ze(e,t){return X(e).toArea(e,t)}function Ce(e,t,n){const r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(n/r)/Math.LN2>G)return!0;const i=t,o=e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation;return l(i,o)/(Math.tan(.5*e.state.camera.fov)*r)>H}function Ae(e,t,n,r,i,o){let a=0;return o===k.ADJUST&&Ce(e,r,i)?(t=0,a=be(e,i,n,r)):a=Pe(e,r,i,n),a=e.state.constraints.clampTilt(i,a),{heading:t,tilt:n=Le(e,r,i,a)}}const Ue=.7;function be(e,t,n,r){const i=Pe(e,r,t,n);if(!e.state.constraints.tilt)return i;const o=e.state.constraints.tilt(t);o.max=Math.min(o.max,.5*Math.PI);const a=o.min*(1-Ue)+o.max*Ue;return Math.min(i,a)}function De(e,t,n,r){let i=Pe(e,r,t,n);if(!e.state.constraints.tilt)return i;const o=e.state.constraints.tilt(t);return i=Math.min(i,.5*Math.PI),o.min*(1-Ue)+i*Ue}function Le(e,t,n,r){return X(e).lookAtTiltToEyeTilt(r,t,n)}function Pe(e,t,n,r){return X(e).eyeTiltToLookAtTilt(r,t,n)}function Ee(t,n,r,i){if(null==n)return null;const o=t.renderSpatialReference,a=new y({spatialReference:V(t)});return S(n.eye,o,a)?(i??=new e,i.position=a,i.heading=n.heading,i.tilt=n.tilt,i.fov=r,i):null}async function Ge(t,n,r,i){const o=t.renderSpatialReference,c=new y({spatialReference:V(t)});return await x(n.eye,o,c,{signal:i}),a(i),new e(c,n.heading,n.tilt,r)}function He(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.levelAtScale(t);L().error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function Fe(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.scaleAtLevel(t);L().error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}export{k as OrientationMode,Q as applyTiltAdjustToScale,le as directionToHeadingTilt,B as distanceToScale,W as externalToInternal,ce as fromCenterDistanceAsync,ae as fromCenterDistanceSync,oe as fromCenterScale,Se as fromExtentAsync,Me as fromExtentSync,de as getObserverForPointAtDistanceAsync,pe as getObserverForPointAtDistanceSync,V as getViewSR,K as headingTiltToDirectionUp,N as internalToExternal,$ as removeTiltAdjustFromScale,ne as scaleErrorThreshold,Z as scaleToDistance,He as scaleToZoom,ze as toArea,je as toExtent,ie as viewScaleToCameraDistance,Fe as zoomToScale};
@@ -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{create as r}from"../../../../geometry/support/ray.js";import{h as o}from"../../../../chunks/sphere.js";import{fromScreenAtEye as t}from"./ray.js";function s(r,s,p,e){const n=t(s,p,m);return o(r,n,e)}const m=r();export{s as intersectScreen};
5
+ import{create as r}from"../../../../geometry/support/ray.js";import{i as o}from"../../../../chunks/sphere.js";import{fromScreenAtEye as t}from"./ray.js";function s(r,s,p,e){const n=t(s,p,m);return o(r,n,e)}const m=r();export{s as intersectScreen};
@@ -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{clamp as t,lerp as e}from"../../../core/mathUtils.js";import{fromRotation as i,identity as o,rotateX as n,rotateY as a,rotateZ as l}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as c,lerp as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,create as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as g,m as f,n as d,g as h,t as b,f as y,c as p}from"../../../chunks/vec32.js";import{fromValues as A,clone as w,create as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as N}from"../../ViewingMode.js";import{S as v}from"../../../chunks/SunCalc.js";import{angle as T}from"./mathUtils.js";const M={local:{altitude:1500,ambientAtNight:.1,ambientAtNoon:.45,ambientAtTwilight:.2,directAtNoon:.65,directAtTwilight:.7},global:{altitude:8e5,ambient:.015,direct:.75},planarDirection:{localAltitude:1e4,globalAltitude:1e6,globalAngles:{azimuth:1.3*Math.PI,altitude:.6*Math.PI}}};class S{constructor(t,e){this.direct=t,this.ambient=e}}function j(i,o,n,a,l,r){g(r.ambient.color,1,1,1),r.ambient.intensity=M.global.ambient,g(r.direct.color,1,1,1),r.direct.intensity=M.global.direct;const c=o[2],s=t((Math.abs(c)-M.local.altitude)/(M.global.altitude-M.local.altitude),0,1);let u;if(r.globalFactor=s,null!=i&&(u=v.getTimes(i,o[1],o[0])),s<1){let t;if(null!=i)t=ot(i,u,a);else{const e=L(a);t={direct:{intensity:M.local.directAtNoon*e.direct,color:A(1,1,1)},ambient:{intensity:M.local.ambientAtNoon*e.ambient,color:A(1,1,1)},timeOfDay:"early afternoon"}}f(r.ambient.color,t.ambient.color,r.ambient.color,s),r.ambient.intensity=e(t.ambient.intensity,r.ambient.intensity,s),f(r.direct.color,t.direct.color,r.direct.color,s),r.direct.intensity=e(t.direct.intensity,r.direct.intensity,s),r.specularStrength="rainy"===a||"snowy"===a||"foggy"===a?0:1,r.environmentStrength="rainy"===a?.7:"snowy"===a||"foggy"===a?.75:1}r.noonFactor=null!=i?F(i,u):1,null!=i?P(i,o,n,r.direct.directionToLightSource):O(l,n,r.direct.directionToLightSource)}function O(t,e,o){e===N.Global?d(lt,t.eye):g(lt,0,0,1),h(rt,t.viewForward,-1);const n=T(rt,lt),a=Math.max(n-2*st,0),l=.85*a/(a+1),r=Math.max(st,n-st-l);i(at,-r,t.viewRight),b(o,rt,at),y(o,o,h(ct,t.viewRight,ut)),d(o,o)}function P(e,i,r,c){const s=H,u=o(G);if(r===N.Global)v.getPosition(e,0,0,s),g(c,0,0,-1),n(u,u,-s.azimuth),a(u,u,-s.altitude),b(c,c,u);else{const o=M.planarDirection,a=o.globalAngles,r=i[2];let m=(Math.abs(r)-o.localAltitude)/(o.globalAltitude-o.localAltitude);m=t(m,0,1),m<1?(v.getPosition(e,i[1],i[0],s),s.azimuth=(1-m)*s.azimuth+m*a.azimuth,s.altitude=(1-m)*s.altitude+m*a.altitude):(s.azimuth=a.azimuth,s.altitude=a.altitude),g(c,0,-1,0),l(u,u,-s.azimuth),n(u,u,-s.altitude),b(c,c,u)}}function z(t,e){if(e===N.Global)return!0;const i=M.planarDirection;return Math.abs(t)<i.localAltitude}function D(t,e,i,o,n){const a=t.getTime(),l=e.getTime()-a,r=Math.floor(l/i)+1,c=new Array(r);for(let s=0;s<r;++s)nt.setTime(a+i*s),c[s]=x(),P(nt,o,n,c[s]);return c}const E=A(.5773502691896258,-.5773502691896258,.5773502691896258);class I{constructor(){this.ambient={color:A(1,1,1),intensity:.55},this.direct={color:A(1,1,1),intensity:.55,directionToLightSource:w(E)},this.noonFactor=.5,this.globalFactor=0,this.specularStrength=1,this.environmentStrength=1}}const G=r(),H={azimuth:0,altitude:0};function F(e,i){const o=e.valueOf();let n,a;i.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(e.getHours()+48)*60*1e3-60*e.getMinutes()*1e3,a=n+432e6):i.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=i.sunrise.valueOf(),a=i.sunset.valueOf());const l=n+(a-n)/2;return 1-t(Math.abs(o-l)/432e5,0,1)}function L(t){switch(t){case"disabled":case"sunny":case"cloudy":return new S(1,1);case"rainy":return new S(.4,1.2);case"snowy":return new S(.5,1.3);case"foggy":return new S(.2,1.6)}}function R(t,e){const i=(t[0]+t[1]+t[2])/3;t[0]+=(i-t[0])*e,t[1]+=(i-t[1])*e,t[2]+=(i-t[2])*e}const U=A(.01,.01,.01),_=A(1,.6,.5),k=A(1,.98,.98),V=A(1,1,1),C=A(.8,.8,1),q=A(.8,.8,1),B=A(.98,.98,1),J=A(1,1,1),K=u(.01,M.local.ambientAtNight),Q=u(M.local.directAtTwilight,M.local.ambientAtTwilight),W=u(.9*M.local.directAtNoon,M.local.ambientAtNoon),X=u(M.local.directAtNoon,M.local.ambientAtNoon),Y=W,Z=k,$=B,tt=Q,et=_,it=q;function ot(t,e,i){const o=t.valueOf();let n,a;e.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=n+432e6):e.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=e.sunrise.valueOf(),a=e.sunset.valueOf());const l=a-n,r=n+l/2,u=l/4,g=r-u,d=r+u,h=.06*l,b=n-h/2,y=n+h/2,A=a-h/2,w=a+h/2,N=m(),T=x(),M=x();let S="";if(o<b||o>w)c(N,K),p(T,U),p(M,C),S="night";else if(o<y){const t=(o-b)/(y-b);s(N,K,Q,t),f(T,U,_,t),f(M,C,q,t),S="sun rising"}else if(o<g){const t=(o-y)/(g-y);s(N,Q,W,t),f(T,_,k,t),f(M,q,B,t),S="early morning"}else if(o<r){const t=(o-g)/(r-g);s(N,W,X,t),f(T,k,V,t),f(M,B,J,t),S="late morning"}else if(o<d){const t=(o-r)/(d-r);s(N,X,Y,t),f(T,V,Z,t),f(M,J,$,t),S="early afternoon"}else if(o<A){const t=(o-d)/(A-d);s(N,Y,tt,t),f(T,Z,et,t),f(M,$,it,t),S="late afternoon"}else if(o<w){const t=(o-A)/(w-A);s(N,tt,K,t),f(T,et,U,t),f(M,it,C,t),S="sun setting"}let j=0;switch(i){case"rainy":case"foggy":j=.8;break;case"snowy":j=.5}j>0&&(R(T,j),R(M,j));const O=L(i);return{direct:{intensity:N[0]*O.direct,color:T},ambient:{intensity:N[1]*O.ambient,color:M},timeOfDay:S}}const nt=new Date(0),at=r(),lt=x(),rt=x(),ct=x(),st=.25,ut=.2;export{I as ColorAndIntensity,j as computeColorAndIntensity,D as computeDirectionsOverTime,z as computeShadowsEnabled,O as computeVirtualLightDirection};
5
+ import{clamp as t,lerp as e}from"../../../core/mathUtils.js";import{fromRotation as i,identity as o,rotateX as n,rotateY as a,rotateZ as l}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as c,lerp as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u,create as m}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as g,m as f,n as d,g as h,t as b,f as y,c as p}from"../../../chunks/vec32.js";import{fromValues as A,clone as w,create as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as N}from"../../ViewingMode.js";import{S as v}from"../../../chunks/SunCalc.js";import{angle as M}from"./mathUtils.js";const T={local:{altitude:1500,ambientAtNight:.1,ambientAtNoon:.45,ambientAtTwilight:.2,directAtNoon:.65,directAtTwilight:.7},global:{altitude:8e5,ambient:.015,direct:.75},planarDirection:{localAltitude:1e4,globalAltitude:1e6,globalAngles:{azimuth:1.3*Math.PI,altitude:.6*Math.PI}}};class S{constructor(t,e){this.direct=t,this.ambient=e}}function j(i,o,n,a,l,r){g(r.ambient.color,1,1,1),r.ambient.intensity=T.global.ambient,g(r.direct.color,1,1,1),r.direct.intensity=T.global.direct;const c=o[2],s=t((Math.abs(c)-T.local.altitude)/(T.global.altitude-T.local.altitude),0,1);let u;if(r.globalFactor=s,null!=i&&(u=v.getTimes(i,o[1],o[0])),s<1){let t;if(null!=i)t=ot(i,u,a);else{const e=L(a);t={direct:{intensity:T.local.directAtNoon*e.direct,color:A(1,1,1)},ambient:{intensity:T.local.ambientAtNoon*e.ambient,color:A(1,1,1)},timeOfDay:"early afternoon"}}f(r.ambient.color,t.ambient.color,r.ambient.color,s),r.ambient.intensity=e(t.ambient.intensity,r.ambient.intensity,s),f(r.direct.color,t.direct.color,r.direct.color,s),r.direct.intensity=e(t.direct.intensity,r.direct.intensity,s),r.specularStrength="rainy"===a||"snowy"===a||"foggy"===a?0:1,r.environmentStrength="rainy"===a?.7:"snowy"===a||"foggy"===a?.75:1}r.noonFactor=null!=i?F(i,u):1,null!=i?P(i,o,n,r.direct.directionToLightSource):O(l,n,r.direct.directionToLightSource)}function O(t,e,o){e===N.Global?d(lt,t.eye):g(lt,0,0,1),h(rt,t.viewForward,-1);const n=M(rt,lt),a=Math.max(n-2*st,0),l=.85*a/(a+1),r=Math.max(st,n-st-l);i(at,-r,t.viewRight),b(o,rt,at),y(o,o,h(ct,t.viewRight,ut)),d(o,o)}function P(e,i,r,c){const s=H,u=o(G);if(r===N.Global)v.getPosition(e,0,0,s),g(c,0,0,-1),n(u,u,-s.azimuth),a(u,u,-s.altitude),b(c,c,u);else{const o=T.planarDirection,a=o.globalAngles,r=i[2];let m=(Math.abs(r)-o.localAltitude)/(o.globalAltitude-o.localAltitude);m=t(m,0,1),m<1?(v.getPosition(e,i[1],i[0],s),s.azimuth=(1-m)*s.azimuth+m*a.azimuth,s.altitude=(1-m)*s.altitude+m*a.altitude):(s.azimuth=a.azimuth,s.altitude=a.altitude),g(c,0,-1,0),l(u,u,-s.azimuth),n(u,u,-s.altitude),b(c,c,u)}}function z(t,e){if(e===N.Global)return!0;const i=T.planarDirection;return Math.abs(t)<i.localAltitude}function D(t,e,i,o,n){const a=t.getTime(),l=Math.max(0,e.getTime()-a),r=Math.floor(l/i)+1,c=new Array(r);for(let s=0;s<r;++s)nt.setTime(a+i*s),c[s]=x(),P(nt,o,n,c[s]);return c}const E=A(.5773502691896258,-.5773502691896258,.5773502691896258);class I{constructor(){this.ambient={color:A(1,1,1),intensity:.55},this.direct={color:A(1,1,1),intensity:.55,directionToLightSource:w(E)},this.noonFactor=.5,this.globalFactor=0,this.specularStrength=1,this.environmentStrength=1}}const G=r(),H={azimuth:0,altitude:0};function F(e,i){const o=e.valueOf();let n,a;i.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(e.getHours()+48)*60*1e3-60*e.getMinutes()*1e3,a=n+432e6):i.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=i.sunrise.valueOf(),a=i.sunset.valueOf());const l=n+(a-n)/2;return 1-t(Math.abs(o-l)/432e5,0,1)}function L(t){switch(t){case"disabled":case"sunny":case"cloudy":return new S(1,1);case"rainy":return new S(.4,1.2);case"snowy":return new S(.5,1.3);case"foggy":return new S(.2,1.6)}}function R(t,e){const i=(t[0]+t[1]+t[2])/3;t[0]+=(i-t[0])*e,t[1]+=(i-t[1])*e,t[2]+=(i-t[2])*e}const U=A(.01,.01,.01),_=A(1,.6,.5),k=A(1,.98,.98),V=A(1,1,1),C=A(.8,.8,1),q=A(.8,.8,1),B=A(.98,.98,1),J=A(1,1,1),K=u(.01,T.local.ambientAtNight),Q=u(T.local.directAtTwilight,T.local.ambientAtTwilight),W=u(.9*T.local.directAtNoon,T.local.ambientAtNoon),X=u(T.local.directAtNoon,T.local.ambientAtNoon),Y=W,Z=k,$=B,tt=Q,et=_,it=q;function ot(t,e,i){const o=t.valueOf();let n,a;e.polarException===v.PolarException.MIDNIGHT_SUN?(n=o-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=n+432e6):e.polarException===v.PolarException.POLAR_NIGHT?(n=o-2,a=o-1):(n=e.sunrise.valueOf(),a=e.sunset.valueOf());const l=a-n,r=n+l/2,u=l/4,g=r-u,d=r+u,h=.06*l,b=n-h/2,y=n+h/2,A=a-h/2,w=a+h/2,N=m(),M=x(),T=x();let S="";if(o<b||o>w)c(N,K),p(M,U),p(T,C),S="night";else if(o<y){const t=(o-b)/(y-b);s(N,K,Q,t),f(M,U,_,t),f(T,C,q,t),S="sun rising"}else if(o<g){const t=(o-y)/(g-y);s(N,Q,W,t),f(M,_,k,t),f(T,q,B,t),S="early morning"}else if(o<r){const t=(o-g)/(r-g);s(N,W,X,t),f(M,k,V,t),f(T,B,J,t),S="late morning"}else if(o<d){const t=(o-r)/(d-r);s(N,X,Y,t),f(M,V,Z,t),f(T,J,$,t),S="early afternoon"}else if(o<A){const t=(o-d)/(A-d);s(N,Y,tt,t),f(M,Z,et,t),f(T,$,it,t),S="late afternoon"}else if(o<w){const t=(o-A)/(w-A);s(N,tt,K,t),f(M,et,U,t),f(T,it,C,t),S="sun setting"}let j=0;switch(i){case"rainy":case"foggy":j=.8;break;case"snowy":j=.5}j>0&&(R(M,j),R(T,j));const O=L(i);return{direct:{intensity:N[0]*O.direct,color:M},ambient:{intensity:N[1]*O.ambient,color:T},timeOfDay:S}}const nt=new Date(0),at=r(),lt=x(),rt=x(),ct=x(),st=.25,ut=.2;export{I as ColorAndIntensity,j as computeColorAndIntensity,D as computeDirectionsOverTime,z as computeShadowsEnabled,O as computeVirtualLightDirection};