@arcgis/core 5.1.0-next.101 → 5.1.0-next.103

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 (736) hide show
  1. package/applications/Components/imageryUtils.d.ts +22 -1
  2. package/applications/Components/imageryUtils.js +1 -1
  3. package/arcade/Dictionary.js +1 -1
  4. package/arcade/Feature.js +1 -1
  5. package/arcade/Pixel.js +1 -1
  6. package/arcade/Voxel.js +1 -1
  7. package/arcade/arcade.js +1 -1
  8. package/arcade/arcadeAsyncRuntime.js +1 -1
  9. package/arcade/arcadeCompiler.js +1 -1
  10. package/arcade/arcadeRuntime.js +1 -1
  11. package/arcade/containerUtils.js +1 -1
  12. package/arcade/debug.js +1 -1
  13. package/arcade/deepClone.js +1 -1
  14. package/arcade/featureSetUtils.js +1 -1
  15. package/arcade/featureset/actions/GroupBy.js +1 -1
  16. package/arcade/featureset/actions/OrderBy.js +1 -1
  17. package/arcade/functions/convertdirection.js +1 -1
  18. package/arcade/functions/date.js +1 -1
  19. package/arcade/functions/feature.js +1 -1
  20. package/arcade/functions/featuresetbase.js +1 -1
  21. package/arcade/functions/featuresetgeom.js +1 -1
  22. package/arcade/functions/featuresetstats.js +1 -1
  23. package/arcade/functions/featuresetstring.js +1 -1
  24. package/arcade/functions/fieldStats.js +1 -1
  25. package/arcade/functions/geomasync.js +1 -1
  26. package/arcade/functions/geometry.js +1 -1
  27. package/arcade/functions/geomsync.js +1 -1
  28. package/arcade/functions/knowledgegraph.js +1 -1
  29. package/arcade/functions/maths.js +1 -1
  30. package/arcade/functions/stats.js +1 -1
  31. package/arcade/functions/string.js +1 -1
  32. package/arcade/functions/track.js +1 -1
  33. package/arcade/geometry/constructors.js +1 -1
  34. package/arcade/geometry/functions.js +1 -1
  35. package/arcade/geometry/operators.js +1 -1
  36. package/arcade/languageUtils.js +1 -1
  37. package/arcgisGlobal.d.ts +1449 -0
  38. package/assets/esri/core/workers/RemoteClient.js +1 -1
  39. package/assets/esri/core/workers/chunks/{92e7067960549733f8e6.js → 037b36d415ae27e987f9.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{58579c53be1a44bd08d2.js → 054ae729e7cefa2c7778.js} +1 -1
  41. package/assets/esri/core/workers/chunks/069459519477bb3dc91b.js +1 -0
  42. package/assets/esri/core/workers/chunks/{4301cb9670fa7c907460.js → 0881929a4a457f94f317.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{abdf146b35e179b5b245.js → 0cb8bc6dbbbe3b212712.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{b811d62284be95f4beb6.js → 0cc74bc3772be51cabc1.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{0630ce1975c91ae362d9.js → 0e9804ece1fd2d59751b.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{545c38789267e3487dbd.js → 10491b5b106bc5ad0b2b.js} +1 -1
  47. package/assets/esri/core/workers/chunks/12053c1213465d07d2f6.js +1 -0
  48. package/assets/esri/core/workers/chunks/{ca6c128940ddbebcaaab.js → 14b7b55c42af65ffa024.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{702e8468836863abd81b.js → 15fa8b5b472131aaa68e.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{852f4cd514008fee5a55.js → 176e676879666f784599.js} +1 -1
  51. package/assets/esri/core/workers/chunks/18201119828664373165.js +1 -0
  52. package/assets/esri/core/workers/chunks/1a3426276dc82a8a80f2.js +1 -0
  53. package/assets/esri/core/workers/chunks/{ce3e51c799a80648e46d.js → 1c0e8808d14d8e6dde2c.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{bafe489e54f34d1841e6.js → 1c83e61fd9a4f8fc8372.js} +1 -1
  55. package/assets/esri/core/workers/chunks/1cb0c4fc315bbc2bd00b.js +1 -0
  56. package/assets/esri/core/workers/chunks/{5afee66e182f79a0fc46.js → 1ff61d8a8ea060e78b83.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{19a9a555365a8363d34b.js → 23119a1b1310b7dab2aa.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{031ea31bbdb7f1be791e.js → 276cb6a1cdd26d0e1444.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{fdb7851e98e8d2ba48d3.js → 286bf3be9f524bde9529.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{53bf9b0c2b8da12820ea.js → 29b00d07d3e1d095c590.js} +2 -2
  61. package/assets/esri/core/workers/chunks/{9d8e7839772029d83c93.js → 29bbc0d6d847b065d10e.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{156efa014b6edd9ccce9.js → 2a5f6a8d282f2c391591.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{15a65aa6969c1b383ce2.js → 2f903bd3a2611e7f0946.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{b803e7b0d489bb628d72.js → 2f925a424b60b4a5e8e5.js} +1 -1
  65. package/assets/esri/core/workers/chunks/30e191d36aa95823c018.js +1 -0
  66. package/assets/esri/core/workers/chunks/{4b19acf8bde5b2e80692.js → 313a89b334e3518d30a4.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{390717f079def83a0d9c.js → 31a8bc25aa1441c70caa.js} +1 -1
  68. package/assets/esri/core/workers/chunks/31c01885ee6d70a2bde2.js +1 -0
  69. package/assets/esri/core/workers/chunks/3292b3883f203637b5a7.js +1 -0
  70. package/assets/esri/core/workers/chunks/{9bb2251ba58932f85d13.js → 33329f5d88e60b4ec568.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{8f9117d589de7caaa02d.js → 35bbd63319d8aa9f31cc.js} +1 -1
  72. package/assets/esri/core/workers/chunks/35fdd62277fd06468a29.js +2 -0
  73. package/assets/esri/core/workers/chunks/{3996149146dd1eca7cc5.js → 38d7430d2370b69334d7.js} +1 -1
  74. package/assets/esri/core/workers/chunks/3aebbed6d4fd1b993a35.js +1 -0
  75. package/assets/esri/core/workers/chunks/3f1d533efe4300d19e6a.js +1 -0
  76. package/assets/esri/core/workers/chunks/{7db09c5bf024242becfa.js → 40caf5e09e4382d81104.js} +5 -5
  77. package/assets/esri/core/workers/chunks/4213aa844900fcf95287.js +1 -0
  78. package/assets/esri/core/workers/chunks/{bc6a809a965355eb425f.js → 44636ef119c6a576470b.js} +1 -1
  79. package/assets/esri/core/workers/chunks/453c9e8d438d061e1736.js +1 -0
  80. package/assets/esri/core/workers/chunks/479e34b0abc10499bd3a.js +1 -0
  81. package/assets/esri/core/workers/chunks/{54dad475dc806a38c287.js → 48440a071a37590846ff.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{38b1d2ffcc318ac0119d.js → 48fcc10768d93e95a04e.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{fa9ab152ea785b5e97e0.js → 4a41f98210f1da3b5041.js} +1 -1
  84. package/assets/esri/core/workers/chunks/4a65bc9091d7ea7e80df.js +1 -0
  85. package/assets/esri/core/workers/chunks/4cdf80e2e60501dd4756.js +1 -0
  86. package/assets/esri/core/workers/chunks/51edfe21d4c6ee22c83d.js +1 -0
  87. package/assets/esri/core/workers/chunks/52219561c144e5cb4442.js +1 -0
  88. package/assets/esri/core/workers/chunks/{312036c89a6a09bb06c2.js → 5570d47533efab56c732.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{5abe34bb0110694f7b42.js → 566c36032b456ec5b5d7.js} +1 -1
  90. package/assets/esri/core/workers/chunks/{34207774bc371e95ba3c.js → 56b6b68d9459b1edea43.js} +1 -1
  91. package/assets/esri/core/workers/chunks/593772bd8b19ac664b29.js +1 -0
  92. package/assets/esri/core/workers/chunks/{10ce083b38ccfa88f766.js → 594e1f633527749d92d7.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{ad329226c8b579d0964c.js → 5a6523c903b11dea77d4.js} +1 -1
  94. package/assets/esri/core/workers/chunks/5c44638670e40e092ce3.js +1 -0
  95. package/assets/esri/core/workers/chunks/{af8bc56cf1404afc3028.js → 5d60253ea3d247cdb3d1.js} +1 -1
  96. package/assets/esri/core/workers/chunks/5dc86a3a40d16b576bb5.js +1 -0
  97. package/assets/esri/core/workers/chunks/601edefd8da4eb2eda28.js +1 -0
  98. package/assets/esri/core/workers/chunks/6182d39e2095d4460b88.js +1 -0
  99. package/assets/esri/core/workers/chunks/{c798a40418e7ff38042a.js → 63513e706fe55a1def15.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{d8d338665fe00494c826.js → 660713adb5a845dfa2ef.js} +1 -1
  101. package/assets/esri/core/workers/chunks/694f9571e2723d3d4b02.js +1 -0
  102. package/assets/esri/core/workers/chunks/69ad5930ff6040c6c561.js +1 -0
  103. package/assets/esri/core/workers/chunks/{f563dd6cace047108b3c.js → 6b5d2df9123dfe7e00b3.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{5217d676749bca59d90f.js → 6c79e8e840c1d027fbb2.js} +1 -1
  105. package/assets/esri/core/workers/chunks/{2ce845c990bb4d701362.js → 6ca81e34854ce7ec6f6e.js} +1 -1
  106. package/assets/esri/core/workers/chunks/{11a99ee68409a641810e.js → 6f02681bcaa9bef501fc.js} +1 -1
  107. package/assets/esri/core/workers/chunks/77ac243d4dcd901c2eec.js +1 -0
  108. package/assets/esri/core/workers/chunks/78af4b7a379c40f497a7.js +1 -0
  109. package/assets/esri/core/workers/chunks/{bf706a5d065a357de51b.js → 79b64a52ff57c40c7800.js} +1 -1
  110. package/assets/esri/core/workers/chunks/{475409026288f0981ce2.js → 7b3642195d6d3ea9b830.js} +1 -1
  111. package/assets/esri/core/workers/chunks/{82b2acc6f181927de89c.js → 7bc746ea17f4e336e0b0.js} +1 -1
  112. package/assets/esri/core/workers/chunks/{19fcc74d34cbbaa56a41.js → 7c86099ed17f420b0489.js} +1 -1
  113. package/assets/esri/core/workers/chunks/{00a25dd4b057cc9f2a7e.js → 7d571845292b1b7769c2.js} +1 -1
  114. package/assets/esri/core/workers/chunks/7dafe608c224b9d48ffa.js +1 -0
  115. package/assets/esri/core/workers/chunks/7e203e947846d40f897e.js +1 -0
  116. package/assets/esri/core/workers/chunks/855bf811cd79b97c169a.js +1 -0
  117. package/assets/esri/core/workers/chunks/{7601278ebced0c0c31cf.js → 85bba0db8a7a5fc1be44.js} +1 -1
  118. package/assets/esri/core/workers/chunks/{a318cf6bb900e0ee268c.js → 881234f25c7814de8753.js} +1 -1
  119. package/assets/esri/core/workers/chunks/895114ccd2603830960f.js +1 -0
  120. package/assets/esri/core/workers/chunks/8a68884d40f6f6de1d12.js +1 -0
  121. package/assets/esri/core/workers/chunks/{0d81409721d29d8bc276.js → 8a7682071941c35f05c1.js} +1 -1
  122. package/assets/esri/core/workers/chunks/8aac1155b8ac071cd2ad.js +1 -0
  123. package/assets/esri/core/workers/chunks/{3e2953ea62817e75d840.js → 8cbaaea72f4ca2f023be.js} +1 -1
  124. package/assets/esri/core/workers/chunks/{7bb17d0ab1cc2b89c035.js → 8e986167d4a393ee41ea.js} +1 -1
  125. package/assets/esri/core/workers/chunks/8fdd57e2a0af647f1e3e.js +1 -0
  126. package/assets/esri/core/workers/chunks/92db9a6d273ae2862883.js +1 -0
  127. package/assets/esri/core/workers/chunks/{9b23d999db902d25ba58.js → 9373daa677dc767d7cf0.js} +1 -1
  128. package/assets/esri/core/workers/chunks/{40ffb1aa17cbfae17b23.js → 9542ef3f6c2bc7c14d85.js} +1 -1
  129. package/assets/esri/core/workers/chunks/{657268b3fde6da2dd735.js → 95798e3de3419fdda6ac.js} +1 -1
  130. package/assets/esri/core/workers/chunks/{aad02c7417648d881129.js → 958617c3a9854ea04e06.js} +1 -1
  131. package/assets/esri/core/workers/chunks/{a28124bba6b43efd74cc.js → 95df6d2ebacc43ac5fa3.js} +1 -1
  132. package/assets/esri/core/workers/chunks/{f618ee43581e8de6ad0c.js → 970e91de5dfbbc247afb.js} +1 -1
  133. package/assets/esri/core/workers/chunks/978b7d10054e17161145.js +1 -0
  134. package/assets/esri/core/workers/chunks/{8a48a6760c33ed50b650.js → 98b4408e12684e37b395.js} +1 -1
  135. package/assets/esri/core/workers/chunks/9d70247d820085a2c190.js +1 -0
  136. package/assets/esri/core/workers/chunks/9da2f2b67837b491cfa3.js +1 -0
  137. package/assets/esri/core/workers/chunks/{edee616b6f1b5be8fd39.js → a0296e6d6c37b861c5fb.js} +1 -1
  138. package/assets/esri/core/workers/chunks/{c19e3f6027b6526de359.js → a02ebdcb802d128c8eee.js} +1 -1
  139. package/assets/esri/core/workers/chunks/a0aaf14c8f9a007d88ac.js +1 -0
  140. package/assets/esri/core/workers/chunks/{1523883460874c352e36.js → a29cd1f5c7bb4f6a5a4f.js} +1 -1
  141. package/assets/esri/core/workers/chunks/{cf826787ab8d4b27ad80.js → a53a3e5548fef65a2710.js} +1 -1
  142. package/assets/esri/core/workers/chunks/{91f9e0e3662d4bf9f163.js → a913a1c83a667ed0e711.js} +1 -1
  143. package/assets/esri/core/workers/chunks/{359465b9726edcc70c83.js → a9c9c00432ee41ec91ba.js} +1 -1
  144. package/assets/esri/core/workers/chunks/{a3a28c4887f802e8d96d.js → aa55923ca939a0d4606c.js} +1 -1
  145. package/assets/esri/core/workers/chunks/{d3b086eb9aa8c7d09048.js → aea8e0577fb48d5c9577.js} +1 -1
  146. package/assets/esri/core/workers/chunks/af45110f07e4b5162bae.js +1 -0
  147. package/assets/esri/core/workers/chunks/{76589434d573111a8fb4.js → b09ae8eb5e97fb27382f.js} +1 -1
  148. package/assets/esri/core/workers/chunks/b0c647af49c9d563b852.js +1 -0
  149. package/assets/esri/core/workers/chunks/{a320998f18922a35899f.js → b32a13972cb3de652339.js} +1 -1
  150. package/assets/esri/core/workers/chunks/b432a5a829e309837db6.js +1 -0
  151. package/assets/esri/core/workers/chunks/{9103eb0b9078019d3a26.js → b5d0898406c7d6e6a717.js} +1 -1
  152. package/assets/esri/core/workers/chunks/b640651c7d86cfe654bf.js +1 -0
  153. package/assets/esri/core/workers/chunks/{503439246250d9e1cbd5.js → b75e090a7e935ff870a3.js} +1 -1
  154. package/assets/esri/core/workers/chunks/{c321bcda8e8893577948.js → b8dda9e55caba0e2b4c2.js} +1 -1
  155. package/assets/esri/core/workers/chunks/{59a64d72eed8c40c63cf.js → bacf0c9d5d3e084dea61.js} +1 -1
  156. package/assets/esri/core/workers/chunks/{48a0e7a32ebd44045c8f.js → bb04aff0b4947408592c.js} +1 -1
  157. package/assets/esri/core/workers/chunks/{17de1c251242b692cf45.js → bff0c4094c14cb97b18f.js} +1 -1
  158. package/assets/esri/core/workers/chunks/{47dd2bfecc5c4b5f10f0.js → c0d7e4afbad0b20e2502.js} +1 -1
  159. package/assets/esri/core/workers/chunks/c13c532fe38ddc5d7ca6.js +1 -0
  160. package/assets/esri/core/workers/chunks/{cc62e5095e328bed3e01.js → c1ffb879e0283fb2815f.js} +1 -1
  161. package/assets/esri/core/workers/chunks/{22fa4aa2b76573bafe21.js → c476f4979048e558baa7.js} +89 -76
  162. package/assets/esri/core/workers/chunks/c8b96104641cb4afd4df.js +1 -0
  163. package/assets/esri/core/workers/chunks/{4faaf61d20e20fcf6c18.js → c91d4f1b42cfe474df52.js} +1 -1
  164. package/assets/esri/core/workers/chunks/{6ae2408ac075b974e887.js → cb26966cc205bd338c76.js} +1 -1
  165. package/assets/esri/core/workers/chunks/{c452c74ba9de218c3e57.js → cb3004998eff7c60930e.js} +1 -1
  166. package/assets/esri/core/workers/chunks/cc48354c54358777e996.js +1 -0
  167. package/assets/esri/core/workers/chunks/{b1b8a7c00ec4d998ab84.js → cc8d55d1830d7542c3f5.js} +1 -1
  168. package/assets/esri/core/workers/chunks/ce0c7070eeb723a718e7.js +1 -0
  169. package/assets/esri/core/workers/chunks/ce3b5b83237cf37ff523.js +1 -0
  170. package/assets/esri/core/workers/chunks/cf3c0bee919bb509cd4f.js +1 -0
  171. package/assets/esri/core/workers/chunks/cf9b0ba30a75c030ca92.js +1 -0
  172. package/assets/esri/core/workers/chunks/d00b9c1fd0865bf8f317.js +1 -0
  173. package/assets/esri/core/workers/chunks/{9a29b7f9e6281ee40c37.js → d4749eb8a47869477037.js} +1 -1
  174. package/assets/esri/core/workers/chunks/d5423df247be82fa085a.js +1 -0
  175. package/assets/esri/core/workers/chunks/d610f517fb3c6cb24365.js +1 -0
  176. package/assets/esri/core/workers/chunks/{47656ec12401e53f4bd3.js → d9d716bfd0aab30b6caf.js} +1 -1
  177. package/assets/esri/core/workers/chunks/da4f7d7099ba88f31f45.js +1 -0
  178. package/assets/esri/core/workers/chunks/dbb1ac41fd5da4fd849b.js +1 -0
  179. package/assets/esri/core/workers/chunks/{176dd195f77b98cb0b0f.js → dd58bc675b85b4d90afa.js} +1 -1
  180. package/assets/esri/core/workers/chunks/e2bb95d601789bbda73b.js +1 -0
  181. package/assets/esri/core/workers/chunks/{f018ad451ee072253a1e.js → e4b2120d7ee1c998b1fc.js} +1 -1
  182. package/assets/esri/core/workers/chunks/e4c350dc65aae121171d.js +1 -0
  183. package/assets/esri/core/workers/chunks/e8518bd3596543b387f8.js +1 -0
  184. package/assets/esri/core/workers/chunks/{f948e4a80a7dbda70f2e.js → e973cab79ec2541cb81b.js} +1 -1
  185. package/assets/esri/core/workers/chunks/{7d6299ab7b0db23ab961.js → eb1d6614eeac6d26bb9c.js} +1 -1
  186. package/assets/esri/core/workers/chunks/f1bb426400dac02880f1.js +1 -0
  187. package/assets/esri/core/workers/chunks/{ffcd4fca7f67e1f943f1.js → f239a8ecad8b692d5eaa.js} +1 -1
  188. package/assets/esri/core/workers/chunks/{de11ebcea2b8f9dfe65d.js → f3161c47a572194f6017.js} +1 -1
  189. package/assets/esri/core/workers/chunks/{f66262f8582909157f01.js → f37be7e517f0892014e3.js} +1 -1
  190. package/assets/esri/core/workers/chunks/{99f726f05cf80b0330ed.js → f3a9100518b044e79501.js} +1 -1
  191. package/assets/esri/core/workers/chunks/f3f984c62311c20a9db8.js +1 -0
  192. package/assets/esri/core/workers/chunks/f5bd0a4f82df5e942b70.js +1 -0
  193. package/assets/esri/core/workers/chunks/{85e65ced3312bf9cf162.js → f7e386ece75afb6e4be5.js} +1 -1
  194. package/assets/esri/core/workers/chunks/f8b884b529064df4a30a.js +1 -0
  195. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +125 -0
  196. package/assets/esri/themes/base/widgets/_Directions.scss +5 -1
  197. package/assets/esri/themes/dark/main.css +1 -1
  198. package/assets/esri/themes/light/main.css +1 -1
  199. package/assets/esri/themes/light/view.css +1 -1
  200. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
  201. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  202. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  203. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  204. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  205. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  206. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  207. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  208. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  209. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
  210. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  211. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  212. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  213. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  214. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  215. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  216. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  217. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  218. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  219. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  220. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  221. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  222. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  223. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  224. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  225. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  226. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  227. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  228. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  229. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  230. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  231. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  232. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  233. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  234. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  235. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  236. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  237. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  238. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  239. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  240. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  241. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  242. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  243. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer.json +1 -1
  244. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ar.json +1 -1
  245. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_bg.json +1 -1
  246. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_bs.json +1 -1
  247. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ca.json +1 -1
  248. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_cs.json +1 -1
  249. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_da.json +1 -1
  250. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_de.json +1 -1
  251. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_el.json +1 -1
  252. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_es.json +1 -1
  253. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_et.json +1 -1
  254. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_fi.json +1 -1
  255. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_fr.json +1 -1
  256. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_he.json +1 -1
  257. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_hr.json +1 -1
  258. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_hu.json +1 -1
  259. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_id.json +1 -1
  260. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_it.json +1 -1
  261. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ja.json +1 -1
  262. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ko.json +1 -1
  263. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_lt.json +1 -1
  264. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_lv.json +1 -1
  265. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_nl.json +1 -1
  266. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_no.json +1 -1
  267. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_pl.json +1 -1
  268. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_pt-BR.json +1 -1
  269. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_pt-PT.json +1 -1
  270. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ro.json +1 -1
  271. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_ru.json +1 -1
  272. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_sk.json +1 -1
  273. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_sl.json +1 -1
  274. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_sr.json +1 -1
  275. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_sv.json +1 -1
  276. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_th.json +1 -1
  277. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_tr.json +1 -1
  278. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_uk.json +1 -1
  279. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_vi.json +1 -1
  280. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_zh-CN.json +1 -1
  281. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_zh-HK.json +1 -1
  282. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_zh-TW.json +1 -1
  283. package/chunks/AtmosphereCompositing.glsl.js +1 -1
  284. package/chunks/Bufferer-Dw9Qi4T1.js +1 -1
  285. package/chunks/Centroid-DZi-eb9F.js +1 -1
  286. package/chunks/Clouds.glsl.js +1 -1
  287. package/chunks/Compositing.glsl.js +1 -1
  288. package/chunks/CutFillComposition.glsl.js +1 -1
  289. package/chunks/CutFillDepth.glsl.js +1 -1
  290. package/chunks/CutFillMask.glsl.js +1 -1
  291. package/chunks/CutFillReduction.glsl.js +1 -1
  292. package/chunks/CutFillTargetDepth.glsl.js +1 -1
  293. package/chunks/Distance2DCalculator-CXhBP-8I.js +1 -1
  294. package/chunks/Envelope.js +1 -1
  295. package/chunks/Envelope2D.js +1 -1
  296. package/chunks/FlatGeometry.js +1 -1
  297. package/chunks/FocusAreaColor.glsl.js +1 -1
  298. package/chunks/FocusAreaMask.glsl.js +1 -1
  299. package/chunks/Fog.glsl.js +1 -1
  300. package/chunks/GaussianSplat.glsl.js +1 -1
  301. package/chunks/GaussianSplatShadow.glsl.js +1 -1
  302. package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
  303. package/chunks/GeodeticUtils.js +1 -1
  304. package/chunks/Geometry.js +1 -1
  305. package/chunks/GeometryCleaner-BEJM7I4l.js +1 -1
  306. package/chunks/GlobalIllumination.glsl.js +1 -1
  307. package/chunks/GlobalIlluminationBlur.glsl.js +1 -1
  308. package/chunks/GlobalIlluminationUpscale.glsl.js +80 -65
  309. package/chunks/GlowBlur.glsl.js +1 -1
  310. package/chunks/GlowComposition.glsl.js +1 -1
  311. package/chunks/HazeCompositing.glsl.js +1 -1
  312. package/chunks/HighlightBlur.glsl.js +1 -1
  313. package/chunks/HighlightDownsample.glsl.js +1 -1
  314. package/chunks/Magnifier.glsl.js +1 -1
  315. package/chunks/MultiPathImpl.js +1 -1
  316. package/chunks/NoiseTextureAtlas.glsl.js +1 -1
  317. package/chunks/OITBlend.glsl.js +2 -2
  318. package/chunks/OITBlendEmission.glsl.js +1 -1
  319. package/chunks/OITDimOpaque.glsl.js +1 -1
  320. package/chunks/OperatorClip.js +1 -1
  321. package/chunks/OperatorCrosses.js +1 -1
  322. package/chunks/OperatorCut.js +1 -1
  323. package/chunks/OperatorDensify.js +1 -1
  324. package/chunks/OperatorGeneralize.js +1 -1
  325. package/chunks/OperatorGeodesicBuffer.js +1 -1
  326. package/chunks/OperatorGeodeticArea.js +1 -1
  327. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  328. package/chunks/OperatorGeodeticDistance.js +1 -1
  329. package/chunks/OperatorGeodeticLength.js +1 -1
  330. package/chunks/OperatorIntegrate.js +1 -1
  331. package/chunks/OperatorIntersects.js +1 -1
  332. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  333. package/chunks/OperatorOverlaps.js +1 -1
  334. package/chunks/OperatorProject.js +1 -1
  335. package/chunks/OperatorProximity.js +1 -1
  336. package/chunks/OperatorProximityGeodesic.js +1 -1
  337. package/chunks/OperatorShapePreservingDensify.js +1 -1
  338. package/chunks/OperatorShapePreservingLength.js +1 -1
  339. package/chunks/OperatorShapePreservingProject.js +1 -1
  340. package/chunks/OperatorSimplifyOGC.js +1 -1
  341. package/chunks/OperatorTouches.js +1 -1
  342. package/chunks/OperatorWithin.js +1 -1
  343. package/chunks/OverlayCompositing.glsl.js +1 -1
  344. package/chunks/Point2D.js +1 -1
  345. package/chunks/PointRenderer.glsl.js +1 -1
  346. package/chunks/ProjectionTransformation.js +1 -1
  347. package/chunks/RasterColorizer.glsl.js +1 -1
  348. package/chunks/ShadowCastAccumulate.glsl.js +1 -1
  349. package/chunks/ShadowCastVisualize.glsl.js +2 -2
  350. package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
  351. package/chunks/SimpleAtmosphere.glsl.js +1 -1
  352. package/chunks/SpatialReference.js +1 -1
  353. package/chunks/Terrain.glsl.js +1 -1
  354. package/chunks/Texture.glsl.js +1 -1
  355. package/chunks/Transformation2D.js +1 -1
  356. package/chunks/Viewshed.glsl.js +1 -1
  357. package/chunks/aiServices.js +1 -1
  358. package/chunks/arcade.js +1 -1
  359. package/chunks/array.js +1 -1
  360. package/chunks/boundedPlane.js +1 -1
  361. package/chunks/constants.js +1 -1
  362. package/chunks/containsOperator.js +1 -1
  363. package/chunks/disjointOperator.js +1 -1
  364. package/chunks/distanceOperator.js +1 -1
  365. package/chunks/equalsOperator.js +1 -1
  366. package/chunks/languageUtils.js +1 -1
  367. package/chunks/pe.js +1 -1
  368. package/chunks/persistableUrlUtils.js +1 -1
  369. package/chunks/relateOperator.js +1 -1
  370. package/chunks/symmetricDifferenceOperator.js +1 -1
  371. package/chunks/unionOperator.js +1 -1
  372. package/chunks/vec2.js +1 -1
  373. package/chunks/vec3.js +1 -1
  374. package/chunks/vec4.js +1 -1
  375. package/config.js +1 -1
  376. package/core/accessorSupport/decorators/persistable.js +1 -1
  377. package/effects/FocusArea.js +1 -1
  378. package/form/elements/inputs/MultipleChoiceInput.d.ts +5 -5
  379. package/form/elements/inputs/MultipleChoiceInput.js +1 -1
  380. package/geometry/coordinateFormatter.js +1 -1
  381. package/geometry/operators/extendOperator.js +1 -1
  382. package/geometry/operators/gx/geodeticUtils.js +1 -1
  383. package/geometry/operators/gx/operatorAffineTransform.js +1 -1
  384. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  385. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  386. package/geometry/operators/gx/operatorBoundary.js +1 -1
  387. package/geometry/operators/gx/operatorBuffer.js +1 -1
  388. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  389. package/geometry/operators/gx/operatorDifference.js +1 -1
  390. package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
  391. package/geometry/operators/gx/operatorGeodeticArea.js +1 -1
  392. package/geometry/operators/gx/operatorGeodeticDensify.js +1 -1
  393. package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
  394. package/geometry/operators/gx/operatorGeodeticLength.js +1 -1
  395. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  396. package/geometry/operators/gx/operatorIntersection.js +1 -1
  397. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  398. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  399. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  400. package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
  401. package/geometry/operators/gx/operatorOffset.js +1 -1
  402. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  403. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  404. package/geometry/operators/gx/operatorProject.js +1 -1
  405. package/geometry/operators/gx/operatorProximityGeodesic.js +1 -1
  406. package/geometry/operators/gx/operatorShapePreservingProject.js +1 -1
  407. package/geometry/operators/gx/operatorSimplify.js +1 -1
  408. package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
  409. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  410. package/geometry/operators/gx/operatorUnion.js +1 -1
  411. package/geometry/operators/isNearOperator.js +1 -1
  412. package/geometry/operators/json/containsOperator.js +1 -1
  413. package/geometry/operators/json/disjointOperator.js +1 -1
  414. package/geometry/operators/locateBetweenOperator.js +1 -1
  415. package/geometry/operators/reshapeOperator.js +1 -1
  416. package/geometry/operators/support/apiConverter.js +1 -1
  417. package/geometry/operators/support/geographicTransformationUtils.js +1 -1
  418. package/geometry/operators/support/initNoPeFactory.js +1 -1
  419. package/geometry/operators/support/jsonConverter.js +1 -1
  420. package/geometry/operators/support/projectionTransformation.js +1 -1
  421. package/geometry/operators/symmetricDifferenceOperator.js +1 -1
  422. package/geometry/operators/unionOperator.js +1 -1
  423. package/geometry/pe.js +1 -1
  424. package/geometry/support/MeshTexture.js +1 -1
  425. package/geometry/support/boundedPlane.js +1 -1
  426. package/geometry/support/buffer/math/vec3.js +1 -1
  427. package/geometry/support/buffer/math/vec4.js +1 -1
  428. package/geometry/support/buffer/utils/vec2.js +1 -1
  429. package/geometry/support/coordinateSystem.js +1 -1
  430. package/geometry/support/meshUtils/extent.js +1 -1
  431. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  432. package/geometry/support/meshUtils/projection.js +1 -1
  433. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  434. package/geometry/support/spatialReferenceUtils.js +1 -1
  435. package/geometry/support/vcsData.js +1 -1
  436. package/interfaces.d.ts +3 -0
  437. package/kernel.js +1 -1
  438. package/layers/FeatureLayer.d.ts +29 -39
  439. package/layers/ImageryTileLayer.js +1 -1
  440. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  441. package/layers/IntegratedMeshLayer.js +1 -1
  442. package/layers/KnowledgeGraphLayer.js +1 -1
  443. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  444. package/layers/OrientedImageryLayer.d.ts +233 -0
  445. package/layers/OrientedImageryLayer.js +1 -1
  446. package/layers/VideoLayer.d.ts +35 -9
  447. package/layers/VideoLayer.js +1 -1
  448. package/layers/catalog/CatalogFootprintLayer.d.ts +147 -0
  449. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  450. package/layers/knowledgeGraph/cypherUtils.js +1 -1
  451. package/layers/mixins/ArcGISImageService.js +1 -1
  452. package/layers/mixins/FeatureLayerBase.d.ts +12 -0
  453. package/layers/mixins/FeatureLayerBase.js +1 -1
  454. package/layers/orientedImagery/transformations/utils.js +1 -1
  455. package/layers/raster/datasets/ImageAuxRaster.js +1 -1
  456. package/layers/raster/formats/RasterCodec.js +1 -1
  457. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  458. package/layers/support/FeatureReductionBinning.d.ts +87 -9
  459. package/layers/support/FeatureReductionCluster.d.ts +87 -9
  460. package/layers/support/FieldConfiguration.d.ts +1 -1
  461. package/layers/support/ImageElement.js +1 -1
  462. package/layers/support/ParquetFilesData.js +1 -1
  463. package/layers/support/SceneFilter.js +1 -1
  464. package/layers/support/Sublayer.d.ts +25 -0
  465. package/layers/support/Sublayer.js +1 -1
  466. package/layers/support/SubtypeSublayer.d.ts +147 -0
  467. package/layers/support/TelemetryData.d.ts +5 -0
  468. package/layers/support/TelemetryData.js +1 -1
  469. package/layers/support/TelemetryDisplay.d.ts +10 -2
  470. package/layers/support/TelemetryDisplay.js +1 -1
  471. package/layers/video/VideoController.js +1 -1
  472. package/layers/video/types.d.ts +8 -1
  473. package/layers/video/videoUtils.js +1 -1
  474. package/linkChart/LinkChartProperties.js +1 -1
  475. package/linkChart/utils.js +1 -1
  476. package/package.json +2 -2
  477. package/portal/PortalItem.js +1 -1
  478. package/portal/jsonTypes.d.ts +7 -0
  479. package/renderers/UniqueValueRenderer.js +1 -1
  480. package/rest/knowledgeGraphService.js +1 -1
  481. package/rest/print.js +1 -1
  482. package/rest/support/PrintParameters.d.ts +8 -1
  483. package/rest/support/PrintParameters.js +1 -1
  484. package/support/arcadeUtils.js +1 -1
  485. package/support/persistableUrlUtils.js +1 -1
  486. package/support/revision.js +1 -1
  487. package/symbols/Symbol3D.js +1 -1
  488. package/symbols/support/IconSymbol3DLayerResource.js +1 -1
  489. package/symbols/support/urlUtils.js +1 -1
  490. package/symbols/support/webStyleSymbolUtils.js +1 -1
  491. package/third-party-notices.txt +188 -0
  492. package/views/2d/ViewStateManager.js +1 -1
  493. package/views/2d/engine/webgl/shaderGraph/graph/GlslGraphWriter.js +1 -1
  494. package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
  495. package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphNode.js +1 -1
  496. package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
  497. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPolygonShader.js +1 -1
  498. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js +1 -1
  499. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/AspectShader.js +1 -1
  500. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/CurvatureShader.js +1 -1
  501. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MaskShader.js +1 -1
  502. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/RemapShader.js +1 -1
  503. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/SlopeShader.js +1 -1
  504. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
  505. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/surface.js +1 -1
  506. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  507. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  508. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  509. package/views/2d/layers/VideoLayerView2D.js +1 -1
  510. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  511. package/views/3d/analysis/Slice/SliceController.js +1 -1
  512. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  513. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  514. package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
  515. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
  516. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  517. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  518. package/views/3d/focusAreaUtils.js +1 -1
  519. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  520. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  521. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  522. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  523. package/views/3d/layers/SceneLayerWorker.js +1 -1
  524. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  525. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  526. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  527. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  528. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  529. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  530. package/views/3d/layers/i3s/meshUtils.js +1 -1
  531. package/views/3d/state/ScreenSizePerspective.js +1 -1
  532. package/views/3d/support/ViewSlice.js +1 -1
  533. package/views/3d/terrain/OverlayRenderer.js +1 -1
  534. package/views/3d/terrain/RasterColorizer.glsl.js +1 -1
  535. package/views/3d/terrain/RasterTile.js +1 -1
  536. package/views/3d/terrain/TerrainRenderer.js +1 -1
  537. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  538. package/views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js +3 -5
  539. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  540. package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
  541. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  542. package/views/3d/webgl-engine/effects/atmosphere/SimpleAtmosphere.glsl.js +1 -1
  543. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  544. package/views/3d/webgl-engine/effects/clouds/Clouds.glsl.js +1 -1
  545. package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
  546. package/views/3d/webgl-engine/effects/clouds/CloudsTechnique.js +1 -1
  547. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.glsl.js +1 -1
  548. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
  549. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlasTechnique.js +1 -1
  550. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColor.glsl.js +1 -1
  551. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  552. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
  553. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.glsl.js +1 -1
  554. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  555. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +1 -1
  556. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  557. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  558. package/views/3d/webgl-engine/effects/fog/FogTechnique.js +1 -1
  559. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  560. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  561. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
  562. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlurTechnique.js +1 -1
  563. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechnique.js +1 -1
  564. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
  565. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscale.glsl.js +1 -1
  566. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscaleTechnique.js +1 -1
  567. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  568. package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
  569. package/views/3d/webgl-engine/effects/glow/GlowBlurTechnique.js +1 -1
  570. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
  571. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +1 -1
  572. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  573. package/views/3d/webgl-engine/effects/haze/HazeCompositing.glsl.js +1 -1
  574. package/views/3d/webgl-engine/effects/haze/HazeCompositingTechnique.js +1 -1
  575. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  576. package/views/3d/webgl-engine/effects/highlight/HighlightBlur.glsl.js +1 -1
  577. package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +1 -1
  578. package/views/3d/webgl-engine/effects/highlight/HighlightDownsample.glsl.js +1 -1
  579. package/views/3d/webgl-engine/effects/highlight/HighlightDownsampleTechnique.js +1 -1
  580. package/views/3d/webgl-engine/effects/magnifier/Magnifier.glsl.js +1 -1
  581. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  582. package/views/3d/webgl-engine/effects/magnifier/MagnifierTechnique.js +1 -1
  583. package/views/3d/webgl-engine/effects/transparency/OITBlend.glsl.js +1 -1
  584. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  585. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  586. package/views/3d/webgl-engine/effects/transparency/OITDimOpaque.glsl.js +1 -1
  587. package/views/3d/webgl-engine/effects/transparency/OITDimOpaqueTechnique.js +1 -1
  588. package/views/3d/webgl-engine/lib/Compositor.js +1 -1
  589. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  590. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  591. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  592. package/views/3d/webgl-engine/lib/GaussianSplatShadowRenderNode.js +1 -1
  593. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  594. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  595. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  596. package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
  597. package/views/3d/webgl-engine/lib/Texture.glsl.js +1 -1
  598. package/views/3d/webgl-engine/lib/TextureTechnique.js +1 -1
  599. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  600. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  601. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  602. package/views/3d/webgl-engine/shaders/AtmosphereCompositing.glsl.js +1 -1
  603. package/views/3d/webgl-engine/shaders/AtmosphereCompositingTechnique.js +1 -1
  604. package/views/3d/webgl-engine/shaders/Compositing.glsl.js +1 -1
  605. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  606. package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
  607. package/views/3d/webgl-engine/shaders/CutFillCompositionTechnique.js +1 -1
  608. package/views/3d/webgl-engine/shaders/CutFillDepth.glsl.js +1 -1
  609. package/views/3d/webgl-engine/shaders/CutFillDepthTechnique.js +1 -1
  610. package/views/3d/webgl-engine/shaders/CutFillMask.glsl.js +1 -1
  611. package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +1 -1
  612. package/views/3d/webgl-engine/shaders/CutFillReduction.glsl.js +1 -1
  613. package/views/3d/webgl-engine/shaders/CutFillReductionTechnique.js +1 -1
  614. package/views/3d/webgl-engine/shaders/CutFillTargetDepth.glsl.js +1 -1
  615. package/views/3d/webgl-engine/shaders/CutFillTargetDepthTechnique.js +1 -1
  616. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  617. package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
  618. package/views/3d/webgl-engine/shaders/GaussianSplatShadowTechnique.js +1 -1
  619. package/views/3d/webgl-engine/shaders/GaussianSplatTechnique.js +1 -1
  620. package/views/3d/webgl-engine/shaders/OverlayCompositing.glsl.js +1 -1
  621. package/views/3d/webgl-engine/shaders/OverlayCompositingTechnique.js +1 -1
  622. package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
  623. package/views/3d/webgl-engine/shaders/PointRendererTechnique.js +1 -1
  624. package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
  625. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  626. package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +1 -1
  627. package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
  628. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  629. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  630. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  631. package/views/3d/webgl-engine/shaders/Viewshed.glsl.js +1 -1
  632. package/views/3d/webgl-engine/shaders/ViewshedTechnique.js +1 -1
  633. package/views/Viewport2DBaseMixin.js +1 -1
  634. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  635. package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
  636. package/webdoc/support/webdocSaveUtils.js +1 -1
  637. package/widgets/Attachments/support/attachmentUtils.js +1 -1
  638. package/widgets/Attachments.d.ts +0 -1
  639. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +8 -1
  640. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  641. package/widgets/BatchAttributeForm/attachmentUtils.js +2 -0
  642. package/widgets/BatchAttributeForm/css.js +1 -1
  643. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  644. package/widgets/BatchAttributeForm/templates/RelationshipElementTemplate.js +1 -1
  645. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  646. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  647. package/widgets/BatchAttributeForm/types.d.ts +7 -0
  648. package/widgets/BatchAttributeForm.js +1 -1
  649. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  650. package/widgets/BuildingExplorer/BuildingLevelPicker/constants.js +1 -1
  651. package/widgets/FeatureForm/RelationshipInput.d.ts +1 -1
  652. package/widgets/FeatureTable.js +1 -1
  653. package/widgets/Features.d.ts +1 -1
  654. package/widgets/LayerList/LayerListItem.js +1 -1
  655. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  656. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  657. package/widgets/OrientedImageryViewer/constants.js +1 -1
  658. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  659. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
  660. package/widgets/OrientedImageryViewer/types.js +1 -1
  661. package/widgets/OrientedImageryViewer/videoViewerUtils.js +1 -1
  662. package/widgets/OrientedImageryViewer.js +1 -1
  663. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  664. package/widgets/Popup.d.ts +2 -24
  665. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  666. package/widgets/TableList/support/tableListUtils.js +1 -1
  667. package/widgets/TableList.js +1 -1
  668. package/widgets/VideoPlayer/VideoPlayerViewModel.d.ts +9 -0
  669. package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
  670. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  671. package/widgets/support/ContingentValuesManager.js +1 -1
  672. package/widgets/support/forms/formUtils.js +1 -1
  673. package/assets/esri/core/workers/chunks/09630888267cde87654f.js +0 -1
  674. package/assets/esri/core/workers/chunks/0d9d33f29124d464a4cb.js +0 -1
  675. package/assets/esri/core/workers/chunks/0e333f1bce992508b68a.js +0 -1
  676. package/assets/esri/core/workers/chunks/0fa207c68dfd7ddee160.js +0 -1
  677. package/assets/esri/core/workers/chunks/13838b6c045425e73cf8.js +0 -1
  678. package/assets/esri/core/workers/chunks/177472a6a9beb1590934.js +0 -1
  679. package/assets/esri/core/workers/chunks/1d0f9f147bfa00b38d48.js +0 -1
  680. package/assets/esri/core/workers/chunks/1d54b71c43d9d6a5f713.js +0 -1
  681. package/assets/esri/core/workers/chunks/1f6b7626f333809837ef.js +0 -1
  682. package/assets/esri/core/workers/chunks/24646a1176ce34039155.js +0 -1
  683. package/assets/esri/core/workers/chunks/268ed861c882740c805b.js +0 -1
  684. package/assets/esri/core/workers/chunks/2b52c1c01cf568ba01fb.js +0 -1
  685. package/assets/esri/core/workers/chunks/3116a1c2b67a296ba86e.js +0 -1
  686. package/assets/esri/core/workers/chunks/32c17c299c7622ae0d71.js +0 -1
  687. package/assets/esri/core/workers/chunks/34f79355145c8e4c59dd.js +0 -1
  688. package/assets/esri/core/workers/chunks/3be111488365768fd917.js +0 -1
  689. package/assets/esri/core/workers/chunks/3f0483cbcd893acf240c.js +0 -1
  690. package/assets/esri/core/workers/chunks/40d251b6b42a41d68bd2.js +0 -1
  691. package/assets/esri/core/workers/chunks/43cc82373be791b7cb4c.js +0 -1
  692. package/assets/esri/core/workers/chunks/4a23b27bfbcfa08fd9a7.js +0 -1
  693. package/assets/esri/core/workers/chunks/4c54cb80c4dc9bbbd395.js +0 -1
  694. package/assets/esri/core/workers/chunks/598271956c46e21e5c09.js +0 -1
  695. package/assets/esri/core/workers/chunks/5b07f3253403fe25ce5b.js +0 -1
  696. package/assets/esri/core/workers/chunks/5b6f2bfdcdd207d8ae42.js +0 -1
  697. package/assets/esri/core/workers/chunks/5c7ba4b8a9ec2e2e02b5.js +0 -1
  698. package/assets/esri/core/workers/chunks/60915a3708a34da1977e.js +0 -1
  699. package/assets/esri/core/workers/chunks/61c523dd9d8027922465.js +0 -1
  700. package/assets/esri/core/workers/chunks/65520a443e3811255bea.js +0 -1
  701. package/assets/esri/core/workers/chunks/671826fe25105aedcce4.js +0 -1
  702. package/assets/esri/core/workers/chunks/6b79c254897ece95b7a3.js +0 -1
  703. package/assets/esri/core/workers/chunks/6c35583707f5c339ee99.js +0 -1
  704. package/assets/esri/core/workers/chunks/6cb467a9517f024be72f.js +0 -1
  705. package/assets/esri/core/workers/chunks/71119398ec91f1b209d7.js +0 -1
  706. package/assets/esri/core/workers/chunks/8ac8ef856ed9592c433b.js +0 -1
  707. package/assets/esri/core/workers/chunks/8fedb32055ac7f771419.js +0 -1
  708. package/assets/esri/core/workers/chunks/9482a6d7baa24bbf5693.js +0 -1
  709. package/assets/esri/core/workers/chunks/9c11e1fe785e1385fdb1.js +0 -1
  710. package/assets/esri/core/workers/chunks/a567d001fcfa1f1cdeea.js +0 -1
  711. package/assets/esri/core/workers/chunks/a58662698c69190a12d8.js +0 -2
  712. package/assets/esri/core/workers/chunks/afdc6fc453157528cf9b.js +0 -1
  713. package/assets/esri/core/workers/chunks/b5ced451d331ca1ffb68.js +0 -1
  714. package/assets/esri/core/workers/chunks/b7f5d51ac26f37837b3b.js +0 -1
  715. package/assets/esri/core/workers/chunks/ba7fe21a78ea37a02b7c.js +0 -1
  716. package/assets/esri/core/workers/chunks/bb3ab2453ccde2f2611c.js +0 -1
  717. package/assets/esri/core/workers/chunks/beba9f2213d8a850ddb6.js +0 -1
  718. package/assets/esri/core/workers/chunks/c1189316d24fb4cdb2a0.js +0 -1
  719. package/assets/esri/core/workers/chunks/c9461568e1002ebac534.js +0 -1
  720. package/assets/esri/core/workers/chunks/d30790c69724258dab2b.js +0 -1
  721. package/assets/esri/core/workers/chunks/d35c475f004367e333eb.js +0 -1
  722. package/assets/esri/core/workers/chunks/d8c4fb66c733ab2f66d3.js +0 -1
  723. package/assets/esri/core/workers/chunks/d95ffd990b3a7df69e1e.js +0 -1
  724. package/assets/esri/core/workers/chunks/dd6efa0afe879bd11a2e.js +0 -1
  725. package/assets/esri/core/workers/chunks/dec51409372764e7093d.js +0 -1
  726. package/assets/esri/core/workers/chunks/e133840540abf20262a4.js +0 -1
  727. package/assets/esri/core/workers/chunks/e63e24101e7e92c62d98.js +0 -1
  728. package/assets/esri/core/workers/chunks/e785f76c1a75cb1d1e1f.js +0 -1
  729. package/assets/esri/core/workers/chunks/f27397379c6c88bc6ef4.js +0 -1
  730. package/assets/esri/core/workers/chunks/f53805c7a84203305b2c.js +0 -1
  731. package/assets/esri/core/workers/chunks/f60292d97bcdbf19165b.js +0 -1
  732. package/assets/esri/core/workers/chunks/f6ebec8d2248c719b89f.js +0 -1
  733. package/assets/esri/core/workers/chunks/fd2afff07aaac8203c18.js +0 -1
  734. package/assets/esri/core/workers/chunks/ff7708aaa2de720e3a47.js +0 -1
  735. /package/assets/esri/core/workers/chunks/{53bf9b0c2b8da12820ea.js.LICENSE.txt → 29b00d07d3e1d095c590.js.LICENSE.txt} +0 -0
  736. /package/assets/esri/core/workers/chunks/{a58662698c69190a12d8.js.LICENSE.txt → 35fdd62277fd06468a29.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as i,isSome as r}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as l}from"../../core/Evented.js";import{makeHandle as c}from"../../core/handleUtils.js";import{equalsShallow as d}from"../../core/lang.js";import h from"../../core/Logger.js";import{clamp as u}from"../../core/mathUtils.js";import{destroyMaybe as p,abortMaybe as m}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as v,waitTick as f}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as _,on as F,watch as b,syncAndInitial as M,initial as S,when as V}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{getMetersPerUnitForSR as P}from"../../core/units.js";import{property as C,subclass as A}from"../../core/accessorSupport/decorators.js";import{isSerializable as k}from"../../core/support/jsonUtils.js";import{UpdatingHandles as T}from"../../core/support/UpdatingHandles.js";import G from"../../geometry/Extent.js";import L from"../../geometry/Point.js";import{projectAsync as O}from"../../geometry/projectionUtils.js";import E from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as j}from"../../geometry/support/centroid.js";import{isClockwise as x}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as B}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as R}from"../../geometry/support/webMercatorUtils.js";import D from"../../layers/GraphicsLayer.js";import H from"../../layers/MediaLayer.js";import{searchImages as z,getSortedLayerFeatures as N}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as U}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as q,computePolygonForInspection as W,resizePolygon as $,checkIfPolygonContainsSelectedPoint as Z}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as J}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as K,convertGeographicToWebMercator as Q}from"../../layers/orientedImagery/core/utils.js";import X from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as Y}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as ee,getInitialAngle as te,convertPixelLocationToSphereVertex as ie,getUpdateElevationProps as re,getImageToWorldProperties as ae,getImageToWorldPanoramicProperties as se}from"../../layers/orientedImagery/transformations/utils.js";import oe from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as ne}from"../../layers/support/floorFilterUtils.js";import le from"../../layers/support/VideoElement.js";import ce from"../../views/MapView.js";import de from"../../views/draw/Draw.js";import{scale as he}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ue}from"../../views/input/InputManager.js";import pe from"../PanoramicVideoViewer.js";import me from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as ge,videoMapViewConstraint as ye,fixedImageSize as ve,clockwiseDirections as fe,sampleExtent as we,videoExtent as _e,invalidCameraHeading as Fe,sectorsInOrder as be,sectorsRadii as Me}from"./constants.js";import{isFeatureAttachment as Se}from"./galleryUtils.js";import{crossSymbol as Ve,crossSymbol3D as Ie,measurementPolygonSymbol as Pe,polylineSymbolPanoramic as Ce,measurementPolylineSymbol as Ae,cameraOverlaySymbol3D as ke,cameraOverlaySymbol as Te,diamondSymbol as Ge,diamondSymbol3D as Le,activeSourcePointSymbol as Oe,sourcePointSymbol as Ee}from"./symbols.js";import{registryKeys as je}from"./types.js";import{isNoAttachmentError as xe,extractHorizonAnglesFromMedia as Be,isTifOrMrf as Re,filterOILLayerView as De,assignElevationSampleToFeatures as He,filterByZ as ze,createPanoramicMedia as Ne,createNonPanoramicMedia as Ue,isSceneView as qe,isGraphic as We,calculateSegment as $e,calculateDirection as Ze}from"./utils.js";import{disableVideoZoomAndPan as Je,getUpdatedConstraints as Ke,getUpdatedExtentPoints as Qe}from"./videoViewerUtils.js";import Xe from"./components/ImageViewer.js";import Ye from"./components/NavigationNode.js";import et from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as tt}from"./navigation/errors.js";import{queryFeatureByObjectIds as it}from"./navigation/queries.js";import{ImageMeasurementService as rt}from"./services/ImageMeasurementService.js";import at from"./services/SuperimposeService.js";import{configureSketchTool as st,extractFieldsFromDataCaptureLayer as ot,constructGraphicFromImageGeometry as nt}from"./support/dataCaptureUtils.js";import{imageSpaceToPoint as lt,removeZFromGeometry as ct}from"./support/geometryUtils.js";import dt from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as ht}from"./support/typeUtils.js";const ut=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let pt=class extends(l(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=ge,this.cameraPitchThreshold=ge,this.clickAction="hittest",this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:r,selectedPoint:a}=this;if(this.emit("popup-close"),r&&a){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadDepthImage(i),await this._loadImage(i)}catch(s){y(s)||(this.loadImageError(s),h.getLogger(this).error("#loadIImage()","error occured while loading image",s))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,i)=>{if(this.emit("popup-close"),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(i)}catch(r){y(r)||(this.loadImageError(r),h.getLogger(this).error("#loadIImage()","error occured while loading image",r))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.initialVideoMapViewExtent=null,this.imageMeasurementViewer=new Xe,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.locationPointOnImage=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new s,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.superimposeViewEnabled=!1,this.defaultSuperimposeCameraLockEnabled=!0,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=null,this.scheduledFrameId=null,this.superimposeScheduledFrameId=null,this.superimposeDebounceTimeoutId=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t,i)=>{"default"===this.mode&&"image-loaded"!==this.state||await(this._adapter?.updateFootprint(e,t,i))},this.updateVideoFootprint=async e=>{this.mode.includes("video")&&this.videoElement?.content&&await(this._adapter?.updateVideoFootprint(e))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new ce({map:new Map,constraints:ye}),this.verticalFilterEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new Xe,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new D({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._superimposeService=new at({getMapPoint:(e,t)=>this.getMapPoint(e,t),pointToPixel:(e,t)=>this._transformationService.pointToPixel(e,t),overlays:this._overlays}),this._panoramicVideoViewer=new pe,this._panoramicViewer=new me,this._panoramicMeasurementViewer=new me,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new T,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._superimposeScheduleController=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,i=this.layer?.imageReferenceField;if(!t||!e||!i)return;const r=this.overlayedMapFeatures.get(e);r?.forEach(e=>{const r=e.attributes??{},a=Object.keys(r).find(e=>e.toLowerCase()===i.toLowerCase());(a?r[a]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:i}=await t;return v(e),this.sketchAdapter=new i({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,i)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,i)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const i=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(i)this.currentBestFeature=i;else{const{layer:i,layerFloorFilterClause:a,layerTimeExtent:s}=this;if(!i)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const o=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(i,e,a,s,t));try{await o,await this.selectBestFeature(e,t)}catch(r){y(r)||(h.getLogger(this).error("oriented-imagery-viewer:show-image",r),"NoFeatureFoundWithObjectIdError"===r.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",r.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{mode:i}=this;if("default"!==i&&"panoramic"!==i)throw new n("NavigationError","Navigation is only supported in 'default' and 'panoramic' modes.");const r=e=>"default"===i&&e.declaredClass.endsWith("NavigationManager")||"panoramic"===i&&e.declaredClass.endsWith("NavigationManagerPanoramic");if(null==this._navigationManager||!r(this._navigationManager)){p(this._navigationManager);const e="default"===i?import("./navigation/NavigationManager.js"):import("./navigation/NavigationManagerPanoramic.js");this._navigationManager=new(await e).default({viewModel:this})}return this._navigationManager.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(v(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),_(()=>"image-loaded"===this.state,t)),this.toggleImageAttributes=()=>{const{currentBestFeature:e,popupEnabled:i,layer:r,view:a}=this;if(this.emit("popup-close"),!(a&&e&&i&&r))return;const{attributes:s,geometry:o}=e,n=new t({geometry:o,attributes:s.toJSON(),origin:r.graphicOrigin,sourceLayer:r});this.emit("popup-open",{features:[n],location:s.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const i=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(i,t),this._groupFeaturesBySectors()},this._computeOverlayFeature=()=>{const{currentBestFeature:e,mode:t}=this,i="panoramic-video"===t;return"video"===t?this.videoViewModel?.closestFeature??e:i?this._panoramicVideoViewer.viewModel.closestFeature??e:e},this._computeOverlayImageSize=()=>{const{mode:e}=this;return"video"===e?ve:"panoramic-video"===e?this._panoramicVideoViewer.imageSize:this.activeViewer?.imageSize},this._geometryToOverlayImageGeometry=async(e,t,i)=>{const{mode:r,videoViewModel:a,_panoramicVideoViewer:s}=this;if("video"===r)return await(a?.geometryToOverlayGeometry(e,t))??null;if("panoramic-video"===r){const a={feature:t,mode:r,imageSize:i,footprintExtent:this.footprintExtent};return await this._transformationService.geometryToImageGeometryForFeature(e,a,s.horizonAngles)}return await this._transformationService.geometryToImageGeometry(e)},this._createViewClickHandle=()=>{if(this.removeHandles(je.click),this.disabled||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,ue.DEFAULT),je.click)},this._createImageClickHandle=()=>{this.removeHandles(je.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:i,currentBestFeature:r,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&r))return;const n=i.clickAction;this.clickAction="pixel-location";const l=c(()=>{this.clickAction=n});let d=null;const h=F(()=>i,"pixel-location",e=>{this.plotReferencePointOnImage(e),d?.abort(),d=a(async t=>{if(!e)return;const i=await this._transformationService.pixelToMapPoint(e).then(e=>{const t=this.view?.spatialReference;return ee(!t,e.spatialReference.equals(t))?e:O(e,t)});v(t),this.plotReferencePointOnGround(i)})});this.addHandles([h,l],je.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(je.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),je.triangularImageClick)},this._enablePan=()=>{this.removeHandles(je.videoPanHandles)},this._disablePan=()=>{this.removeHandles(je.videoPanHandles),this.addHandles(Je(this.videoMapView),je.videoPanHandles)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:i}=this;if(!t)return;const r=e.results.find(({graphic:e,graphic:{attributes:r}})=>i.includes(e)&&r&&!r[t.imageReferenceField]&&!r[t.imageGeometryField]);if(!r)return;const a=r.graphic.attributes[t.objectIdField];await this.showImageByObjectId(a)},this._loadDepthImage=async e=>{const{currentBestFeature:t,layer:i,depthImageNotSupported:r}=this;if(this.depthImage?.destroy(),this.depthImage=null,!i||!t||r)return;const{depthImage:a}=t.attributes;if(!a)return;const s=(await import("./services/DepthImageService.js")).default;v(e),this.depthImage=new s({url:a});try{await this.depthImage.load(e)}catch(o){y(o)||(h.getLogger(this).error("error occurred while loading depth image",o),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:r}=this;if(this.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),v(e),await this.transformAndPlotSelectedLocation(e)}catch(a){y(a)||this.loadImageError(a)}},this._loadVideo=async e=>{const{currentBestFeature:t,mode:i,selectedPoint:r}=this,a=t?.attributes.imagePath;if(!t||"panoramic-video"!==i||!a)return;const{attributes:s}=t,{cameraPitch:o,cameraOrientation:n,location:l}=s,c=l.spatialReference.isWGS84&&4!==n?.type?R(l):new L(l);try{this._panoramicVideoViewer.viewModel.video&&(this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.viewModel.videoPaused=!0),this._panoramicVideoViewer.videoSource=a;let t=0;c&&r&&(t=await te(c,r)-t),this._panoramicVideoViewer.pitch=o??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),v(e)}catch(d){y(d)||this.loadImageError(d)}},this._loadImageFromFeature=async(e,t,i)=>{const{mode:r}=this;if("default"!==r&&"panoramic"!==r)return;let a;try{a=await dt(t.attributes,e,i),v(i)}catch(f){if(y(f))return;return xe(f)?(h.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${e.objectIdField}: ${t.attributes.objectId}`)):(h.getLogger(this).error(f,{[e.objectIdField]:t.attributes.objectId,layer:e}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`))}if(!a)return;const{mediaUrl:s,datasetFormat:o,rotation:n,searchParams:l,location:c,cameraHeading:d,matrix:u,cameraPitch:p,getDataSetFormatError:m}=a,g=`${t.attributes.objectId}`;try{let a=this._mediaPrefetcher?.getCachedMedia(g);if(!a){const i=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(i){try{await(this._mediaPrefetcher?.startPrefetchForNode(i,e))}catch(w){}a=this._mediaPrefetcher?.getCachedMedia(g)}}if(a){if("panoramic"===r){const e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;let r=0;return c&&this.selectedPoint&&(r=await te(c,this.selectedPoint)-r),await e.loadMedia(a,i),this.selectedPoint?e.set({yaw:r,pitch:p}):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)&&e.set({yaw:t.attributes.viewAngle,pitch:p}),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}return await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,a,i),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}}catch(w){}m&&h.getLogger(this).warn("error occurred while getting dataset format",m),"panoramic"===r?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await te(c,this.selectedPoint):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:o?.toUpperCase(),url:s,cameraHeading:d,matrix:u},i):await this.loadMediaSource({datasetFormat:o?.toUpperCase(),url:s,customParameters:l,rotation:n},i),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i)},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:i,mode:r}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),v(e)}catch(a){y(a)||this.loadImageError(a)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){const{default:t}=await import("./support/MediaPrefetcher.js");v(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*fe.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{const{view:t}=this;if(this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");v(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");v(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=B(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:i,currentBestFeatureMeasurementImage:r,triangulatedMeasurementGraphic:a}=this;t&&i&&r&&a&&"active"!==t.state&&(t.update([a],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._updateInteraction=()=>{const e=this.videoMapView.extent;if(!e)return;if(e.width<we.xmax-we.xmin&&e.height<we.ymax-we.ymin){this._enablePan();const t=Ke(e);t&&(this.videoMapView.constraints.geometry=t)}else this.initialVideoMapViewExtent&&!this.videoMapView.extent.equals(this.initialVideoMapViewExtent)&&(this.videoMapView.extent=this.initialVideoMapViewExtent),this._disablePan(),this.videoMapView.constraints.geometry=null},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=a(async t=>{const{pointerType:i,button:r,mapPoint:a}=e;if("mouse"===i&&0!==r||!a)return;e.stopPropagation(),e.preventDefault();const{view:s,layer:o}=this;if(s&&o){if(this.shouldShowSelectedImage){const i=s.hitTest(e,{include:[o]});this._updatingHandles.addPromise(i);const r=await i;return v(t),await this._processHitTestResults(o,r,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(a,{signal:t}))}})},this.plotSelectedPointOnImage=async(e,i)=>{if(await f(i),!e)return;const r=new L({...k(e)?e.toJSON():e});if("default"===this.mode)r.x-=.5,r.y=.5-r.y,r.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:r,symbol:Ve}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:i,media:r}=this._panoramicViewer;if(!i||!r)return;const a=Be(r),s=ie(e,...i,a);this._crossSymbol=new t({geometry:new L(s,E.WebMercator),symbol:Ie}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([b(()=>this.view,()=>this.load(),M),b(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},S),b(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},S),b(()=>[this.state,this.mapImageConversionToolState,this.view,this.disabled],()=>{this._createViewClickHandle(),this._createImageClickHandle()},M),b(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},M),b(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},M),b(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},M),b(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},M),b(()=>[this.superimposeViewEnabled,this.defaultSuperimposeCameraLockEnabled,this.superimposeViewSupported,this.currentBestFeature,this.mode,this.state,this.view?.type],()=>{this._shouldDisableUnsupportedSuperimposeView()?this.superimposeViewEnabled=!1:this._hasActiveSuperimposeCameraContext()?this._updateSuperimposedImage():this._resetInactiveSuperimposeState()},M),b(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),M),b(()=>this.currentBestFeature,async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=a(async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}])),await this._featureChangedTask.promise},{sync:!0}),b(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=a(async e=>{this.preloadMedia&&null!=this.navigationMode?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),v(e),"directional"===this.navigationMode?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},M),b(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{m(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=a(async i=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:i}),v(i),this._reorderTriangularSketchLayer()})},M),b(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this._measurementService?.resetMeasurementVectors(),this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),b(()=>this.mode,e=>{switch(this.removeHandles(je.interactionHandles),e){case"default":this.addHandles(b(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...M,equals:(e,t)=>i(e,t,d)}),je.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:i}=this;if(e&&t?.loaded&&i)return{videoExtent:_e,bestFeatureFootprint:i}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(i)}))},{...M,equals:(e,t)=>i(e?.videoExtent,t?.videoExtent,d)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),je.interactionHandles);break;case"panoramic":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:i}=this,{imageSize:r,vfov:a,hfov:s,pitch:o,yaw:n}=i;return e&&r&&!t.includes("loading")&&null!=a&&null!=s&&null!=o&&null!=n?[a,s,n,o]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,i,r,s]=e;this.currentNode&&(this.currentNode.currentHeading=r,this.currentNode.currentPitch=s),m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:s},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,d)}),je.interactionHandles);break;case"panoramic-video":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:i}=this,{imageSize:r,vfov:a,hfov:s,pitch:o,yaw:n,viewModel:l}=i,c=l.closestFeature??e;return c&&r&&!t.includes("loading")&&null!=a&&null!=s&&null!=o&&null!=n?[a,s,n,o,c]:null},e=>{if(!e)return;const[t,i,r,s,o]=e;m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:s,feature:o,horizonAngles:this._panoramicVideoViewer.horizonAngles},{signal:e}),v(e),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,d)}),je.interactionHandles)}},M),b(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:r,sharpness:a}=this;"default"===r&&(e.brightness=t,e.contrast=i,e.sharpness=a)},M),b(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),b(()=>this.activeViewer,e=>{this.removeHandles(je.hittestHandles),e&&this.addHandles(F(()=>e,"hittest-response",this._handleImageHitTestResponse),je.hittestHandles)}),b(()=>this.videoMapView.extent,async()=>{const e=this.videoViewModel?.closestFeature;e&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(i)}))}),b(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this.scheduledFrameId||(this.scheduledFrameId=requestAnimationFrame(()=>{this.scheduledFrameId=null,this._updateInteraction()}))},{initial:!0}),V(()=>null!=this.videoMapView.extent,()=>{this.initialVideoMapViewExtent=this.videoMapView.extent},{once:!0})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._abortSuperimposeSchedule(),this.currentBestFeature=null,this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._locationViewModel=p(this._locationViewModel),this._crossSymbol=p(this._crossSymbol),this._referencePointOnGround=p(this._referencePointOnGround),this._referencePointOnImage=p(this._referencePointOnImage),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.destroy()}get activeLayer(){return o(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:i}=this;switch(i){case"default":return e;case"panoramic":return t;default:return null}}get activeTriangulatedViewer(){switch(this.mode){case"default":return this.imageMeasurementViewer;case"panoramic":return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",u(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",u(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!Re(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return Re(t)||Se(t)}get imageLoaded(){return o(h.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===Fe}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(De(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ne(e):null}get layerTimeExtent(){return this.layerView?.timeExtent??null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:i,isSpherical:r}=e;return 360===i||r?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:i}=t.viewModel;return("panoramic-video"===e&&!0===i)??!1}get overlayGraphicsEnabled(){const{mode:e,state:t,panoramicVideoLoaded:i,videoViewModel:r,_panoramicVideoViewer:a}=this;return"image-loaded"===t||"video"===e&&"video-loaded"===t&&!0===r?.videoPaused||"panoramic-video"===e&&i&&!0===a.viewModel.videoPaused}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?be.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",u(e,0,1))}get superimposeViewSupported(){return"default"===this.mode||"panoramic"===this.mode}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:i}=this;if(!this.isFulfilled()||t||!1===i?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:i,imageRotation:r}})=>{const a=e?.trim();return Re(a)||Se(a)?{url:a,objectId:t,rotation:(i??0)+(r??0)}:null}).filter(r)):null}get videoExtentPoints(){const e=Qe(this.videoMapView.extent);return e.length?e:_e}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new D({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new D({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}updateSuperimposeZOffset(e){this._superimposeService.updateZOffset(this.mode,e)}updateDefaultSuperimposeCameraLock(e){this.defaultSuperimposeCameraLockEnabled=e,this.superimposeViewEnabled&&"default"===this.mode&&(e?this._adapter?.enableDefaultSuperimposeNavigation?.():this._adapter?.disableDefaultSuperimposeNavigation?.())}beforeLoad(e=!0){this.emit("popup-close"),e&&(this.displayMessage=null),this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=p(this.locationPointOnImage)),this.correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this.correctedLocationPointOnImage=p(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:i,dataCaptureLayer:r}=this;if(!i)throw ut();st(r,e,i),await i.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw ut();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw ut();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw ut();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw ut();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw ut();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw ut();return this.sketch.update(e,t)}filterByFootprints(e,t,i=!1){const r=[],a=[],s=[];return e.forEach(e=>{const{layer:{coveragePercent:o},attributes:n}=e;let l;const{polygon:c,frustum:d}=q(n);if(l=c.clone(),n.isInspection&&(l=W(n)),o&&(l=$(l,o)),i||!t||Z(l,t)){s.push(e);const{geometry:t,objectId:i,cameraHeight:o,cameraHeading:l}=n,h=t.clone();h.z=o/K(t.spatialReference),h.imageID=i,this.pointSources.push(h),l!==Fe&&(r.push(c),d&&a.push(d))}}),{features:s,polygons:r,frustums:a}}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[be[e]],i=t?.at(0);i&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(i):this._updateCurrentBestFeature(i))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const r=this._sectorData?.[t],a=r?.at(i);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=Q(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){const t=import("./adapters/draw/HeightMeasurementAdapter.js"),{default:i}=await t;if(v(e),this.drawAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.drawAdapter.viewModel.isResolved())return}return this.drawAdapter}loadImageError(e){h.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:i}=await t;v(e),this.sketch=new i({layer:this._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(v(e),this.sketchAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,i){const{features:r}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(r))return;const{features:a,polygons:s,frustums:o}=this.filterByFootprints(r,t,i?.skipFilter);if(!this._checkFeatures(a))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o);const n=await this.processElevationSample(s,a,i);v(i),await this._updateElevationOfSelectedPointAndLocations(a,t,n),v(i),He(a,n);let l=a;if(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled&&(l=ze(a,t,this.layer.verticalSearchRange),!l.length))return void this.setMessage("noImageAtElevation","info");const c=this._processSuitableFeatures(l,t);this.updateSuitabilities(c,i?.loadBestImage)}async processFeatureElevation(e,t,i){if(!t)return;const{features:r,polygons:a}=this.filterByFootprints(e,t,!0);if(!r?.length)return;const s=await this.processElevationSample(a,r,i);return v(i),s}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:r,activeViewer:a,mode:s}=this;if(!i||!r||!a||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===s){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=Pe(o),this.sketch.polylineSymbol="panoramic"===s?Ce:Ae(o,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new de({view:this.activeViewer?.imageRenderer}),this.polylineDrawAction=this.draw.create("polyline"),await this.loadHeightMeasurementAdapter()}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:i,overlayedCameraLocations:a,layer:s,mode:o,layerFloorFilterClause:n,layerTimeExtent:l,videoViewModel:c,_panoramicVideoViewer:d}=this,h="video"===o,u="panoramic-video"===o,p=this._computeOverlayFeature(),m=this._computeOverlayImageSize();if(!m||!p||!s||"default"!==o&&"panoramic"!==o&&"video"!==o&&"panoramic-video"!==o||!this.overlayGraphicsEnabled)return;const{polygon:g}=q(p.attributes);if(h?c?.removeOverlayGraphics(a.toArray()):u?d.removeManyGraphics(a.toArray()):i?.removeManyGraphics(a.toArray()),a.removeAll(),e){const{features:e}=await s.queryFeatures({where:I(`${s.objectIdField} <> ${p.attributes.objectId}`,I(s.definitionExpression,n)),geometry:g,returnGeometry:!0,outFields:[s.objectIdField],timeExtent:l}),y=await Promise.all(e.map(async e=>{const{attributes:i,geometry:r}=e;if("point"!==r?.type)return null;const a=await this._geometryToOverlayImageGeometry(r,p,m);if(!a)return null;const s="panoramic"===o||"panoramic-video"===o?ke():Te();return new t({attributes:i,symbol:s,geometry:a})}));a.addMany(y.filter(r)),h?c?.addOverlayGraphics(a.toArray()):u?d.addManyGraphics(a.toArray()):i?.addManyGraphics(a.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),"video"!==this.mode?"panoramic-video"!==this.mode?this.activeViewer?.addManyGraphics(t.toArray()):this._panoramicVideoViewer.addManyGraphics(t.toArray()):this.videoViewModel?.addOverlayGraphics(t.toArray())}async overlayMapFeatures(e,i=!1){const{activeViewer:a,mode:o,layer:n,videoViewModel:l,_panoramicVideoViewer:c}=this,d="video"===o,u="panoramic-video"===o,p=this._computeOverlayFeature(),m=this._computeOverlayImageSize();if(!(m&&p&&"none"!==o&&this.overlayGraphicsEnabled&&n))return;const{polygon:g}=q(p.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=ot(e,n.imageGeometryField,n.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(w){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",w)}const{features:y}=await e.queryFeatures({geometry:g,returnGeometry:!0,outFields:["*"]}),v=await Promise.all(y.map(async r=>{const s=r.symbol?.clone()??e.renderer?.getSymbol(r)?.clone(),{attributes:n,geometry:g}=r,{imageGeometryField:y,oiObjectIdField:v}=this;if(y&&v&&ht(e,y,v)&&`${n[v]}`==`${p.attributes.objectId}`)try{const r=u?c.horizonAngles:Be(a?.media),h=nt(n,y,e,i,m,d?"default":o,s,r);if(!d)return h;const p=h.geometry;if(!p)return null;const g=l?.imageGeometryToOverlayGeometry(p);return g?new t({attributes:n,layer:e,symbol:h.symbol,geometry:g,visible:h.visible}):null}catch(w){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:w,feature:r,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}if(!g)return null;const f={feature:p,imageSize:m,footprintExtent:this.footprintExtent},_=await this._geometryToOverlayImageGeometry(g,f.feature,f.imageSize);return _?new t({attributes:n,layer:e,symbol:s,geometry:_,visible:e.visible&&i}):null})),f=new s(v.filter(r));this.overlayGraphicsOnImage(`${e.id}`,f)}getDepthAt(e){const{activeViewer:t,currentBestFeature:i,mode:r,state:a,depthImage:s}=this,o=t?.imageSize;if(!o||!i||"none"===r||a.includes("loading"))return h.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!s?.loaded)return h.getLogger(this).error("oriented-imagery-viewer:get-depth-at","Depth image is not loaded"),this.emit("depth-image-service:not-loaded"),null;const n=(Array.isArray(e)?e:[e]).map(e=>s.depthAt(e,{width:o[0],height:o[1]})??null);return Array.isArray(e)?n:n[0]}getActiveSectors(){return be.filter(e=>this._sectorData?.[e]?.length)}async getPixelLocationForFeature(e,t,i){const r=await this._transformationService.pointToPixelForFeature(Array.isArray(e)?e:[e],t,i);return Array.isArray(e)?r:r[0]}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new L({...e.toJSON()}),symbol:Ge}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){const{state:i,mode:r,activeViewer:a}=this;if("image-loaded"!==i||!a?.imageSize||"default"!==r&&"panoramic"!==r)return;this.clearReferencePointOnImage();const s=Be(a.media),o=lt(e,r,a.imageSize,s);this._referencePointOnImage=new t({geometry:o,symbol:"panoramic"===r?Le.clone():Ge.clone()}),a.addGraphic(this._referencePointOnImage,0)}removeAllOverlayMapFeatures(){const{mode:e}=this;this.overlayedMapFeatures.forEach(t=>{const i=t.toArray();switch(e){case"video":this.videoViewModel?.removeOverlayGraphics(i);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(i);break;default:this.activeViewer?.removeManyGraphics(i)}}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e),{mode:i}=this;if(!t?.length)return;const r=t.toArray();switch(i){case"video":this.videoViewModel?.removeOverlayGraphics(r);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(r);break;default:this.activeViewer?.removeManyGraphics(r)}this.overlayedMapFeatures.delete(e)}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0,this._measurementService?.resetMeasurementVectors()}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:i,savedGraphics:r}=t,a=i.get(e.id),s=a?.toArray();if(!a||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce((t,{objectId:i,globalId:r,error:a},o)=>{const n=s[o],{attributes:l}=n;return a?t.error.push(n):(i&&(l[e.objectIdField]=i),r&&e.globalIdField&&(l[e.globalIdField]=r),t.success.push(n)),t},{success:[],error:[]});r.addMany(n.success),a.removeAll(),a.addMany(n.error)}async saveDataCaptureFeatures(e,t){const{activeViewer:i,currentBestFeature:a,dataCaptureLayer:s,mode:o}=this,l=i?.imageSize;if(!l||!a||"none"===o||"video"===o||"panoramic-video"===o)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!s)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");const c=await Promise.all(e.map(async e=>{const i=e.clone(),{geometry:r}=i;if(!r)return;const a=r.type,o=s.hasZ,n=s.geometryType,l=a!==n,c=l?await import("./transformers.js"):null,d=c?.default[n],h=l?d?.(r):r;return h&&(i.geometry=await this._transformationService.imageGeometryToMapGeometry(h,t),i.geometry)?(o||ct(i.geometry),i):void 0})),d=c.filter(r);return s.applyEdits({addFeatures:d}).then(e=>{const{addFeatureResults:t}=e;let i=0;const r=c.map(e=>{const r=t[i++];return e?r:{error:new n("orientedimageryviewer:save-unsucccessful","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:r}})}async searchBestImage(e,t){try{const i=await z(e,t);i&&await this.processFeatureResponse(i,e.point,t)}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),h.getLogger(this).error("error occurred while finding best image",i))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async startDataCapture(e,t){const i=this.activeViewer?.imageRenderer,{oiObjectIdField:r,currentBestFeature:a}=this;if(!i||!a||!r)return;const{attributes:{objectId:o}}=a,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],c=[];for(const s of n)`${s.getAttribute(r)}`==`${o}`?l.push(s):c.push(s);this.overlayGraphicsOnImage(e.id,new s(c)),this.collectionId=e.id;const d=await this.loadSketch(t),h=await this.loadDataCaptureAdapter(t);v(t),d.addGraphics(l),h.savedGraphics.addMany(l);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,i=this.activeViewer?.imageRenderer;if(!i||i.destroyed)return;i.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const r=i.ui.find("zoom");r&&(r.visible=!0)}stopMeasurement(){this.draw?.reset(),this.sketch?.cancel()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,i){const r=this.overlayedMapFeatures.get(e);r&&i&&this._toggleVisiblity(r,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{selectedLocation:t,options:i}=e;let r=!1,a=!1;const s=this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=t.spatialReference.equals(s.spatialReference)?t:await O(t,s.spatialReference);r=s.contains(e);break}case"mesh":{const e=t.spatialReference.equals(s.spatialReference)?t:await O(t,s.spatialReference);a=s.extent.contains(e);break}}if(!r&&!a)return void this.clearReferencePointOnImage();const o=await this._transformationService.pointToPixel(t,i);if(o)return v(i),this.plotReferencePointOnImage(o),{x:o.x,y:o.y};this.clearReferencePointOnImage()}async updateFeatureCache(e,t){const i=await N(e,t);i.features?.length&&(this.featureCache=i.features)}async _fetchFeatures(e,t){const{layer:i,layerFloorFilterClause:r,layerTimeExtent:a,view:s}=this;if(!s||!i)return;e.x=B(e.x,e.spatialReference);const o=i.spatialReference.equals(e.spatialReference)?e:await O(e,i.spatialReference),n=o.spatialReference.isGeographic?R(o):o,l=I("1=1",I(i.definitionExpression,r)),c=n.spatialReference.isGeographic?1:P(n.spatialReference),d={layerInstanceOrURL:i,point:n,queryParams:{where:l,maximumDistance:i.maximumDistance?i.maximumDistance/c:void 0,timeExtent:a}};return await this.searchBestImage(d,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),h.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:i,invalidCameraHeading:r}=this,a=i.at(0);if(!e||!t||!a||!i||r)return void(this._sectorData=null);this._sectorData={};const o={};this._featureToSector=o;for(const d of be)this._sectorData[d]=new s;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const l=n.map(({distance:e})=>e),c=Math.max(...l);n.forEach(e=>{const{distance:t,angle:r,featureIndex:s}=e,n=t/c*Me[2],l=$e(t,c),d=Ze(r);if(!this._sectorData)return;const h=Me[3]+n*Math.sin(r*Math.PI/180),u=Me[3]+n*Math.cos(r*Math.PI/180);let p;const m=i.at(s),g=m===a,{cameraPitch:y}=m.attributes,v=y<5;if(g&&v)p=-90;else{const e=h-Me[3],t=u-Me[3],i=t/Math.sqrt(e**2+t**2);let r=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(r*=-1),p=r}const f=""===l?d:`${l}_${d}`;g&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=v?null:{x:h,y:u,direction:d}),o[`${m.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:r,featureIndex:s,x:h,y:u,objectID:m.attributes.objectId,sector:f,featureIndexInSector:w.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){const t=import("./components/ImageLocationViewModel.js"),{default:i}=await t;v(e),this._locationViewModel=new i({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||(this._measurementService=new rt({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService}))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(je.videoPlayerHandles),this.videoElement=new le({video:this.currentBestFeature.attributes.imagePath,georeference:new oe({extent:new G(we)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new H({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.videoViewModel=new et({oiViewModel:this})}async getMapPoint(e,t){const i=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?i:i[0]}async getMapPointForFeature(e,t,i){const r=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,i);return Array.isArray(e)?r:r[0]}async loadPanoramicMediaSource(e,t){const{lookAt:i,...r}=e,a=Ne(r);try{await a.load(t)}catch(o){if(y(o))return;if("unsupported-format"===o.name)return void this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:a?.extension??"UNKNOWN FORMAT"})}const s=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await s.loadMedia(a,t),i&&s.set(i)}async loadMediaSource(e,t){const i=Ue(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.emit("no-image-found"),this.setMessage("noImageError","error"),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,i){if(!e[0])return;const r=(await import("../../geometry/operators/unionOperator.js")).executeMany(e);if(this._updateFootprintWithFeatures(t,r),"3d"===this.view?.type)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(a){y(a)||h.getLogger(this).error(a)}}async processElevationSample(e,t,i){const{elevationSource:r}=t[0].attributes,a=await this._getElevationSampleFromGround(e,t,i);return a||(r&&this.footprintExtent&&J(r)?await Y({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return U({features:e,selectedPoint:t,camera:qe(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,i){const{results:[r]}=t;if("graphic"!==r?.type)return this.emit("no-image-found"),void this.setMessage("noImageError","error");const a=r.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(a,i)}async _queryAndLoadByObjectId(e,t,i,r,a){this.displayMessage=null;const{response:s}=await it(e,t,i,r,a);if(v(a),!s?.features?.length)throw new tt(t);const o=q(s.features[0].attributes).polygon,n=L.fromJSON(j(o)),l=Q(n),c=P(l.spatialReference);this.selectedPoint=l;const d={layerInstanceOrURL:e,point:l,queryParams:{where:I(I("1=1",I(e.definitionExpression,i)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/c:void 0,timeExtent:r}},h=await z(d,a);v(a);const{features:u}=h;return u.push(s.features[0]),await this.processFeatureResponse(h,l,{...a,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,i){e.media=t,await e.loadMedia(t,i)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,i,r){const{location:a,cameraHeight:s}=e[0].attributes,o=await re(a.spatialReference,a.z,s,{elevationSample:i,elevationSource:i?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);v(r);const[n,...l]=await X([t,...e.map(e=>e.attributes.geometry.clone())],o);v(r),t.elevation=n.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:i}=e,{isSpherical:r,cameraHeading:a,cameraPitch:s}=i;return new Ye({geometry:t,attributes:i,currentHeading:r?0:a,currentPitch:r?0:s})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0]),"video"===this.mode&&(this._initializeVideo(),this.videoElement?.loaded&&this.videoViewModel?.playVideoFromSelectedLocation(e[0])),"panoramic-video"===this.mode&&this._loadVideo()}_updateFootprintWithFeatures(e,t){const i=[];for(const{attributes:{geometry:r}}of e)t.contains(r)||i.push([r.x,r.y]);i.sort((e,t)=>+x([e,t])),t.addRing(i),this.footprintExtent=he(t.extent,2,2)}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:r,currentCoverageVisible:a,isAdditionalPointSourcesVisible:s,mode:o,layer:n}=this;if(r&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),v(e);for(const o of i){const i=this.view&&!this.view.spatialReference?.equals(o.spatialReference)?await O(o.clone(),this.view?.spatialReference,e):o.clone();o.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:o.imageID},geometry:i,symbol:Oe,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:o.imageID},geometry:i,symbol:Ee,visible:s}))}"video"!==o&&"panoramic-video"!==o||(await this.initializeTransformationService(e),n&&!this.featureCache.length&&await this.updateFeatureCache(n,r.geometry.spatialReference))}}_updateCurrentBestFeature(e){if(!e)return;if(this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature));const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let i;if(t)i=-90;else{const t=e.x-Me[3],r=e.y-Me[3],a=r/Math.sqrt(t**2+r**2);let s=180*Math.acos(a)/Math.PI;(t<0&&r<0||t<0&&r>0)&&(s*=-1),i=s}i===this.bestFeatureAngle?this.previousFeatureAngle=i:this.bestFeatureAngle=i,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=p(this._referencePointOnImage))}async initializeReferenceTransformationService(e){const{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:i,mode:r}=this;if(!t||!i||!i.imageSize||"panoramic"!==r&&"default"!==r)return;const{imageSize:a}=i,{attributes:s,elevationSample:o}=t,{location:{spatialReference:n,z:l},cameraHeight:c,elevationSource:d}=s;let h=s.location;h.spatialReference.isGeographic&&(h=Q(h));const u="default"===r?ae(s,a[0],a[1]):se(s,a[0],a[1]),p=await re(n,l??0,c,{elevationSample:o,elevationSource:d,extent:this.footprintExtent},e),m=(await import("./services/TransformationService.js")).default,g={imageToWorldProperties:u,updateElevationProps:p,mode:r,imageSize:a,depthImageService:this.depthImage};this._referenceTransformationService=new m(g),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){const{currentBestFeature:t,activeViewer:i,mode:r}=this,a="video"===r||"panoramic-video"===r?ve:i?.imageSize;if(!t||!a||"none"===r)return;const{attributes:s,elevationSample:o}=t,{location:{spatialReference:n,z:l},cameraHeight:c,elevationSource:d}=s;let h=s.location;h.spatialReference.isGeographic&&(h=Q(h));const u="default"===r||"video"===r?"default":"panoramic",p={..."default"===u?ae(s,a[0],a[1]):se(s,a[0],a[1]),cameraLocation:h},m=await re(n,l??0,c,{elevationSample:o,elevationSource:d,extent:this.footprintExtent},e),g=(await import("./services/TransformationService.js")).default,y={imageToWorldProperties:p,updateElevationProps:m,mode:u,imageSize:a,depthImageService:this.depthImage};this._transformationService=new g(y),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}setMessage(e,t,i,r){this.displayMessage={key:e,type:t,data:i,map:r}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:i,selectedPoint:r,activeViewer:a}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)),!r||!t||"image-loaded"!==a?.state||i)return;let s;try{s=await this._transformationService.pointToPixel(r,{signal:e?.signal}),v(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||h.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:r,feature:t})}}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:r,currentBestFeature:a,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:l,_adapter:c,mode:d}=this;if(!a)return;const{attributes:{objectId:h},elevationSample:u}=a;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...r,s].filter(We);"3d"===l?.type&&u&&c?.updateGroundElevation&&(this._updateGroundElevation&&c.updateGroundElevation(e),"panoramic"===d&&c.updateGroundElevation([this.bestFeatureCurrentFootprint])),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Ve.clone(),attributes:{imageID:h}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return void this._superimposeService.clear();this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,"3d"===l?.type&&u&&c?.updateGroundElevation&&"panoramic"===d&&c.updateGroundElevation([e]),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}_updateSuperimposedImage(){if(!this._hasActiveSuperimposeCameraContext())return;const e="panoramic"===this.mode?this._panoramicViewer:null,{currentBestFeature:t,defaultSuperimposeCameraLockEnabled:i,layer:r,mode:a,view:s,state:o,superimposeViewEnabled:n,superimposeViewSupported:l,activeViewer:c,depthImage:d}=this;this._superimposeService.update({activeImageSize:c?.imageSize||void 0,adapter:this._adapter,currentBestFeature:t,defaultSuperimposeCameraLockEnabled:i,depthImageLoaded:d?.loaded??!1,layer:r,mode:a,panoramicCamera:e?.camera,panoramicHorizonAngles:Be(e?.media),state:o,superimposeViewEnabled:n&&l,view:s}),this.setMessage("superimposeImageDescription","info"),this.currentCoverageVisible=!1}_getSuperimposeCameraWatchState(){const e="3d"===this.view?.type?this.view:null,t=e?.camera;return[this.superimposeViewEnabled,this.superimposeViewSupported,this.mode,this.state,this.view?.type,this.view?.interacting,this.view?.navigating,t?.heading,t?.tilt,t?.fov,t?.position.x,t?.position.y,t?.position.z]}_handleSuperimposeCameraChange(){const e=this.view,t="3d"===e?.type?e:null;this._hasActiveSuperimposeCameraContext()?"panoramic"!==this.mode?!t||t.interacting||t.navigating?this._abortSuperimposeSchedule():this._scheduleDefaultSuperimposeUpdate():this._schedulePanoramicSuperimposeUpdate():this._abortSuperimposeSchedule()}_shouldDisableUnsupportedSuperimposeView(){return this.superimposeViewEnabled&&"panoramic"===this.mode&&!this.superimposeViewSupported}_hasActiveSuperimposeCameraContext(){return("default"===this.mode||"panoramic"===this.mode)&&this.superimposeViewEnabled&&this.superimposeViewSupported&&"image-loaded"===this.state&&"3d"===this.view?.type&&!!this.view.camera}_abortSuperimposeSchedule(){this._superimposeScheduleController?.abort(),this._superimposeScheduleController=null,this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame()}_resetInactiveSuperimposeState(){this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._superimposeService.clear(),this._restoreDefaultMessageAfterSuperimpose()}_restoreDefaultMessageAfterSuperimpose(){"superimposeImageDescription"===this.displayMessage?.key&&this.setMessage("onLoadMessage","info")}_clearSuperimposeDebounceTimeout(){null!=this.superimposeDebounceTimeoutId&&(clearTimeout(this.superimposeDebounceTimeoutId),this.superimposeDebounceTimeoutId=null)}_clearSuperimposeScheduledFrame(){null!=this.superimposeScheduledFrameId&&(cancelAnimationFrame(this.superimposeScheduledFrameId),this.superimposeScheduledFrameId=null)}_schedulePanoramicSuperimposeUpdate(){this._abortSuperimposeSchedule(),this.superimposeDebounceTimeoutId=window.setTimeout(()=>{this.superimposeDebounceTimeoutId=null,this._hasActiveSuperimposeCameraContext()&&"panoramic"===this.mode&&this._updateSuperimposedImage()},150)}_scheduleDefaultSuperimposeUpdate(){const e=this.view;if(!("3d"===e?.type?e:null))return;if(this.superimposeScheduledFrameId)return;this._superimposeScheduleController?.abort();const t=new AbortController,{signal:i}=t,r=()=>{this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame(),this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.removeEventListener("abort",r)};this._superimposeScheduleController=t,i.addEventListener("abort",r),this.superimposeScheduledFrameId=requestAnimationFrame(()=>{if(i.removeEventListener("abort",r),this.superimposeScheduledFrameId=null,this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.aborted)return;const e=this.view,a="3d"===e?.type?e:null;!this._hasActiveSuperimposeCameraContext()||null==a||a.interacting||a.navigating||this._updateSuperimposedImage()})}};e([C()],pt.prototype,"activeLayer",null),e([C({readOnly:!0})],pt.prototype,"activeViewer",null),e([C()],pt.prototype,"activeTriangulatedViewer",null),e([C()],pt.prototype,"accuracyParametersMissing",null),e([C()],pt.prototype,"additionalFeatures",void 0),e([C({type:s.ofType(t)})],pt.prototype,"additionalCameraLocations",void 0),e([C({type:s.ofType(t)})],pt.prototype,"additionalFootprints",void 0),e([C()],pt.prototype,"areaMeasurementResult",void 0),e([C()],pt.prototype,"areaMeasurementAccuracy",void 0),e([C()],pt.prototype,"bestFeatureAngle",void 0),e([C()],pt.prototype,"bestFeatureCurrentFootprint",void 0),e([C({type:t})],pt.prototype,"bestFeatureFootprint",void 0),e([C({type:Number})],pt.prototype,"brightness",null),e([C()],pt.prototype,"cameraHeadingThreshold",void 0),e([C()],pt.prototype,"cameraPitchThreshold",void 0),e([C()],pt.prototype,"clickAction",void 0),e([C()],pt.prototype,"correctedLocationPointOnImage",void 0),e([C()],pt.prototype,"videoViewModel",void 0),e([C()],pt.prototype,"collectionId",void 0),e([C({type:Number})],pt.prototype,"contrast",null),e([C()],pt.prototype,"coverageFrustums",void 0),e([C()],pt.prototype,"coveragePolygons",void 0),e([C()],pt.prototype,"currentBestFeature",void 0),e([C()],pt.prototype,"currentBestFeatureMeasurementImage",void 0),e([C()],pt.prototype,"currentBestFeatureLocation",void 0),e([C()],pt.prototype,"currentCoverageVisible",void 0),e([C()],pt.prototype,"currentNode",null),e([C()],pt.prototype,"depthImage",void 0),e([C()],pt.prototype,"depthImageNotSupported",null),e([C()],pt.prototype,"featureCache",void 0),e([C()],pt.prototype,"navigationNodes",void 0),e([C({json:{write:!1}})],pt.prototype,"determineWorkflowForFeature",void 0),e([C({json:{write:!1}})],pt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([C()],pt.prototype,"disabled",void 0),e([C()],pt.prototype,"displayMessage",void 0),e([C()],pt.prototype,"displayNewMeasurementButton",void 0),e([C()],pt.prototype,"distanceMeasurementResult",void 0),e([C()],pt.prototype,"distanceAccuracyArray",void 0),e([C()],pt.prototype,"dataCaptureLayer",void 0),e([C({readOnly:!0})],pt.prototype,"featureCount",null),e([C()],pt.prototype,"features",void 0),e([C()],pt.prototype,"groundCoordinates",void 0),e([C()],pt.prototype,"groundCoordinatesAccuracy",void 0),e([C()],pt.prototype,"heightGraphic",void 0),e([C()],pt.prototype,"heightMeasurementResult",void 0),e([C()],pt.prototype,"heightMeasurementAccuracy",void 0),e([C({readOnly:!0})],pt.prototype,"imageGalleryEnabled",null),e([C()],pt.prototype,"imageGeometryField",void 0),e([C({readOnly:!0})],pt.prototype,"imageLoaded",null),e([C()],pt.prototype,"imageLocationToolState",void 0),e([C()],pt.prototype,"initialVideoMapViewExtent",void 0),e([C({readOnly:!0})],pt.prototype,"invalidCameraHeading",null),e([C()],pt.prototype,"imagePointsInView",null),e([C()],pt.prototype,"imageMeasurementViewer",void 0),e([C()],pt.prototype,"isAdditionalCoverageVisible",void 0),e([C()],pt.prototype,"isAdditionalPointSourcesVisible",void 0),e([C()],pt.prototype,"layer",void 0),e([C()],pt.prototype,"layerView",null),e([C({readOnly:!0})],pt.prototype,"layerFloorFilterClause",null),e([C({readOnly:!0})],pt.prototype,"layerTimeExtent",null),e([C({type:Number})],pt.prototype,"localPort",void 0),e([C()],pt.prototype,"locationPointOnImage",void 0),e([C()],pt.prototype,"mapImageConversionToolState",void 0),e([C()],pt.prototype,"measureType",void 0),e([C()],pt.prototype,"measurementGraphic",void 0),e([C({readOnly:!0,value:"none"})],pt.prototype,"mode",null),e([C()],pt.prototype,"navigationMode",void 0),e([C()],pt.prototype,"navigatorCurrentBestFeature",void 0),e([C()],pt.prototype,"oiObjectIdField",void 0),e([C({type:s.ofType(t)})],pt.prototype,"overlayedCameraLocations",void 0),e([C()],pt.prototype,"overlayedMapFeatures",void 0),e([C()],pt.prototype,"panoramicVideoLoaded",null),e([C()],pt.prototype,"pixelCoordinates",void 0),e([C()],pt.prototype,"preserveAngle",void 0),e([C()],pt.prototype,"pointSources",void 0),e([C({readOnly:!0})],pt.prototype,"popupEnabled",null),e([C()],pt.prototype,"preloadMedia",void 0),e([C()],pt.prototype,"preloadMediaSize",void 0),e([C()],pt.prototype,"previousFeatureAngle",void 0),e([C()],pt.prototype,"referencePoint",null),e([C({readOnly:!0})],pt.prototype,"sectorData",null),e([C()],pt.prototype,"selectedPoint",void 0),e([C({type:Number})],pt.prototype,"sharpness",null),e([C()],pt.prototype,"shouldShowSelectedImage",void 0),e([C()],pt.prototype,"superimposeViewEnabled",void 0),e([C()],pt.prototype,"defaultSuperimposeCameraLockEnabled",void 0),e([C()],pt.prototype,"superimposeViewSupported",null),e([C()],pt.prototype,"sketch",void 0),e([C()],pt.prototype,"sketchTriangular",void 0),e([C()],pt.prototype,"sketchTriangularGraphicsLayer",void 0),e([C()],pt.prototype,"draw",void 0),e([C()],pt.prototype,"drawAdapter",void 0),e([C()],pt.prototype,"polylineDrawAction",void 0),e([C()],pt.prototype,"scheduledFrameId",void 0),e([C()],pt.prototype,"superimposeScheduledFrameId",void 0),e([C()],pt.prototype,"superimposeDebounceTimeoutId",void 0),e([C()],pt.prototype,"sketchAdapter",void 0),e([C({readOnly:!0})],pt.prototype,"sketchGraphicsLayer",null),e([C({readOnly:!0})],pt.prototype,"state",null),e([C({readOnly:!0})],pt.prototype,"thumbnails",null),e([C()],pt.prototype,"videoExtentPoints",null),e([C()],pt.prototype,"triangularMeasurementActive",void 0),e([C()],pt.prototype,"triangulatedDistanceMeasurement",void 0),e([C()],pt.prototype,"triangulatedDistanceAccuracy",void 0),e([C()],pt.prototype,"triangulatedAreaMeasurement",void 0),e([C()],pt.prototype,"triangulatedAreaAccuracy",void 0),e([C()],pt.prototype,"triangulatedMeasurementGraphic",void 0),e([C()],pt.prototype,"triangulatedPoint",void 0),e([C()],pt.prototype,"triangulatedMeasurementAdapter",void 0),e([C()],pt.prototype,"updateFootprint",void 0),e([C()],pt.prototype,"updateVideoFootprint",void 0),e([C()],pt.prototype,"updateFootprintPanorama",void 0),e([C()],pt.prototype,"updatingTriangularMeasurementState",void 0),e([C({value:null})],pt.prototype,"view",null),e([C()],pt.prototype,"videoElement",void 0),e([C()],pt.prototype,"videoLayer",void 0),e([C()],pt.prototype,"videoMapView",void 0),e([C()],pt.prototype,"verticalFilterEnabled",void 0),e([C()],pt.prototype,"_adapter",void 0),e([C()],pt.prototype,"_defaultGraphicsLayer",null),e([C()],pt.prototype,"_highlightedFeatureHandle",void 0),e([C()],pt.prototype,"_imageViewer",void 0),e([C()],pt.prototype,"_initialCurrentCoverageUpdate",void 0),e([C()],pt.prototype,"_locationViewModel",void 0),e([C()],pt.prototype,"_measurementService",void 0),e([C()],pt.prototype,"_mediaPrefetcher",void 0),e([C()],pt.prototype,"_navigationManager",void 0),e([C()],pt.prototype,"_overlays",void 0),e([C()],pt.prototype,"_superimposeService",void 0),e([C({readOnly:!0})],pt.prototype,"_overlaysView",null),e([C()],pt.prototype,"_panoramicVideoViewer",void 0),e([C()],pt.prototype,"_panoramicViewer",void 0),e([C()],pt.prototype,"_panoramicMeasurementViewer",void 0),e([C()],pt.prototype,"_referencePointOnGround",void 0),e([C()],pt.prototype,"_referencePointOnImage",void 0),e([C()],pt.prototype,"_referenceTransformationService",void 0),e([C()],pt.prototype,"_sectorData",void 0),e([C()],pt.prototype,"_transformationService",void 0),e([C()],pt.prototype,"_featureToSector",void 0),e([C({readOnly:!0})],pt.prototype,"_updatingHandles",void 0),e([C()],pt.prototype,"footprintExtent",void 0),e([C()],pt.prototype,"_featureChangedTask",void 0),pt=e([A("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],pt);const mt=pt;export{mt as default};
2
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as i,isSome as r}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{deprecatedProperty as s}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as l}from"../../core/Evented.js";import{makeHandle as c}from"../../core/handleUtils.js";import{equalsShallow as d}from"../../core/lang.js";import h from"../../core/Logger.js";import{clamp as u}from"../../core/mathUtils.js";import{destroyMaybe as p,abortMaybe as m}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as v,throwIfAborted as y,waitTick as f}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as _,on as F,watch as b,syncAndInitial as M,initial as V,when as S}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{getMetersPerUnitForSR as P}from"../../core/units.js";import{property as C,subclass as A}from"../../core/accessorSupport/decorators.js";import{isSerializable as k}from"../../core/support/jsonUtils.js";import{UpdatingHandles as O}from"../../core/support/UpdatingHandles.js";import T from"../../geometry/Extent.js";import G from"../../geometry/Point.js";import{projectAsync as L}from"../../geometry/projectionUtils.js";import E from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as j}from"../../geometry/support/centroid.js";import{isClockwise as x}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as R}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as B}from"../../geometry/support/webMercatorUtils.js";import D from"../../layers/GraphicsLayer.js";import H from"../../layers/MediaLayer.js";import{searchImages as z,getSortedLayerFeatures as N}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as U}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as q,computePolygonForInspection as W,resizePolygon as $,checkIfPolygonContainsSelectedPoint as Z}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as J}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as K,convertGeographicToWebMercator as Q}from"../../layers/orientedImagery/core/utils.js";import X from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as Y}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as ee,getInitialAngle as te,convertPixelLocationToSphereVertex as ie,getUpdateElevationProps as re,getImageToWorldProperties as ae,getImageToWorldPanoramicProperties as oe}from"../../layers/orientedImagery/transformations/utils.js";import se from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as ne}from"../../layers/support/floorFilterUtils.js";import le from"../../layers/support/VideoElement.js";import ce from"../../views/MapView.js";import de from"../../views/draw/Draw.js";import{scale as he}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ue}from"../../views/input/InputManager.js";import pe from"../PanoramicVideoViewer.js";import me from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as ge,videoMapViewConstraint as ve,fixedImageSize as ye,clockwiseDirections as fe,sampleExtent as we,videoExtent as _e,invalidCameraHeading as Fe,sectorsInOrder as be,sectorsRadii as Me}from"./constants.js";import{isFeatureAttachment as Ve}from"./galleryUtils.js";import{crossSymbol as Se,crossSymbol3D as Ie,measurementPolygonSymbol as Pe,polylineSymbolPanoramic as Ce,measurementPolylineSymbol as Ae,cameraOverlaySymbol3D as ke,cameraOverlaySymbol as Oe,diamondSymbol as Te,diamondSymbol3D as Ge,activeSourcePointSymbol as Le,sourcePointSymbol as Ee}from"./symbols.js";import{registryKeys as je}from"./types.js";import{isNoAttachmentError as xe,extractHorizonAnglesFromMedia as Re,isTifOrMrf as Be,filterOILLayerView as De,assignElevationSampleToFeatures as He,filterByZ as ze,createPanoramicMedia as Ne,createNonPanoramicMedia as Ue,isSceneView as qe,isGraphic as We,calculateSegment as $e,calculateDirection as Ze}from"./utils.js";import{disableVideoZoomAndPan as Je,getUpdatedConstraints as Ke,getUpdatedExtentPoints as Qe}from"./videoViewerUtils.js";import Xe from"./components/ImageViewer.js";import Ye from"./components/NavigationNode.js";import et from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as tt}from"./navigation/errors.js";import{queryFeatureByObjectIds as it}from"./navigation/queries.js";import{ImageMeasurementService as rt}from"./services/ImageMeasurementService.js";import at from"./services/SuperimposeService.js";import{configureSketchTool as ot,extractFieldsFromDataCaptureLayer as st,constructGraphicFromImageGeometry as nt}from"./support/dataCaptureUtils.js";import{removeZFromGeometry as lt,imageSpaceToPoint as ct}from"./support/geometryUtils.js";import dt from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as ht}from"./support/typeUtils.js";const ut=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let pt=class extends(l(g)){constructor(e){super(e),this.additionalFeatures=new o,this.additionalCameraLocations=new o,this.additionalFootprints=new o,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=ge,this.cameraPitchThreshold=ge,this.clickAction="hittest",this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new o,this.coveragePolygons=new o,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.navigationNodes=new o,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:r,selectedPoint:a}=this;if(this.emit("popup-close"),r&&a){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadDepthImage(i),await this._loadImage(i)}catch(o){v(o)||(this.loadImageError(o),h.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,i)=>{if(this.emit("popup-close"),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(i)}catch(r){v(r)||(this.loadImageError(r),h.getLogger(this).error("#loadIImage()","error occured while loading image",r))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new o,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.initialVideoMapViewExtent=null,this.imageMeasurementViewer=new Xe,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.locationPointOnImage=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new o,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new o,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.superimposeViewEnabled=!1,this.defaultSuperimposeCameraLockEnabled=!0,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=null,this.scheduledFrameId=null,this.superimposeScheduledFrameId=null,this.superimposeDebounceTimeoutId=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t,i)=>{"default"===this.mode&&"image-loaded"!==this.state||await(this._adapter?.updateFootprint(e,t,i))},this.updateVideoFootprint=async e=>{this.mode.includes("video")&&this.videoElement?.content&&await(this._adapter?.updateVideoFootprint(e))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new ce({map:new Map,constraints:ve}),this.verticalFilterEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new Xe,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new D({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._superimposeService=new at({getMapPoint:(e,t)=>this.getMapPoint(e,t),pointToPixel:(e,t)=>this._transformationService.pointToPixel(e,t),overlays:this._overlays}),this._panoramicVideoViewer=new pe,this._panoramicViewer=new me,this._panoramicMeasurementViewer=new me,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new O,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._superimposeScheduleController=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,i=this.layer?.imageReferenceField;if(!t||!e||!i)return;const r=this.overlayedMapFeatures.get(e);r?.forEach(e=>{const r=e.attributes??{},a=Object.keys(r).find(e=>e.toLowerCase()===i.toLowerCase());(a?r[a]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:i}=await t;return y(e),this.sketchAdapter=new i({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,i)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,i)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const i=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(i)this.currentBestFeature=i;else{const{layer:i,layerFloorFilterClause:a,layerTimeExtent:o}=this;if(!i)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(i,e,a,o,t));try{await s,await this.selectBestFeature(e,t)}catch(r){v(r)||(h.getLogger(this).error("oriented-imagery-viewer:show-image",r),"NoFeatureFoundWithObjectIdError"===r.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",r.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{mode:i}=this;if("default"!==i&&"panoramic"!==i)throw new n("NavigationError","Navigation is only supported in 'default' and 'panoramic' modes.");const r=e=>"default"===i&&e.declaredClass.endsWith("NavigationManager")||"panoramic"===i&&e.declaredClass.endsWith("NavigationManagerPanoramic");if(null==this._navigationManager||!r(this._navigationManager)){p(this._navigationManager);const e="default"===i?import("./navigation/NavigationManager.js"):import("./navigation/NavigationManagerPanoramic.js");this._navigationManager=new(await e).default({viewModel:this})}return this._navigationManager.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(y(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),_(()=>"image-loaded"===this.state,t)),this.toggleImageAttributes=()=>{const{currentBestFeature:e,popupEnabled:i,layer:r,view:a}=this;if(this.emit("popup-close"),!(a&&e&&i&&r))return;const{attributes:o,geometry:s}=e,n=new t({geometry:s,attributes:o.toJSON(),origin:r.graphicOrigin,sourceLayer:r});this.emit("popup-open",{features:[n],location:o.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const i=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(i,t),this._groupFeaturesBySectors()},this._computeOverlayImageSize=()=>{const{mode:e}=this;return"video"===e?ye:"panoramic-video"===e?this._panoramicVideoViewer.imageSize:this.activeViewer?.imageSize},this._geometryToOverlayImageGeometry=async(e,t,i)=>{const{mode:r,videoViewModel:a,_panoramicVideoViewer:o}=this;if("video"===r)return await(a?.geometryToOverlayGeometry(e,t))??null;if("panoramic-video"===r){const a={feature:t,mode:r,imageSize:i,footprintExtent:this.footprintExtent};return await this._transformationService.geometryToImageGeometryForFeature(e,a,o.horizonAngles)}return await this._transformationService.geometryToImageGeometry(e)},this._createViewClickHandle=()=>{if(this.removeHandles(je.click),this.disabled||null==this.view)return;const e=this.mapImageConversionToolState&&("image-loaded"===this.state||"video-loaded"===this.state&&"video"===this.mode&&!!this.videoViewModel?.videoPaused||this.panoramicVideoLoaded&&"panoramic-video"===this.mode&&this.panoramicVideoPaused)?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,ue.DEFAULT),je.click)},this._createImageClickHandle=()=>{this.removeHandles(je.imageClick),this.videoViewModel?.syncMapImageConversionHandle();const{mapImageConversionToolState:e,mode:t,footprintExtent:i,panoramicVideoLoaded:r}=this,o="panoramic-video"===t?this._panoramicVideoViewer:this.activeViewer,s=o?.imageSize;if(!e||"none"===t||"video"===t||!s||!i)return;const n="panoramic-video"===t,l=this._getActiveFeatureForCurrentMode(),d=!n||r&&this.panoramicVideoPaused;if(!l||!d)return;const h=o.clickAction;this.clickAction="pixel-location";const u=c(()=>{this.clickAction=h});let p=null;const m=F(()=>o,"pixel-location",e=>{this.plotReferencePointOnImage(e),p?.abort(),p=a(async r=>{if(!e)return;const a=this._getActiveFeatureForCurrentMode();if(!a)return;const o={feature:a,mode:t,imageSize:s,footprintExtent:i};let l=n?await this.getMapPointForFeature(e,o,{signal:r}):await this._transformationService.pixelToMapPoint(e);const c=this.view?.spatialReference;l&&!ee(!c,l.spatialReference.equals(c))&&(l=await L(l,c,{signal:r})),y(r),this.plotReferencePointOnGround(l)})});this.addHandles([m,u],je.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(je.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),je.triangularImageClick)},this._enablePan=()=>{this.removeHandles(je.videoPanHandles)},this._disablePan=()=>{this.removeHandles(je.videoPanHandles),this.addHandles(Je(this.videoMapView),je.videoPanHandles)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:i}=this;if(!t)return;const r=e.results.find(({graphic:e,graphic:{attributes:r}})=>i.includes(e)&&r&&!r[t.imageReferenceField]&&!r[t.imageGeometryField]);if(!r)return;const a=r.graphic.attributes[t.objectIdField];await this.showImageByObjectId(a)},this._loadDepthImage=async e=>{const{currentBestFeature:t,layer:i,depthImageNotSupported:r}=this;if(this.depthImage?.destroy(),this.depthImage=null,!i||!t||r)return;const{depthImage:a}=t.attributes;if(!a)return;const o=(await import("./services/DepthImageService.js")).default;y(e),this.depthImage=new o({url:a});try{await this.depthImage.load(e)}catch(s){v(s)||(h.getLogger(this).error("error occurred while loading depth image",s),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:r}=this;if(this.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),y(e),await this.transformAndPlotSelectedLocation(e)}catch(a){v(a)||this.loadImageError(a)}},this._loadVideo=async e=>{const{currentBestFeature:t,mode:i,selectedPoint:r}=this,a=t?.attributes.imagePath;if(!t||"panoramic-video"!==i||!a)return;const{attributes:o}=t,{cameraPitch:s,cameraOrientation:n,location:l}=o,c=l.spatialReference.isWGS84&&4!==n?.type?B(l):new G(l);try{this._panoramicVideoViewer.viewModel.video&&(this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.viewModel.videoPaused=!0),this._panoramicVideoViewer.videoSource=a;let t=0;c&&r&&(t=await te(c,r)-t),this._panoramicVideoViewer.pitch=s??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),y(e)}catch(d){v(d)||this.loadImageError(d)}},this._loadImageFromFeature=async(e,t,i)=>{const{mode:r}=this;if("default"!==r&&"panoramic"!==r)return;let a;try{a=await dt(t.attributes,e,i),y(i)}catch(f){if(v(f))return;return xe(f)?(h.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${e.objectIdField}: ${t.attributes.objectId}`)):(h.getLogger(this).error(f,{[e.objectIdField]:t.attributes.objectId,layer:e}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`))}if(!a)return;const{mediaUrl:o,datasetFormat:s,rotation:n,searchParams:l,location:c,cameraHeading:d,matrix:u,cameraPitch:p,getDataSetFormatError:m}=a,g=`${t.attributes.objectId}`;try{let a=this._mediaPrefetcher?.getCachedMedia(g);if(!a){const i=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(i){try{await(this._mediaPrefetcher?.startPrefetchForNode(i,e))}catch(w){}a=this._mediaPrefetcher?.getCachedMedia(g)}}if(a){if("panoramic"===r){const e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;let r=0;return c&&this.selectedPoint&&(r=await te(c,this.selectedPoint)-r),await e.loadMedia(a,i),this.selectedPoint?e.set({yaw:r,pitch:p}):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)&&e.set({yaw:t.attributes.viewAngle,pitch:p}),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}return await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,a,i),void(this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i))}}catch(w){}m&&h.getLogger(this).warn("error occurred while getting dataset format",m),"panoramic"===r?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await te(c,this.selectedPoint):"viewAngle"in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:s?.toUpperCase(),url:o,cameraHeading:d,matrix:u},i):await this.loadMediaSource({datasetFormat:s?.toUpperCase(),url:o,customParameters:l,rotation:n},i),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(i):await this.initializeTransformationService(i)},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:i,mode:r}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),i&&t&&"none"!==r&&"video"!==r&&"panoramic-video"!==r)try{await this.loadImageFromFeature(i,t,e),y(e)}catch(a){v(a)||this.loadImageError(a)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){const{default:t}=await import("./support/MediaPrefetcher.js");y(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*fe.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{const{view:t}=this;if(this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");y(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");y(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=R(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:i,currentBestFeatureMeasurementImage:r,triangulatedMeasurementGraphic:a}=this;t&&i&&r&&a&&"active"!==t.state&&(t.update([a],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._updateInteraction=()=>{const e=this.videoMapView.extent;if(!e)return;if(e.width<we.xmax-we.xmin&&e.height<we.ymax-we.ymin){this._enablePan();const t=Ke(e);t&&(this.videoMapView.constraints.geometry=t)}else this.initialVideoMapViewExtent&&!this.videoMapView.extent.equals(this.initialVideoMapViewExtent)&&(this.videoMapView.extent=this.initialVideoMapViewExtent),this._disablePan(),this.videoMapView.constraints.geometry=null},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=a(async t=>{const{pointerType:i,button:r,mapPoint:a}=e;if("mouse"===i&&0!==r||!a)return;e.stopPropagation(),e.preventDefault();const{view:o,layer:s}=this;if(o&&s){if(this.shouldShowSelectedImage){const i=o.hitTest(e,{include:[s]});this._updatingHandles.addPromise(i);const r=await i;return y(t),await this._processHitTestResults(s,r,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(a,{signal:t}))}})},this.plotSelectedPointOnImage=async(e,i)=>{if(await f(i),!e)return;const r=new G({...k(e)?e.toJSON():e});if("default"===this.mode)r.x-=.5,r.y=.5-r.y,r.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:r,symbol:Se}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:i,media:r}=this._panoramicViewer;if(!i||!r)return;const a=Re(r),o=ie(e,...i,a);this._crossSymbol=new t({geometry:new G(o,E.WebMercator),symbol:Ie}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([b(()=>this.view,()=>this.load(),M),b(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},V),b(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},V),b(()=>[this.state,this.panoramicVideoLoaded,this.mapImageConversionToolState,this.view,this.disabled,this.panoramicVideoPaused,this.videoViewModel?.videoPaused],(e,t)=>{const i=e[2],r=t?.[2];r&&!i&&(this.plotReferencePointOnGround(null),this.clearReferencePointOnImage()),this._createViewClickHandle(),this._createImageClickHandle()},M),b(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},M),b(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},M),b(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},M),b(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},M),b(()=>[this.superimposeViewEnabled,this.defaultSuperimposeCameraLockEnabled,this.superimposeViewSupported,this.currentBestFeature,this.mode,this.state,this.view?.type],()=>{this._shouldDisableUnsupportedSuperimposeView()?this.superimposeViewEnabled=!1:this._hasActiveSuperimposeCameraContext()?this._updateSuperimposedImage():this._resetInactiveSuperimposeState()},M),b(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),M),b(()=>this.currentBestFeature,async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=a(async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}])),await this._featureChangedTask.promise},{sync:!0}),b(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=a(async e=>{this.preloadMedia&&null!=this.navigationMode?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),y(e),"directional"===this.navigationMode?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},M),b(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{m(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=a(async i=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:i}),y(i),this._reorderTriangularSketchLayer()})},M),b(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this._measurementService?.resetMeasurementVectors(),this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),b(()=>this.mode,e=>{switch(this.removeHandles(je.interactionHandles),e){case"default":this.addHandles(b(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...M,equals:(e,t)=>i(e,t,d)}),je.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:i}=this;if(e&&t?.loaded&&i)return{videoExtent:_e,bestFeatureFootprint:i}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(i)}))},{...M,equals:(e,t)=>i(e?.videoExtent,t?.videoExtent,d)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),je.interactionHandles);break;case"panoramic":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:i}=this,{imageSize:r,vfov:a,hfov:o,pitch:s,yaw:n}=i;return e&&r&&!t.includes("loading")&&null!=a&&null!=o&&null!=s&&null!=n?[a,o,n,s]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,i,r,o]=e;this.currentNode&&(this.currentNode.currentHeading=r,this.currentNode.currentPitch=o),m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:o},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,d)}),je.interactionHandles);break;case"panoramic-video":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:i}=this,{imageSize:r,vfov:a,hfov:o,pitch:s,yaw:n,viewModel:l}=i,c=l.closestFeature??e;return c&&r&&!t.includes("loading")&&null!=a&&null!=o&&null!=s&&null!=n?[a,o,n,s,c]:null},e=>{if(!e)return;const[t,i,r,o,s]=e;m(this._updateFootprintTask),this._updateFootprintTask=a(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:r,pitch:o,feature:s,horizonAngles:this._panoramicVideoViewer.horizonAngles},{signal:e}),y(e),this._updateFootprintTask=null})},{equals:(e,t)=>i(e,t,d)}),je.interactionHandles)}},M),b(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:r,sharpness:a}=this;"default"===r&&(e.brightness=t,e.contrast=i,e.sharpness=a)},M),b(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),b(()=>this.activeViewer,e=>{this.removeHandles(je.hittestHandles),e&&this.addHandles(F(()=>e,"hittest-response",this._handleImageHitTestResponse),je.hittestHandles)}),b(()=>this.videoMapView.extent,async()=>{const e=this.videoViewModel?.closestFeature;e&&(m(this._updateFootprintTask),this._updateFootprintTask=a(async t=>{const i={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(i)}))}),b(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this.scheduledFrameId||(this.scheduledFrameId=requestAnimationFrame(()=>{this.scheduledFrameId=null,this._updateInteraction()}))},{initial:!0}),S(()=>null!=this.videoMapView.extent,()=>{this.initialVideoMapViewExtent=this.videoMapView.extent},{once:!0})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._abortSuperimposeSchedule(),this.currentBestFeature=null,this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._locationViewModel=p(this._locationViewModel),this._crossSymbol=p(this._crossSymbol),this._referencePointOnGround=p(this._referencePointOnGround),this.clearReferencePointOnImage(),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.destroy()}get activeLayer(){return s(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){s(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:i}=this;switch(i){case"default":return e;case"panoramic":return t;default:return null}}get activeTriangulatedViewer(){switch(this.mode){case"default":return this.imageMeasurementViewer;case"panoramic":return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",u(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",u(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!Be(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return Be(t)||Ve(t)}get imageLoaded(){return s(h.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===Fe}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(De(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ne(e):null}get layerTimeExtent(){return this.layerView?.timeExtent??null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:i,isSpherical:r}=e;return 360===i||r?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:i}=t.viewModel;return("panoramic-video"===e&&!0===i)??!1}get overlayGraphicsEnabled(){const{mode:e,state:t,panoramicVideoLoaded:i,videoViewModel:r,panoramicVideoPaused:a}=this;return"image-loaded"===t||"video"===e&&"video-loaded"===t&&!0===r?.videoPaused||"panoramic-video"===e&&i&&a}get panoramicVideoPaused(){return!!this._panoramicVideoViewer.viewModel.videoPaused}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?be.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",u(e,0,1))}get superimposeViewSupported(){return"default"===this.mode||"panoramic"===this.mode}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:i}=this;if(!this.isFulfilled()||t||!1===i?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new o(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:i,imageRotation:r}})=>{const a=e?.trim();return Be(a)||Ve(a)?{url:a,objectId:t,rotation:(i??0)+(r??0)}:null}).filter(r)):null}get videoExtentPoints(){const e=Qe(this.videoMapView.extent);return e.length?e:_e}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new D({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new D({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}updateSuperimposeZOffset(e){this._superimposeService.updateZOffset(e)}setDefaultSuperimposeZOffsetPercentage(e){this._superimposeService.setDefaultZOffsetPercentage(e)}setPanoramicSuperimposeRadiusPercentage(e){this._superimposeService.setPanoramicRadiusPercentage(e)}updateDefaultSuperimposeCameraLock(e){this.defaultSuperimposeCameraLockEnabled=e,this.superimposeViewEnabled&&"default"===this.mode&&(e?this._adapter?.enableDefaultSuperimposeNavigation?.():this._adapter?.disableDefaultSuperimposeNavigation?.())}beforeLoad(e=!0){this.emit("popup-close"),e&&(this.displayMessage=null),this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=p(this.locationPointOnImage)),this.correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this.correctedLocationPointOnImage=p(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:i,dataCaptureLayer:r}=this;if(!i)throw ut();ot(r,e,i),await i.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw ut();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw ut();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw ut();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw ut();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw ut();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw ut();return this.sketch.update(e,t)}filterByFootprints(e,t,i=!1){const r=[],a=[],o=[];return e.forEach(e=>{const{layer:{coveragePercent:s},attributes:n}=e;let l;const{polygon:c,frustum:d}=q(n);if(l=c.clone(),n.isInspection&&(l=W(n)),s&&(l=$(l,s)),i||!t||Z(l,t)){o.push(e);const{geometry:t,objectId:i,cameraHeight:s,cameraHeading:l}=n,h=t.clone();h.z=s/K(t.spatialReference),h.imageID=i,this.pointSources.push(h),l!==Fe&&(r.push(c),d&&a.push(d))}}),{features:o,polygons:r,frustums:a}}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[be[e]],i=t?.at(0);i&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(i):this._updateCurrentBestFeature(i))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const r=this._sectorData?.[t],a=r?.at(i);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!v(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=Q(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){const t=import("./adapters/draw/HeightMeasurementAdapter.js"),{default:i}=await t;if(y(e),this.drawAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.drawAdapter.viewModel.isResolved())return}return this.drawAdapter}loadImageError(e){h.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:i}=await t;y(e),this.sketch=new i({layer:this._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(y(e),this.sketchAdapter=new i({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,i){const{features:r}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(r))return;const{features:a,polygons:o,frustums:s}=this.filterByFootprints(r,t,i?.skipFilter);if(!this._checkFeatures(a))return;this.coveragePolygons.addMany(o),this.coverageFrustums.addMany(s);const n=await this.processElevationSample(o,a,i);y(i),await this._updateElevationOfSelectedPointAndLocations(a,t,n),y(i),He(a,n);let l=a;if(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled&&(l=ze(a,t,this.layer.verticalSearchRange),!l.length))return void this.setMessage("noImageAtElevation","info");const c=this._processSuitableFeatures(l,t);this.updateSuitabilities(c,i?.loadBestImage)}async processFeatureElevation(e,t,i){if(!t)return;const{features:r,polygons:a}=this.filterByFootprints(e,t,!0);if(!r?.length)return;const o=await this.processElevationSample(a,r,i);return y(i),o}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:r,activeViewer:a,mode:o}=this;if(!i||!r||!a||"none"===o)return;if(this.displayNewMeasurementButton=!1,"panoramic"===o&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===o){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const s=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;s&&this.sketch&&(this.sketch.polygonSymbol=Pe(s),this.sketch.polylineSymbol="panoramic"===o?Ce:Ae(s,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new de({view:this.activeViewer?.imageRenderer}),this.polylineDrawAction=this.draw.create("polyline"),await this.loadHeightMeasurementAdapter()}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:i,overlayedCameraLocations:a,layer:o,mode:s,layerFloorFilterClause:n,layerTimeExtent:l,videoViewModel:c,_panoramicVideoViewer:d}=this,h="video"===s,u="panoramic-video"===s,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!(m&&p&&o&&"none"!==s&&this.overlayGraphicsEnabled))return;const{polygon:g}=q(p.attributes);if(h?c?.removeOverlayGraphics(a.toArray()):u?d.removeManyGraphics(a.toArray()):i?.removeManyGraphics(a.toArray()),a.removeAll(),e){const{features:e}=await o.queryFeatures({where:I(`${o.objectIdField} <> ${p.attributes.objectId}`,I(o.definitionExpression,n)),geometry:g,returnGeometry:!0,outFields:[o.objectIdField],timeExtent:l}),v=await Promise.all(e.map(async e=>{const{attributes:i,geometry:r}=e;if("point"!==r?.type)return null;const a=await this._geometryToOverlayImageGeometry(r,p,m);if(!a)return null;const o="panoramic"===s||"panoramic-video"===s?ke():Oe();return new t({attributes:i,symbol:o,geometry:a})}));a.addMany(v.filter(r)),h?c?.addOverlayGraphics(a.toArray()):u?d.addManyGraphics(a.toArray()):i?.addManyGraphics(a.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),"video"!==this.mode?"panoramic-video"!==this.mode?this.activeViewer?.addManyGraphics(t.toArray()):this._panoramicVideoViewer.addManyGraphics(t.toArray()):this.videoViewModel?.addOverlayGraphics(t.toArray())}async overlayMapFeatures(e,i=!1){const{activeViewer:a,mode:s,layer:n,videoViewModel:l,_panoramicVideoViewer:c}=this,d="video"===s,u="panoramic-video"===s,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!(m&&p&&"none"!==s&&this.overlayGraphicsEnabled&&n))return;const{polygon:g}=q(p.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=st(e,n.imageGeometryField,n.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(w){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",w)}const{features:v}=await e.queryFeatures({geometry:g,returnGeometry:!0,outFields:["*"]}),y=await Promise.all(v.map(async r=>{const o=r.symbol?.clone()??e.renderer?.getSymbol(r)?.clone(),{attributes:n,geometry:g}=r,{imageGeometryField:v,oiObjectIdField:y}=this;if(v&&y&&ht(e,v,y)&&`${n[y]}`==`${p.attributes.objectId}`)try{const r=u?c.horizonAngles:Re(a?.media),h=nt(n,v,e,i,m,d?"default":s,o,r);if(!d)return h;const p=h.geometry;if(!p)return null;const g=l?.imageGeometryToOverlayGeometry(p);return g?new t({attributes:n,layer:e,symbol:h.symbol,geometry:g,visible:h.visible}):null}catch(w){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:w,feature:r,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}if(!g)return null;const f={feature:p,imageSize:m,footprintExtent:this.footprintExtent},_=await this._geometryToOverlayImageGeometry(g,f.feature,f.imageSize);return _?new t({attributes:n,layer:e,symbol:o,geometry:_,visible:e.visible&&i}):null})),f=new o(y.filter(r));this.overlayGraphicsOnImage(`${e.id}`,f)}getDepthAt(e){const{activeViewer:t,currentBestFeature:i,mode:r,state:a,depthImage:o}=this,s=t?.imageSize;if(!s||!i||"none"===r||a.includes("loading"))return h.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!o?.loaded)return h.getLogger(this).error("oriented-imagery-viewer:get-depth-at","Depth image is not loaded"),this.emit("depth-image-service:not-loaded"),null;const n=(Array.isArray(e)?e:[e]).map(e=>o.depthAt(e,{width:s[0],height:s[1]})??null);return Array.isArray(e)?n:n[0]}getActiveSectors(){return be.filter(e=>this._sectorData?.[e]?.length)}async getPixelLocationForFeature(e,t,i){return(await this._transformationService.pointToPixelForFeature([e],t,i))[0]}async getPixelLocationsForFeature(e,t,i){return await this._transformationService.pointToPixelForFeature(e,t,i)}async plotMapPoint(e){this.plotReferencePoint(e);const t=this._getActiveFeatureForCurrentMode();if(t)return this.transformAndPlotReferencePointOnImage({feature:t,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new G({...e.toJSON()}),symbol:Te}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){switch(this.mode){case"video":return void this._plotReferencePointOnVideo(e);case"panoramic-video":return void this._plotReferencePointOnPanoramicVideo(e);case"default":return void this._plotReferencePointOnDefaultImage(e);case"panoramic":return void this._plotReferencePointOnPanoramicImage(e)}}removeAllOverlayMapFeatures(){const{mode:e}=this;this.overlayedMapFeatures.forEach(t=>{const i=t.toArray();switch(e){case"video":this.videoViewModel?.removeOverlayGraphics(i);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(i);break;default:this.activeViewer?.removeManyGraphics(i)}}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e),{mode:i}=this;if(!t?.length)return;const r=t.toArray();switch(i){case"video":this.videoViewModel?.removeOverlayGraphics(r);break;case"panoramic-video":this._panoramicVideoViewer.removeManyGraphics(r);break;default:this.activeViewer?.removeManyGraphics(r)}this.overlayedMapFeatures.delete(e)}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0,this._measurementService?.resetMeasurementVectors()}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:i,savedGraphics:r}=t,a=i.get(e.id),o=a?.toArray();if(!a||!o?.length)return;const{addFeatureResults:s}=await this.saveDataCaptureFeatures(o),n=s.reduce((t,{objectId:i,globalId:r,error:a},s)=>{const n=o[s],{attributes:l}=n;return a?t.error.push(n):(i&&(l[e.objectIdField]=i),r&&e.globalIdField&&(l[e.globalIdField]=r),t.success.push(n)),t},{success:[],error:[]});r.addMany(n.success),a.removeAll(),a.addMany(n.error)}async saveDataCaptureFeatures(e,t){const{activeViewer:i,currentBestFeature:a,dataCaptureLayer:o,mode:s}=this,l=i?.imageSize;if(!l||!a||"none"===s||"video"===s||"panoramic-video"===s)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!o)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");const c=await Promise.all(e.map(async e=>{const i=e.clone(),{geometry:r}=i;if(!r)return;const a=r.type,s=o.hasZ,n=o.geometryType,l=a!==n,c=l?await import("./transformers.js"):null,d=c?.default[n],h=l?d?.(r):r;return h&&(i.geometry=await this._transformationService.imageGeometryToMapGeometry(h,t),i.geometry)?(s||lt(i.geometry),i):void 0})),d=c.filter(r);return o.applyEdits({addFeatures:d}).then(e=>{const{addFeatureResults:t}=e;let i=0;const r=c.map(e=>{const r=t[i++];return e?r:{error:new n("orientedimageryviewer:save-unsucccessful","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:r}})}async searchBestImage(e,t){try{const i=await z(e,t);i&&await this.processFeatureResponse(i,e.point,t)}catch(i){v(i)||(this.setMessage("imageLoadError","error",i.message),h.getLogger(this).error("error occurred while finding best image",i))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async startDataCapture(e,t){const i=this.activeViewer?.imageRenderer,{oiObjectIdField:r,currentBestFeature:a}=this;if(!i||!a||!r)return;const{attributes:{objectId:s}}=a,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],c=[];for(const o of n)`${o.getAttribute(r)}`==`${s}`?l.push(o):c.push(o);this.overlayGraphicsOnImage(e.id,new o(c)),this.collectionId=e.id;const d=await this.loadSketch(t),h=await this.loadDataCaptureAdapter(t);y(t),d.addGraphics(l),h.savedGraphics.addMany(l);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,i=this.activeViewer?.imageRenderer;if(!i||i.destroyed)return;i.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const r=i.ui.find("zoom");r&&(r.visible=!0)}stopMeasurement(){this.draw?.reset(),this.sketch?.cancel()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,i){const r=this.overlayedMapFeatures.get(e);r&&i&&this._toggleVisiblity(r,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{feature:t,selectedLocation:i,options:r}=e;let a=!1,o=!1;const s="video"===this.mode?this.bestFeatureCurrentFootprint?.geometry:this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=i.spatialReference.equals(s.spatialReference)?i:await L(i,s.spatialReference);a=s.contains(e);break}case"mesh":{const e=i.spatialReference.equals(s.spatialReference)?i:await L(i,s.spatialReference);o=s.extent.contains(e);break}}if(!a&&!o)return void this.clearReferencePointOnImage();const n="video"===this.mode||"panoramic-video"===this.mode?await this.getPixelLocationForFeature(i,{feature:t,mode:this.mode,imageSize:ye,footprintExtent:this.footprintExtent},r):await this._transformationService.pointToPixel(i,r);if(n)return y(r),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async updateFeatureCache(e,t){const i=await N(e,t);i.features?.length&&(this.featureCache=i.features)}_plotReferencePointOnVideo(e){"video-loaded"===this.state&&this.videoViewModel?.videoPaused&&(this.clearReferencePointOnImage(),this.videoViewModel.plotReferencePointOnVideo(e))}_plotReferencePointOnPanoramicVideo(e){const i=this._panoramicVideoViewer,{imageSize:r,media:a}=i.viewModel;if(!this.panoramicVideoLoaded||!this.panoramicVideoPaused||!r)return;this.clearReferencePointOnImage();const o=Re(a),s=ct(e,"panoramic",r,o);this._referencePointOnImage=new t({geometry:s,symbol:Ge.clone()}),i.addGraphic(this._referencePointOnImage,0)}_getActiveFeatureForCurrentMode(){switch(this.mode){case"video":return this.videoViewModel?.closestFeature??this.currentBestFeature;case"panoramic-video":return this._panoramicVideoViewer.viewModel.closestFeature??this.currentBestFeature;default:return this.currentBestFeature}}_plotReferencePointOnDefaultImage(e){const i=this._imageViewer,{imageSize:r}=i;if("image-loaded"!==this.state||!r)return;this.clearReferencePointOnImage();const a=ct(e,"default",r);this._referencePointOnImage=new t({geometry:a,symbol:Te.clone()}),i.addGraphic(this._referencePointOnImage,0)}_plotReferencePointOnPanoramicImage(e){const i=this._panoramicViewer,{imageSize:r,media:a}=i;if("image-loaded"!==this.state||!r)return;this.clearReferencePointOnImage();const o=Re(a),s=ct(e,"panoramic",r,o);this._referencePointOnImage=new t({geometry:s,symbol:Ge.clone()}),i.addGraphic(this._referencePointOnImage,0)}async _fetchFeatures(e,t){const{layer:i,layerFloorFilterClause:r,layerTimeExtent:a,view:o}=this;if(!o||!i)return;e.x=R(e.x,e.spatialReference);const s=i.spatialReference.equals(e.spatialReference)?e:await L(e,i.spatialReference),n=s.spatialReference.isGeographic?B(s):s,l=I("1=1",I(i.definitionExpression,r)),c=n.spatialReference.isGeographic?1:P(n.spatialReference),d={layerInstanceOrURL:i,point:n,queryParams:{where:l,maximumDistance:i.maximumDistance?i.maximumDistance/c:void 0,timeExtent:a}};return await this.searchBestImage(d,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(v(i))return;this.setMessage("imageLoadError","error"),h.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:i,invalidCameraHeading:r}=this,a=i.at(0);if(!e||!t||!a||!i||r)return void(this._sectorData=null);this._sectorData={};const s={};this._featureToSector=s;for(const d of be)this._sectorData[d]=new o;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const l=n.map(({distance:e})=>e),c=Math.max(...l);n.forEach(e=>{const{distance:t,angle:r,featureIndex:o}=e,n=t/c*Me[2],l=$e(t,c),d=Ze(r);if(!this._sectorData)return;const h=Me[3]+n*Math.sin(r*Math.PI/180),u=Me[3]+n*Math.cos(r*Math.PI/180);let p;const m=i.at(o),g=m===a,{cameraPitch:v}=m.attributes,y=v<5;if(g&&y)p=-90;else{const e=h-Me[3],t=u-Me[3],i=t/Math.sqrt(e**2+t**2);let r=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(r*=-1),p=r}const f=""===l?d:`${l}_${d}`;g&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=y?null:{x:h,y:u,direction:d}),s[`${m.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:r,featureIndex:o,x:h,y:u,objectID:m.attributes.objectId,sector:f,featureIndexInSector:w.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){const t=import("./components/ImageLocationViewModel.js"),{default:i}=await t;y(e),this._locationViewModel=new i({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||(this._measurementService=new rt({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService}))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(je.videoPlayerHandles),this.videoElement=new le({video:this.currentBestFeature.attributes.imagePath,georeference:new se({extent:new T(we)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new H({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.videoViewModel=new et({oiViewModel:this})}async getMapPoint(e,t){const i=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?i:i[0]}async getMapPointForFeature(e,t,i){const r=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,i);return Array.isArray(e)?r:r[0]}async loadPanoramicMediaSource(e,t){const{lookAt:i,...r}=e,a=Ne(r);try{await a.load(t)}catch(s){if(v(s))return;if("unsupported-format"===s.name)return void this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:a?.extension??"UNKNOWN FORMAT"})}const o=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await o.loadMedia(a,t),i&&o.set(i)}async loadMediaSource(e,t){const i=Ue(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.emit("no-image-found"),this.setMessage("noImageError","error"),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,i){if(!e[0])return;const r=(await import("../../geometry/operators/unionOperator.js")).executeMany(e);if(this._updateFootprintWithFeatures(t,r),"3d"===this.view?.type)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(a){v(a)||h.getLogger(this).error(a)}}async processElevationSample(e,t,i){const{elevationSource:r}=t[0].attributes,a=await this._getElevationSampleFromGround(e,t,i);return a||(r&&this.footprintExtent&&J(r)?await Y({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return U({features:e,selectedPoint:t,camera:qe(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,i){const{results:[r]}=t;if("graphic"!==r?.type)return this.emit("no-image-found"),void this.setMessage("noImageError","error");const a=r.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(a,i)}async _queryAndLoadByObjectId(e,t,i,r,a){this.displayMessage=null;const{response:o}=await it(e,t,i,r,a);if(y(a),!o?.features?.length)throw new tt(t);const s=q(o.features[0].attributes).polygon,n=G.fromJSON(j(s)),l=Q(n),c=P(l.spatialReference);this.selectedPoint=l;const d={layerInstanceOrURL:e,point:l,queryParams:{where:I(I("1=1",I(e.definitionExpression,i)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/c:void 0,timeExtent:r}},h=await z(d,a);y(a);const{features:u}=h;return u.push(o.features[0]),await this.processFeatureResponse(h,l,{...a,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,i){e.media=t,await e.loadMedia(t,i)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,i,r){const{location:a,cameraHeight:o}=e[0].attributes,s=await re(a.spatialReference,a.z,o,{elevationSample:i,elevationSource:i?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);y(r);const[n,...l]=await X([t,...e.map(e=>e.attributes.geometry.clone())],s);y(r),t.elevation=n.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:i}=e,{isSpherical:r,cameraHeading:a,cameraPitch:o}=i;return new Ye({geometry:t,attributes:i,currentHeading:r?0:a,currentPitch:r?0:o})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0]),"video"===this.mode&&(this._initializeVideo(),this.videoElement?.loaded&&this.videoViewModel?.playVideoFromSelectedLocation(e[0])),"panoramic-video"===this.mode&&this._loadVideo()}_updateFootprintWithFeatures(e,t){const i=[];for(const{attributes:{geometry:r}}of e)t.contains(r)||i.push([r.x,r.y]);i.sort((e,t)=>+x([e,t])),t.addRing(i),this.footprintExtent=he(t.extent,2,2)}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:r,currentCoverageVisible:a,isAdditionalPointSourcesVisible:o,mode:s,layer:n}=this;if(r&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),y(e);for(const s of i){const i=this.view&&!this.view.spatialReference?.equals(s.spatialReference)?await L(s.clone(),this.view?.spatialReference,e):s.clone();s.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:s.imageID},geometry:i,symbol:Le,visible:a}):this.additionalCameraLocations.push(new t({attributes:{imageID:s.imageID},geometry:i,symbol:Ee,visible:o}))}"video"!==s&&"panoramic-video"!==s||(await this.initializeTransformationService(e),n&&!this.featureCache.length&&await this.updateFeatureCache(n,r.geometry.spatialReference))}}_updateCurrentBestFeature(e){if(!e)return;if(this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature));const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let i;if(t)i=-90;else{const t=e.x-Me[3],r=e.y-Me[3],a=r/Math.sqrt(t**2+r**2);let o=180*Math.acos(a)/Math.PI;(t<0&&r<0||t<0&&r>0)&&(o*=-1),i=o}i===this.bestFeatureAngle?this.previousFeatureAngle=i:this.bestFeatureAngle=i,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._panoramicVideoViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=p(this._referencePointOnImage)),this.videoViewModel?.clearReferencePointOnVideo()}async initializeReferenceTransformationService(e){const{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:i,mode:r}=this;if(!t||!i||!i.imageSize||"panoramic"!==r&&"default"!==r)return;const{imageSize:a}=i,{attributes:o,elevationSample:s}=t,{location:{spatialReference:n,z:l},cameraHeight:c,elevationSource:d}=o;let h=o.location;h.spatialReference.isGeographic&&(h=Q(h));const u="default"===r?ae(o,a[0],a[1]):oe(o,a[0],a[1]),p=await re(n,l??0,c,{elevationSample:s,elevationSource:d,extent:this.footprintExtent},e),m=(await import("./services/TransformationService.js")).default,g={imageToWorldProperties:u,updateElevationProps:p,mode:r,imageSize:a,depthImageService:this.depthImage};this._referenceTransformationService=new m(g),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){const{currentBestFeature:t,activeViewer:i,mode:r}=this,a="video"===r||"panoramic-video"===r?ye:i?.imageSize;if(!t||!a||"none"===r)return;const{attributes:o,elevationSample:s}=t,{location:{spatialReference:n,z:l},cameraHeight:c,elevationSource:d}=o;let h=o.location;h.spatialReference.isGeographic&&(h=Q(h));const u="default"===r||"video"===r?"default":"panoramic",p={..."default"===u?ae(o,a[0],a[1]):oe(o,a[0],a[1]),cameraLocation:h},m=await re(n,l??0,c,{elevationSample:s,elevationSource:d,extent:this.footprintExtent},e),g=(await import("./services/TransformationService.js")).default,v={imageToWorldProperties:p,updateElevationProps:m,mode:u,imageSize:a,depthImageService:this.depthImage};this._transformationService=new g(v),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}setMessage(e,t,i,r){this.displayMessage={key:e,type:t,data:i,map:r}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:i,selectedPoint:r,activeViewer:a}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)),!r||!t||"image-loaded"!==a?.state||i)return;let o;try{o=await this._transformationService.pointToPixel(r,{signal:e?.signal}),y(e),await this.plotSelectedPointOnImage(o,e)}catch(s){v(s)||h.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:s,selectedPoint:r,feature:t})}}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:r,currentBestFeature:a,currentBestFeatureLocation:o,currentCoverageVisible:s,selectedPoint:n,view:l,_adapter:c,mode:d}=this;if(!a)return;const{attributes:{objectId:h},elevationSample:u}=a;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=s,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...r,o].filter(We);"3d"===l?.type&&u&&c?.updateGroundElevation&&(this._updateGroundElevation&&c.updateGroundElevation(e),"panoramic"===d&&c.updateGroundElevation([this.bestFeatureCurrentFootprint])),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Se.clone(),attributes:{imageID:h}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return void this._superimposeService.clear();this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,"3d"===l?.type&&u&&c?.updateGroundElevation&&"panoramic"===d&&c.updateGroundElevation([e]),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}_updateSuperimposedImage(){if(!this._hasActiveSuperimposeCameraContext())return;const e="panoramic"===this.mode?this._panoramicViewer:null,{currentBestFeature:t,defaultSuperimposeCameraLockEnabled:i,layer:r,mode:a,view:o,state:s,superimposeViewEnabled:n,superimposeViewSupported:l,activeViewer:c,depthImage:d}=this,h=this.coverageFrustums.find(({imageID:e})=>e===t?.attributes.objectId);this._superimposeService.update({activeImageSize:c?.imageSize||void 0,adapter:this._adapter,currentBestFeature:t,currentBestFeatureFrustum:h,defaultSuperimposeCameraLockEnabled:i,depthImageLoaded:d?.loaded??!1,layer:r,mode:a,panoramicCamera:e?.camera,panoramicHorizonAngles:Re(e?.media),state:s,superimposeViewEnabled:n&&l,view:o}),this.setMessage("superimposeImageDescription","info"),this.currentCoverageVisible=!1}_getSuperimposeCameraWatchState(){const e="3d"===this.view?.type?this.view:null,t=e?.camera;return[this.superimposeViewEnabled,this.superimposeViewSupported,this.mode,this.state,this.view?.type,this.view?.interacting,this.view?.navigating,t?.heading,t?.tilt,t?.fov,t?.position.x,t?.position.y,t?.position.z]}_handleSuperimposeCameraChange(){const e=this.view,t="3d"===e?.type?e:null;this._hasActiveSuperimposeCameraContext()?"panoramic"!==this.mode?!t||t.interacting||t.navigating?this._abortSuperimposeSchedule():this._scheduleDefaultSuperimposeUpdate():this._schedulePanoramicSuperimposeUpdate():this._abortSuperimposeSchedule()}_shouldDisableUnsupportedSuperimposeView(){return this.superimposeViewEnabled&&"panoramic"===this.mode&&!this.superimposeViewSupported}_hasActiveSuperimposeCameraContext(){return("default"===this.mode||"panoramic"===this.mode)&&this.superimposeViewEnabled&&this.superimposeViewSupported&&"image-loaded"===this.state&&"3d"===this.view?.type&&!!this.view.camera}_abortSuperimposeSchedule(){this._superimposeScheduleController?.abort(),this._superimposeScheduleController=null,this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame()}_resetInactiveSuperimposeState(){this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._superimposeService.clear(),this._restoreDefaultMessageAfterSuperimpose()}_restoreDefaultMessageAfterSuperimpose(){"superimposeImageDescription"===this.displayMessage?.key&&this.setMessage("onLoadMessage","info")}_clearSuperimposeDebounceTimeout(){null!=this.superimposeDebounceTimeoutId&&(clearTimeout(this.superimposeDebounceTimeoutId),this.superimposeDebounceTimeoutId=null)}_clearSuperimposeScheduledFrame(){null!=this.superimposeScheduledFrameId&&(cancelAnimationFrame(this.superimposeScheduledFrameId),this.superimposeScheduledFrameId=null)}_schedulePanoramicSuperimposeUpdate(){this._abortSuperimposeSchedule(),this.superimposeDebounceTimeoutId=window.setTimeout(()=>{this.superimposeDebounceTimeoutId=null,this._hasActiveSuperimposeCameraContext()&&"panoramic"===this.mode&&this._updateSuperimposedImage()},150)}_scheduleDefaultSuperimposeUpdate(){const e=this.view;if(!("3d"===e?.type?e:null))return;if(this.superimposeScheduledFrameId)return;this._superimposeScheduleController?.abort();const t=new AbortController,{signal:i}=t,r=()=>{this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame(),this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.removeEventListener("abort",r)};this._superimposeScheduleController=t,i.addEventListener("abort",r),this.superimposeScheduledFrameId=requestAnimationFrame(()=>{if(i.removeEventListener("abort",r),this.superimposeScheduledFrameId=null,this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),i.aborted)return;const e=this.view,a="3d"===e?.type?e:null;!this._hasActiveSuperimposeCameraContext()||null==a||a.interacting||a.navigating||this._updateSuperimposedImage()})}};e([C()],pt.prototype,"activeLayer",null),e([C({readOnly:!0})],pt.prototype,"activeViewer",null),e([C()],pt.prototype,"activeTriangulatedViewer",null),e([C()],pt.prototype,"accuracyParametersMissing",null),e([C()],pt.prototype,"additionalFeatures",void 0),e([C({type:o.ofType(t)})],pt.prototype,"additionalCameraLocations",void 0),e([C({type:o.ofType(t)})],pt.prototype,"additionalFootprints",void 0),e([C()],pt.prototype,"areaMeasurementResult",void 0),e([C()],pt.prototype,"areaMeasurementAccuracy",void 0),e([C()],pt.prototype,"bestFeatureAngle",void 0),e([C()],pt.prototype,"bestFeatureCurrentFootprint",void 0),e([C({type:t})],pt.prototype,"bestFeatureFootprint",void 0),e([C({type:Number})],pt.prototype,"brightness",null),e([C()],pt.prototype,"cameraHeadingThreshold",void 0),e([C()],pt.prototype,"cameraPitchThreshold",void 0),e([C()],pt.prototype,"clickAction",void 0),e([C()],pt.prototype,"correctedLocationPointOnImage",void 0),e([C()],pt.prototype,"videoViewModel",void 0),e([C()],pt.prototype,"collectionId",void 0),e([C({type:Number})],pt.prototype,"contrast",null),e([C()],pt.prototype,"coverageFrustums",void 0),e([C()],pt.prototype,"coveragePolygons",void 0),e([C()],pt.prototype,"currentBestFeature",void 0),e([C()],pt.prototype,"currentBestFeatureMeasurementImage",void 0),e([C()],pt.prototype,"currentBestFeatureLocation",void 0),e([C()],pt.prototype,"currentCoverageVisible",void 0),e([C()],pt.prototype,"currentNode",null),e([C()],pt.prototype,"depthImage",void 0),e([C()],pt.prototype,"depthImageNotSupported",null),e([C()],pt.prototype,"featureCache",void 0),e([C()],pt.prototype,"navigationNodes",void 0),e([C({json:{write:!1}})],pt.prototype,"determineWorkflowForFeature",void 0),e([C({json:{write:!1}})],pt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([C()],pt.prototype,"disabled",void 0),e([C()],pt.prototype,"displayMessage",void 0),e([C()],pt.prototype,"displayNewMeasurementButton",void 0),e([C()],pt.prototype,"distanceMeasurementResult",void 0),e([C()],pt.prototype,"distanceAccuracyArray",void 0),e([C()],pt.prototype,"dataCaptureLayer",void 0),e([C({readOnly:!0})],pt.prototype,"featureCount",null),e([C()],pt.prototype,"features",void 0),e([C()],pt.prototype,"groundCoordinates",void 0),e([C()],pt.prototype,"groundCoordinatesAccuracy",void 0),e([C()],pt.prototype,"heightGraphic",void 0),e([C()],pt.prototype,"heightMeasurementResult",void 0),e([C()],pt.prototype,"heightMeasurementAccuracy",void 0),e([C({readOnly:!0})],pt.prototype,"imageGalleryEnabled",null),e([C()],pt.prototype,"imageGeometryField",void 0),e([C({readOnly:!0})],pt.prototype,"imageLoaded",null),e([C()],pt.prototype,"imageLocationToolState",void 0),e([C()],pt.prototype,"initialVideoMapViewExtent",void 0),e([C({readOnly:!0})],pt.prototype,"invalidCameraHeading",null),e([C()],pt.prototype,"imagePointsInView",null),e([C()],pt.prototype,"imageMeasurementViewer",void 0),e([C()],pt.prototype,"isAdditionalCoverageVisible",void 0),e([C()],pt.prototype,"isAdditionalPointSourcesVisible",void 0),e([C()],pt.prototype,"layer",void 0),e([C()],pt.prototype,"layerView",null),e([C({readOnly:!0})],pt.prototype,"layerFloorFilterClause",null),e([C({readOnly:!0})],pt.prototype,"layerTimeExtent",null),e([C({type:Number})],pt.prototype,"localPort",void 0),e([C()],pt.prototype,"locationPointOnImage",void 0),e([C()],pt.prototype,"mapImageConversionToolState",void 0),e([C()],pt.prototype,"measureType",void 0),e([C()],pt.prototype,"measurementGraphic",void 0),e([C({readOnly:!0,value:"none"})],pt.prototype,"mode",null),e([C()],pt.prototype,"navigationMode",void 0),e([C()],pt.prototype,"navigatorCurrentBestFeature",void 0),e([C()],pt.prototype,"oiObjectIdField",void 0),e([C({type:o.ofType(t)})],pt.prototype,"overlayedCameraLocations",void 0),e([C()],pt.prototype,"overlayedMapFeatures",void 0),e([C()],pt.prototype,"panoramicVideoLoaded",null),e([C()],pt.prototype,"panoramicVideoPaused",null),e([C()],pt.prototype,"pixelCoordinates",void 0),e([C()],pt.prototype,"preserveAngle",void 0),e([C()],pt.prototype,"pointSources",void 0),e([C({readOnly:!0})],pt.prototype,"popupEnabled",null),e([C()],pt.prototype,"preloadMedia",void 0),e([C()],pt.prototype,"preloadMediaSize",void 0),e([C()],pt.prototype,"previousFeatureAngle",void 0),e([C()],pt.prototype,"referencePoint",null),e([C({readOnly:!0})],pt.prototype,"sectorData",null),e([C()],pt.prototype,"selectedPoint",void 0),e([C({type:Number})],pt.prototype,"sharpness",null),e([C()],pt.prototype,"shouldShowSelectedImage",void 0),e([C()],pt.prototype,"superimposeViewEnabled",void 0),e([C()],pt.prototype,"defaultSuperimposeCameraLockEnabled",void 0),e([C()],pt.prototype,"superimposeViewSupported",null),e([C()],pt.prototype,"sketch",void 0),e([C()],pt.prototype,"sketchTriangular",void 0),e([C()],pt.prototype,"sketchTriangularGraphicsLayer",void 0),e([C()],pt.prototype,"draw",void 0),e([C()],pt.prototype,"drawAdapter",void 0),e([C()],pt.prototype,"polylineDrawAction",void 0),e([C()],pt.prototype,"scheduledFrameId",void 0),e([C()],pt.prototype,"superimposeScheduledFrameId",void 0),e([C()],pt.prototype,"superimposeDebounceTimeoutId",void 0),e([C()],pt.prototype,"sketchAdapter",void 0),e([C({readOnly:!0})],pt.prototype,"sketchGraphicsLayer",null),e([C({readOnly:!0})],pt.prototype,"state",null),e([C({readOnly:!0})],pt.prototype,"thumbnails",null),e([C()],pt.prototype,"videoExtentPoints",null),e([C()],pt.prototype,"triangularMeasurementActive",void 0),e([C()],pt.prototype,"triangulatedDistanceMeasurement",void 0),e([C()],pt.prototype,"triangulatedDistanceAccuracy",void 0),e([C()],pt.prototype,"triangulatedAreaMeasurement",void 0),e([C()],pt.prototype,"triangulatedAreaAccuracy",void 0),e([C()],pt.prototype,"triangulatedMeasurementGraphic",void 0),e([C()],pt.prototype,"triangulatedPoint",void 0),e([C()],pt.prototype,"triangulatedMeasurementAdapter",void 0),e([C()],pt.prototype,"updateFootprint",void 0),e([C()],pt.prototype,"updateVideoFootprint",void 0),e([C()],pt.prototype,"updateFootprintPanorama",void 0),e([C()],pt.prototype,"updatingTriangularMeasurementState",void 0),e([C({value:null})],pt.prototype,"view",null),e([C()],pt.prototype,"videoElement",void 0),e([C()],pt.prototype,"videoLayer",void 0),e([C()],pt.prototype,"videoMapView",void 0),e([C()],pt.prototype,"verticalFilterEnabled",void 0),e([C()],pt.prototype,"_adapter",void 0),e([C()],pt.prototype,"_defaultGraphicsLayer",null),e([C()],pt.prototype,"_highlightedFeatureHandle",void 0),e([C()],pt.prototype,"_imageViewer",void 0),e([C()],pt.prototype,"_initialCurrentCoverageUpdate",void 0),e([C()],pt.prototype,"_locationViewModel",void 0),e([C()],pt.prototype,"_measurementService",void 0),e([C()],pt.prototype,"_mediaPrefetcher",void 0),e([C()],pt.prototype,"_navigationManager",void 0),e([C()],pt.prototype,"_overlays",void 0),e([C()],pt.prototype,"_superimposeService",void 0),e([C({readOnly:!0})],pt.prototype,"_overlaysView",null),e([C()],pt.prototype,"_panoramicVideoViewer",void 0),e([C()],pt.prototype,"_panoramicViewer",void 0),e([C()],pt.prototype,"_panoramicMeasurementViewer",void 0),e([C()],pt.prototype,"_referencePointOnGround",void 0),e([C()],pt.prototype,"_referencePointOnImage",void 0),e([C()],pt.prototype,"_referenceTransformationService",void 0),e([C()],pt.prototype,"_sectorData",void 0),e([C()],pt.prototype,"_transformationService",void 0),e([C()],pt.prototype,"_featureToSector",void 0),e([C({readOnly:!0})],pt.prototype,"_updatingHandles",void 0),e([C()],pt.prototype,"footprintExtent",void 0),e([C()],pt.prototype,"_featureChangedTask",void 0),pt=e([A("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],pt);const mt=pt;export{mt as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import o from"../../../core/Logger.js";import{throwIfAborted as i,isAbortError as r}from"../../../core/promiseUtils.js";import{watch as s,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as n,subclass as d}from"../../../core/accessorSupport/decorators.js";import l from"../../../geometry/Multipoint.js";import c from"../../../geometry/Polygon.js";import h from"../../../geometry/Polyline.js";import p from"../../../geometry/SpatialReference.js";import{fixedImageSize as m}from"../constants.js";import{imageGeometryToVideoMapGeometry as u,pixelToVideoMapPoint as v}from"../videoViewerUtils.js";import{coordinateToPoints as y}from"../support/geometryUtils.js";let V=class extends t{constructor(e){super(e),this.closestFeature=null,this.currentTime=0,this.videoBrightness=1,this.videoContrast=1,this.videoDuration=void 0,this.videoPaused=null,this.videoScale=void 0,this.videoMuted=null,this.enableAudio=()=>{const{videoElement:e}=this.oiViewModel;e?.content&&(e.content.muted=!1,this.videoMuted=!1)},this.playVideoHandler=()=>{const e=this.oiViewModel.videoElement?.content;e&&(e.paused?e.play().catch(e=>{o.getLogger(this).error("error playing video",e)}):e.pause())},this.rewindVideoHandler=()=>{const e=this.oiViewModel.videoElement?.content;e&&(e.currentTime=0,e.play().catch(e=>{o.getLogger(this).error("error playing video",e)}))},this.resetVideoHandler=()=>{const{videoElement:e,videoMapView:t,videoLayer:o}=this.oiViewModel;this.clearOverlayGraphics(),e?.content&&o&&t&&(e.content.pause(),t.map.layers.remove(o),o.destroy(),this.oiViewModel.videoElement=null)},this.resetVideoEnhancementTools=()=>{this.oiViewModel?.videoLayer&&(this.videoBrightness=1,this.videoContrast=1,this.oiViewModel.videoLayer.effect=`brightness(${this.videoBrightness}) contrast(${this.videoContrast})`)},this.resetVideoScale=()=>{this.videoScale&&(this.oiViewModel.videoMapView.scale=this.videoScale)},this.toggleAudio=()=>{const{videoElement:e}=this.oiViewModel;if(e?.content){const t=e.content.muted;e.content.muted=!t,this.videoMuted=!t}}}initialize(){this.addHandles([s(()=>this.oiViewModel.videoElement?.content,e=>{if(e instanceof HTMLVideoElement){this._startVideo();const t=async()=>{this.currentTime=Number(e.currentTime.toFixed(2)),e.currentTime&&await this._updateVidFootprint(e.currentTime)};e.addEventListener("timeupdate",t),e.addEventListener("play",()=>this._updateVideoIcon(e.paused)),e.addEventListener("pause",()=>this._pauseVideoHandler(e))}},a),s(()=>this.oiViewModel.layer,(e,t)=>{t&&e&&e.uid!==t.uid&&this.oiViewModel.resetVideo()},a)])}destroy(){this.resetVideoHandler()}_pauseVideoHandler(e){this._updateVideoIcon(e.paused)}_setVideoInfo(){const{videoElement:e,videoMapView:t}=this.oiViewModel;e?.content&&(this.videoDuration=e.content.duration,this.videoScale=t.scale)}_startVideo(){try{this.enableAudio(),this._setVideoInfo();const e=this.oiViewModel.currentBestFeature;e&&this.playVideoFromSelectedLocation(e)}catch(e){o.getLogger(this).error("oriented-imagery-viewer:video-load",e)}}async _updateVideoFootprintWithGivenFeature(e,t,s){const{activeViewer:a,mode:n,footprintExtent:d}=this.oiViewModel;if(t&&("video"===n?m:a?.imageSize)&&d)try{const o={points:e,feature:t,undefined:void 0,options:s};await this.oiViewModel.updateVideoFootprint(o),i(s)}catch(l){r(l)||o.getLogger(this).error("update-footprint",l)}else this.oiViewModel.updateCurrentCoveragePolygon(null)}async _updateVidFootprint(e){const t=this.oiViewModel.featureCache.find(t=>t.attributes.offsetFromStart===Math.floor(e));t?.attributes.offsetFromStart&&this.closestFeature!==t&&(this.closestFeature=t,await this._updateVideoFootprintWithGivenFeature(this.oiViewModel.videoExtentPoints,t))}_updateVideoIcon(e){this.videoPaused=!!e,!e&&this.oiViewModel.mapImageConversionToolState&&(this.oiViewModel.setMapImageConversionToolState(!1),this.oiViewModel.plotReferencePointOnGround(null)),e||this.clearOverlayGraphics()}handleVideoBrightnessChange(e){this.oiViewModel?.videoLayer&&(this.videoBrightness=e??0,this.oiViewModel.videoLayer.effect=`brightness(${this.videoBrightness}) contrast(${this.videoContrast})`)}handleVideoContrastChange(e){this.oiViewModel?.videoLayer&&(this.videoContrast=e??0,this.oiViewModel.videoLayer.effect=`brightness(${this.videoBrightness}) contrast(${this.videoContrast})`)}playVideoFromSelectedLocation(e){const t=e.attributes.offsetFromStart;if(t){this.resetVideoScale();const e=this.oiViewModel.videoElement?.content;e&&(e.currentTime=t,e.play().catch(e=>{o.getLogger(this).error("error playing video",e)}))}}addOverlayGraphics(e){this.oiViewModel.videoMapView.graphics.addMany(e)}imageGeometryToOverlayGeometry(e){return u(e)}async geometryToOverlayGeometry(e,t,o){const{footprintExtent:r}=this.oiViewModel;if(!r)return null;const s={feature:t,mode:"video",imageSize:m,footprintExtent:r};switch(e.type){case"point":{const t=await this.oiViewModel.getPixelLocationForFeature(e,s,o);return v(t)}case"polyline":{const t=await Promise.all(e.paths.map(async t=>{const r=t.map(t=>y(t,e.spatialReference)),a=await this.oiViewModel.getPixelLocationForFeature(r,s,o);return i(o),a.map(e=>{const t=v(e);return[t.x,t.y]})}));return new h({paths:t,spatialReference:p.WebMercator})}case"polygon":{const t=await Promise.all(e.rings.map(async t=>{const r=t.map(t=>y(t,e.spatialReference)),a=await this.oiViewModel.getPixelLocationForFeature(r,s,o);return i(o),a.map(e=>{const t=v(e);return[t.x,t.y]})}));return c.fromJSON({rings:t,spatialReference:p.WebMercator})}case"multipoint":{const t=e.points.map(t=>y(t,e.spatialReference)),r=await this.oiViewModel.getPixelLocationForFeature(t,s,o);return i(o),l.fromJSON({points:r.map(e=>{const t=v(e);return[t.x,t.y]}),spatialReference:p.WebMercator})}case"extent":{const i=c.fromExtent(e),r=await this.geometryToOverlayGeometry(i,t,o);return r?.extent??null}default:return null}}removeOverlayGraphics(e){this.oiViewModel.videoMapView.graphics.removeMany(e)}clearOverlayGraphics(){const e=Array.from(this.oiViewModel.overlayedMapFeatures.values()).flatMap(e=>e.toArray()),t=[...this.oiViewModel.overlayedCameraLocations.toArray(),...e];t.length&&this.removeOverlayGraphics(t)}};e([n()],V.prototype,"closestFeature",void 0),e([n()],V.prototype,"currentTime",void 0),e([n()],V.prototype,"oiViewModel",void 0),e([n({type:Number})],V.prototype,"videoBrightness",void 0),e([n({type:Number})],V.prototype,"videoContrast",void 0),e([n()],V.prototype,"videoDuration",void 0),e([n()],V.prototype,"videoPaused",void 0),e([n()],V.prototype,"videoScale",void 0),e([n()],V.prototype,"videoMuted",void 0),V=e([d("esri.widgets.OrientedImageryViewer.components.OrientedImageryVideoViewModel")],V);const g=V;export{g as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../core/Accessor.js";import{createTask as o}from"../../../core/asyncUtils.js";import r from"../../../core/Logger.js";import{throwIfAborted as s,isAbortError as n}from"../../../core/promiseUtils.js";import{watch as a,syncAndInitial as d}from"../../../core/reactiveUtils.js";import{property as l,subclass as c}from"../../../core/accessorSupport/decorators.js";import h from"../../../geometry/Multipoint.js";import p from"../../../geometry/Polygon.js";import m from"../../../geometry/Polyline.js";import{projectAsync as u}from"../../../geometry/projectionUtils.js";import{fixedImageSize as v,videoSpatialReference as V}from"../constants.js";import{diamondSymbol as y}from"../symbols.js";import{registryKeys as f}from"../types.js";import{imageGeometryToVideoMapGeometry as g,pixelToVideoMapPoint as w,geoToPixel as M}from"../videoViewerUtils.js";import{coordinateToPoints as P}from"../support/geometryUtils.js";let F=class extends i{constructor(e){super(e),this.closestFeature=null,this.currentTime=0,this.videoBrightness=1,this.videoContrast=1,this.videoDuration=void 0,this.videoPaused=null,this.videoScale=void 0,this.videoMuted=null,this._referencePointOnVideo=null,this.enableAudio=()=>{const{videoElement:e}=this.oiViewModel;e?.content&&(e.content.muted=!1,this.videoMuted=!1)},this.playVideoHandler=()=>{const e=this.oiViewModel.videoElement?.content;e&&(e.paused?e.play().catch(e=>{r.getLogger(this).error("error playing video",e)}):e.pause())},this.rewindVideoHandler=()=>{const e=this.oiViewModel.videoElement?.content;e&&(e.currentTime=0,e.play().catch(e=>{r.getLogger(this).error("error playing video",e)}))},this.resetVideoHandler=()=>{const{videoElement:e,videoMapView:t,videoLayer:i}=this.oiViewModel;this.removeHandles(f.videoImageClick),this.clearReferencePointOnVideo(),this.clearOverlayGraphics(),e?.content&&i&&t&&(e.content.pause(),t.map.layers.remove(i),i.destroy(),this.oiViewModel.videoElement=null)},this.resetVideoEnhancementTools=()=>{this.oiViewModel?.videoLayer&&(this.videoBrightness=1,this.videoContrast=1,this.oiViewModel.videoLayer.effect=`brightness(${this.videoBrightness}) contrast(${this.videoContrast})`)},this.resetVideoScale=()=>{this.videoScale&&(this.oiViewModel.videoMapView.scale=this.videoScale)},this.toggleAudio=()=>{const{videoElement:e}=this.oiViewModel;if(e?.content){const t=e.content.muted;e.content.muted=!t,this.videoMuted=!t}}}initialize(){this.addHandles([a(()=>this.oiViewModel.videoElement?.content,e=>{if(e instanceof HTMLVideoElement){this._startVideo();const t=async()=>{this.currentTime=Number(e.currentTime.toFixed(2)),e.currentTime&&await this._updateVidFootprint(e.currentTime)};e.addEventListener("timeupdate",t),e.addEventListener("play",()=>this._updateVideoIcon(e.paused)),e.addEventListener("pause",()=>this._pauseVideoHandler(e))}},d),a(()=>this.oiViewModel.layer,(e,t)=>{t&&e&&e.uid!==t.uid&&this.oiViewModel.resetVideo()},d)])}destroy(){this.resetVideoHandler()}_pauseVideoHandler(e){this._updateVideoIcon(e.paused)}_setVideoInfo(){const{videoElement:e,videoMapView:t}=this.oiViewModel;e?.content&&(this.videoDuration=e.content.duration,this.videoScale=t.scale)}_startVideo(){try{this.enableAudio(),this._setVideoInfo();const e=this.oiViewModel.currentBestFeature;e&&this.playVideoFromSelectedLocation(e)}catch(e){r.getLogger(this).error("oriented-imagery-viewer:video-load",e)}}async _updateVideoFootprintWithGivenFeature(e,t,i){const{activeViewer:o,mode:a,footprintExtent:d}=this.oiViewModel;if(t&&("video"===a?v:o?.imageSize)&&d)try{const o={points:e,feature:t,undefined:void 0,options:i};await this.oiViewModel.updateVideoFootprint(o),s(i)}catch(l){n(l)||r.getLogger(this).error("update-footprint",l)}else this.oiViewModel.updateCurrentCoveragePolygon(null)}async _updateVidFootprint(e){const t=this.oiViewModel.featureCache.find(t=>t.attributes.offsetFromStart===Math.floor(e));t?.attributes.offsetFromStart&&this.closestFeature!==t&&(this.closestFeature=t,await this._updateVideoFootprintWithGivenFeature(this.oiViewModel.videoExtentPoints,t))}_updateVideoIcon(e){this.videoPaused=!!e,!e&&this.oiViewModel.mapImageConversionToolState&&(this.oiViewModel.setMapImageConversionToolState(!1),this.oiViewModel.plotReferencePointOnGround(null),this.clearReferencePointOnVideo()),e||this.clearOverlayGraphics()}handleVideoBrightnessChange(e){this.oiViewModel?.videoLayer&&(this.videoBrightness=e??0,this.oiViewModel.videoLayer.effect=`brightness(${this.videoBrightness}) contrast(${this.videoContrast})`)}handleVideoContrastChange(e){this.oiViewModel?.videoLayer&&(this.videoContrast=e??0,this.oiViewModel.videoLayer.effect=`brightness(${this.videoBrightness}) contrast(${this.videoContrast})`)}playVideoFromSelectedLocation(e){const t=e.attributes.offsetFromStart;if(t){this.resetVideoScale();const e=this.oiViewModel.videoElement?.content;e&&(e.currentTime=t,e.play().catch(e=>{r.getLogger(this).error("error playing video",e)}))}}addOverlayGraphics(e){this.oiViewModel.videoMapView.graphics.addMany(e)}imageGeometryToOverlayGeometry(e){return g(e)}async geometryToOverlayGeometry(e,t,i){const{footprintExtent:o}=this.oiViewModel;if(!o)return null;const r={feature:t,mode:"video",imageSize:v,footprintExtent:o};switch(e.type){case"point":{const t=await this.oiViewModel.getPixelLocationForFeature(e,r,i);return w(t)}case"polyline":{const t=await Promise.all(e.paths.map(async t=>{const o=t.map(t=>P(t,e.spatialReference)),n=await this.oiViewModel.getPixelLocationsForFeature(o,r,i);return s(i),n.map(e=>{const t=w(e);return[t.x,t.y]})}));return new m({paths:t,spatialReference:V})}case"polygon":{const t=await Promise.all(e.rings.map(async t=>{const o=t.map(t=>P(t,e.spatialReference)),n=await this.oiViewModel.getPixelLocationsForFeature(o,r,i);return s(i),n.map(e=>{const t=w(e);return[t.x,t.y]})}));return p.fromJSON({rings:t,spatialReference:V})}case"multipoint":{const t=e.points.map(t=>P(t,e.spatialReference)),o=await this.oiViewModel.getPixelLocationsForFeature(t,r,i);return s(i),h.fromJSON({points:o.map(e=>{const t=w(e);return[t.x,t.y]}),spatialReference:V})}case"extent":{const o=p.fromExtent(e),r=await this.geometryToOverlayGeometry(o,t,i);return r?.extent??null}default:return null}}removeOverlayGraphics(e){this.oiViewModel.videoMapView.graphics.removeMany(e)}clearOverlayGraphics(){const e=Array.from(this.oiViewModel.overlayedMapFeatures.values()).flatMap(e=>e.toArray()),t=[...this.oiViewModel.overlayedCameraLocations.toArray(),...e];t.length&&this.removeOverlayGraphics(t)}syncMapImageConversionHandle(){this.removeHandles(f.videoImageClick);const{currentBestFeature:e,footprintExtent:t,mode:i,mapImageConversionToolState:r,state:n,view:a,videoMapView:d}=this.oiViewModel;if(!r||!0!==this.videoPaused||"video-loaded"!==n||!t||!e)return;let l=null;const c=d.on("click",e=>{if(e.stopPropagation(),e.preventDefault(),!e.mapPoint)return;const r=M(e.mapPoint.x,e.mapPoint.y);this.oiViewModel.plotReferencePointOnImage(r),l?.abort(),l=o(async e=>{const o=this.closestFeature??this.oiViewModel.currentBestFeature;if(!o)return;const n={feature:o,mode:i,imageSize:v,footprintExtent:t};let d=await this.oiViewModel.getMapPointForFeature(r,n,{signal:e});s(e);const l=a?.spatialReference;l&&!d.spatialReference.equals(l)&&(d=await u(d,l),s(e)),this.oiViewModel.plotReferencePointOnGround(d)})});this.addHandles(c,f.videoImageClick)}plotReferencePointOnVideo(e){this.clearReferencePointOnVideo(),this._referencePointOnVideo=new t({geometry:w(e),symbol:y.clone()}),this.oiViewModel.videoMapView.graphics.add(this._referencePointOnVideo)}clearReferencePointOnVideo(){this._referencePointOnVideo&&(this.oiViewModel.videoMapView.graphics.remove(this._referencePointOnVideo),this._referencePointOnVideo.destroy(),this._referencePointOnVideo=null)}};e([l()],F.prototype,"closestFeature",void 0),e([l()],F.prototype,"currentTime",void 0),e([l()],F.prototype,"oiViewModel",void 0),e([l({type:Number})],F.prototype,"videoBrightness",void 0),e([l({type:Number})],F.prototype,"videoContrast",void 0),e([l()],F.prototype,"videoDuration",void 0),e([l()],F.prototype,"videoPaused",void 0),e([l()],F.prototype,"videoScale",void 0),e([l()],F.prototype,"videoMuted",void 0),e([l()],F.prototype,"_referencePointOnVideo",void 0),F=e([c("esri.widgets.OrientedImageryViewer.components.OrientedImageryVideoViewModel")],F);const O=F;export{O as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{rad2deg as e}from"../../core/mathUtils.js";import a from"../../geometry/Extent.js";const t=120,m=[21,36,51,60],r=3.5,x=["FAR_WEST","FAR_NORTH","FAR_EAST","FAR_SOUTH","WEST","NORTH","EAST","SOUTH","NEAR_WEST","NEAR_NORTH","NEAR_EAST","NEAR_SOUTH"],i=23.937554159486076,n=96.06244584051393,o={EAST:[i,i,n,i,60,i],NORTH:[i,n,i,i,i,60],SOUTH:[n,i,n,n,n,60],WEST:[n,n,i,n,60,n]},c=-999,T=100,R=()=>["after-data-capture-complete","deselect-data-capture-features","select-data-capture-features","no-image-found"],s="ImageGeometry",y="OIObjectId",E=[1920,1080],S=[{x:-2886579864025407e-30,y:1080},{x:0,y:0},{x:1920,y:54511950509095186e-30},{x:1920,y:1080},{x:-2886579864025407e-30,y:1080}],A={xmin:-150,ymin:1,xmax:20,ymax:80,spatialReference:{wkid:4326}},l=.001,d={minScale:15e7,maxScale:5e6,rotationEnabled:!1,geometry:new a({xmin:A.xmin+l,ymin:A.ymin+l,xmax:A.xmax-l,ymax:A.ymax-l,spatialReference:A.spatialReference})},f=5,p=e(Math.acos(.05)),O=["towards","right","backwards","left"];export{O as clockwiseDirections,f as defaultAngleThresholdInDegrees,s as defaultImageGeometryField,y as defaultOIObjectIDField,r as featureCircleRadius,E as fixedImageSize,R as getDelegatedEvents,T as imageGalleryThumbnailSize,c as invalidCameraHeading,t as navigationToolDimensionLength,A as sampleExtent,x as sectorsInOrder,m as sectorsRadii,o as segmentArcs,S as videoExtent,d as videoMapViewConstraint,p as viewingLimit};
2
+ import{rad2deg as e}from"../../core/mathUtils.js";import a from"../../geometry/Extent.js";import t from"../../geometry/SpatialReference.js";const m=120,r=[21,36,51,60],o=3.5,i=["FAR_WEST","FAR_NORTH","FAR_EAST","FAR_SOUTH","WEST","NORTH","EAST","SOUTH","NEAR_WEST","NEAR_NORTH","NEAR_EAST","NEAR_SOUTH"],x=23.937554159486076,n=96.06244584051393,c={EAST:[x,x,n,x,60,x],NORTH:[x,n,x,x,x,60],SOUTH:[n,x,n,n,n,60],WEST:[n,n,x,n,60,n]},R=-999,s=100,S=()=>["after-data-capture-complete","deselect-data-capture-features","select-data-capture-features","no-image-found"],T="ImageGeometry",y="OIObjectId",f=[1920,1080],E=[{x:-2886579864025407e-30,y:1080},{x:0,y:0},{x:1920,y:54511950509095186e-30},{x:1920,y:1080},{x:-2886579864025407e-30,y:1080}],l={xmin:-150,ymin:1,xmax:20,ymax:80,spatialReference:{wkid:4326}},p=t.fromJSON(l.spatialReference),A=.001,O={minScale:15e7,maxScale:5e6,rotationEnabled:!1,geometry:new a({xmin:l.xmin+A,ymin:l.ymin+A,xmax:l.xmax-A,ymax:l.ymax-A,spatialReference:l.spatialReference})},d=5,N=e(Math.acos(.05)),H=["towards","right","backwards","left"];export{H as clockwiseDirections,d as defaultAngleThresholdInDegrees,T as defaultImageGeometryField,y as defaultOIObjectIDField,o as featureCircleRadius,f as fixedImageSize,S as getDelegatedEvents,s as imageGalleryThumbnailSize,R as invalidCameraHeading,m as navigationToolDimensionLength,l as sampleExtent,i as sectorsInOrder,r as sectorsRadii,c as segmentArcs,E as videoExtent,O as videoMapViewConstraint,p as videoSpatialReference,N as viewingLimit};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../Graphic.js";import{createTask as t}from"../../../core/asyncUtils.js";import a from"../../../core/Collection.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import s from"../../../geometry/Mesh.js";import n from"../../../geometry/Multipoint.js";import{projectAsync as o}from"../../../geometry/projectionUtils.js";import c from"../../../geometry/support/MeshComponent.js";import l from"../../../geometry/support/MeshMaterial.js";import u from"../../../geometry/support/MeshTexture.js";import h from"../../../geometry/support/MeshVertexAttributes.js";import p from"../../../symbols/FillSymbol3DLayer.js";import m from"../../../symbols/MeshSymbol3D.js";import{calculateUpdatedWmsf as f}from"../imageMeasurementUtils.js";import{validateTifOrMrfExtension as d}from"../utils.js";import _ from"../support/resolveMediaProps.js";import{computeDefaultAreaOfInterest as g,getViewDependentRasterLevel as v,applyMeshOffsetInMeters as y,applySphereMeshOffsetInMeters as w,updateSuperimposeGraphicTexture as x,getRasterFetchParameters as b,computePanoramicAreasOfInterest as M,clampRasterLevelForTextureSize as P,getRasterLevelSize as D,createSuperimposeSamplePixels as I,createSuperimposeGridVertexAttributes as R}from"../support/superimposeUtils.js";const G=.02,T=2,F=2,S=2,O=2,U=1,L=0,N=[255,255,255,255];class A{constructor(e){this._properties=e,this._defaultCameraFeature=null,this._graphics=[],this._panoramicNavigationFeature=null,this._task=null,this._zOffsetInMeters=0}clear(){this._destroyGraphics(this._graphics,!0),this._defaultCameraFeature=null,this._graphics=[],this._panoramicNavigationFeature=null}destroy(){this._task=this._task?.abort()??null,this.clear()}update(e){this._task?.abort(),this._task=t(async t=>{if(!this._canUpdate(e))return void this._resetInactiveState(e.adapter);let a=!1,r=[],s=null;try{await this._updateDefaultCameraIfNeeded(e,t);const n=await this._resolveMedia(e,t);if(!n)return;if(({graphics:r,overlayGraphic:s}=await this._createGraphics(e,n,t)),!r.length)return;await this._updateNavigation(e,t),this._applyZOffset(r,e.mode,this._zOffsetInMeters),i(t),this._replaceGraphics(r,e.mode),a=!0,await this._progressivelyRefineDefaultOverlayIfPossible(e,n,s,t)}finally{a||this._destroyGraphics(r,!1)}})}_canUpdate(e){const t=["default","panoramic"];return e.superimposeViewEnabled&&"image-loaded"===e.state&&"3d"===e.view?.type&&!!e.currentBestFeature&&!!e.layer&&t.includes(e.mode)}_resetInactiveState(e){e?.disableDefaultSuperimposeNavigation?.(),e?.disablePanoramicSuperimposeNavigation?.(),this.clear()}async _updateDefaultCameraIfNeeded(e,t){const{currentBestFeature:a,mode:r}=e;if(a&&"default"===r)return this._shouldUpdateDefaultCamera(r,a)?(await(e.adapter?.updateDefaultSuperimposeCamera?.({currentBestFeature:a},{signal:t})),i(t),void(this._defaultCameraFeature=a)):void 0}async _resolveMedia(e,t){const{currentBestFeature:a,layer:r,mode:s,view:n}=e;if(!a||!r||!n||"default"!==s&&"panoramic"!==s)return null;const o=await _(a.attributes,r,{signal:t});if(i(t),!o?.mediaUrl)return null;if(!d(o.datasetFormat))return this._resolveNonRasterMedia(o);const c=await this._resolveRasterMedia(o,t);if(!c)return null;switch(s){case"default":{const a=await this._resolveDefaultAreaOfInterest(e,o,t);return this._resolveDefaultRasterMedia(c,a,n,t)}case"panoramic":return this._resolvePanoramicRasterMedia(c,e,t)}}_resolveNonRasterMedia(e){return{areaOfInterest:null,textureUrl:this._resolveTextureUrl(e)}}async _resolveDefaultAreaOfInterest(e,t,a){const{activeImageSize:r,currentBestFeature:s,mode:n,view:o}=e;if(!("default"===n&&r&&s&&o&&d(t.datasetFormat)))return null;const c=await g(s,o,r,this._properties.pointToPixel,{signal:a});return i(a),c}async _resolveRasterMedia(e,t){const a=await this._loadRaster(e,{signal:t});if(i(t),!a)return null;const r=await this._createRasterTexture(a,null,void 0,{signal:t});return i(t),r?{baseTexture:r,raster:a}:null}async _resolveDefaultRasterMedia(e,t,a,r){const{baseTexture:s,raster:n}=e;if(!t)return{areaOfInterest:null,baseTexture:s,raster:n,texture:s};const o=Math.max(L,v(n,a,t)),c=await this._createRasterTexture(n,t,o,{signal:r});return i(r),{areaOfInterest:t,baseTexture:s,overlayLevel:o,overlayTexture:c,raster:n,texture:c??s}}async _resolvePanoramicRasterMedia(e,t,a){const{activeImageSize:r,currentBestFeature:s,view:n}=t,{baseTexture:o,raster:c}=e;if(!r||!s||!n)return{areaOfInterest:null,baseTexture:o,raster:c,texture:o};const l=await this._createPanoramicRasterTexture(c,s,n,r,{signal:a})??o;return i(a),{areaOfInterest:null,baseTexture:o,raster:c,texture:l}}async _createGraphics(e,t,a){switch(e.mode){case"default":return this._createDefaultGraphics(e,t,a);case"panoramic":return this._createPanoramicGraphics(e,t,a)}return{graphics:[],overlayGraphic:null}}async _createDefaultGraphics(e,t,a){if(!this._canCreateLayeredDefaultGraphics(e,t))return this._createFallbackDefaultGraphics(e,t,a);const r=await this._createAndDrapeDefaultGraphic(e,a,{texture:t.baseTexture});if(!r)return this._createBaseTextureGraphicResult(e,t.baseTexture,a);const i=await this._createDefaultOverlayGraphic(e,t,a);return i?{graphics:[r,i],overlayGraphic:i}:{graphics:[r],overlayGraphic:null}}_canCreateLayeredDefaultGraphics(e,t){return!!t.baseTexture&&!!e.activeImageSize}async _createDefaultOverlayGraphic(e,t,a){const{areaOfInterest:r,overlayTexture:i}=t;if(!r||!i)return null;const s=await this._createAndDrapeDefaultGraphic(e,a,{areaOfInterest:r,texture:i});return"mesh"===s?.geometry?.type&&y(s.geometry,{z:G}),s}async _createBaseTextureGraphicResult(e,t,a){const r=await this._createAndDrapeDefaultGraphic(e,a,{texture:t});return{graphics:r?[r]:[],overlayGraphic:null}}async _createFallbackDefaultGraphics(e,t,a){const r=await this._createAndDrapeDefaultGraphic(e,a,{areaOfInterest:t.areaOfInterest,texture:t.texture,textureUrl:t.textureUrl});return{graphics:r?[r]:[],overlayGraphic:null}}async _createAndDrapeDefaultGraphic(e,t,a){const{activeImageSize:r,depthImageLoaded:s,view:n}=e,{areaOfInterest:o,texture:c,textureUrl:l}=a;if(!r||!n)return null;const u=await this._createDefaultGraphic({areaOfInterest:o,depthImageLoaded:s,imageSize:r,signal:t,texture:c,textureUrl:l,view:n});return u?(await this._drapeGraphicToGround(u,n,{signal:t}),i(t),u):null}async _createPanoramicGraphics(e,t,a){const r=await this._createPanoramicSuperimposeGraphic(e,t,a);return{graphics:r?[r]:[],overlayGraphic:null}}async _createPanoramicSuperimposeGraphic(e,t,a){const{activeImageSize:r,currentBestFeature:i,panoramicHorizonAngles:s,view:n}=e;return n?this._createPanoramicGraphic({currentBestFeature:i??void 0,horizonAngles:s,imageSize:r,signal:a,texture:t.texture,textureUrl:t.textureUrl,view:n}):null}async _updateNavigation(e,t){const{currentBestFeature:a,mode:r,view:i}=e;if(a&&i&&"3d"===i.type)switch(r){case"default":return void this._updateDefaultNavigation(e);case"panoramic":return void await this._updatePanoramicNavigation(e,a,i,t)}}_updateDefaultNavigation(e){this._updateDefaultSuperimposeNavigation(e.adapter,e.defaultSuperimposeCameraLockEnabled)}async _progressivelyRefineDefaultOverlayIfPossible(e,t,a,r){const{activeImageSize:i,currentBestFeature:s,depthImageLoaded:n,mode:o,view:c}=e,{areaOfInterest:l,overlayLevel:u,raster:h}=t;"default"===o&&h&&l&&null!=u&&i&&s&&c&&a&&await this._progressivelyRefineDefaultOverlay({areaOfInterest:l,currentBestFeature:s,depthImageLoaded:n,imageSize:i,level:u,overlayGraphic:a,raster:h,signal:r,view:c})}async _updatePanoramicNavigation(e,t,a,r){e.adapter?.disableDefaultSuperimposeNavigation?.();const s=t!==this._panoramicNavigationFeature?e.panoramicCamera??a.camera:a.camera;s&&this._shouldUpdatePanoramicCamera(e.mode,t)&&(e.adapter?.disablePanoramicSuperimposeNavigation?.(),await(e.adapter?.updatePanoramicSuperimposeCamera?.({camera:s,currentBestFeature:t},{signal:r})),i(r)),this._panoramicNavigationFeature=t}_replaceGraphics(e,t){if("panoramic"===t&&this._updatePanoramicGraphicInPlace(e))return;const a=this._graphics;this._graphics=e,this._properties.overlays.addMany(e),this._destroyGraphics(a,!0)}_updatePanoramicGraphicInPlace(e){if(1!==this._graphics.length||1!==e.length)return!1;const t=this._graphics[0],a=e[0];return!(!t||!a)&&(t.geometry=a.geometry,t.symbol=a.symbol,t.visible=a.visible,a.geometry=null,a.symbol=null,r(a),!0)}_destroyGraphics(e,t){e.length&&(t&&this._properties.overlays.removeMany(e),e.forEach(e=>r(e)))}_updateDefaultSuperimposeNavigation(e,t=!0){t?e?.enableDefaultSuperimposeNavigation?.():e?.disableDefaultSuperimposeNavigation?.(),this._panoramicNavigationFeature&&e?.disablePanoramicSuperimposeNavigation?.(),this._panoramicNavigationFeature=null}_shouldUpdateDefaultCamera(e,t){return"default"===e&&t!==this._defaultCameraFeature}_shouldUpdatePanoramicCamera(e,t){return"panoramic"===e&&t!==this._panoramicNavigationFeature}updateZOffset(e,t){0!==t&&(this._zOffsetInMeters+=t,this._applyZOffset(this._graphics,e,t))}_applyZOffset(e,t,a){0!==a&&e.forEach(e=>{const r=e.geometry;"mesh"===r?.type&&("panoramic"!==t?y(r,{z:a}):w(r,{radiusOffset:a}))})}async _progressivelyRefineDefaultOverlay(e){const{areaOfInterest:t,level:a,overlayGraphic:r,raster:s,signal:n}=e;for(let o=a-1;o>=L;o-=1){const e=await this._createRasterTexture(s,t,o,{signal:n});i(n),e&&x(r,e)}}_resolveTextureUrl(e){const t=new URL(e.mediaUrl);return Object.entries(e.searchParams).forEach(([e,a])=>{t.searchParams.has(e)||t.searchParams.set(e,a)}),t.toString()}async _drapeGraphicToGround(e,t,a){if("3d"!==t.type)return;const r=e.geometry;if("mesh"!==r?.type)return;const{position:s}=r.vertexAttributes,o=new Array;for(let i=0;i<s.length;i+=3)o.push([s[i],s[i+1],s[i+2]??0]);const c=await t.map.ground.queryElevation(new n({hasZ:!0,points:o,spatialReference:r.spatialReference}),a);i(a),c.geometry.points.forEach((e,t)=>{const a=e[2];"number"==typeof a&&(s[3*t+2]=a)})}_createImageDataFromPixelBlock(e){return new ImageData(e.getAsRGBA(),e.width,e.height)}_copyImageData(e,t,a,r,i=e.width,s=e.height){const n=e.data,o=t.data,c=e.width,l=e.height,u=t.width,h=t.height;for(let p=0;p<s;p+=1){const e=r+p;if(e<0||e>=h)continue;const t=Math.min(l-1,Math.floor(p*l/s));for(let r=0;r<i;r+=1){const s=a+r;if(s<0||s>=u)continue;const l=4*(t*c+Math.min(c-1,Math.floor(r*c/i))),h=4*(e*u+s);o[h]=n[l],o[h+1]=n[l+1],o[h+2]=n[l+2],o[h+3]=n[l+3]}}}async _fetchRasterTextureAtLevel(e,t,a,r){const{offset:s,size:n}=b(e,t,a),{pixelBlock:o}=await e.fetchRawPixels(t,s,n,r);return i(r),o?this._createImageDataFromPixelBlock(o):void 0}async _loadRaster(e,t){const{loadRaster:a}=await import("../../PanoramicViewer/utils.js"),r=await a(this._resolveTextureUrl(e),t);return i(t),r}async _createRasterTexture(e,t,a,r){const{maximumPyramidLevel:i}=e.rasterInfo.storageInfo,s=await this._fetchRasterTextureAtLevel(e,a??i,t,r);if(s)return new u({data:s})}async _createPanoramicRasterTexture(e,t,a,r,s){const n=await M(t,a,r,this._properties.pointToPixel,s);if(i(s),!n?.length)return this._createRasterTexture(e,null,void 0,s);const{baseLevel:o,level:c,scalingFactor:l}=this._resolvePanoramicRasterLevels(e,a,n);return o<=c?this._createRasterTexture(e,null,c,s):this._createCompositedPanoramicRasterTexture(e,n,{baseLevel:o,level:c,scalingFactor:l},s)}_resolvePanoramicRasterLevels(e,t,a){const{maximumPyramidLevel:r,pyramidScalingFactor:i}=e.rasterInfo.storageInfo,s=a.reduce((a,r)=>Math.min(a,v(e,t,r)),r),n=P(e,s),o=i??T;return{baseLevel:Math.min(r,n+F),level:n,scalingFactor:o}}async _createCompositedPanoramicRasterTexture(e,t,a,r){const{baseLevel:s,level:n,scalingFactor:o}=a,c=D(e.rasterInfo.width,e.rasterInfo.height,n,o),l=await this._fetchRasterTextureAtLevel(e,s,null,r);if(i(r),!l)return;const h=new ImageData(c.width,c.height);this._copyImageData(l,h,0,0,c.width,c.height);const p=o**n;for(const u of t){const t=await this._fetchRasterTextureAtLevel(e,n,u,r);if(i(r),!t)continue;const{x:a,y:s}=this._resolvePanoramicRasterDrawOrigin(u,p);this._copyImageData(t,h,a,s)}return new u({data:h})}_resolvePanoramicRasterDrawOrigin(e,t){return{x:Math.max(0,Math.floor(e.xmin/t)),y:Math.max(0,Math.floor(e.ymin/t))}}async _createFootprintMesh(e,t,a,r,n){if("3d"!==t.type)return null;const l=I(e,a,r),u=await this._properties.getMapPoint(l,n);i(n);const p=await Promise.all(u.map(e=>e.spatialReference.equals(t.spatialReference)?e:o(e,t.spatialReference,n)));if(i(n),p.some(e=>!e))return null;const{faces:m,position:f,uv:d}=R(p,e,a,r);return new s({vertexAttributes:new h({position:f,uv:d}),components:[new c({faces:m})],spatialReference:t.spatialReference.clone()})}async _createPanoramicGraphic(t){const{currentBestFeature:r,horizonAngles:s,signal:n,texture:o,textureUrl:c,view:l}=t;if(!t.imageSize||!r)return null;const u=this._createPanoramicMeshTexture(o,c),h=await this._resolvePanoramicMeshLocation(r,l,n);if(!h)return null;i(n);const{imageMesh:f,radiusOfSphericalMesh:d}=this._createPanoramicSphereMesh(r,h,u);return this._flipPanoramicMeshUv(f),this._rotatePanoramicMeshToHorizon(f,s),f.offset(0,0,-d),new e({geometry:f,symbol:new m({symbolLayers:new a([new p({})])})})}_createPanoramicMeshTexture(e,t){if(e)return e;if(!t)throw new Error("Missing texture URL or texture data.");return new u({url:t})}async _resolvePanoramicMeshLocation(e,t,a){const r=e.attributes.location,s=r.spatialReference.equals(t.spatialReference)?r.clone():await o(r,t.spatialReference,{signal:a});return i(a),s}_createPanoramicSphereMesh(e,t,a){const r=t.spatialReference.isWebMercator?f(t.y):1,i=e.attributes.farDistance*r,n=new l({colorTexture:a}),o=s.createSphere(t,{size:i*S,densificationFactor:O,vertexSpace:"georeferenced",material:n});return o.components?.forEach(e=>{e.material=n,e.trustSourceNormals=!0}),{imageMesh:o,radiusOfSphericalMesh:i}}_flipPanoramicMeshUv(e){const t=e.vertexAttributes,a=t.uv;if(!a)return;const r=a.length/2;for(let i=0;i<r;i++)a[2*i]=U-a[2*i];e.vertexAttributes=t}_rotatePanoramicMeshToHorizon(e,t){if(!t)return;const[a,r,i]=t;e.rotate(-a,-r,i,{origin:e.extent.center})}async _createDefaultGraphic(t){const{texture:r,textureUrl:i}=t;if(!r&&!i)throw new Error("Missing texture URL or texture data.");if(!t.imageSize)return null;const s=await this._createFootprintMesh(t.imageSize,t.view,t.depthImageLoaded,t.areaOfInterest,{signal:t.signal});if(!s)return null;const n=s.vertexAttributes.position,o=[];for(let e=0;e<n.length;e+=3)o.push(...N);s.vertexAttributes.color=new Uint8Array(o);const c=new l({colorTexture:r??new u({url:i})});return s.components?.forEach(e=>{e.shading="source",e.material=c}),new e({geometry:s,symbol:new m({symbolLayers:new a([new p({})])})})}}export{A as default};
2
+ import e from"../../../Graphic.js";import{createTask as t}from"../../../core/asyncUtils.js";import a from"../../../core/Collection.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import i from"../../../geometry/Mesh.js";import{projectAsync as n}from"../../../geometry/projectionUtils.js";import o from"../../../geometry/support/MeshComponent.js";import c from"../../../geometry/support/MeshMaterial.js";import u from"../../../geometry/support/MeshTexture.js";import l from"../../../geometry/support/MeshVertexAttributes.js";import h from"../../../symbols/FillSymbol3DLayer.js";import m from"../../../symbols/MeshSymbol3D.js";import{calculateUpdatedWmsf as f}from"../imageMeasurementUtils.js";import{validateTifOrMrfExtension as p}from"../utils.js";import _ from"../support/resolveMediaProps.js";import{computeDefaultAreaOfInterest as x,getBaseRasterLevel as d,applySphereMeshOffsetInMeters as g,applyMeshOffsetInMeters as y,getRasterFetchParameters as v,getRasterLevelSize as w,computePanoramicAreasOfInterest as R,getViewDependentRasterLevel as M,clampRasterLevelForTextureSize as I,createSuperimposeSamplePixels as P,createSuperimposeGridVertexAttributes as O}from"../support/superimposeUtils.js";const b=2,T=2,F=2,D=2,Z=1,C=[255,255,255,255];class S{constructor(e){this._properties=e,this._cachedBaseTexture=null,this._cachedDefaultFrustumObjectId=null,this._cachedDefaultFrustumNearPlaneAverageZ=0,this._cachedPanoramicRadiusObjectId=null,this._defaultZOffsetInMeters=0,this._defaultZOffsetPercentage=0,this._defaultZOffsetRangeInMeters=0,this._defaultCameraFeature=null,this._graphics=[],this._panoramicZOffsetInMeters=0,this._panoramicZOffsetPercentage=0,this._panoramicZOffsetRangeInMeters=0,this._panoramicNavigationFeature=null,this._rasterTextureCacheFeature=null,this._rasterTextureFetchCache=new Map,this._task=null}clear(){this._destroyGraphics(this._graphics,!0),this._cachedBaseTexture=null,this._cachedDefaultFrustumObjectId=null,this._cachedDefaultFrustumNearPlaneAverageZ=0,this._cachedPanoramicRadiusObjectId=null,this._defaultZOffsetInMeters=0,this._defaultZOffsetRangeInMeters=0,this._defaultCameraFeature=null,this._graphics=[],this._panoramicZOffsetInMeters=0,this._panoramicZOffsetPercentage=0,this._panoramicZOffsetRangeInMeters=0,this._panoramicNavigationFeature=null,this._rasterTextureCacheFeature=null,this._rasterTextureFetchCache.clear()}destroy(){this._task=this._task?.abort()??null,this.clear()}update(e){this._task?.abort(),this._task=t(async t=>{if(!this._canUpdate(e))return void this._resetInactiveState(e.adapter);let a=!1,r=[];try{await this._updateDefaultCameraIfNeeded(e,t),this._resetRasterTextureCacheIfNeeded(e.currentBestFeature);const i=await this._resolveMedia(e,t);if(!i)return;if(({graphics:r}=await this._createGraphics(e,i,t)),!r.length)return;await this._updateNavigation(e,t),await this._applyPersistentZOffset(r,e,t),s(t),this._replaceGraphics(r,e.mode),a=!0}finally{a||this._destroyGraphics(r,!1)}})}_canUpdate(e){const t=["default","panoramic"];return e.superimposeViewEnabled&&"image-loaded"===e.state&&"3d"===e.view?.type&&!!e.currentBestFeature&&!!e.layer&&t.includes(e.mode)}_resetInactiveState(e){e?.disableDefaultSuperimposeNavigation?.(),e?.disablePanoramicSuperimposeNavigation?.(),this.clear()}async _updateDefaultCameraIfNeeded(e,t){const{currentBestFeature:a,mode:r}=e;if(a&&"default"===r)return this._shouldUpdateDefaultCamera(r,a)?(await(e.adapter?.updateDefaultSuperimposeCamera?.({currentBestFeature:a},{signal:t})),s(t),void(this._defaultCameraFeature=a)):void 0}async _resolveMedia(e,t){const{currentBestFeature:a,layer:r,mode:i,view:n}=e;if(!a||!r||!n||"default"!==i&&"panoramic"!==i)return null;const o=await _(a.attributes,r,{signal:t});if(s(t),!o?.mediaUrl)return null;if(!p(o.datasetFormat))return this._resolveNonRasterMedia(o);const c=await this._resolveRasterMedia(o,n,t);if(!c)return null;switch(i){case"default":{const a=await this._resolveDefaultAreaOfInterest(e,o,t);return this._resolveDefaultRasterMedia(c,a,n,t)}case"panoramic":return this._resolvePanoramicRasterMedia(c,e,t)}}_resolveNonRasterMedia(e){return{areaOfInterest:null,textureUrl:this._resolveTextureUrl(e)}}async _resolveDefaultAreaOfInterest(e,t,a){const{activeImageSize:r,currentBestFeature:i,mode:n,view:o}=e;if(!("default"===n&&r&&i&&o&&p(t.datasetFormat)))return null;const c=await x(i,o,r,this._properties.pointToPixel,{signal:a});return s(a),c}async _resolveRasterMedia(e,t,a){const r=await this._loadRaster(e,{signal:a});if(s(a),!r)return null;const i=d(r,t);let n=this._cachedBaseTexture;if(!n){const e=await this._createRasterTexture(r,null,i,{signal:a});s(a),e&&(n=e,this._cachedBaseTexture=e)}return n?{baseLevel:i,baseTexture:n,raster:r}:null}async _resolveDefaultRasterMedia(e,t,a,r){const{baseLevel:i,baseTexture:n,raster:o}=e;if(!t)return{areaOfInterest:null,baseTexture:n,raster:o,texture:n};const c=d(o,a,t),u=await this._createCompositedDefaultRasterTexture(o,t,c,i,{signal:r});return s(r),{areaOfInterest:t,baseTexture:n,overlayTexture:u,raster:o,texture:u??n}}async _resolvePanoramicRasterMedia(e,t,a){const{activeImageSize:r,currentBestFeature:i,view:n}=t,{baseTexture:o,raster:c}=e;if(!r||!i||!n)return{areaOfInterest:null,baseTexture:o,raster:c,texture:o};const u=await this._createPanoramicRasterTexture(c,i,n,r,{signal:a})??o;return s(a),{areaOfInterest:null,baseTexture:o,raster:c,texture:u}}async _createGraphics(e,t,a){switch(e.mode){case"default":return this._createDefaultGraphics(e,t,a);case"panoramic":return this._createPanoramicGraphics(e,t,a)}return{graphics:[]}}async _createDefaultGraphics(e,t,a){const r=await this._createAndDrapeDefaultGraphic(e,a,{texture:t.texture,textureUrl:t.textureUrl});return{graphics:r?[r]:[]}}async _createAndDrapeDefaultGraphic(e,t,a){const{activeImageSize:r,depthImageLoaded:i,view:n}=e,{areaOfInterest:o,texture:c,textureUrl:u}=a;if(!r||!n)return null;const l=await this._createDefaultGraphic({areaOfInterest:o,depthImageLoaded:i,imageSize:r,signal:t,texture:c,textureUrl:u,view:n});return l?(s(t),l):null}async _createPanoramicGraphics(e,t,a){const r=await this._createPanoramicSuperimposeGraphic(e,t,a);return{graphics:r?[r]:[]}}async _createPanoramicSuperimposeGraphic(e,t,a){const{activeImageSize:r,currentBestFeature:s,panoramicHorizonAngles:i,view:n}=e;return n?this._createPanoramicGraphic({currentBestFeature:s??void 0,horizonAngles:i,imageSize:r,signal:a,texture:t.texture,textureUrl:t.textureUrl,view:n}):null}async _updateNavigation(e,t){const{currentBestFeature:a,mode:r,view:s}=e;if(a&&s&&"3d"===s.type)switch(r){case"default":return void this._updateDefaultNavigation(e);case"panoramic":return void await this._updatePanoramicNavigation(e,a,s,t)}}_updateDefaultNavigation(e){this._updateDefaultSuperimposeNavigation(e.adapter,e.defaultSuperimposeCameraLockEnabled)}async _updatePanoramicNavigation(e,t,a,r){e.adapter?.disableDefaultSuperimposeNavigation?.();const i=t!==this._panoramicNavigationFeature?e.panoramicCamera??a.camera:a.camera;i&&this._shouldUpdatePanoramicCamera(e.mode,t)&&(e.adapter?.disablePanoramicSuperimposeNavigation?.(),await(e.adapter?.updatePanoramicSuperimposeCamera?.({camera:i,currentBestFeature:t},{signal:r})),s(r)),this._panoramicNavigationFeature=t}_replaceGraphics(e,t){if("panoramic"===t&&this._updatePanoramicGraphicInPlace(e))return;const a=this._graphics;this._graphics=e,this._properties.overlays.addMany(e),this._destroyGraphics(a,!0)}_updatePanoramicGraphicInPlace(e){if(1!==this._graphics.length||1!==e.length)return!1;const t=this._graphics[0],a=e[0];return!(!t||!a)&&(t.geometry=a.geometry,t.symbol=a.symbol,t.visible=a.visible,a.geometry=null,a.symbol=null,r(a),!0)}_destroyGraphics(e,t){e.length&&(t&&this._properties.overlays.removeMany(e),e.forEach(e=>r(e)))}_updateDefaultSuperimposeNavigation(e,t=!0){t?e?.enableDefaultSuperimposeNavigation?.():e?.disableDefaultSuperimposeNavigation?.(),this._panoramicNavigationFeature&&e?.disablePanoramicSuperimposeNavigation?.(),this._panoramicNavigationFeature=null}_shouldUpdateDefaultCamera(e,t){return"default"===e&&t!==this._defaultCameraFeature}_shouldUpdatePanoramicCamera(e,t){return"panoramic"===e&&t!==this._panoramicNavigationFeature}setDefaultZOffsetPercentage(e){const t=Math.max(0,Math.min(100,e)),a=this._defaultZOffsetRangeInMeters*t/100,r=a-this._defaultZOffsetInMeters;this._defaultZOffsetPercentage=t,this._defaultZOffsetInMeters=a,this._applyZOffset(this._graphics,"default",r)}setPanoramicRadiusPercentage(e){const t=Math.max(0,Math.min(100,e)),a=this._panoramicZOffsetRangeInMeters*t/100,r=a-this._panoramicZOffsetInMeters;this._panoramicZOffsetPercentage=t,this._panoramicZOffsetInMeters=a,this._applyZOffset(this._graphics,"panoramic",r)}updateZOffset(e){0!==e&&(this._panoramicZOffsetInMeters+=e,this._applyZOffset(this._graphics,"panoramic",e))}_applyZOffset(e,t,a){0!==a&&e.forEach(e=>{const r=e.geometry;"mesh"===r?.type&&("panoramic"!==t?y(r,{z:a}):g(r,{radiusOffset:a}))})}async _applyPersistentZOffset(e,t,a){if("panoramic"===t.mode)return this._panoramicZOffsetRangeInMeters=await this._resolvePanoramicZOffsetRangeInMeters(t.currentBestFeature,t.view,a),this._panoramicZOffsetInMeters=this._panoramicZOffsetRangeInMeters*this._panoramicZOffsetPercentage/100,void this._applyZOffset(e,"panoramic",this._panoramicZOffsetInMeters);this._defaultZOffsetRangeInMeters=await this._resolveDefaultZOffsetRangeInMeters(e,t.currentBestFeature,t.currentBestFeatureFrustum,t.view,a),this._defaultZOffsetInMeters=this._defaultZOffsetRangeInMeters*this._defaultZOffsetPercentage/100,this._applyZOffset(e,"default",this._defaultZOffsetInMeters)}async _resolveDefaultZOffsetRangeInMeters(e,t,a,r,i){const[o]=e,c=o?.geometry,u=t.attributes.objectId;if("mesh"!==c?.type||!a)return 0;if(this._cachedDefaultFrustumObjectId!==u){const e=a.spatialReference.equals(r.spatialReference)?a:await n(a.clone(),r.spatialReference,{signal:i});if(s(i),!e||"mesh"!==e.type)return this._cachedDefaultFrustumObjectId=u,this._cachedDefaultFrustumNearPlaneAverageZ=0,0;this._cachedDefaultFrustumObjectId=u,this._cachedDefaultFrustumNearPlaneAverageZ=this._getFrustumNearPlaneAverageZ(e)}return this._cachedDefaultFrustumNearPlaneAverageZ-this._getMeshAverageZ(c)}async _resolvePanoramicZOffsetRangeInMeters(e,t,a){const r=e.attributes.objectId;if(this._cachedPanoramicRadiusObjectId!==r){const i=e.attributes.farDistance,o=e.attributes.nearDistance??i;if(!(i>0&&o>=0))return this._cachedPanoramicRadiusObjectId=r,this._panoramicZOffsetRangeInMeters=0,0;const c=e.attributes.location,u=c.spatialReference.equals(t.spatialReference)?c:await n(c,t.spatialReference,{signal:a});if(s(a),!u)return this._cachedPanoramicRadiusObjectId=r,this._panoramicZOffsetRangeInMeters=0,0;const l=u.spatialReference.isWebMercator?f(u.y):1;this._cachedPanoramicRadiusObjectId=r,this._panoramicZOffsetRangeInMeters=(o-i)*l}return this._panoramicZOffsetRangeInMeters}_getFrustumNearPlaneAverageZ(e){const{position:t}=e.vertexAttributes;if(t.length<12)return this._getMeshAverageZ(e);let a=0;for(let r=0;r<4;r+=1)a+=t[3*r+2];return a/4}_getMeshAverageZ(e){const{position:t}=e.vertexAttributes,a=Math.floor(t.length/3);if(0===a)return 0;let r=0;for(let s=0;s<a;s+=1)r+=t[3*s+2];return r/a}_resolveTextureUrl(e){const t=new URL(e.mediaUrl);return Object.entries(e.searchParams).forEach(([e,a])=>{t.searchParams.has(e)||t.searchParams.set(e,a)}),t.toString()}_resetRasterTextureCacheIfNeeded(e){e&&e!==this._rasterTextureCacheFeature&&(this._cachedBaseTexture=null,this._rasterTextureFetchCache.clear(),this._rasterTextureCacheFeature=e)}_createImageDataFromPixelBlock(e){return new ImageData(e.getAsRGBA(),e.width,e.height)}_copyImageData(e,t,a,r,s=e.width,i=e.height){const n=e.data,o=t.data,c=e.width,u=e.height,l=t.width,h=t.height;for(let m=0;m<i;m+=1){const e=r+m;if(e<0||e>=h)continue;const t=Math.min(u-1,Math.floor(m*u/i));for(let r=0;r<s;r+=1){const i=a+r;if(i<0||i>=l)continue;const u=4*(t*c+Math.min(c-1,Math.floor(r*c/s))),h=4*(e*l+i);o[h]=n[u],o[h+1]=n[u+1],o[h+2]=n[u+2],o[h+3]=n[u+3]}}}_copyImageDataRegion(e,t,a,r,s,i,n,o){const c=e.data,u=t.data,l=e.width,h=t.width;for(let m=0;m<o;m+=1)for(let e=0;e<n;e+=1){const t=4*((r+m)*l+(a+e)),n=4*((i+m)*h+(s+e));u[n]=c[t],u[n+1]=c[t+1],u[n+2]=c[t+2],u[n+3]=c[t+3]}}async _fetchRasterTextureAtLevel(e,t,a,r){const{offset:i,size:n}=v(e,t,a),o=this._createRasterTextureExtent(i,n),c=this._createRasterTextureLevelCacheKey(e,t),u=this._getOrCreateRasterTextureLevelCache(c),l=this._getUncoveredRasterTextureExtents(o,u.patches);for(const h of l){const a=this._createRasterTextureExtentCacheKey(h);let i=u.inflight.get(a);i||(i=this._fetchRasterTexturePatch(e,t,h,r),u.inflight.set(a,i));try{const e=await i;s(r),e&&u.patches.push(e)}finally{u.inflight.delete(a)}}return this._composeRasterTextureFromCachedPatches(o,u.patches)}_getOrCreateRasterTextureLevelCache(e){let t=this._rasterTextureFetchCache.get(e);return t||(t={inflight:new Map,patches:[]},this._rasterTextureFetchCache.set(e,t)),t}_createRasterTextureLevelCacheKey(e,t){return[e.url,e.rasterInfo.width,e.rasterInfo.height,t].join(":")}_createRasterTextureExtentCacheKey(e){return[e.xmin,e.ymin,e.xmax,e.ymax].join(":")}_createRasterTextureExtent(e,t){return{xmin:e.x,ymin:e.y,xmax:e.x+t.width,ymax:e.y+t.height}}_getUncoveredRasterTextureExtents(e,t){let a=[e];for(const r of t)if(a=a.flatMap(e=>this._subtractRasterTextureExtent(e,r.extent)),!a.length)break;return a}_subtractRasterTextureExtent(e,t){const a=this._intersectRasterTextureExtents(e,t);if(!a)return[e];const r=[];return e.ymin<a.ymin&&r.push({xmin:e.xmin,ymin:e.ymin,xmax:e.xmax,ymax:a.ymin}),a.ymax<e.ymax&&r.push({xmin:e.xmin,ymin:a.ymax,xmax:e.xmax,ymax:e.ymax}),e.xmin<a.xmin&&r.push({xmin:e.xmin,ymin:a.ymin,xmax:a.xmin,ymax:a.ymax}),a.xmax<e.xmax&&r.push({xmin:a.xmax,ymin:a.ymin,xmax:e.xmax,ymax:a.ymax}),r.filter(({xmin:e,ymin:t,xmax:a,ymax:r})=>a>e&&r>t)}_intersectRasterTextureExtents(e,t){const a=Math.max(e.xmin,t.xmin),r=Math.max(e.ymin,t.ymin),s=Math.min(e.xmax,t.xmax),i=Math.min(e.ymax,t.ymax);return s>a&&i>r?{xmin:a,ymin:r,xmax:s,ymax:i}:null}async _fetchRasterTexturePatch(e,t,a,r){const{pixelBlock:i}=await e.fetchRawPixels(t,{x:a.xmin,y:a.ymin},{width:a.xmax-a.xmin,height:a.ymax-a.ymin},r);if(s(r),i)return{extent:a,imageData:this._createImageDataFromPixelBlock(i)}}_composeRasterTextureFromCachedPatches(e,t){const a=t.filter(t=>this._intersectRasterTextureExtents(e,t.extent));if(!a.length)return;const r=new ImageData(e.xmax-e.xmin,e.ymax-e.ymin);for(const s of a){const t=this._intersectRasterTextureExtents(e,s.extent);t&&this._copyImageDataRegion(s.imageData,r,t.xmin-s.extent.xmin,t.ymin-s.extent.ymin,t.xmin-e.xmin,t.ymin-e.ymin,t.xmax-t.xmin,t.ymax-t.ymin)}return r}async _loadRaster(e,t){const{loadRaster:a}=await import("../../PanoramicViewer/utils.js"),r=await a(this._resolveTextureUrl(e),t);return s(t),r}async _createCompositedDefaultRasterTexture(e,t,a,r,i){const{pyramidScalingFactor:n}=e.rasterInfo.storageInfo,o=n??b,c=w(e.rasterInfo.width,e.rasterInfo.height,a,o),l=await this._fetchRasterTextureAtLevel(e,r,null,i);if(s(i),!l)return;const h=await this._fetchRasterTextureAtLevel(e,a,t,i);if(s(i),!h)return new u({data:l});const m=new ImageData(c.width,c.height);this._copyImageData(l,m,0,0,c.width,c.height);const f=o**a,{x:p,y:_}=this._resolveRasterDrawOrigin(t,f);return this._copyImageData(h,m,p,_),new u({data:m})}async _createRasterTexture(e,t,a,r){const{maximumPyramidLevel:s}=e.rasterInfo.storageInfo,i=await this._fetchRasterTextureAtLevel(e,a??s,t,r);if(i)return new u({data:i})}async _createPanoramicRasterTexture(e,t,a,r,i){const n=await R(t,a,r,this._properties.pointToPixel,i);if(s(i),!n?.length)return this._createRasterTexture(e,null,void 0,i);const{baseLevel:o,level:c,scalingFactor:u}=this._resolvePanoramicRasterLevels(e,a,n);return o<=c?this._createRasterTexture(e,null,c,i):this._createCompositedPanoramicRasterTexture(e,n,{baseLevel:o,level:c,scalingFactor:u},i)}_resolvePanoramicRasterLevels(e,t,a){const{maximumPyramidLevel:r,pyramidScalingFactor:s}=e.rasterInfo.storageInfo,i=a.reduce((a,r)=>Math.min(a,M(e,t,r)),r),n=I(e,i),o=s??b;return{baseLevel:Math.min(r,n+T),level:n,scalingFactor:o}}async _createCompositedPanoramicRasterTexture(e,t,a,r){const{baseLevel:i,level:n,scalingFactor:o}=a,c=w(e.rasterInfo.width,e.rasterInfo.height,n,o),l=await this._fetchRasterTextureAtLevel(e,i,null,r);if(s(r),!l)return;const h=new ImageData(c.width,c.height);this._copyImageData(l,h,0,0,c.width,c.height);const m=o**n;for(const u of t){const t=await this._fetchRasterTextureAtLevel(e,n,u,r);if(s(r),!t)continue;const{x:a,y:i}=this._resolveRasterDrawOrigin(u,m);this._copyImageData(t,h,a,i)}return new u({data:h})}_resolveRasterDrawOrigin(e,t){return{x:Math.max(0,Math.floor(e.xmin/t)),y:Math.max(0,Math.floor(e.ymin/t))}}async _createFootprintMesh(e,t,a,r){if("3d"!==t.type)return null;const c=P(e,a),u=await this._properties.getMapPoint(c,r);s(r);const h=await Promise.all(u.map(e=>e.spatialReference.equals(t.spatialReference)?e:n(e,t.spatialReference,r)));if(s(r),h.some(e=>!e))return null;const{faces:m,position:f,uv:p}=O(h,e,a);return new i({vertexAttributes:new l({position:f,uv:p}),components:[new o({faces:m})],spatialReference:t.spatialReference.clone()})}async _createPanoramicGraphic(t){const{currentBestFeature:r,horizonAngles:i,signal:n,texture:o,textureUrl:c,view:u}=t;if(!t.imageSize||!r)return null;const l=this._createPanoramicMeshTexture(o,c),f=await this._resolvePanoramicMeshLocation(r,u,n);if(!f)return null;s(n);const{imageMesh:p,radiusOfSphericalMesh:_}=this._createPanoramicSphereMesh(r,f,l);return this._flipPanoramicMeshUv(p),this._rotatePanoramicMeshToHorizon(p,i),p.offset(0,0,-_),new e({geometry:p,symbol:new m({symbolLayers:new a([new h({})])})})}_createPanoramicMeshTexture(e,t){if(e)return e;if(!t)throw new Error("Missing texture URL or texture data.");return new u({url:t})}async _resolvePanoramicMeshLocation(e,t,a){const r=e.attributes.location,i=r.spatialReference.equals(t.spatialReference)?r.clone():await n(r,t.spatialReference,{signal:a});return s(a),i}_createPanoramicSphereMesh(e,t,a){const r=t.spatialReference.isWebMercator?f(t.y):1,s=e.attributes.farDistance*r,n=new c({colorTexture:a}),o=i.createSphere(t,{size:s*F,densificationFactor:D,vertexSpace:"georeferenced",material:n});return o.components?.forEach(e=>{e.material=n,e.trustSourceNormals=!0}),{imageMesh:o,radiusOfSphericalMesh:s}}_flipPanoramicMeshUv(e){const t=e.vertexAttributes,a=t.uv;if(!a)return;const r=a.length/2;for(let s=0;s<r;s++)a[2*s]=Z-a[2*s];e.vertexAttributes=t}_rotatePanoramicMeshToHorizon(e,t){if(!t)return;const[a,r,s]=t;e.rotate(-a,-r,s,{origin:e.extent.center})}async _createDefaultGraphic(t){const{texture:r,textureUrl:s}=t;if(!r&&!s)throw new Error("Missing texture URL or texture data.");if(!t.imageSize)return null;const i=await this._createFootprintMesh(t.imageSize,t.view,t.areaOfInterest,{signal:t.signal});if(!i)return null;const n=i.vertexAttributes.position,o=[];for(let e=0;e<n.length;e+=3)o.push(...C);i.vertexAttributes.color=new Uint8Array(o);const l=new c({colorTexture:r??new u({url:s})});return i.components?.forEach(e=>{e.shading="source",e.material=l}),new e({geometry:i,symbol:new m({symbolLayers:new a([new h({})])})})}}export{S as default};