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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (484) hide show
  1. package/Basemap.js +1 -1
  2. package/applications/Components/QuantityFormatter.d.ts +4 -0
  3. package/applications/Components/QuantityFormatter.js +5 -0
  4. package/applications/Components/baUtils.js +1 -1
  5. package/arcade/ArcadeDate.js +1 -1
  6. package/arcade/enum.js +5 -0
  7. package/arcade/featureset/actions/GroupBy.js +1 -1
  8. package/arcade/functions/convertdirection.js +1 -1
  9. package/arcade/functions/date.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/geomasync.js +1 -1
  12. package/arcade/functions/geomsync.js +1 -1
  13. package/arcade/functions/string.js +1 -1
  14. package/arcade/geometry/functions.js +1 -1
  15. package/arcade/geometry/unitConversion.js +1 -1
  16. package/assets/esri/core/workers/RemoteClient.js +1 -1
  17. package/assets/esri/core/workers/chunks/{0fd6d80393722132e044.js → 0229c573fa8a2fff2d8b.js} +2 -2
  18. package/assets/esri/core/workers/chunks/{d21d9e8b8c8a2e0485d5.js → 094e8aae6dada24c8115.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{ffaa977cd97a2b7190c5.js → 0c2dccec20c0994366fe.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{8f1fbfdac04e694f621d.js → 0c50ee1f3cdd30d96479.js} +1 -1
  21. package/assets/esri/core/workers/chunks/151d6354e7bc105b25c0.js +346 -0
  22. package/assets/esri/core/workers/chunks/1cf0fae3f2e848a2a738.js +1 -0
  23. package/assets/esri/core/workers/chunks/24327d01cb2c5c55a4b7.js +1 -0
  24. package/assets/esri/core/workers/chunks/{1a010d877b8428e755fb.js → 2841888fdbc2770e90c8.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{7e1dc8e5e18f18dd21e2.js → 29fb64826bb1351aca8d.js} +2 -2
  26. package/assets/esri/core/workers/chunks/{1f4fd9e3849f4e593375.js → 2b1486a466760d2152f5.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{4e0d2458f4d7a35bb97c.js → 2ce5cc797ae0d66c8678.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{9d564f79b82d427fc1da.js → 2fd30428309f4c517d4c.js} +1 -1
  29. package/assets/esri/core/workers/chunks/3ca6f893fd58f5b17af5.js +1 -0
  30. package/assets/esri/core/workers/chunks/{52d160cb7921ae7a4f57.js → 3fc44d8cef392b4b9c7a.js} +1 -1
  31. package/assets/esri/core/workers/chunks/417293f00b2c21cc3175.js +1 -0
  32. package/assets/esri/core/workers/chunks/{4cb199b547e5b97e65fb.js → 48cedef1c926d11164b7.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{563594357f3648652a5c.js → 4b21c4815533a43835c3.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{d166f805990353578494.js → 523046e04679e301797d.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{921c040d0497031fd8ff.js → 54da9c7fd1088a8076ce.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{ab9614555a15f04396f6.js → 54f981fe0f8851767be9.js} +2 -2
  37. package/assets/esri/core/workers/chunks/{28d9e2ffc3059a55311e.js → 59f701c30bcd9088b291.js} +1 -1
  38. package/assets/esri/core/workers/chunks/5d50a8d0427eab0a2514.js +1 -0
  39. package/assets/esri/core/workers/chunks/5f4ca51b82daf0e51010.js +1 -0
  40. package/assets/esri/core/workers/chunks/{05c80002c37002ac99e8.js → 5f6719286a6c9a3ac74b.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{a09b5700c92bb76c3234.js → 638ecabe3e22978af5a3.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{9fff43ffcd5602ccc50f.js → 649caffe8f5dbaad0d7b.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{4480e4b61affb3b2e9d6.js → 6648e68f00d28e12bcf9.js} +1 -1
  44. package/assets/esri/core/workers/chunks/66a1b92358344dd28ee1.js +1 -0
  45. package/assets/esri/core/workers/chunks/{b92a34f88569c481ed10.js → 67338948e470c1251d8a.js} +3 -3
  46. package/assets/esri/core/workers/chunks/{a8d043b73e087bee7c40.js → 67c5f1112a7c65e9eeff.js} +1 -1
  47. package/assets/esri/core/workers/chunks/6a225393b63e1e8c7933.js +1 -0
  48. package/assets/esri/core/workers/chunks/6c29a768f02dc7ce0ed6.js +1 -0
  49. package/assets/esri/core/workers/chunks/{fbd2f45d5adce4ca323f.js → 73ddb356121add556994.js} +2 -2
  50. package/assets/esri/core/workers/chunks/{a6ca68ef6311ffc365b2.js → 73e179b04bb931ca9b86.js} +1 -1
  51. package/assets/esri/core/workers/chunks/7678177555570682154e.js +1 -0
  52. package/assets/esri/core/workers/chunks/7a9a0383f27f4967bcfa.js +1 -0
  53. package/assets/esri/core/workers/chunks/7b9d14cc4a466ef18d71.js +1 -0
  54. package/assets/esri/core/workers/chunks/7e6141b5baae47682f97.js +1 -0
  55. package/assets/esri/core/workers/chunks/{257db39a1ba1a11ebfb4.js → 8365707e408d19988356.js} +1 -1
  56. package/assets/esri/core/workers/chunks/87fc7b6c3e2d4f7775e2.js +1 -0
  57. package/assets/esri/core/workers/chunks/8a2cee726b7843c7408a.js +1 -0
  58. package/assets/esri/core/workers/chunks/{b1e275607d9754079f60.js → 8eadf90d938753691044.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{ff4e7da880b206fd98ec.js → 9049c81445cc044286f1.js} +1 -1
  60. package/assets/esri/core/workers/chunks/9588328d4ed6b0f04166.js +2 -0
  61. package/assets/esri/core/workers/chunks/{dcf5719f38ad40b92941.js → 9826a1c66885dbbdc130.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{3b4b4f84d594db8945f9.js → 9839309d0cd804fe52c2.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{c10885b3a0739708e9e0.js → 9a06476b834584d00d5c.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{4954e0cf4a40e45d237f.js → 9c8e66da6cf32ace0914.js} +1 -1
  65. package/assets/esri/core/workers/chunks/9cac00d4bfac14aaae12.js +1 -0
  66. package/assets/esri/core/workers/chunks/{d60da671aba70485050e.js → 9f18392933c06f1d63b6.js} +1 -1
  67. package/assets/esri/core/workers/chunks/a937076d2f8c2b6a5d8a.js +1 -0
  68. package/assets/esri/core/workers/chunks/{c3b2b05996e2008adbe3.js → a9f16323666042a9d47f.js} +1 -1
  69. package/assets/esri/core/workers/chunks/aad9a693813b47a51530.js +2 -0
  70. package/assets/esri/core/workers/chunks/{654fe135d41af81daa13.js → be1f3cac908c28c64401.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{5e52c1c076a1502f9fe4.js → be2c8c0a8b2bce7979b6.js} +1 -1
  72. package/assets/esri/core/workers/chunks/bf4d9cdcbe6bb8bc9d39.js +1 -0
  73. package/assets/esri/core/workers/chunks/{d49518eb4b351afc5f00.js → ca3851ca2621879eb887.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{56db71ea7eb8a5652d98.js → ca62e7ec102a1bb879dc.js} +1 -1
  75. package/assets/esri/core/workers/chunks/cb16ba9512ae0a09c55d.js +1 -0
  76. package/assets/esri/core/workers/chunks/{8c1242ffd48b3ef800fa.js → d103e184ddf9beec779d.js} +1 -1
  77. package/assets/esri/core/workers/chunks/d3d98ea5b5e56fc60a31.js +1 -0
  78. package/assets/esri/core/workers/chunks/{5719471414810b6a9aec.js → d9d9180689bcf71af00f.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{dcaeb57c69d432118604.js → db13c93b4d708a2481db.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{2c3bfa75286376388806.js → db192728fa0ee08a776a.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{40b8e53c8b1c447eff7e.js → e2d012078d51dc2b2802.js} +1 -1
  82. package/assets/esri/core/workers/chunks/e385a27fd1ac2123a05f.js +1 -0
  83. package/assets/esri/core/workers/chunks/{e85f892ea44d67d53ff0.js → f3b51aa0a1a8fc3b231c.js} +2 -2
  84. package/assets/esri/core/workers/chunks/f74f8ed3f17713a208c3.js +1 -0
  85. package/assets/esri/core/workers/chunks/f9567108862629f25c8b.js +1 -0
  86. package/assets/esri/core/workers/chunks/fa99abc572b382e7e0c7.js +1 -0
  87. package/assets/esri/themes/base/widgets/_Directions.scss +74 -0
  88. package/assets/esri/themes/base/widgets/_Editor.scss +2 -1
  89. package/assets/esri/themes/base/widgets/_SearchResultRenderer.scss +5 -30
  90. package/assets/esri/themes/dark/main.css +1 -1
  91. package/assets/esri/themes/light/main.css +1 -1
  92. package/assets/esri/themes/light/view.css +1 -1
  93. package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
  94. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  95. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  96. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  97. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  98. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  99. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  100. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  101. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  102. package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
  103. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  104. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  105. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  106. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  107. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  108. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  109. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  110. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  111. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  112. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  113. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  114. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  115. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  116. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  117. package/assets/esri/widgets/Directions/t9n/Directions_no.json +1 -1
  118. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  119. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  120. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  121. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  122. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  123. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  124. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  125. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  126. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  127. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  128. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  129. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  130. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  131. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  132. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  133. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  134. package/assets/esri/widgets/Search/t9n/Search.json +1 -1
  135. package/assets/esri/widgets/Search/t9n/Search_ar.json +1 -1
  136. package/assets/esri/widgets/Search/t9n/Search_bg.json +1 -1
  137. package/assets/esri/widgets/Search/t9n/Search_bs.json +1 -1
  138. package/assets/esri/widgets/Search/t9n/Search_ca.json +1 -1
  139. package/assets/esri/widgets/Search/t9n/Search_cs.json +1 -1
  140. package/assets/esri/widgets/Search/t9n/Search_da.json +1 -1
  141. package/assets/esri/widgets/Search/t9n/Search_de.json +1 -1
  142. package/assets/esri/widgets/Search/t9n/Search_el.json +1 -1
  143. package/assets/esri/widgets/Search/t9n/Search_en.json +1 -1
  144. package/assets/esri/widgets/Search/t9n/Search_es.json +1 -1
  145. package/assets/esri/widgets/Search/t9n/Search_et.json +1 -1
  146. package/assets/esri/widgets/Search/t9n/Search_fi.json +1 -1
  147. package/assets/esri/widgets/Search/t9n/Search_fr.json +1 -1
  148. package/assets/esri/widgets/Search/t9n/Search_he.json +1 -1
  149. package/assets/esri/widgets/Search/t9n/Search_hr.json +1 -1
  150. package/assets/esri/widgets/Search/t9n/Search_hu.json +1 -1
  151. package/assets/esri/widgets/Search/t9n/Search_id.json +1 -1
  152. package/assets/esri/widgets/Search/t9n/Search_it.json +1 -1
  153. package/assets/esri/widgets/Search/t9n/Search_ja.json +1 -1
  154. package/assets/esri/widgets/Search/t9n/Search_ko.json +1 -1
  155. package/assets/esri/widgets/Search/t9n/Search_lt.json +1 -1
  156. package/assets/esri/widgets/Search/t9n/Search_lv.json +1 -1
  157. package/assets/esri/widgets/Search/t9n/Search_nl.json +1 -1
  158. package/assets/esri/widgets/Search/t9n/Search_no.json +1 -1
  159. package/assets/esri/widgets/Search/t9n/Search_pl.json +1 -1
  160. package/assets/esri/widgets/Search/t9n/Search_pt-BR.json +1 -1
  161. package/assets/esri/widgets/Search/t9n/Search_pt-PT.json +1 -1
  162. package/assets/esri/widgets/Search/t9n/Search_ro.json +1 -1
  163. package/assets/esri/widgets/Search/t9n/Search_ru.json +1 -1
  164. package/assets/esri/widgets/Search/t9n/Search_sk.json +1 -1
  165. package/assets/esri/widgets/Search/t9n/Search_sl.json +1 -1
  166. package/assets/esri/widgets/Search/t9n/Search_sr.json +1 -1
  167. package/assets/esri/widgets/Search/t9n/Search_sv.json +1 -1
  168. package/assets/esri/widgets/Search/t9n/Search_th.json +1 -1
  169. package/assets/esri/widgets/Search/t9n/Search_tr.json +1 -1
  170. package/assets/esri/widgets/Search/t9n/Search_uk.json +1 -1
  171. package/assets/esri/widgets/Search/t9n/Search_vi.json +1 -1
  172. package/assets/esri/widgets/Search/t9n/Search_zh-CN.json +1 -1
  173. package/assets/esri/widgets/Search/t9n/Search_zh-HK.json +1 -1
  174. package/assets/esri/widgets/Search/t9n/Search_zh-TW.json +1 -1
  175. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ar.json +1 -0
  176. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_bg.json +1 -0
  177. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_bs.json +1 -0
  178. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ca.json +1 -0
  179. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_cs.json +1 -0
  180. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_da.json +1 -0
  181. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_de.json +1 -0
  182. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_el.json +1 -0
  183. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_es.json +1 -0
  184. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_et.json +1 -0
  185. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_fi.json +1 -0
  186. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_fr.json +1 -0
  187. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_he.json +1 -0
  188. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_hr.json +1 -0
  189. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_hu.json +1 -0
  190. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_id.json +1 -0
  191. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_it.json +1 -0
  192. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ja.json +1 -0
  193. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ko.json +1 -0
  194. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_lt.json +1 -0
  195. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_lv.json +1 -0
  196. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_nl.json +1 -0
  197. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_no.json +1 -0
  198. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pl.json +1 -0
  199. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pt-BR.json +1 -0
  200. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pt-PT.json +1 -0
  201. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ro.json +1 -0
  202. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ru.json +1 -0
  203. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sk.json +1 -0
  204. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sl.json +1 -0
  205. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sr.json +1 -0
  206. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sv.json +1 -0
  207. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_th.json +1 -0
  208. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_tr.json +1 -0
  209. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_uk.json +1 -0
  210. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_vi.json +1 -0
  211. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-CN.json +1 -0
  212. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-HK.json +1 -0
  213. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-TW.json +1 -0
  214. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ar.json +1 -0
  215. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_bg.json +1 -0
  216. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_bs.json +1 -0
  217. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ca.json +1 -0
  218. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_cs.json +1 -0
  219. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_da.json +1 -0
  220. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_de.json +1 -0
  221. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_el.json +1 -0
  222. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_es.json +1 -0
  223. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_et.json +1 -0
  224. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_fi.json +1 -0
  225. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_fr.json +1 -0
  226. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_he.json +1 -0
  227. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_hr.json +1 -0
  228. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_hu.json +1 -0
  229. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_id.json +1 -0
  230. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_it.json +1 -0
  231. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ja.json +1 -0
  232. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ko.json +1 -0
  233. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_lt.json +1 -0
  234. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_lv.json +1 -0
  235. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_nl.json +1 -0
  236. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_no.json +1 -0
  237. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pl.json +1 -0
  238. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pt-BR.json +1 -0
  239. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pt-PT.json +1 -0
  240. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ro.json +1 -0
  241. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ru.json +1 -0
  242. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sk.json +1 -0
  243. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sl.json +1 -0
  244. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sr.json +1 -0
  245. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sv.json +1 -0
  246. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_th.json +1 -0
  247. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_tr.json +1 -0
  248. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_uk.json +1 -0
  249. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_vi.json +1 -0
  250. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-CN.json +1 -0
  251. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-HK.json +1 -0
  252. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-TW.json +1 -0
  253. package/chunks/Bufferer-Dw9Qi4T1.js +5 -0
  254. package/chunks/Distance2DCalculator-CXhBP-8I.js +5 -0
  255. package/chunks/Envelope.js +1 -1
  256. package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +5 -0
  257. package/chunks/Geometry.js +1 -1
  258. package/chunks/MultiPathImpl.js +5 -0
  259. package/chunks/OperatorClip.js +1 -1
  260. package/chunks/OperatorCut.js +1 -1
  261. package/chunks/OperatorDensify.js +1 -1
  262. package/chunks/OperatorGeneralize.js +1 -1
  263. package/chunks/OperatorGeodesicBuffer.js +1 -1
  264. package/chunks/OperatorGeodeticArea.js +1 -1
  265. package/chunks/OperatorGeodeticDistance.js +1 -1
  266. package/chunks/OperatorGeodeticLength.js +1 -1
  267. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  268. package/chunks/OperatorProximityGeodesic.js +1 -1
  269. package/chunks/OperatorShapePreservingLength.js +1 -1
  270. package/chunks/OperatorShapePreservingProject.js +1 -1
  271. package/chunks/Point2D.js +1 -1
  272. package/chunks/ProjectionTransformation.js +1 -1
  273. package/chunks/ShadowCastClear.glsl.js +5 -0
  274. package/chunks/distanceOperator.js +1 -1
  275. package/config.js +1 -1
  276. package/geometry/operators/extendOperator.js +1 -1
  277. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  278. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  279. package/geometry/operators/gx/operatorBoundary.js +1 -1
  280. package/geometry/operators/gx/operatorBuffer.js +1 -1
  281. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  282. package/geometry/operators/gx/operatorDifference.js +1 -1
  283. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  284. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  285. package/geometry/operators/gx/operatorIntersection.js +1 -1
  286. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  287. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  288. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  289. package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
  290. package/geometry/operators/gx/operatorOffset.js +1 -1
  291. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  292. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  293. package/geometry/operators/gx/operatorSimplify.js +1 -1
  294. package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
  295. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  296. package/geometry/operators/gx/operatorUnion.js +1 -1
  297. package/geometry/operators/isNearOperator.js +1 -1
  298. package/geometry/operators/reshapeOperator.js +1 -1
  299. package/geometry/operators/support/apiConverter.js +1 -1
  300. package/geometry/operators/support/initNoPeFactory.js +1 -1
  301. package/geometry/operators/support/jsonConverter.js +1 -1
  302. package/geometry/support/aaBoundingBox.js +1 -1
  303. package/geometry.js +1 -1
  304. package/interfaces.d.ts +205 -51
  305. package/layers/KnowledgeGraphLayer.js +1 -1
  306. package/layers/LinkChartLayer.js +1 -1
  307. package/layers/graphics/sources/support/QueryTask.js +1 -1
  308. package/package.json +2 -2
  309. package/pointCloudRenderers.js +1 -1
  310. package/portal/Portal.js +1 -1
  311. package/rasterRenderers.js +1 -1
  312. package/renderers.js +1 -1
  313. package/request.js +1 -1
  314. package/rest/knowledgeGraph/GraphAddNamedTypesResult.js +1 -1
  315. package/rest/knowledgeGraph/GraphAddPropertyResult.js +5 -0
  316. package/rest/knowledgeGraph/GraphApplyEditsResult.js +1 -1
  317. package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +1 -1
  318. package/rest/knowledgeGraph/GraphDeletePropertyResult.js +5 -0
  319. package/rest/knowledgeGraph/GraphUpdateNamedTypesResult.js +5 -0
  320. package/rest/knowledgeGraph/GraphUpdatePropertyResult.js +5 -0
  321. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  322. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
  323. package/rest/knowledgeGraphService.js +1 -1
  324. package/rest/networks/unitIdentifiers/insertGap.js +5 -0
  325. package/rest/networks/unitIdentifiers/queryUnitIdentifiers.js +5 -0
  326. package/rest/networks/unitIdentifiers/reset.js +5 -0
  327. package/rest/networks/unitIdentifiers/resize.js +5 -0
  328. package/rest/networks/unitIdentifiers/support/InsertGapParameters.js +5 -0
  329. package/rest/networks/unitIdentifiers/support/QueryUnitIdentifiersParamters.js +5 -0
  330. package/rest/networks/unitIdentifiers/support/ResetParameters.js +5 -0
  331. package/rest/networks/unitIdentifiers/support/ResizeParameters.js +5 -0
  332. package/rest/networks/unitIdentifiers/support/UnitQueryResult.js +5 -0
  333. package/rest/query/executeForCount.js +1 -1
  334. package/rest/utils.js +1 -1
  335. package/support/apiKeyUtils.js +1 -1
  336. package/support/basemapEnsureType.js +1 -1
  337. package/support/revision.js +1 -1
  338. package/symbols.js +1 -1
  339. package/unionTypes.d.ts +2 -0
  340. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  341. package/views/3d/FocusAreasView.js +1 -1
  342. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementController.js +1 -1
  343. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  344. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  345. package/views/3d/analysis/Dimension/DimensionController.js +1 -1
  346. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  347. package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
  348. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  349. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  350. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  351. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  352. package/views/3d/analysis/support/measurementUtils.js +1 -1
  353. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  354. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  355. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  356. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  357. package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils3D.js +1 -1
  358. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  359. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
  360. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  361. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  362. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  363. package/views/3d/layers/ContentGeometryLayerView.js +5 -0
  364. package/views/3d/layers/DimensionLayerView3D.js +1 -1
  365. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  366. package/views/3d/layers/FlowSubView3D.js +1 -1
  367. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  368. package/views/3d/layers/I3SMeshView3D.js +1 -1
  369. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  370. package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
  371. package/views/3d/layers/RouteLayerView3D.js +1 -1
  372. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  373. package/views/3d/layers/ViewshedLayerView3D.js +1 -1
  374. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  375. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  376. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  377. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  378. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  379. package/views/3d/layers/graphics/Labeler.js +1 -1
  380. package/views/3d/layers/support/LayerViewAnalysisViewManager.js +1 -1
  381. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  382. package/views/3d/support/pointsOfInterest/ContentGeometryUpdates.js +1 -1
  383. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  384. package/views/3d/terrain/TerrainRenderer.js +1 -1
  385. package/views/3d/terrain/TerrainSurface.js +1 -1
  386. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  387. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  388. package/views/3d/webgl-engine/shaders/ShadowCastClear.glsl.js +5 -0
  389. package/views/3d/webgl-engine/shaders/ShadowCastClearTechnique.js +5 -0
  390. package/views/LinkChartView.js +1 -1
  391. package/views/draw/DrawAction.js +1 -1
  392. package/views/draw/DrawGraphicTool.js +1 -1
  393. package/views/draw/DrawOperation.js +1 -1
  394. package/views/draw/DrawScreenTool.js +1 -1
  395. package/views/draw/DrawTool.js +1 -1
  396. package/views/draw/PointDrawAction.js +1 -1
  397. package/views/draw/PolygonDrawAction.js +1 -1
  398. package/views/draw/PolylineDrawAction.js +1 -1
  399. package/views/draw/SegmentDrawAction.js +1 -1
  400. package/views/draw/support/Box.js +1 -1
  401. package/views/draw/support/Reshape.js +1 -1
  402. package/views/draw/support/reshapeTooltipUtils.js +1 -1
  403. package/views/draw/support/tooltipUtils.js +1 -1
  404. package/views/interactive/SegmentLabels.js +1 -1
  405. package/views/interactive/coordinateHelper.js +1 -1
  406. package/views/interactive/snapping/LineSnapper.js +1 -1
  407. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  408. package/views/interactive/snapping/SelfSnappingEngine.js +1 -1
  409. package/views/interactive/snapping/SnappingManager.js +1 -1
  410. package/views/support/automaticAreaMeasurementUtils.js +1 -1
  411. package/views/support/automaticLengthMeasurementUtils.js +1 -1
  412. package/views/support/extentUtils.js +1 -1
  413. package/views/support/geodesicAreaMeasurementUtils.js +1 -1
  414. package/views/support/geodesicLengthMeasurementUtils.js +1 -1
  415. package/views/support/geodesicMeasurementUtils.js +1 -1
  416. package/views/support/layerViewUtils.js +1 -1
  417. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  418. package/widgets/BasemapLayerList.js +1 -1
  419. package/widgets/BatchAttributeForm/VisibleElements.js +1 -1
  420. package/widgets/BatchAttributeForm.js +1 -1
  421. package/widgets/CatalogLayerList.js +1 -1
  422. package/widgets/Directions/css.js +1 -1
  423. package/widgets/Directions.js +1 -1
  424. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  425. package/widgets/Editor/EditorViewModel.js +1 -1
  426. package/widgets/Editor/UpdateFeaturesWorkflow.d.ts +4 -0
  427. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  428. package/widgets/Editor/UpdateFeaturesWorkflowData.d.ts +4 -0
  429. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  430. package/widgets/Editor/UpdateWorkflow.js +1 -1
  431. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  432. package/widgets/Editor/support/SketchController.js +1 -1
  433. package/widgets/Editor/workflowUtils.js +1 -1
  434. package/widgets/Editor.js +1 -1
  435. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  436. package/widgets/LayerList.js +1 -1
  437. package/widgets/Search/SearchResultRenderer.js +1 -1
  438. package/widgets/Search/SearchViewModel.js +1 -1
  439. package/widgets/Search/searchResultRendererCSS.js +1 -1
  440. package/widgets/Sketch/SketchViewModel.js +1 -1
  441. package/widgets/TableList.js +1 -1
  442. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  443. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  444. package/widgets/support/SelectionList/selectionListUtils.js +1 -1
  445. package/widgets/support/SelectionList.js +1 -1
  446. package/widgets/support/SelectionToolbar.js +1 -1
  447. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  448. package/assets/esri/core/workers/chunks/009730713ed9bc7c7388.js +0 -1
  449. package/assets/esri/core/workers/chunks/0817ddd885ce8b2459cb.js +0 -1
  450. package/assets/esri/core/workers/chunks/0cce3770591b0730cf22.js +0 -1
  451. package/assets/esri/core/workers/chunks/1991f0d0f0a12175f849.js +0 -1
  452. package/assets/esri/core/workers/chunks/1f194ffea16cc6595ecc.js +0 -1
  453. package/assets/esri/core/workers/chunks/297d2c0a9d3f1e978318.js +0 -1
  454. package/assets/esri/core/workers/chunks/394b9723d108cff7136e.js +0 -1
  455. package/assets/esri/core/workers/chunks/4a362a35bcdb8405a53a.js +0 -1
  456. package/assets/esri/core/workers/chunks/52a3d0e041717da7697e.js +0 -1
  457. package/assets/esri/core/workers/chunks/62798f66872dc32e77d6.js +0 -346
  458. package/assets/esri/core/workers/chunks/6b42bcfbb60432e3ed1f.js +0 -1
  459. package/assets/esri/core/workers/chunks/7e8f78b96d43c224c7b6.js +0 -1
  460. package/assets/esri/core/workers/chunks/8e82acd1f730571680f4.js +0 -1
  461. package/assets/esri/core/workers/chunks/a0d2bd5d4ed3c90f6b1c.js +0 -1
  462. package/assets/esri/core/workers/chunks/a673128da9e6656ead2e.js +0 -1
  463. package/assets/esri/core/workers/chunks/a9b1f4bf5eaa937943be.js +0 -1
  464. package/assets/esri/core/workers/chunks/b52b28a6f422b10ff166.js +0 -1
  465. package/assets/esri/core/workers/chunks/c07c1bb7ae09136dc1f6.js +0 -1
  466. package/assets/esri/core/workers/chunks/cbbca011f8b176d4b5db.js +0 -1
  467. package/assets/esri/core/workers/chunks/cd5c380196db7fb55242.js +0 -1
  468. package/assets/esri/core/workers/chunks/ce321fd8fc5551e190ec.js +0 -1
  469. package/assets/esri/core/workers/chunks/ce53ddda04e09ba2f860.js +0 -1
  470. package/assets/esri/core/workers/chunks/d6ab65ad864782c50705.js +0 -1
  471. package/assets/esri/core/workers/chunks/da3c62a851a4332f6dda.js +0 -1
  472. package/assets/esri/core/workers/chunks/db3f710d770adf631b28.js +0 -2
  473. package/assets/esri/core/workers/chunks/f4c6ea630cecf0f260d7.js +0 -2
  474. package/chunks/Bufferer-CicaNej1.js +0 -5
  475. package/chunks/Distance2DCalculator-C1KHhZwD.js +0 -5
  476. package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +0 -5
  477. package/chunks/QuadraticBezier.js +0 -5
  478. /package/assets/esri/core/workers/chunks/{0fd6d80393722132e044.js.LICENSE.txt → 0229c573fa8a2fff2d8b.js.LICENSE.txt} +0 -0
  479. /package/assets/esri/core/workers/chunks/{7e1dc8e5e18f18dd21e2.js.LICENSE.txt → 29fb64826bb1351aca8d.js.LICENSE.txt} +0 -0
  480. /package/assets/esri/core/workers/chunks/{ab9614555a15f04396f6.js.LICENSE.txt → 54f981fe0f8851767be9.js.LICENSE.txt} +0 -0
  481. /package/assets/esri/core/workers/chunks/{fbd2f45d5adce4ca323f.js.LICENSE.txt → 73ddb356121add556994.js.LICENSE.txt} +0 -0
  482. /package/assets/esri/core/workers/chunks/{db3f710d770adf631b28.js.LICENSE.txt → 9588328d4ed6b0f04166.js.LICENSE.txt} +0 -0
  483. /package/assets/esri/core/workers/chunks/{f4c6ea630cecf0f260d7.js.LICENSE.txt → aad9a693813b47a51530.js.LICENSE.txt} +0 -0
  484. /package/assets/esri/core/workers/chunks/{e85f892ea44d67d53ff0.js.LICENSE.txt → f3b51aa0a1a8fc3b231c.js.LICENSE.txt} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{G as e}from"./SimpleGeometryCursor.js";import{a as t,c as s,G as i,i as n,g as r,d as h}from"./Geometry.js";import{c as m}from"./Envelope.js";import{Envelope2D as a}from"./Envelope2D.js";import{E as o,n as x,L as p,S as c}from"./QuadraticBezier.js";import{d as l,m as _,P as u,e as g,f as y}from"./Point2D.js";function f(e,t,s,i,n){return v(e,t,null,s,i,n)}function v(e,s,o,x,p,c){const l=e.getGeometryType();if(l===i.enumPoint){const t=e.getXY();return s.contains(t)?e:e.createInstance()}if(l===i.enumEnvelope){const t=a.constructEmpty();if(e.queryEnvelope(t),t.intersect(s)){const s=e.clone();return s.setEnvelope(t),s}return e.createInstance()}if(e.isEmpty())return e;if(s.isEmpty())return e.createInstance();const _=s.clone();{const t=new a;if(e.queryLooseEnvelope(t),_.containsEnvelope(t))return e;if(!_.isIntersecting(t))return e.createInstance();0===p&&(t.intersect(_),t.inflate(Math.max(.1*t.maxDimension(),1)),t.intersect(_),_.assign(t))}let u=x;if((null!==o||Number.isNaN(u))&&(u=m(o,_,!1).total()),l===i.enumGeometryCollection){const t=e,s=e.createInstance();for(let e=0,i=t.getGeometryCount();e<i;e++){const i=t.getGeometry(e);if(i.isEmpty())continue;const n=f(i,_,u,p,c);n.isEmpty()||(n===i?s.addGeometry(n.clone()):s.addGeometry(n))}return s}n(l)||t("Clip: geometry not supported");const g=e.getImpl().getAccelerators();if(null!==g){const e=g.getRasterizedGeometry();r(null===e)}switch(l){case i.enumMultiPoint:{const t=e;let s;const i=t.getPointCount(),n=t.getImpl().getAttributeStreamRef(0);let h=0;for(let e=0;e<i;e++){const i=n.readPoint2D(2*e);_.contains(i)||(0===h&&(s=t.createInstance()),h<e&&s.addPoints(t,h,e),h=e+1)}return h>0&&s.addPoints(t,h,i),0===h?t:(r(null!==s),s)}case i.enumPolygon:case i.enumPolyline:return P(e,_,u,p,c);default:h("")}}function d(e,t,s,i,n,r){const h=new E(t,r),m=new a;return e.queryLooseEnvelope(m),t.containsEnvelope(m)?e:t.isIntersecting(m)?h.clipPolesOut(e,n):e.createInstance()}function P(e,t,s,i,n){return new E(t,n).clipMultiPath2(e,s,i)}class E{constructor(e,t){this.m_shape=new o,this.m_geometry=x,this.m_verticesOnExtentIndex=-1,this.m_verticesOnExtent=[],this.m_progressCounter=0,this.m_extent=new a(e),this.m_progressTracker=t}progress_(){}clipMultiPath2(e,t,s){return e.getGeometryType()===i.enumPolygon?this.clipPolygonOrProjectedPolyline2(e,s):this.clipPolyline(e,t)}clipPolygonOrProjectedPolyline2(e,t){const s=e.getGeometryType()===i.enumPolyline;if(0===this.m_extent.width()||0===this.m_extent.height())return e.createInstance();const n=a.constructEmpty();e.queryLooseEnvelope(n),this.m_geometry=s?this.m_shape.addGeometry(e):this.m_shape.addGeometry(e,this.m_extent);const h=a.constructEmpty(),m=a.constructEmpty(),o=new u,c=new u,g=l(9,Number.NaN),y=l(9,Number.NaN),f=_(u,9);let v=null;const d=new p,P=[];let I=!1;for(let i=0;!I&&i<4;i++){let e=!1;const t=!!(1&i);let a=0;switch(i){case 0:a=this.m_extent.xmin,e=n.xmin<=a&&n.xmax>=a;break;case 1:a=this.m_extent.ymin,e=n.ymin<=a&&n.ymax>=a;break;case 2:a=this.m_extent.xmax,e=n.xmin<=a&&n.xmax>=a;break;case 3:a=this.m_extent.ymax,e=n.ymin<=a&&n.ymax>=a}if(e){I=!0;for(let e=this.m_shape.getFirstPath(this.m_geometry);e!==x;){let n=!0,p=-1,l=-1;const _=this.m_shape.getFirstVertex(e);let u=_;do{this.progress_(),v=this.m_shape.getSegment(u);let e=v;if(null===e){const t=this.m_shape.getNextVertex(u);if(t===x){r(s),0===p&&P.push(u);break}this.m_shape.queryXY(u,o),d.setStartXY(o),this.m_shape.queryXY(t,c),d.setEndXY(c),e=d}e.queryLooseEnvelope(h);let _=E.checkSegmentIntersection(h,i,a);e.isCurve()&&0===_&&e.isCurve()&&(d.setStartXY(e.getStartXY()),d.setEndXY(e.getEndXY()),this.m_shape.replaceCurveWithLine(u),e=d,d.queryEnvelope(h),_=E.checkSegmentIntersection(h,i,a));let V=0,X=x;if(-1===_){const s=e.intersectionWithAxis2D(t,a,g,y);if(s>0){let i=null;if(e.isCurve()){i=f,r(s<=9);for(let e=0;e<s;e++)t?f[e].setCoords(g[e],a):f[e].setCoords(a,g[e]);V=this.m_shape.splitSegmentAxisAware(u,y,s,i,t?1:0)}else V=this.m_shape.splitSegmentAxisAware(u,y,s,null,-1)}else V=0;V+=1;let h=u,x=this.m_shape.getNextVertex(h);e=null;for(let e=0;e<V;e++){this.m_shape.queryXY(h,o),this.m_shape.queryXY(x,c),v=this.m_shape.getSegment(h);let e=v;null===e&&(d.setStartXY(o),d.setEndXY(c),e=d),e.queryEnvelope(m);let s=E.checkSegmentIntersection(m,i,a);if(e.isCurve()&&0===s&&(this.m_shape.replaceCurveWithLine(h),d.setStartXY(o),d.setEndXY(c),e=d,e.queryEnvelope(m),s=E.checkSegmentIntersection(m,i,a)),-1===s){if(t){Math.abs(o.y-a)<Math.abs(c.y-a)?(o.y=a,this.m_shape.setXY(h,o)):(c.y=a,this.m_shape.setXY(x,c))}else{Math.abs(o.x-a)<Math.abs(c.x-a)?(o.x=a,this.m_shape.setXY(h,o)):(c.x=a,this.m_shape.setXY(x,c))}v=this.m_shape.getSegment(h),e=v,null===e&&(d.setStartXY(o),d.setEndXY(c),e=d),e.queryEnvelope(m),s=E.checkSegmentIntersection(m,i,a),-1===s&&(s=E.checkSegmentIntersectionLoose(m,i,a))}const r=p;p=s,-1===l&&(l=p),0===r&&1===p||1===r&&0===p||0===r&&0===p&&P.push(h),1===p&&(I=!1,n=!1),h=x,X=h,x=this.m_shape.getNextVertex(x)}}if(0===V){const e=p;p=_,-1===l&&(l=p),0===e&&p>=1||e>=1&&0===p||0===e&&0===p&&P.push(u),1===p&&(I=!1,n=!1),X=this.m_shape.getNextVertex(u)}if(u=X,P.length>=256){for(let e=1,t=P.length-1;e<t;e++){const t=P[e];s?this.m_shape.snapVertexForPoleClipping(t,a):this.m_shape.removeVertex(t,!1)}P[1]=P.at(-1),P.length=2}}while(u!==_);if(!n){0!==l||!s&&0!==p&&2!==p||P.push(_);for(let e=0,t=P.length;e<t;e++){const t=P[e];s?this.m_shape.snapVertexForPoleClipping(t,a):this.m_shape.removeVertex(t,!1)}}P.length=0,e=n||0===this.m_shape.getPathSize(e)?this.m_shape.removePath(e):this.m_shape.getNextPath(e)}}}if(I)return e.createInstance();v=null,s?this.removeSpikesAlongPoles():this.resolveBoundaryOverlaps(),t>0&&this.densifyAlongClipExtent(t);const V=this.m_shape.getGeometry(this.m_geometry);if(V.getGeometryType()===i.enumPolygon){V.setFillRule(e.getFillRule())}return V}clipPolyline(e,t){const s=a.constructEmpty(),i=a.constructEmpty(),n=l(9,Number.NaN),r=l(9,Number.NaN),h=new c;let m=e;const o=a.constructEmpty();e.queryLooseEnvelope(o);for(let a=0;a<4;a++){let t=!1;const x=!!(1&a);let p=0;switch(a){case 0:p=this.m_extent.xmin,t=o.xmin<=p&&o.xmax>=p;break;case 1:p=this.m_extent.ymin,t=o.ymin<=p&&o.ymax>=p;break;case 2:p=this.m_extent.xmax,t=o.xmin<=p&&o.xmax>=p;break;case 3:p=this.m_extent.ymax,t=o.ymin<=p&&o.ymax>=p}if(!t)continue;const c=m;m=e.createInstance();const l=c.getImpl().querySegmentIterator();l.resetToFirstPath();const _=new u,g=new u;for(;l.nextPath();){let e=-1,t=!0;for(;l.hasNextSegment();){this.progress_();const o=l.nextSegment(),c=o.isDegenerate(0);o.queryLooseEnvelope(s);const u=E.checkSegmentIntersection(s,a,p);if(-1===u){const s=o.intersectionWithAxis2D(x,p,n,r);let l=0;_.assign(o.getStartXY());for(let u=0;u<=s;u++){const y=u<s?r[u]:1;if(l===y)continue;o.queryCut(l,y,h,!1);const f=h.get();let v=!1;if(f.getStartXY().equals(_)||(f.setStartXY(_),v=!0),u<s&&(x?(g.x=n[u],g.y=p):(g.x=p,g.y=n[u]),f.getEndXY().equals(g)||(f.setEndXY(g),v=!0)),v&&f.normalizeAfterEndpointChange(),!c&&f.isDegenerate(0))continue;f.queryEnvelope(i);let d=E.checkSegmentIntersection(i,a,p);if(-1===d){const e=f.getStartXY(),t=f.getEndXY();if(v=!1,x){Math.abs(e.y-p)<Math.abs(t.y-p)?(e.y=p,f.setStartXY(e),e.equals(f.getStartXY())||(f.setStartXY(e),v=!0)):(t.y=p,t.equals(f.getEndXY())||(f.setEndXY(t),v=!0))}else{Math.abs(e.x-p)<Math.abs(t.x-p)?(e.x=p,e.equals(f.getStartXY())||(f.setStartXY(e),v=!0)):(t.x=p,t.equals(f.getEndXY())||(f.setEndXY(t),v=!0))}v&&f.normalizeAfterEndpointChange(),f.queryEnvelope(i),d=E.checkSegmentIntersection(i,a,p),-1===d&&(d=E.checkSegmentIntersectionLoose(i,a,p))}_.assign(f.getEndXY()),l=y,e=d,e>=1?(m.addSegment(f,t),t=!1):t=!0}}else e=u,e>=1?(m.addSegment(o,t),t=!1):t=!0}}}return m}static checkSegmentIntersection(e,t,s){switch(t){case 0:return e.xmin<s&&e.xmax<=s?0:e.xmin>=s?e.xmax===s?2:1:-1;case 1:return e.ymin<s&&e.ymax<=s?0:e.ymin>=s?e.ymax===s?2:1:-1;case 2:return e.xmin>=s&&e.xmax>s?0:e.xmax<=s?e.xmin===s?2:1:-1;case 3:return e.ymin>=s&&e.ymax>s?0:e.ymax<=s?e.ymin===s?2:1:-1}return h(""),0}static checkSegmentIntersectionLoose(e,t,s){switch(t){case 0:{const t=Math.abs(e.xmin-s),i=Math.abs(e.xmax-s);return e.xmin<s?t>i?0:1:(h(""),1)}case 1:{const t=Math.abs(e.ymin-s),i=Math.abs(e.ymax-s);return e.ymin<s?t>i?0:1:(h(""),1)}case 2:{const t=Math.abs(e.xmin-s),i=Math.abs(e.xmax-s);return e.xmax>s?t<i?0:1:(h(""),1)}case 3:{const t=Math.abs(e.ymin-s),i=Math.abs(e.ymax-s);return e.ymax>s?t<i?0:1:(h(""),1)}}return h(""),0}resolveBoundaryOverlaps(){this.m_verticesOnExtentIndex=-1,this.splitSegments(!1,this.m_extent.xmin),this.splitSegments(!1,this.m_extent.xmax),this.splitSegments(!0,this.m_extent.ymin),this.splitSegments(!0,this.m_extent.ymax),this.m_verticesOnExtent.length=0,this.m_verticesOnExtentIndex=this.m_shape.createUserIndex();const e=new u;for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==x;t=this.m_shape.getNextPath(t)){let s=this.m_shape.getFirstVertex(t);for(let i=0,n=this.m_shape.getPathSize(t);i<n;i++,s=this.m_shape.getNextVertex(s))this.progress_(),this.m_shape.queryXY(s,e),this.m_extent.xmin!==e.x&&this.m_extent.xmax!==e.x&&this.m_extent.ymin!==e.y&&this.m_extent.ymax!==e.y||(this.m_shape.setUserIndex(s,this.m_verticesOnExtentIndex,this.m_verticesOnExtent.length),this.m_verticesOnExtent.push(s))}this.dbgCheckPathFirst(),this.resolveOverlaps(!1,this.m_extent.xmin),this.dbgCheckPathFirst(),this.resolveOverlaps(!1,this.m_extent.xmax),this.dbgCheckPathFirst(),this.resolveOverlaps(!0,this.m_extent.ymin),this.dbgCheckPathFirst(),this.resolveOverlaps(!0,this.m_extent.ymax),this.fixPaths()}densifyAlongClipExtent(e){const t=new u(0,0),s=new u(0,0),i=l(2048,Number.NaN);for(let n=this.m_shape.getFirstPath(this.m_geometry);n!==x;n=this.m_shape.getNextPath(n)){const m=this.m_shape.getFirstVertex(n);let a=m;do{const n=this.m_shape.getNextVertex(a);this.m_shape.queryXY(a,t);let m=-1;if(t.x===this.m_extent.xmin?(this.m_shape.queryXY(n,s),s.x===this.m_extent.xmin&&(m=1)):t.x===this.m_extent.xmax&&(this.m_shape.queryXY(n,s),s.x===this.m_extent.xmax&&(m=1)),t.y===this.m_extent.ymin?(this.m_shape.queryXY(n,s),s.y===this.m_extent.ymin&&(m=0)):t.y===this.m_extent.ymax&&(this.m_shape.queryXY(n,s),s.y===this.m_extent.ymax&&(m=0)),-1===m){a=n;continue}if(this.isCurve(a)){a=n;continue}const o=t.clone(),x=new u(0,0);if(m){const i=t.y-this.m_extent.ymin;x.y=g(s.y-t.y),o.y=e*y(Math.floor(Math.abs(i)/e),i)+this.m_extent.ymin,x.y<0&&(o.y+=e)}else{const i=t.x-this.m_extent.xmin;x.x=g(s.x-t.x),o.x=e*y(Math.floor(Math.abs(i)/e),i)+this.m_extent.xmin,x.x<0&&(o.x+=e)}const p=m?s.y-t.y:s.x-t.x,c=Math.abs(p);if(c/e>65536&&h(""),c>0){const s=Math.trunc(c/e)+2;i.length<s&&(i.length=s);let n=0;for(let h=0;;h++){const s=o.add(x.mul(h*e)),a=(m?s.y-t.y:s.x-t.x)/p;if(a>=1)break;a<=0||(r(n<=i.length),i[n]=a,n++)}0!==n&&this.m_shape.splitSegment(a,i,n)}a=n}while(a!==m)}}splitSegments(e,t){let s=-1;const i=new u,n=[];for(let _=this.m_shape.getFirstPath(this.m_geometry);_!==x;_=this.m_shape.getNextPath(_)){let r=this.m_shape.getFirstVertex(_),h=x;for(let m=0,a=this.m_shape.getPathSize(_);m<a;m++,r=h)if(this.progress_(),h=this.m_shape.getNextVertex(r),this.m_shape.queryXY(r,i),(e?i.y===t:i.x===t)&&(this.m_shape.queryXY(h,i),e?i.y===t:i.x===t)){if(this.isCurve(r))continue;-1===s&&(s=this.m_shape.createUserIndex()),1!==this.m_shape.getUserIndex(r,s)&&(n.push(r),this.m_shape.setUserIndex(r,s,1)),1!==this.m_shape.getUserIndex(h,s)&&(n.push(h),this.m_shape.setUserIndex(h,s,1))}}if(-1!==s&&this.m_shape.removeUserIndex(s),n.length<3)return;n.sort(((e,t)=>this.compareVertices(e,t)));const r=new u,h=new u,m=new u;h.setNAN();let a=-1;let o=[],p=[];const c=this.m_shape.createUserIndex(),l=this.m_shape.createUserIndex();for(let x=0,_=n.length;x<_;x++){const s=n[x];if(this.m_shape.queryXY(s,i),!i.isEqualPoint2D(h)){if(-1===a){a=x,h.setCoordsPoint2D(i);continue}for(let i=a;i<x;i++){const s=n[i],m=this.m_shape.getNextVertex(s),a=this.m_shape.getPrevVertex(s);let x=!1;this.m_shape.queryXY(m,r),h.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(s)||(o.push(s),x=!0,this.m_shape.setUserIndex(s,l,1))),this.m_shape.queryXY(a,r),h.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(a)||(x||o.push(s),this.m_shape.setUserIndex(s,c,1)))}for(let e=0,t=o.length;e<t;e++){const t=o[e],s=this.m_shape.getUserIndex(t,c),n=this.m_shape.getUserIndex(t,l);if(1===s){const e=this.m_shape.getPrevVertex(t);this.m_shape.queryXY(e,m);let s=0;if(!m.isEqualPoint2D(i)){const n=u.distance(h,m);s=u.distance(m,i)/n,0===s?s=Number.EPSILON:1===s&&(s=1-Number.EPSILON),this.m_shape.splitSegment(e,[s],1);const r=this.m_shape.getPrevVertex(t);this.m_shape.setXY(r,i),p.push(r),this.m_shape.setUserIndex(r,c,1),this.m_shape.setUserIndex(r,l,-1)}}if(1===n){const e=this.m_shape.getNextVertex(t);this.m_shape.queryXY(e,m);let s=0;if(!m.isEqualPoint2D(i)){const e=u.distance(h,m);s=u.distance(h,i)/e,0===s?s=Number.EPSILON:1===s&&(s=1-Number.EPSILON),this.m_shape.splitSegment(t,[s],1);const n=this.m_shape.getNextVertex(t);this.m_shape.setXY(n,i),p.push(n),this.m_shape.setUserIndex(n,c,-1),this.m_shape.setUserIndex(n,l,1)}}}const s=o;o=p,p=s,p.length=0,a=x,h.setCoordsPoint2D(i)}}this.m_shape.removeUserIndex(c),this.m_shape.removeUserIndex(l)}resolveOverlaps(e,t){const s=new u,i=[];let n=-1;for(let r=0,o=this.m_verticesOnExtent.length;r<o;r++){this.progress_();const h=this.m_verticesOnExtent[r];if(h===x)continue;const m=this.m_shape.getNextVertex(h);if(this.m_shape.queryXY(h,s),(e?s.y===t:s.x===t)&&(this.m_shape.queryXY(m,s),e?s.y===t:s.x===t)){if(this.isCurve(h))continue;-1===n&&(n=this.m_shape.createUserIndex()),-2!==this.m_shape.getUserIndex(h,n)&&(i.push(h),this.m_shape.setUserIndex(h,n,-2)),-2!==this.m_shape.getUserIndex(m,n)&&(i.push(m),this.m_shape.setUserIndex(m,n,-2))}}if(0===i.length)return void(-1!==n&&this.m_shape.removeUserIndex(n));r(-1!==n),i.sort(((e,t)=>this.compareVertices(e,t)));for(let r=0,o=i.length;r<o;r++){const e=i[r];this.m_shape.setUserIndex(e,n,r)}const h=new u,m=new u;m.setNAN();let a=-1;for(let r=0,o=i.length;r<o;r++){this.progress_();const o=i[r];if(o!==x&&(this.m_shape.queryXY(o,s),!s.isEqualPoint2D(m))){if(-1!==a)for(;;){let s=!1;const o=r;for(let p=a;p<o;p++){const a=i[p];if(a===x)continue;let o=x;const c=this.m_shape.getNextVertex(a);this.m_shape.queryXY(c,h),m.compare(h)<0&&(e?h.y===t:h.x===t)&&(this.isCurve(a)||(o=c));let l=x;const _=this.m_shape.getPrevVertex(a);if(this.m_shape.queryXY(_,h),m.compare(h)<0&&(e?h.y===t:h.x===t)&&(this.isCurve(_)||(l=_)),o===x||l===x){if(o!==x||l!==x){for(let c=p+1;c<r;c++){const r=i[c];if(r===x)continue;const p=this.m_shape.getNextVertex(r);let _=x;this.m_shape.queryXY(p,h),m.compare(h)<0&&(e?h.y===t:h.x===t)&&(this.isCurve(r)||(_=p));const u=this.m_shape.getPrevVertex(r);let g=x;if(this.m_shape.queryXY(u,h),m.compare(h)<0&&(e?h.y===t:h.x===t)&&(this.isCurve(u)||(g=u)),_!==x&&g!==x){this.beforeRemoveVertex(r,i,n),this.m_shape.removeVertex(r,!1),this.beforeRemoveVertex(_,i,n),this.m_shape.removeVertex(_,!1),s=!0;break}if(o!==x&&g!==x){this.removeOverlap(i,a,o,r,g,n),s=!0;break}if(l!==x&&_!==x){this.removeOverlap(i,r,_,a,l,n),s=!0;break}}if(s)break}}else this.beforeRemoveVertex(a,i,n),this.m_shape.removeVertex(a,!1),this.beforeRemoveVertex(o,i,n),this.m_shape.removeVertex(o,!1),s=!0}if(!s)break}a=r,m.setCoordsPoint2D(s)}}this.m_shape.removeUserIndex(n)}beforeRemoveVertex(e,t,s){let i=this.m_shape.getUserIndex(e,s);r(i>=0),t[i]=x,i=this.m_shape.getUserIndex(e,this.m_verticesOnExtentIndex),r(i>=0),this.m_verticesOnExtent[i]=x;const n=this.m_shape.getPathFromVertex(e);if(n!==x){this.m_shape.getFirstVertex(n)===e&&(this.m_shape.setFirstVertex(n,x),this.m_shape.setLastVertex(n,x))}}removeOverlap(e,t,s,i,n,r){this.m_shape.setNextVertex(t,i),this.m_shape.setPrevVertex(i,t),this.m_shape.setPrevVertex(s,n),this.m_shape.setNextVertex(n,s),this.beforeRemoveVertex(i,e,r),this.m_shape.removeVertexInternal(i,!1),this.beforeRemoveVertex(n,e,r),this.m_shape.removeVertexInternal(n,!0)}removeSpikesAlongPoles(){this.removeSpikesOnPole(this.m_extent.ymin),this.removeSpikesOnPole(this.m_extent.ymax)}removeSpikesOnPole(e){for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==x;t=this.m_shape.getNextPath(t)){const s=this.m_shape.getPathSize(t);if(s<3)continue;let i=this.m_shape.getFirstVertex(t);const n=new u;this.m_shape.queryXY(i,n);let r=n.y===e&&!this.isCurve(i);i=this.m_shape.getNextVertex(i);const h=new u;this.m_shape.queryXY(i,h);let m=h.y===e&&!this.isCurve(i);i=this.m_shape.getNextVertex(i);const a=new u;for(let t=0,o=s-2;t<o;t++,i=this.m_shape.getNextVertex(i)){this.progress_(),this.m_shape.queryXY(i,a);const t=a.y===e;if(m&&r&&t){if((h.x-n.x)*(a.x-h.x)<=0){this.m_shape.removeVertex(this.m_shape.getPrevVertex(i),!1),h.setCoordsPoint2D(a),m=t&&!this.isCurve(i);continue}}n.setCoordsPoint2D(h),r=m,h.setCoordsPoint2D(a),m=t&&!this.isCurve(i)}}}fixPaths(){for(let n=0,r=this.m_verticesOnExtent.length;n<r;n++){const e=this.m_verticesOnExtent[n];e!==x&&this.m_shape.setPathToVertex(e,x)}const e=this.m_shape.hasCurves();let t=0,s=0;for(let n=this.m_shape.getFirstPath(this.m_geometry);n!==x;){const e=this.m_shape.getFirstVertex(n);if(e===x||n!==this.m_shape.getPathFromVertex(e)){const e=n;n=this.m_shape.getNextPath(n),this.m_shape.setFirstVertex(e,x),this.m_shape.removePathOnly(e);continue}let i=e,r=0;do{this.m_shape.setPathToVertex(i,n),r++,i=this.m_shape.getNextVertex(i)}while(i!==e);this.m_shape.setRingAreaValid(n,!1),this.m_shape.setLastVertex(n,this.m_shape.getPrevVertex(e)),this.m_shape.setPathSize(n,r),s+=r,t++,n=this.m_shape.getNextPath(n)}for(let n=0,h=this.m_verticesOnExtent.length;n<h;n++){let i=this.m_verticesOnExtent[n];if(i===x)continue;let h=this.m_shape.getPathFromVertex(i);if(h!==x)continue;h=this.m_shape.insertPath(this.m_geometry,x);let m=!1,a=0;const o=i;do{this.m_shape.setPathToVertex(i,h),a++,e&&a<=2&&(m||=this.isCurve(i)),i=this.m_shape.getNextVertex(i)}while(i!==o);if(m?0===a:a<=2){let e=this.m_shape.getUserIndex(o,this.m_verticesOnExtentIndex);r(e>=0),this.m_verticesOnExtent[e]=x;const t=this.m_shape.removeVertex(o,!1);2===a&&(e=this.m_shape.getUserIndex(t,this.m_verticesOnExtentIndex),e>=0&&(this.m_verticesOnExtent[e]=x),this.m_shape.removeVertex(t,!1));const s=h;h=this.m_shape.getNextPath(h),this.m_shape.setFirstVertex(s,x),this.m_shape.removePathOnly(s)}else this.m_shape.setClosedPath(h,!0),this.m_shape.setPathSize(h,a),this.m_shape.setFirstVertex(h,o),this.m_shape.setLastVertex(h,this.m_shape.getPrevVertex(o)),this.m_shape.setRingAreaValid(h,!1),s+=a,t++}this.m_shape.setGeometryPathCount(this.m_geometry,t),this.m_shape.setGeometryVertexCount(this.m_geometry,s);let i=0;for(let n=this.m_shape.getFirstGeometry();n!==x;n=this.m_shape.getNextGeometry(n))i+=this.m_shape.getPointCount(n);this.m_shape.setTotalPointCount(i)}dbgCheckPathFirst(){}isCurve(e){return null!==this.m_shape.getSegment(e)}compareVertices(e,t){const s=new u;this.m_shape.queryXY(e,s);const i=new u;this.m_shape.queryXY(t,i);return s.compare(i)}clipPolesOut(e,t){return this.clipPolygonOrProjectedPolyline2(e,t)}}class I{getOperatorType(){return 10004}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,i){return new V(e,t,s,i)}execute(e,t,s,i){return X(e,t,s,i)}}class V extends e{constructor(e,s,i,n){super(),this.m_progressTracker=n,this.m_index=-1,e||t(""),this.m_envelope=s,this.m_inputGeometryCursor=e,this.m_spatialRefImpl=i,this.m_tolerance=m(i,s,!1).total()}next(){let e;return(e=this.m_inputGeometryCursor.next())?(s(e),this.m_index=this.m_inputGeometryCursor.getGeometryID(),f(e,this.m_envelope,this.m_tolerance,0,this.m_progressTracker)):null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}}function X(e,t,s,i){return v(e,t,s,Number.NaN,0,i)}export{I as O,d as a,f as c};
5
+ import{G as e}from"./SimpleGeometryCursor.js";import{a as t,c as s,G as i,i as n,g as r,d as h}from"./Geometry.js";import{c as m}from"./Envelope.js";import{Envelope2D as a}from"./Envelope2D.js";import{E as o,n as x,L as p,S as c}from"./MultiPathImpl.js";import{d as l,m as _,P as u,e as g,f as y}from"./Point2D.js";function f(e,t,s,i,n){return v(e,t,null,s,i,n)}function v(e,s,o,x,p,c){const l=e.getGeometryType();if(l===i.enumPoint){const t=e.getXY();return s.contains(t)?e:e.createInstance()}if(l===i.enumEnvelope){const t=a.constructEmpty();if(e.queryEnvelope(t),t.intersect(s)){const s=e.clone();return s.setEnvelope(t),s}return e.createInstance()}if(e.isEmpty())return e;if(s.isEmpty())return e.createInstance();const _=s.clone();{const t=new a;if(e.queryLooseEnvelope(t),_.containsEnvelope(t))return e;if(!_.isIntersecting(t))return e.createInstance();0===p&&(t.intersect(_),t.inflate(Math.max(.1*t.maxDimension(),1)),t.intersect(_),_.assign(t))}let u=x;if((null!==o||Number.isNaN(u))&&(u=m(o,_,!1).total()),l===i.enumGeometryCollection){const t=e,s=e.createInstance();for(let e=0,i=t.getGeometryCount();e<i;e++){const i=t.getGeometry(e);if(i.isEmpty())continue;const n=f(i,_,u,p,c);n.isEmpty()||(n===i?s.addGeometry(n.clone()):s.addGeometry(n))}return s}n(l)||t("Clip: geometry not supported");const g=e.getImpl().getAccelerators();if(null!==g){const e=g.getRasterizedGeometry();r(null===e)}switch(l){case i.enumMultiPoint:{const t=e;let s;const i=t.getPointCount(),n=t.getImpl().getAttributeStreamRef(0);let h=0;for(let e=0;e<i;e++){const i=n.readPoint2D(2*e);_.contains(i)||(0===h&&(s=t.createInstance()),h<e&&s.addPoints(t,h,e),h=e+1)}return h>0&&s.addPoints(t,h,i),0===h?t:(r(null!==s),s)}case i.enumPolygon:case i.enumPolyline:return P(e,_,u,p,c);default:h("")}}function d(e,t,s,i,n,r){const h=new E(t,r),m=new a;return e.queryLooseEnvelope(m),t.containsEnvelope(m)?e:t.isIntersecting(m)?h.clipPolesOut(e,n):e.createInstance()}function P(e,t,s,i,n){return new E(t,n).clipMultiPath2(e,s,i)}class E{constructor(e,t){this.m_shape=new o,this.m_geometry=x,this.m_verticesOnExtentIndex=-1,this.m_verticesOnExtent=[],this.m_progressCounter=0,this.m_extent=new a(e),this.m_progressTracker=t}progress_(){}clipMultiPath2(e,t,s){return e.getGeometryType()===i.enumPolygon?this.clipPolygonOrProjectedPolyline2(e,s):this.clipPolyline(e,t)}clipPolygonOrProjectedPolyline2(e,t){const s=e.getGeometryType()===i.enumPolyline;if(0===this.m_extent.width()||0===this.m_extent.height())return e.createInstance();const n=a.constructEmpty();e.queryLooseEnvelope(n),this.m_geometry=s?this.m_shape.addGeometry(e):this.m_shape.addGeometry(e,this.m_extent);const h=a.constructEmpty(),m=a.constructEmpty(),o=new u,c=new u,g=l(9,Number.NaN),y=l(9,Number.NaN),f=_(u,9);let v=null;const d=new p,P=[];let I=!1;for(let i=0;!I&&i<4;i++){let e=!1;const t=!!(1&i);let a=0;switch(i){case 0:a=this.m_extent.xmin,e=n.xmin<=a&&n.xmax>=a;break;case 1:a=this.m_extent.ymin,e=n.ymin<=a&&n.ymax>=a;break;case 2:a=this.m_extent.xmax,e=n.xmin<=a&&n.xmax>=a;break;case 3:a=this.m_extent.ymax,e=n.ymin<=a&&n.ymax>=a}if(e){I=!0;for(let e=this.m_shape.getFirstPath(this.m_geometry);e!==x;){let n=!0,p=-1,l=-1;const _=this.m_shape.getFirstVertex(e);let u=_;do{this.progress_(),v=this.m_shape.getSegment(u);let e=v;if(null===e){const t=this.m_shape.getNextVertex(u);if(t===x){r(s),0===p&&P.push(u);break}this.m_shape.queryXY(u,o),d.setStartXY(o),this.m_shape.queryXY(t,c),d.setEndXY(c),e=d}e.queryLooseEnvelope(h);let _=E.checkSegmentIntersection(h,i,a);e.isCurve()&&0===_&&e.isCurve()&&(d.setStartXY(e.getStartXY()),d.setEndXY(e.getEndXY()),this.m_shape.replaceCurveWithLine(u),e=d,d.queryEnvelope(h),_=E.checkSegmentIntersection(h,i,a));let V=0,X=x;if(-1===_){const s=e.intersectionWithAxis2D(t,a,g,y);if(s>0){let i=null;if(e.isCurve()){i=f,r(s<=9);for(let e=0;e<s;e++)t?f[e].setCoords(g[e],a):f[e].setCoords(a,g[e]);V=this.m_shape.splitSegmentAxisAware(u,y,s,i,t?1:0)}else V=this.m_shape.splitSegmentAxisAware(u,y,s,null,-1)}else V=0;V+=1;let h=u,x=this.m_shape.getNextVertex(h);e=null;for(let e=0;e<V;e++){this.m_shape.queryXY(h,o),this.m_shape.queryXY(x,c),v=this.m_shape.getSegment(h);let e=v;null===e&&(d.setStartXY(o),d.setEndXY(c),e=d),e.queryEnvelope(m);let s=E.checkSegmentIntersection(m,i,a);if(e.isCurve()&&0===s&&(this.m_shape.replaceCurveWithLine(h),d.setStartXY(o),d.setEndXY(c),e=d,e.queryEnvelope(m),s=E.checkSegmentIntersection(m,i,a)),-1===s){if(t){Math.abs(o.y-a)<Math.abs(c.y-a)?(o.y=a,this.m_shape.setXY(h,o)):(c.y=a,this.m_shape.setXY(x,c))}else{Math.abs(o.x-a)<Math.abs(c.x-a)?(o.x=a,this.m_shape.setXY(h,o)):(c.x=a,this.m_shape.setXY(x,c))}v=this.m_shape.getSegment(h),e=v,null===e&&(d.setStartXY(o),d.setEndXY(c),e=d),e.queryEnvelope(m),s=E.checkSegmentIntersection(m,i,a),-1===s&&(s=E.checkSegmentIntersectionLoose(m,i,a))}const r=p;p=s,-1===l&&(l=p),0===r&&1===p||1===r&&0===p||0===r&&0===p&&P.push(h),1===p&&(I=!1,n=!1),h=x,X=h,x=this.m_shape.getNextVertex(x)}}if(0===V){const e=p;p=_,-1===l&&(l=p),0===e&&p>=1||e>=1&&0===p||0===e&&0===p&&P.push(u),1===p&&(I=!1,n=!1),X=this.m_shape.getNextVertex(u)}if(u=X,P.length>=256){for(let e=1,t=P.length-1;e<t;e++){const t=P[e];s?this.m_shape.snapVertexForPoleClipping(t,a):this.m_shape.removeVertex(t,!1)}P[1]=P.at(-1),P.length=2}}while(u!==_);if(!n){0!==l||!s&&0!==p&&2!==p||P.push(_);for(let e=0,t=P.length;e<t;e++){const t=P[e];s?this.m_shape.snapVertexForPoleClipping(t,a):this.m_shape.removeVertex(t,!1)}}P.length=0,e=n||0===this.m_shape.getPathSize(e)?this.m_shape.removePath(e):this.m_shape.getNextPath(e)}}}if(I)return e.createInstance();v=null,s?this.removeSpikesAlongPoles():this.resolveBoundaryOverlaps(),t>0&&this.densifyAlongClipExtent(t);const V=this.m_shape.getGeometry(this.m_geometry);if(V.getGeometryType()===i.enumPolygon){V.setFillRule(e.getFillRule())}return V}clipPolyline(e,t){const s=a.constructEmpty(),i=a.constructEmpty(),n=l(9,Number.NaN),r=l(9,Number.NaN),h=new c;let m=e;const o=a.constructEmpty();e.queryLooseEnvelope(o);for(let a=0;a<4;a++){let t=!1;const x=!!(1&a);let p=0;switch(a){case 0:p=this.m_extent.xmin,t=o.xmin<=p&&o.xmax>=p;break;case 1:p=this.m_extent.ymin,t=o.ymin<=p&&o.ymax>=p;break;case 2:p=this.m_extent.xmax,t=o.xmin<=p&&o.xmax>=p;break;case 3:p=this.m_extent.ymax,t=o.ymin<=p&&o.ymax>=p}if(!t)continue;const c=m;m=e.createInstance();const l=c.getImpl().querySegmentIterator();l.resetToFirstPath();const _=new u,g=new u;for(;l.nextPath();){let e=-1,t=!0;for(;l.hasNextSegment();){this.progress_();const o=l.nextSegment(),c=o.isDegenerate(0);o.queryLooseEnvelope(s);const u=E.checkSegmentIntersection(s,a,p);if(-1===u){const s=o.intersectionWithAxis2D(x,p,n,r);let l=0;_.assign(o.getStartXY());for(let u=0;u<=s;u++){const y=u<s?r[u]:1;if(l===y)continue;o.queryCut(l,y,h,!1);const f=h.get();let v=!1;if(f.getStartXY().equals(_)||(f.setStartXY(_),v=!0),u<s&&(x?(g.x=n[u],g.y=p):(g.x=p,g.y=n[u]),f.getEndXY().equals(g)||(f.setEndXY(g),v=!0)),v&&f.normalizeAfterEndpointChange(),!c&&f.isDegenerate(0))continue;f.queryEnvelope(i);let d=E.checkSegmentIntersection(i,a,p);if(-1===d){const e=f.getStartXY(),t=f.getEndXY();if(v=!1,x){Math.abs(e.y-p)<Math.abs(t.y-p)?(e.y=p,f.setStartXY(e),e.equals(f.getStartXY())||(f.setStartXY(e),v=!0)):(t.y=p,t.equals(f.getEndXY())||(f.setEndXY(t),v=!0))}else{Math.abs(e.x-p)<Math.abs(t.x-p)?(e.x=p,e.equals(f.getStartXY())||(f.setStartXY(e),v=!0)):(t.x=p,t.equals(f.getEndXY())||(f.setEndXY(t),v=!0))}v&&f.normalizeAfterEndpointChange(),f.queryEnvelope(i),d=E.checkSegmentIntersection(i,a,p),-1===d&&(d=E.checkSegmentIntersectionLoose(i,a,p))}_.assign(f.getEndXY()),l=y,e=d,e>=1?(m.addSegment(f,t),t=!1):t=!0}}else e=u,e>=1?(m.addSegment(o,t),t=!1):t=!0}}}return m}static checkSegmentIntersection(e,t,s){switch(t){case 0:return e.xmin<s&&e.xmax<=s?0:e.xmin>=s?e.xmax===s?2:1:-1;case 1:return e.ymin<s&&e.ymax<=s?0:e.ymin>=s?e.ymax===s?2:1:-1;case 2:return e.xmin>=s&&e.xmax>s?0:e.xmax<=s?e.xmin===s?2:1:-1;case 3:return e.ymin>=s&&e.ymax>s?0:e.ymax<=s?e.ymin===s?2:1:-1}return h(""),0}static checkSegmentIntersectionLoose(e,t,s){switch(t){case 0:{const t=Math.abs(e.xmin-s),i=Math.abs(e.xmax-s);return e.xmin<s?t>i?0:1:(h(""),1)}case 1:{const t=Math.abs(e.ymin-s),i=Math.abs(e.ymax-s);return e.ymin<s?t>i?0:1:(h(""),1)}case 2:{const t=Math.abs(e.xmin-s),i=Math.abs(e.xmax-s);return e.xmax>s?t<i?0:1:(h(""),1)}case 3:{const t=Math.abs(e.ymin-s),i=Math.abs(e.ymax-s);return e.ymax>s?t<i?0:1:(h(""),1)}}return h(""),0}resolveBoundaryOverlaps(){this.m_verticesOnExtentIndex=-1,this.splitSegments(!1,this.m_extent.xmin),this.splitSegments(!1,this.m_extent.xmax),this.splitSegments(!0,this.m_extent.ymin),this.splitSegments(!0,this.m_extent.ymax),this.m_verticesOnExtent.length=0,this.m_verticesOnExtentIndex=this.m_shape.createUserIndex();const e=new u;for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==x;t=this.m_shape.getNextPath(t)){let s=this.m_shape.getFirstVertex(t);for(let i=0,n=this.m_shape.getPathSize(t);i<n;i++,s=this.m_shape.getNextVertex(s))this.progress_(),this.m_shape.queryXY(s,e),this.m_extent.xmin!==e.x&&this.m_extent.xmax!==e.x&&this.m_extent.ymin!==e.y&&this.m_extent.ymax!==e.y||(this.m_shape.setUserIndex(s,this.m_verticesOnExtentIndex,this.m_verticesOnExtent.length),this.m_verticesOnExtent.push(s))}this.dbgCheckPathFirst(),this.resolveOverlaps(!1,this.m_extent.xmin),this.dbgCheckPathFirst(),this.resolveOverlaps(!1,this.m_extent.xmax),this.dbgCheckPathFirst(),this.resolveOverlaps(!0,this.m_extent.ymin),this.dbgCheckPathFirst(),this.resolveOverlaps(!0,this.m_extent.ymax),this.fixPaths()}densifyAlongClipExtent(e){const t=new u(0,0),s=new u(0,0),i=l(2048,Number.NaN);for(let n=this.m_shape.getFirstPath(this.m_geometry);n!==x;n=this.m_shape.getNextPath(n)){const m=this.m_shape.getFirstVertex(n);let a=m;do{const n=this.m_shape.getNextVertex(a);this.m_shape.queryXY(a,t);let m=-1;if(t.x===this.m_extent.xmin?(this.m_shape.queryXY(n,s),s.x===this.m_extent.xmin&&(m=1)):t.x===this.m_extent.xmax&&(this.m_shape.queryXY(n,s),s.x===this.m_extent.xmax&&(m=1)),t.y===this.m_extent.ymin?(this.m_shape.queryXY(n,s),s.y===this.m_extent.ymin&&(m=0)):t.y===this.m_extent.ymax&&(this.m_shape.queryXY(n,s),s.y===this.m_extent.ymax&&(m=0)),-1===m){a=n;continue}if(this.isCurve(a)){a=n;continue}const o=t.clone(),x=new u(0,0);if(m){const i=t.y-this.m_extent.ymin;x.y=g(s.y-t.y),o.y=e*y(Math.floor(Math.abs(i)/e),i)+this.m_extent.ymin,x.y<0&&(o.y+=e)}else{const i=t.x-this.m_extent.xmin;x.x=g(s.x-t.x),o.x=e*y(Math.floor(Math.abs(i)/e),i)+this.m_extent.xmin,x.x<0&&(o.x+=e)}const p=m?s.y-t.y:s.x-t.x,c=Math.abs(p);if(c/e>65536&&h(""),c>0){const s=Math.trunc(c/e)+2;i.length<s&&(i.length=s);let n=0;for(let h=0;;h++){const s=o.add(x.mul(h*e)),a=(m?s.y-t.y:s.x-t.x)/p;if(a>=1)break;a<=0||(r(n<=i.length),i[n]=a,n++)}0!==n&&this.m_shape.splitSegment(a,i,n)}a=n}while(a!==m)}}splitSegments(e,t){let s=-1;const i=new u,n=[];for(let _=this.m_shape.getFirstPath(this.m_geometry);_!==x;_=this.m_shape.getNextPath(_)){let r=this.m_shape.getFirstVertex(_),h=x;for(let m=0,a=this.m_shape.getPathSize(_);m<a;m++,r=h)if(this.progress_(),h=this.m_shape.getNextVertex(r),this.m_shape.queryXY(r,i),(e?i.y===t:i.x===t)&&(this.m_shape.queryXY(h,i),e?i.y===t:i.x===t)){if(this.isCurve(r))continue;-1===s&&(s=this.m_shape.createUserIndex()),1!==this.m_shape.getUserIndex(r,s)&&(n.push(r),this.m_shape.setUserIndex(r,s,1)),1!==this.m_shape.getUserIndex(h,s)&&(n.push(h),this.m_shape.setUserIndex(h,s,1))}}if(-1!==s&&this.m_shape.removeUserIndex(s),n.length<3)return;n.sort(((e,t)=>this.compareVertices(e,t)));const r=new u,h=new u,m=new u;h.setNAN();let a=-1;let o=[],p=[];const c=this.m_shape.createUserIndex(),l=this.m_shape.createUserIndex();for(let x=0,_=n.length;x<_;x++){const s=n[x];if(this.m_shape.queryXY(s,i),!i.isEqualPoint2D(h)){if(-1===a){a=x,h.setCoordsPoint2D(i);continue}for(let i=a;i<x;i++){const s=n[i],m=this.m_shape.getNextVertex(s),a=this.m_shape.getPrevVertex(s);let x=!1;this.m_shape.queryXY(m,r),h.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(s)||(o.push(s),x=!0,this.m_shape.setUserIndex(s,l,1))),this.m_shape.queryXY(a,r),h.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(a)||(x||o.push(s),this.m_shape.setUserIndex(s,c,1)))}for(let e=0,t=o.length;e<t;e++){const t=o[e],s=this.m_shape.getUserIndex(t,c),n=this.m_shape.getUserIndex(t,l);if(1===s){const e=this.m_shape.getPrevVertex(t);this.m_shape.queryXY(e,m);let s=0;if(!m.isEqualPoint2D(i)){const n=u.distance(h,m);s=u.distance(m,i)/n,0===s?s=Number.EPSILON:1===s&&(s=1-Number.EPSILON),this.m_shape.splitSegment(e,[s],1);const r=this.m_shape.getPrevVertex(t);this.m_shape.setXY(r,i),p.push(r),this.m_shape.setUserIndex(r,c,1),this.m_shape.setUserIndex(r,l,-1)}}if(1===n){const e=this.m_shape.getNextVertex(t);this.m_shape.queryXY(e,m);let s=0;if(!m.isEqualPoint2D(i)){const e=u.distance(h,m);s=u.distance(h,i)/e,0===s?s=Number.EPSILON:1===s&&(s=1-Number.EPSILON),this.m_shape.splitSegment(t,[s],1);const n=this.m_shape.getNextVertex(t);this.m_shape.setXY(n,i),p.push(n),this.m_shape.setUserIndex(n,c,-1),this.m_shape.setUserIndex(n,l,1)}}}const s=o;o=p,p=s,p.length=0,a=x,h.setCoordsPoint2D(i)}}this.m_shape.removeUserIndex(c),this.m_shape.removeUserIndex(l)}resolveOverlaps(e,t){const s=new u,i=[];let n=-1;for(let r=0,o=this.m_verticesOnExtent.length;r<o;r++){this.progress_();const h=this.m_verticesOnExtent[r];if(h===x)continue;const m=this.m_shape.getNextVertex(h);if(this.m_shape.queryXY(h,s),(e?s.y===t:s.x===t)&&(this.m_shape.queryXY(m,s),e?s.y===t:s.x===t)){if(this.isCurve(h))continue;-1===n&&(n=this.m_shape.createUserIndex()),-2!==this.m_shape.getUserIndex(h,n)&&(i.push(h),this.m_shape.setUserIndex(h,n,-2)),-2!==this.m_shape.getUserIndex(m,n)&&(i.push(m),this.m_shape.setUserIndex(m,n,-2))}}if(0===i.length)return void(-1!==n&&this.m_shape.removeUserIndex(n));r(-1!==n),i.sort(((e,t)=>this.compareVertices(e,t)));for(let r=0,o=i.length;r<o;r++){const e=i[r];this.m_shape.setUserIndex(e,n,r)}const h=new u,m=new u;m.setNAN();let a=-1;for(let r=0,o=i.length;r<o;r++){this.progress_();const o=i[r];if(o!==x&&(this.m_shape.queryXY(o,s),!s.isEqualPoint2D(m))){if(-1!==a)for(;;){let s=!1;const o=r;for(let p=a;p<o;p++){const a=i[p];if(a===x)continue;let o=x;const c=this.m_shape.getNextVertex(a);this.m_shape.queryXY(c,h),m.compare(h)<0&&(e?h.y===t:h.x===t)&&(this.isCurve(a)||(o=c));let l=x;const _=this.m_shape.getPrevVertex(a);if(this.m_shape.queryXY(_,h),m.compare(h)<0&&(e?h.y===t:h.x===t)&&(this.isCurve(_)||(l=_)),o===x||l===x){if(o!==x||l!==x){for(let c=p+1;c<r;c++){const r=i[c];if(r===x)continue;const p=this.m_shape.getNextVertex(r);let _=x;this.m_shape.queryXY(p,h),m.compare(h)<0&&(e?h.y===t:h.x===t)&&(this.isCurve(r)||(_=p));const u=this.m_shape.getPrevVertex(r);let g=x;if(this.m_shape.queryXY(u,h),m.compare(h)<0&&(e?h.y===t:h.x===t)&&(this.isCurve(u)||(g=u)),_!==x&&g!==x){this.beforeRemoveVertex(r,i,n),this.m_shape.removeVertex(r,!1),this.beforeRemoveVertex(_,i,n),this.m_shape.removeVertex(_,!1),s=!0;break}if(o!==x&&g!==x){this.removeOverlap(i,a,o,r,g,n),s=!0;break}if(l!==x&&_!==x){this.removeOverlap(i,r,_,a,l,n),s=!0;break}}if(s)break}}else this.beforeRemoveVertex(a,i,n),this.m_shape.removeVertex(a,!1),this.beforeRemoveVertex(o,i,n),this.m_shape.removeVertex(o,!1),s=!0}if(!s)break}a=r,m.setCoordsPoint2D(s)}}this.m_shape.removeUserIndex(n)}beforeRemoveVertex(e,t,s){let i=this.m_shape.getUserIndex(e,s);r(i>=0),t[i]=x,i=this.m_shape.getUserIndex(e,this.m_verticesOnExtentIndex),r(i>=0),this.m_verticesOnExtent[i]=x;const n=this.m_shape.getPathFromVertex(e);if(n!==x){this.m_shape.getFirstVertex(n)===e&&(this.m_shape.setFirstVertex(n,x),this.m_shape.setLastVertex(n,x))}}removeOverlap(e,t,s,i,n,r){this.m_shape.setNextVertex(t,i),this.m_shape.setPrevVertex(i,t),this.m_shape.setPrevVertex(s,n),this.m_shape.setNextVertex(n,s),this.beforeRemoveVertex(i,e,r),this.m_shape.removeVertexInternal(i,!1),this.beforeRemoveVertex(n,e,r),this.m_shape.removeVertexInternal(n,!0)}removeSpikesAlongPoles(){this.removeSpikesOnPole(this.m_extent.ymin),this.removeSpikesOnPole(this.m_extent.ymax)}removeSpikesOnPole(e){for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==x;t=this.m_shape.getNextPath(t)){const s=this.m_shape.getPathSize(t);if(s<3)continue;let i=this.m_shape.getFirstVertex(t);const n=new u;this.m_shape.queryXY(i,n);let r=n.y===e&&!this.isCurve(i);i=this.m_shape.getNextVertex(i);const h=new u;this.m_shape.queryXY(i,h);let m=h.y===e&&!this.isCurve(i);i=this.m_shape.getNextVertex(i);const a=new u;for(let t=0,o=s-2;t<o;t++,i=this.m_shape.getNextVertex(i)){this.progress_(),this.m_shape.queryXY(i,a);const t=a.y===e;if(m&&r&&t){if((h.x-n.x)*(a.x-h.x)<=0){this.m_shape.removeVertex(this.m_shape.getPrevVertex(i),!1),h.setCoordsPoint2D(a),m=t&&!this.isCurve(i);continue}}n.setCoordsPoint2D(h),r=m,h.setCoordsPoint2D(a),m=t&&!this.isCurve(i)}}}fixPaths(){for(let n=0,r=this.m_verticesOnExtent.length;n<r;n++){const e=this.m_verticesOnExtent[n];e!==x&&this.m_shape.setPathToVertex(e,x)}const e=this.m_shape.hasCurves();let t=0,s=0;for(let n=this.m_shape.getFirstPath(this.m_geometry);n!==x;){const e=this.m_shape.getFirstVertex(n);if(e===x||n!==this.m_shape.getPathFromVertex(e)){const e=n;n=this.m_shape.getNextPath(n),this.m_shape.setFirstVertex(e,x),this.m_shape.removePathOnly(e);continue}let i=e,r=0;do{this.m_shape.setPathToVertex(i,n),r++,i=this.m_shape.getNextVertex(i)}while(i!==e);this.m_shape.setRingAreaValid(n,!1),this.m_shape.setLastVertex(n,this.m_shape.getPrevVertex(e)),this.m_shape.setPathSize(n,r),s+=r,t++,n=this.m_shape.getNextPath(n)}for(let n=0,h=this.m_verticesOnExtent.length;n<h;n++){let i=this.m_verticesOnExtent[n];if(i===x)continue;let h=this.m_shape.getPathFromVertex(i);if(h!==x)continue;h=this.m_shape.insertPath(this.m_geometry,x);let m=!1,a=0;const o=i;do{this.m_shape.setPathToVertex(i,h),a++,e&&a<=2&&(m||=this.isCurve(i)),i=this.m_shape.getNextVertex(i)}while(i!==o);if(m?0===a:a<=2){let e=this.m_shape.getUserIndex(o,this.m_verticesOnExtentIndex);r(e>=0),this.m_verticesOnExtent[e]=x;const t=this.m_shape.removeVertex(o,!1);2===a&&(e=this.m_shape.getUserIndex(t,this.m_verticesOnExtentIndex),e>=0&&(this.m_verticesOnExtent[e]=x),this.m_shape.removeVertex(t,!1));const s=h;h=this.m_shape.getNextPath(h),this.m_shape.setFirstVertex(s,x),this.m_shape.removePathOnly(s)}else this.m_shape.setClosedPath(h,!0),this.m_shape.setPathSize(h,a),this.m_shape.setFirstVertex(h,o),this.m_shape.setLastVertex(h,this.m_shape.getPrevVertex(o)),this.m_shape.setRingAreaValid(h,!1),s+=a,t++}this.m_shape.setGeometryPathCount(this.m_geometry,t),this.m_shape.setGeometryVertexCount(this.m_geometry,s);let i=0;for(let n=this.m_shape.getFirstGeometry();n!==x;n=this.m_shape.getNextGeometry(n))i+=this.m_shape.getPointCount(n);this.m_shape.setTotalPointCount(i)}dbgCheckPathFirst(){}isCurve(e){return null!==this.m_shape.getSegment(e)}compareVertices(e,t){const s=new u;this.m_shape.queryXY(e,s);const i=new u;this.m_shape.queryXY(t,i);return s.compare(i)}clipPolesOut(e,t){return this.clipPolygonOrProjectedPolyline2(e,t)}}class I{getOperatorType(){return 10004}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,i){return new V(e,t,s,i)}execute(e,t,s,i){return X(e,t,s,i)}}class V extends e{constructor(e,s,i,n){super(),this.m_progressTracker=n,this.m_index=-1,e||t(""),this.m_envelope=s,this.m_inputGeometryCursor=e,this.m_spatialRefImpl=i,this.m_tolerance=m(i,s,!1).total()}next(){let e;return(e=this.m_inputGeometryCursor.next())?(s(e),this.m_index=this.m_inputGeometryCursor.getGeometryID(),f(e,this.m_envelope,this.m_tolerance,0,this.m_progressTracker)):null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}}function X(e,t,s,i){return v(e,t,s,Number.NaN,0,i)}export{I as O,d as a,f as c};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{G as t}from"./SimpleGeometryCursor.js";import{G as e,d as s,g as n}from"./Geometry.js";import{P as r,a as o,E as m,n as i}from"./QuadraticBezier.js";import{g as u,c}from"./Envelope.js";import{l as a,m as h,n as l,T as d,o as y,C as p}from"./ProjectionTransformation.js";var _=p;function g(t,e){return{m_geometry:t,m_side:e}}function f(t,e,s,n,r,o){if(e.isEmpty()){const t=g(e,0);return void r.push(t)}if(s.isEmpty()){const t=g(e,0);return void r.push(t)}const i=[],u=new m;{const m=u.createGeometryUserIndex(),c=u.addGeometry(e),p=u.addGeometry(s),f=new d(o);let C=0,E=null;if(u.hasCurves()){E=new _;const t=u.getEnvelope2D(o);C=a(n.total());const e=h(n.total(),t);l(u,e,n.total(),12e3,E,null,o)}u.dbgVerifyCurves(),f.setEditShapeCrackAndCluster(u,n),f.cut(t,m,c,p,i);for(const t of i){null!==E&&E.stitchCurves(u,t,C,!1);const e=g(u.getGeometry(t),y(u.getGeometryUserIndex(t,m)));r.push(e)}null!==E&&E.clearStitcher(u)}}function C(t,e,s,n,r,u){if(e.isEmpty()){const t=g(e,0);return void r.push(t)}if(s.isEmpty()){const t=g(e,0);return void r.push(t)}const c=[],y=new m;{const t=y.createGeometryUserIndex(),p=y.addGeometry(e),f=y.addGeometry(s),C=new d(u);let E=0,G=null;if(y.hasCurves()){G=new _;const t=y.getEnvelope2D(u);E=a(n.total());const e=h(n.total(),t);l(y,e,n.total(),12e3,G,null,u)}y.dbgVerifyCurves(),C.setEditShapeCrackAndCluster(y,n),C.cut(!1,t,p,f,c),null!==G&&G.stitchCurves(y,i,E,!0);let v=y.getGeometry(p);const w=new o,x=new o,k=[];for(let e=0;e<c.length;e++){let s=null;{const r=new m,o=r.addGeometry(v),d=r.addGeometry(y.getGeometry(c[e]));if(r.hasCurves()){const t=r.getEnvelope2D(u);E=a(n.total());const e=h(n.total(),t);l(r,e,n.total(),12e3,G,null,u)}C.setEditShapeCrackAndCluster(r,n);const p=C.intersection(o,d);if(null!==G&&G.stitchCurves(r,i,E,!0),s=r.getGeometry(p),s.isEmpty())continue;const _=y.getGeometryUserIndex(c[e],t);2===_?w.add(s,!1):1===_?x.add(s,!1):k.push(s)}{const t=new m,s=t.addGeometry(v),r=t.addGeometry(y.getGeometry(c[e]));if(t.hasCurves()){const e=t.getEnvelope2D(u);E=a(n.total());const s=h(n.total(),e);l(t,s,n.total(),12e3,G,null,u)}C.setEditShapeCrackAndCluster(t,n);const o=C.difference(s,r);null!==G&&G.stitchCurves(t,i,E,!0);v=t.getGeometry(o)}}if(!v.isEmpty()&&c.length>0&&k.push(v),w.isEmpty()&&x.isEmpty())return;if(!w.isEmpty()){const t=g(w,1);r.push(t)}if(!x.isEmpty()){const t=g(x,2);r.push(t)}for(let e=0,s=k.length;e<s;++e){const t=g(k[e],3);r.push(t)}}}class E{getOperatorType(){return 10005}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}execute(t,e,s,n,r){return new G(t,e,s,n,r)}}class G extends t{constructor(t,e,s,n,o){super(),this.m_cutIndex=-1,this.m_cuts=[],this.m_progressTracker=o,this.m_cuttee=e.clone(),this.m_cutter=new r({copy:s}),this.m_bConsiderTouch=t;const m=u(e,s);this.m_tolerance=c(n,m,!0)}next(){return-1===this.m_cutIndex&&this.generateCuts(),++this.m_cutIndex<this.m_cuts.length?this.m_cuts[this.m_cutIndex]:null}getGeometryID(){return this.m_cutIndex}tock(){return!0}getRank(){return 1}generateCuts(){switch(this.m_cuttee.getGeometryType()){case e.enumPolyline:this.generatePolylineCuts();break;case e.enumPolygon:this.generatePolygonCuts()}}generatePolylineCuts(){const t=new r,e=new r,n=new r;this.m_cuts.length=0,this.m_cuts.push(t),this.m_cuts.push(e);const o=[];f(this.m_bConsiderTouch,this.m_cuttee,this.m_cutter,this.m_tolerance,o,this.m_progressTracker);for(let r=0;r<o.length;r++){const m=o[r];1===m.m_side?t.add(m.m_geometry,!1):2===m.m_side||4===m.m_side?e.add(m.m_geometry,!1):3===m.m_side?this.m_cuts.push(m.m_geometry):0===m.m_side?n.add(m.m_geometry,!1):s("")}n.isEmpty()||t.isEmpty()&&e.isEmpty()&&!(this.m_cuts.length>=3)||this.m_cuts.push(n),t.isEmpty()&&e.isEmpty()&&this.m_cuts.length<3&&(this.m_cuts.length=0)}generatePolygonCuts(){const t=new o,e=new o,r=new o;this.m_cuts.length=0,this.m_cuts.push(t),this.m_cuts.push(e);const m=[];C(this.m_bConsiderTouch,this.m_cuttee,this.m_cutter,this.m_tolerance,m,this.m_progressTracker);for(let n=0;n<m.length;n++){const o=m[n];1===o.m_side?t.add(o.m_geometry,!1):2===o.m_side?e.add(o.m_geometry,!1):3===o.m_side?this.m_cuts.push(o.m_geometry):0===o.m_side?r.add(o.m_geometry,!1):s("")}n(r.isEmpty()||1===m.length),t.isEmpty()&&e.isEmpty()&&this.m_cuts.length<3&&(this.m_cuts.length=0)}}export{E as O};
5
+ import{G as t}from"./SimpleGeometryCursor.js";import{G as e,d as s,g as n}from"./Geometry.js";import{P as r,a as o,E as m,n as i}from"./MultiPathImpl.js";import{g as u,c}from"./Envelope.js";import{l,m as h,n as a,T as d,o as p,C as y}from"./ProjectionTransformation.js";var _=y;function g(t,e){return{m_geometry:t,m_side:e}}function f(t,e,s,n,r,o){if(e.isEmpty()){const t=g(e,0);return void r.push(t)}if(s.isEmpty()){const t=g(e,0);return void r.push(t)}const i=[],u=new m;{const m=u.createGeometryUserIndex(),c=u.addGeometry(e),y=u.addGeometry(s),f=new d(o);let C=0,E=null;if(u.hasCurves()){E=new _;const t=u.getEnvelope2D(o);C=l(n.total());const e=h(n.total(),t);a(u,e,n.total(),12e3,E,null,o)}u.dbgVerifyCurves(),f.setEditShapeCrackAndCluster(u,n),f.cut(t,m,c,y,i);for(const t of i){null!==E&&E.stitchCurves(u,t,C,!1);const e=g(u.getGeometry(t),p(u.getGeometryUserIndex(t,m)));r.push(e)}null!==E&&E.clearStitcher(u)}}function C(t,e,s,n,r,u){if(e.isEmpty()){const t=g(e,0);return void r.push(t)}if(s.isEmpty()){const t=g(e,0);return void r.push(t)}const c=[],p=new m;{const t=p.createGeometryUserIndex(),y=p.addGeometry(e),f=p.addGeometry(s),C=new d(u);let E=0,G=null;if(p.hasCurves()){G=new _;const t=p.getEnvelope2D(u);E=l(n.total());const e=h(n.total(),t);a(p,e,n.total(),12e3,G,null,u)}p.dbgVerifyCurves(),C.setEditShapeCrackAndCluster(p,n),C.cut(!1,t,y,f,c),null!==G&&G.stitchCurves(p,i,E,!0);let v=p.getGeometry(y);const w=new o,x=new o,I=[];for(let e=0;e<c.length;e++){let s=null;{const r=new m,o=r.addGeometry(v),d=r.addGeometry(p.getGeometry(c[e]));if(r.hasCurves()){const t=r.getEnvelope2D(u);E=l(n.total());const e=h(n.total(),t);a(r,e,n.total(),12e3,G,null,u)}C.setEditShapeCrackAndCluster(r,n);const y=C.intersection(o,d);if(null!==G&&G.stitchCurves(r,i,E,!0),s=r.getGeometry(y),s.isEmpty())continue;const _=p.getGeometryUserIndex(c[e],t);2===_?w.add(s,!1):1===_?x.add(s,!1):I.push(s)}{const t=new m,s=t.addGeometry(v),r=t.addGeometry(p.getGeometry(c[e]));if(t.hasCurves()){const e=t.getEnvelope2D(u);E=l(n.total());const s=h(n.total(),e);a(t,s,n.total(),12e3,G,null,u)}C.setEditShapeCrackAndCluster(t,n);const o=C.difference(s,r);null!==G&&G.stitchCurves(t,i,E,!0);v=t.getGeometry(o)}}if(!v.isEmpty()&&c.length>0&&I.push(v),w.isEmpty()&&x.isEmpty())return;if(!w.isEmpty()){const t=g(w,1);r.push(t)}if(!x.isEmpty()){const t=g(x,2);r.push(t)}for(let e=0,s=I.length;e<s;++e){const t=g(I[e],3);r.push(t)}}}class E{getOperatorType(){return 10005}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}execute(t,e,s,n,r){return new G(t,e,s,n,r)}}class G extends t{constructor(t,e,s,n,o){super(),this.m_cutIndex=-1,this.m_cuts=[],this.m_progressTracker=o,this.m_cuttee=e.clone(),this.m_cutter=new r({copy:s}),this.m_bConsiderTouch=t;const m=u(e,s);this.m_tolerance=c(n,m,!0)}next(){return-1===this.m_cutIndex&&this.generateCuts(),++this.m_cutIndex<this.m_cuts.length?this.m_cuts[this.m_cutIndex]:null}getGeometryID(){return this.m_cutIndex}tock(){return!0}getRank(){return 1}generateCuts(){switch(this.m_cuttee.getGeometryType()){case e.enumPolyline:this.generatePolylineCuts();break;case e.enumPolygon:this.generatePolygonCuts()}}generatePolylineCuts(){const t=new r,e=new r,n=new r;this.m_cuts.length=0,this.m_cuts.push(t),this.m_cuts.push(e);const o=[];f(this.m_bConsiderTouch,this.m_cuttee,this.m_cutter,this.m_tolerance,o,this.m_progressTracker);for(let r=0;r<o.length;r++){const m=o[r];1===m.m_side?t.add(m.m_geometry,!1):2===m.m_side||4===m.m_side?e.add(m.m_geometry,!1):3===m.m_side?this.m_cuts.push(m.m_geometry):0===m.m_side?n.add(m.m_geometry,!1):s("")}n.isEmpty()||t.isEmpty()&&e.isEmpty()&&!(this.m_cuts.length>=3)||this.m_cuts.push(n),t.isEmpty()&&e.isEmpty()&&this.m_cuts.length<3&&(this.m_cuts.length=0)}generatePolygonCuts(){const t=new o,e=new o,r=new o;this.m_cuts.length=0,this.m_cuts.push(t),this.m_cuts.push(e);const m=[];C(this.m_bConsiderTouch,this.m_cuttee,this.m_cutter,this.m_tolerance,m,this.m_progressTracker);for(let n=0;n<m.length;n++){const o=m[n];1===o.m_side?t.add(o.m_geometry,!1):2===o.m_side?e.add(o.m_geometry,!1):3===o.m_side?this.m_cuts.push(o.m_geometry):0===o.m_side?r.add(o.m_geometry,!1):s("")}n(r.isEmpty()||1===m.length),t.isEmpty()&&e.isEmpty()&&this.m_cuts.length<3&&(this.m_cuts.length=0)}}export{E as O};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{G as e}from"./SimpleGeometryCursor.js";import{c as r}from"./Geometry.js";import{d as t,D as s}from"./QuadraticBezier.js";var n=s;class i extends e{constructor(e,r,t,s,i,o){super(),this.m_densificator=new n(r,t,s,o,!1,i),this.m_index=-1,this.m_inputGeoms=e}tock(){return!0}getRank(){return 1}next(){let e=null;for(;e=this.m_inputGeoms.next();)return r(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.densify(e);return null}getGeometryID(){return this.m_index}densify(e){return this.m_densificator.densify(e)}}class o{getOperatorType(){return 10202}accelerateGeometry(e,r,t){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}executeMany(e,r,t,s,n,o=12e3){return new i(e,r,t,s,o,n)}execute(e,r,s,n,i,o=12e3){return t(e,r,s,n,i,o)}}export{o as O};
5
+ import{G as e}from"./SimpleGeometryCursor.js";import{c as t}from"./Geometry.js";import{d as r,D as s}from"./MultiPathImpl.js";var n=s;class i extends e{constructor(e,t,r,s,i,m){super(),this.m_densificator=new n(t,r,s,m,!1,i),this.m_index=-1,this.m_inputGeoms=e}tock(){return!0}getRank(){return 1}next(){let e=null;for(;e=this.m_inputGeoms.next();)return t(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.densify(e);return null}getGeometryID(){return this.m_index}densify(e){return this.m_densificator.densify(e)}}class m{getOperatorType(){return 10202}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}executeMany(e,t,r,s,n,m=12e3){return new i(e,t,r,s,m,n)}execute(e,t,s,n,i,m=12e3){return r(e,t,s,n,i,m)}}export{m as O};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{b as t,c as e}from"./tslib.es6.js";import{G as s}from"./SimpleGeometryCursor.js";import{a as i,c as r,e as a,G as n,f as h,h as m,t as l}from"./Geometry.js";import{a as o,P as c,L as u}from"./QuadraticBezier.js";import{P as _}from"./Envelope.js";import{h as g,P as p,c as k}from"./Point2D.js";import{O as f}from"./OperatorDensify.js";class P{getOperatorType(){return 10204}supportsCurves(){return!0}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}executeMany(t,e,s,i){return new y(t,e,s,i)}execute(t,e,s,r){t||i("null param is not allowed.");return new y(null,e,s,r).generalize(t)}}class y extends s{constructor(t,e,s,i){super(),this.m_pline=null,this.m_point=new _,this.m_stack=[],this.m_resultstack=[],this.m_callCount=0,this.m_progressTracker=i,this.m_geoms=t,this.m_maxDeviation=e,this.m_bRemoveDegenerateParts=s}tock(){return!0}getRank(){return 1}next(){const t=this.m_geoms.next();return null===t?null:(r(t),this.generalize(t))}getGeometryID(){return this.m_geoms.getGeometryID()}generalize(s){const i=s.getGeometryType();if(a(i))return s;if(i===n.enumEnvelope){const t=new o({vd:s.getDescription()});return t.addEnvelope(s,!1),this.generalize(t)}if(h(i)){const t=new c({vd:s.getDescription()});return t.addSegment(s,!0),this.generalize(t)}if(m(i)||l(""),s.isEmpty()||this.m_maxDeviation<=0)return s;const r=(new f).execute(s,0,.05*this.m_maxDeviation,0,this.m_progressTracker);s.hasNonLinearSegments()&&(this.m_maxDeviation*=.95);const _=r,p=s.createInstance();if(p.getGeometryType()===n.enumPolygon){p.setFillRule(s.getFillRule())}this.m_xy=_.getAttributeStreamRef(0);{const s={stack:[],error:void 0,hasError:!1};try{const e=new u;this.m_pline=e,t(s,g((()=>{this.m_pline=null}),!1),!1);for(let t=0,s=_.getPathCount();t<s;t++)this.generalizePath(_.getImpl(),t,p.getImpl())}catch(k){s.error=k,s.hasError=!0}finally{e(s)}}return this.m_resultstack.length=0,this.m_stack.length=0,p}generalizePath(t,e,s){if(t.getPathSize(e)<2)return;this.m_resultstack.length=0,this.m_stack.length=0;const i=t.getPathStart(e),r=t.getPathEnd(e)-1,a=t.isClosedPath(e),n=t.isClosedPathInXYPlane(e);let h=0,m=-1;this.m_stack.push(a?i:r),this.m_stack.push(i);let l=!1,o=!1;for(!this.m_bRemoveDegenerateParts&&n&&(l=!0,o=!0);this.m_stack.length>1;){const e=this.m_stack.at(-1);this.m_stack.pop();const s=this.m_stack.at(-1);let i=t.getXY(e);this.m_pline.setStartXY(i),i=t.getXY(s),this.m_pline.setEndXY(i);const a=[Number.NaN];let n=this.findGreatestDistance(e,s,r,a);n>=0&&(l?l=!1:(o&&a[0]>h&&(h=a[0],m=n),a[0]<=this.m_maxDeviation&&(n=-1))),n>=0?(this.m_stack.push(n),this.m_stack.push(e)):this.m_resultstack.push(e)}a||this.m_resultstack.push(this.m_stack[0]);const c=this.m_resultstack.length;if(c===t.getPathSize(e)&&c===this.m_stack.length)s.addPath(t,e,!0);else if(this.m_resultstack.length>0){if(this.m_bRemoveDegenerateParts&&this.m_resultstack.length<=2){if(a||1===this.m_resultstack.length)return;if(p.distance(t.getXY(this.m_resultstack[0]),t.getXY(this.m_resultstack[1]))<=this.m_maxDeviation)return}if(o&&m>=0&&h<=this.m_maxDeviation){const t=this.m_resultstack.at(-1)>m;this.m_resultstack.push(m),t&&(this.m_resultstack[this.m_resultstack.length-2]=k(this.m_resultstack[this.m_resultstack.length-1],this.m_resultstack[this.m_resultstack.length-1]=this.m_resultstack[this.m_resultstack.length-2]))}for(let e=0,i=this.m_resultstack.length;e<i;e++)t.getPointByVal(this.m_resultstack[e],this.m_point),0===e?s.startPathPoint(this.m_point):s.lineToPoint(this.m_point);if(a){for(let t=this.m_resultstack.length;t<3;t++)s.lineToPoint(this.m_point);s.closePathWithLine()}}}findGreatestDistance(t,e,s,i){let r=e-1;e<=t&&(r=s);let a=-1,n=0;const h=new p;for(let m=t+1;m<=r;m++){this.m_xy.queryPoint2D(2*m,h);const t=h.x,e=h.y,s=this.m_pline.getClosestCoordinate(h,!1);h.assign(this.m_pline.getCoord2D(s)),h.x-=t,h.y-=e;const i=h.length();i>n&&(a=m,n=i),this.m_callCount++}return i[0]=n,a}}export{P as O};
5
+ import{b as t,c as e}from"./tslib.es6.js";import{G as s}from"./SimpleGeometryCursor.js";import{a as i,c as r,e as a,G as n,f as h,h as m,t as l}from"./Geometry.js";import{a as o,P as c,L as u}from"./MultiPathImpl.js";import{P as _}from"./Envelope.js";import{h as g,P as p,c as k}from"./Point2D.js";import{O as f}from"./OperatorDensify.js";class P{getOperatorType(){return 10204}supportsCurves(){return!0}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}executeMany(t,e,s,i){return new y(t,e,s,i)}execute(t,e,s,r){t||i("null param is not allowed.");return new y(null,e,s,r).generalize(t)}}class y extends s{constructor(t,e,s,i){super(),this.m_pline=null,this.m_point=new _,this.m_stack=[],this.m_resultstack=[],this.m_callCount=0,this.m_progressTracker=i,this.m_geoms=t,this.m_maxDeviation=e,this.m_bRemoveDegenerateParts=s}tock(){return!0}getRank(){return 1}next(){const t=this.m_geoms.next();return null===t?null:(r(t),this.generalize(t))}getGeometryID(){return this.m_geoms.getGeometryID()}generalize(s){const i=s.getGeometryType();if(a(i))return s;if(i===n.enumEnvelope){const t=new o({vd:s.getDescription()});return t.addEnvelope(s,!1),this.generalize(t)}if(h(i)){const t=new c({vd:s.getDescription()});return t.addSegment(s,!0),this.generalize(t)}if(m(i)||l(""),s.isEmpty()||this.m_maxDeviation<=0)return s;const r=(new f).execute(s,0,.05*this.m_maxDeviation,0,this.m_progressTracker);s.hasNonLinearSegments()&&(this.m_maxDeviation*=.95);const _=r,p=s.createInstance();if(p.getGeometryType()===n.enumPolygon){p.setFillRule(s.getFillRule())}this.m_xy=_.getAttributeStreamRef(0);{const s={stack:[],error:void 0,hasError:!1};try{const e=new u;this.m_pline=e,t(s,g((()=>{this.m_pline=null}),!1),!1);for(let t=0,s=_.getPathCount();t<s;t++)this.generalizePath(_.getImpl(),t,p.getImpl())}catch(k){s.error=k,s.hasError=!0}finally{e(s)}}return this.m_resultstack.length=0,this.m_stack.length=0,p}generalizePath(t,e,s){if(t.getPathSize(e)<2)return;this.m_resultstack.length=0,this.m_stack.length=0;const i=t.getPathStart(e),r=t.getPathEnd(e)-1,a=t.isClosedPath(e),n=t.isClosedPathInXYPlane(e);let h=0,m=-1;this.m_stack.push(a?i:r),this.m_stack.push(i);let l=!1,o=!1;for(!this.m_bRemoveDegenerateParts&&n&&(l=!0,o=!0);this.m_stack.length>1;){const e=this.m_stack.at(-1);this.m_stack.pop();const s=this.m_stack.at(-1);let i=t.getXY(e);this.m_pline.setStartXY(i),i=t.getXY(s),this.m_pline.setEndXY(i);const a=[Number.NaN];let n=this.findGreatestDistance(e,s,r,a);n>=0&&(l?l=!1:(o&&a[0]>h&&(h=a[0],m=n),a[0]<=this.m_maxDeviation&&(n=-1))),n>=0?(this.m_stack.push(n),this.m_stack.push(e)):this.m_resultstack.push(e)}a||this.m_resultstack.push(this.m_stack[0]);const c=this.m_resultstack.length;if(c===t.getPathSize(e)&&c===this.m_stack.length)s.addPath(t,e,!0);else if(this.m_resultstack.length>0){if(this.m_bRemoveDegenerateParts&&this.m_resultstack.length<=2){if(a||1===this.m_resultstack.length)return;if(p.distance(t.getXY(this.m_resultstack[0]),t.getXY(this.m_resultstack[1]))<=this.m_maxDeviation)return}if(o&&m>=0&&h<=this.m_maxDeviation){const t=this.m_resultstack.at(-1)>m;this.m_resultstack.push(m),t&&(this.m_resultstack[this.m_resultstack.length-2]=k(this.m_resultstack[this.m_resultstack.length-1],this.m_resultstack[this.m_resultstack.length-1]=this.m_resultstack[this.m_resultstack.length-2]))}for(let e=0,i=this.m_resultstack.length;e<i;e++)t.getPointByVal(this.m_resultstack[e],this.m_point),0===e?s.startPathPoint(this.m_point):s.lineToPoint(this.m_point);if(a){for(let t=this.m_resultstack.length;t<3;t++)s.lineToPoint(this.m_point);s.closePathWithLine()}}}findGreatestDistance(t,e,s,i){let r=e-1;e<=t&&(r=s);let a=-1,n=0;const h=new p;for(let m=t+1;m<=r;m++){this.m_xy.queryPoint2D(2*m,h);const t=h.x,e=h.y,s=this.m_pline.getClosestCoordinate(h,!1);h.assign(this.m_pline.getCoord2D(s)),h.x-=t,h.y-=e;const i=h.length();i>n&&(a=m,n=i),this.m_callCount++}return i[0]=n,a}}export{P as O};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{S as e,G as t}from"./SimpleGeometryCursor.js";import{d as s,t as n,a as i,c as r,i as o,G as m,m as a,f as h,e as c,h as u,n as l}from"./Geometry.js";import{Envelope2D as _}from"./Envelope2D.js";import{j as f,B as d,v as g,J as p,L as P,A as x,H as b,Q as y,p as w,R as C,S as v,U as S,f as D,O as I,V as G,W as M,X as T,P as N,z as k,Y as A,Z as E,_ as q,$ as R,a0 as z,a1 as B}from"./ProjectionTransformation.js";import{b as X,c as Y}from"./tslib.es6.js";import{a as O,P as j,E as F}from"./QuadraticBezier.js";import{e as W,c as J,P as U,b as H,f as L,h as V,s as Q}from"./Envelope.js";import{T as Z}from"./Transformation2D.js";import{d as $,m as K,P as ee,S as te,o as se,p as ne}from"./Point2D.js";import{c as ie}from"./OperatorClip.js";import{c as re}from"./GeometryCleaner-BEJM7I4l.js";import{O as oe}from"./OperatorDensify.js";function me(e,t,s,n,a,h){n<Number.MAX_VALUE&&n>-Number.MAX_VALUE||i("Geodesic_bufferer.buffer - bad distance"),r(e);const c=re(e),u=c.getGeometryType();if(o(u)){const e=c.getPointCount(),i=8e6;if(Math.abs(n)>i&&(e>50||u!==m.enumMultiPoint&&4===s&&e>2)){let e=c;const r=n>0?1:-1,o=7e6;let m=n,u=1;do{u++,m=(Math.abs(m)-o)*r}while(Math.abs(m)>i);m=n;for(let n=0;n<u-1;n++)e=he(e,t,s,o*r,a,u,h),m=(Math.abs(m)-o)*r;return e=he(e,t,s,m,a,u,h),e}}return he(c,t,s,n,a,1,h)}class ae{constructor(e){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_radTolerance=0,this.m_q90=0,this.m_gcs90=0,this.m_gcs180=0,this.m_gcs360=0,this.m_gcs60=0,this.m_ellipticToGeodesicMaxRatio=0,this.m_curveType=0,this.m_bShapePreserving=!1,this.m_distance=0,this.m_absDistance=0,this.m_convergenceOffset=0,this.m_cornerStep=0,this.m_segmentStep=0,this.m_progressTracker=e}bufferPolygon(e){const t=new O,s=new we(this,e,t);return this.processGnomonicBufferPiecesCursor(!0,s)}bufferPolyline(e){const t=new we(this,e,null);return this.processGnomonicBufferPiecesCursor(!0,t)}bufferMultiPoint(e){const t=new Ce(this,e);return this.processGnomonicBufferPiecesCursor(!1,t)}bufferPoint(e){const t=e.getXY();t.scale(this.m_rpu);let s=new O;if(this.bufferPoint2D(t,!1,s)){const e=H(null,s,!0);s=w(s,e,!0,!0,-1,this.m_progressTracker,0,!1)}return s=(new x).foldInto360RangeGeodetic(s,this.m_gcs,2),s}processGnomonicBufferPiecesCursor(e,t){const s=t;let n=s.getGnomonic();const i=C(v());let r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2);const m=$(6,!1),a=K(_,6);this.initializeGrid(m,a);const h=[null,null,null,null,null,null],c=[null,null,null,null,null,null],u=[null,null,null,null,null,null];let l,d,g;for(;null!==(l=s.next());){if(d=s.getGnomonic(),d!==n){if(null!==n){let t=o.next();if(r=null,o=null,null!=t){const s=H(i,t,!0),r=W(s);t=n.unproject(t,r,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}}null!==d&&(r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2)),n=d}if(s.isRunningInGnomonic()){if(d.project(l),s.needsSimplify()){const e=H(null,l,!0);l=w(l,e,!0,!0,-1,this.m_progressTracker,0,!1)}r.tick(be(l)),o.tock()}else this.putInGridCursors(e,l,i,!0,m,a,h,c,u)}let p=!1;for(let _=0;_<6;_++)if(null!=u[_]){p=!0;break}if(p){let t=!1;const l=[null,null,null,null,null,null];if(e){const n=s.m_densified;if(s.m_densified=null,null!==n){const s=new Z;s.scale(1/this.m_rpu,1/this.m_rpu),n.applyTransformation(s),this.m_distance>0?this.putInGridCursors(e,n,i,!1,m,a,h,c,u):(this.processInGrid(e,n,!1,m,a,h,l),t=!0)}}const _=new S,d=(new f).executeMany(_,this.m_gcs,this.m_progressTracker,2);if(null!==o){let t=o.next();r=null,o=null;const s=H(i,t,!0),l=W(s);t=n.unproject(t,l,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}for(let e=0;e<6;e++)if(null!=u[e]){let s=u[e].next();u[e]=null,c[e]=null,t&&null!==l[e]&&(s=(new D).execute(l[e],s,i,this.m_progressTracker));const n=H(i,s,!0),r=W(n);s=h[e].unproject(s,r,this.m_progressTracker),s=(new I).execute(s,this.m_gcs,!0,this.m_progressTracker),_.tick(be(s)),d.tock()}g=d.next()}else{let t,m=!1;if(e){let e=s.m_densified;if(s.m_densified=null,null!==e){const s=new Z;s.scale(1/this.m_rpu,1/this.m_rpu),e.applyTransformation(s),d.project(e);const n=H(null,e,!0);e=w(e,n,!1,!0,-1,this.m_progressTracker,0,!1),this.m_distance>0?(r.tick(be(e)),o.tock()):(t=e,m=!0)}}let a=o.next();r=null,o=null,m&&(a=(new D).execute(t,a,i,this.m_progressTracker));const h=H(i,a,!0),c=W(h);g=n.unproject(a,c,this.m_progressTracker),g=(new I).execute(g,this.m_gcs,!0,this.m_progressTracker)}return g=(new x).foldInto360RangeGeodetic(g,this.m_gcs,2),g}putInGridCursors(e,t,s,n,i,r,o,m,a){const h=[null,null,null,null,null,null];this.processInGrid(e,t,n,i,r,o,h);for(let c=0;c<6;c++)null!==h[c]&&(null===m[c]&&(m[c]=new S,a[c]=(new f).executeMany(m[c],s,this.m_progressTracker,2)),m[c].tick(be(h[c])),a[c].tock())}processInGrid(e,t,s,n,i,r,o){const m=.01,a=this.insertGeodeticPointsAlongGrid(t,i,m);for(let h=0;h<6;h++){if(n[h])continue;const e=i[h].clone();e.inflateCoords(m,m);const c=L(t,e),u=J(null,c,!1).total();let l=ie(a,e,u,Number.NaN,this.m_progressTracker);if(null!==l&&!l.isEmpty()){if(l===a&&(l=l.clone()),null===r[h]){const e=new ee;h<3?e.setCoords(0,1):e.setCoords(0,-1);const t=new ee;t.setAdd(i[h].getCenter(),e),r[h]=xe(this.m_gcs,t)}r[h].project(l);const e=H(null,l,!0);l=w(l,e,s,!0,-1,this.m_progressTracker,0,!1),o[h]=l}}}insertGeodeticPointsAlongGrid(e,t,s){const n=_.construct(t[3].xmin,t[3].ymin,t[2].xmax,t[2].ymax),i=G(this.m_gcs,n,e,!0,this.m_progressTracker),r=new F,o=r.addGeometry(i);return M(r,o,this.m_gcs,0,2,!0,t[0].xmax+s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax+s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin+s),0!==s&&(M(r,o,this.m_gcs,0,2,!0,t[0].xmax-s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax-s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin-s)),r.getGeometry(o)}initializeGrid(e,t){for(let s=0;s<6;s++)e[s]=!1;t[0].setCoords({xmin:-this.m_gcs180,ymin:0,xmax:-this.m_gcs60,ymax:this.m_gcs90}),t[1].setCoords({xmin:-this.m_gcs60,ymin:0,xmax:this.m_gcs60,ymax:this.m_gcs90}),t[2].setCoords({xmin:this.m_gcs60,ymin:0,xmax:this.m_gcs180,ymax:this.m_gcs90}),t[3].setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:-this.m_gcs60,ymax:0}),t[4].setCoords({xmin:-this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs60,ymax:0}),t[5].setCoords({xmin:this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:0})}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t,s,n,i,r){const o=e[0],m=e.at(-1),a=o.y<m.y?o.y:m.y,h=o.y>m.y?o.y:m.y,c=p.q(this.m_a,this.m_eSquared,a),u=p.q(this.m_a,this.m_eSquared,h);if(this.m_q90-(c+t+this.m_absDistance)>.001&&this.m_q90+(u-t-this.m_absDistance)>.001)return!1;const l=s-se,_=n+se,f=l-Math.PI,d=l+Math.PI,g=_+Math.PI,P=[Number.NaN],x=[Number.NaN],b=[Number.NaN],y=[Number.NaN];let w=!1;if(le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,l,f,m,_,P,x),le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,g,_,o,f,b,y),(_<P[0]&&P[0]<g||_<x[0]&&x[0]<g)&&(w=!0),w||(f<b[0]&&b[0]<l||f<y[0]&&y[0]<l)&&(w=!0),!w&&i)return!1;const C=[];for(let p=e.length-1;p>=0;p--)C.push(e[p]);r.setEmpty(),r.addPathPoint2D(null,0,!0);let v=0;v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,e,l,_,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,_,g,this.m_cornerStep,i,v,r,P[0],x[0]),v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,C,g,d,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,f,l,this.m_cornerStep,i,v,r,b[0],y[0]);let S=!1;return i||(S=this.checkAndPrepForPole(r)),w||S}bufferPoint2D(e,t,s){s.setEmpty(),s.addPathPoint2D(null,0,!0);const n=0;ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,e,-this.m_cornerStep,2*Math.PI,this.m_cornerStep,t,n,s);let i=!1;return t||(i=this.checkAndPrepForPole(s)),i}checkAndPrepForPole(e){const t=this.checkAndPrepForPoleTouch(e),s=this.checkAndPrepForPoleWrap(e);return t||s}checkAndPrepForPoleTouch(e){const t=new _;return e.queryEnvelope(t),!(!T(t.ymax,this.m_gcs90)&&!T(t.ymin,-this.m_gcs90))&&(this.prepPoleTouch(e),!0)}checkAndPrepForPoleWrap(e){const t=e.getXY(0),s=e.getXY(e.getPointCount()-1);return Math.abs(t.x-s.x)>this.m_gcs180?(this.prepSinglePoleWrap(e),!0):this.checkAndPrepForDoublePoleWrap(e)}checkAndPrepForDoublePoleWrap(e){return e.calculateArea2D()<0&&(this.prepDoublePoleWrap(e),!0)}prepPoleTouch(e){const t=new O;t.insertPath2D(-1,null,0,0,!0);const s=e.getPathStart(0),n=e.getPathEnd(0),i=n-s;let r=-1;for(r=s;r<n;r++){const t=e.getXY(r),s=T(t.y,this.m_gcs90),n=T(t.y,-this.m_gcs90);if(!s&&!n)break}let o=r,m=!1,a=Number.NaN;do{const n=e.getXY(o),r=T(n.y,this.m_gcs90),h=T(n.y,-this.m_gcs90),c=s+(o+1-s)%i;if(r||h){let s=ee.construct(a,n.y);t.insertPoint2D(0,-1,s);const i=e.getXY(c),r=T(i.y,this.m_gcs90),o=T(i.y,-this.m_gcs90);r||o||(s=ee.construct(i.x,n.y),m?t.setXY(t.getPointCount()-1,s):t.insertPoint2D(0,-1,s)),m=!0}else t.insertPoint2D(0,-1,n),a=n.x,m=!1;o=c}while(o!==r);e.setEmpty(),e.add(t,!1)}prepSinglePoleWrap(e){const t=new O,s=new O,n=new Z,i=e.getXY(e.getPathStart(0)),r=e.getXY(e.getPathEnd(0)-1),o=this.m_gcs360,m=this.m_gcs180,a=new _;a.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const h=new _;e.queryEnvelope(h);const c=Math.ceil(h.width()/o);let u,l;i.x>r.x?(u=-o,l=this.m_gcs90):(u=o,l=-this.m_gcs90),n.setShiftCoords(u,0),t.addPath(e,0,!0),s.add(t,!1);const f=new U;for(let _=0;_<c;_++)s.applyTransformation(n),s.getPointByVal(0,f),t.lineToPoint(f),t.addSegmentsFromPath(s,0,0,s.getSegmentCount()-1,!1);const d=t.getXY(0),g=t.getXY(t.getPointCount()-1);d.y=l,g.y=l,t.lineTo(g);const p=new ee;for(p.setCoordsPoint2D(g),p.x-=.5*u;Math.abs(p.x-d.x)>m;)t.lineTo(p),p.x-=.5*u;t.lineTo(d);const P=a.getCenterX(),x=new _;t.queryEnvelope(x);let b=0;const y=x.getCenter().x;y-P>m?b=-Math.ceil((y-P-m)/o):P-y>m&&(b=Math.ceil((P-y-m)/o)),0!==b&&(n.setShiftCoords(b*o,0),t.applyTransformation(n));const w=new F,C=w.addGeometry(t);M(w,C,this.m_gcs,0,2,!0,a.xmin),M(w,C,this.m_gcs,0,2,!0,a.xmax);const v=w.getGeometry(C),S=L(v,a);S.inflateCoords(0,1);const D=J(null,S,!0).total(),I=ie(v,a,D,Number.NaN,this.m_progressTracker);e.setEmpty(),e.add(I,!1)}prepDoublePoleWrap(e){const t=this.m_gcs360,s=this.m_gcs180,n=new _;n.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const i=n.getCenter().x,r=new _;e.queryPathEnvelope(0,r);let o,m=0,a=r.getCenter().x;if(a-i>s?m=-Math.ceil((a-i-s)/t):i-a>s&&(m=Math.ceil((i-a-s)/t)),0!==m){const s=new Z;s.setShiftCoords(m*t,0),e.getImpl().applyTransformationToPath(s,0),e.queryPathEnvelope(0,r),a=r.getCenter().x}const h=new _;n.containsExclusiveEnvelope(r)?(o=!1,h.setCoords({env2D:n})):(o=!0,h.setCoords({env2D:n}),h.xmin-=t,h.xmax+=t);let c=e.createInstance();c.addPathPoint2D(null,0,!0);const u=new ee;if(u.setCoords(h.xmin,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(h.xmin,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymin),c.insertPoint2D(0,-1,u),o){c.addPath(e,0,!0);const s=new Z;a<i?s.setShiftCoords(t,0):s.setShiftCoords(-t,0),e.getImpl().applyTransformationToPath(s,0),c.addPath(e,0,!0);const r=new F,o=r.addGeometry(c);M(r,o,this.m_gcs,0,2,!0,n.xmin),M(r,o,this.m_gcs,0,2,!0,n.xmax),c=r.getGeometry(o);const m=L(c,n);m.inflateCoords(0,1);const h=J(null,m,!0).total();c=ie(c,n,h,Number.NaN,this.m_progressTracker)}else c.addPath(e,0,!0);e.setEmpty(),e.add(c,!1)}setMinCornerStep(){const e={stack:[],error:void 0,hasError:!1};try{let s=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);s=Math.min(s,.125*this.m_a*Math.PI);const n=new ee;n.setCoords(0,10*this.m_rpu);const i=0;let r=45*this.m_rpu;const o=X(e,new te(new N,new N),!1),m=X(e,new te(new N,new N),!1),a=X(e,new te(new N,new N),!1),h=X(e,new te(new N,new N),!1),c=new ee,u=new ee,l=new ee,_=new ee;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,i,o.at(0),o.at(1)),c.setCoords(o.at(0).val,o.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const t=.5*(i+r);k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,t,a.at(0),a.at(1)),l.setCoords(a.at(0).val,a.at(1).val);const o=X(e,new N,!1),f=X(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,u.x,u.y,o,f,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,c.x,c.y,.5*o.val,f.val,h.at(0),h.at(1),2),_.setCoords(h.at(0).val,h.at(1).val);const d=X(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,_.x,_.y,d,null,null,2);if(d.val<=this.m_convergenceOffset)break;r*=.9,k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}const f=r-i,d=2*Math.PI/Math.ceil(2*Math.PI/f);this.m_cornerStep=d}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}setMinSegmentStep(){const e={stack:[],error:void 0,hasError:!1};try{let n=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);n=Math.min(n,.125*this.m_a*Math.PI);const i=new ee,r=new ee;i.setCoords(0,10*this.m_rpu),r.setCoords(10*this.m_rpu,10*this.m_rpu);const o=X(e,new N,!1),m=X(e,new N,!1),a=X(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,a,o,m,this.m_curveType);const h=X(e,new te(new N,new N),!1),c=X(e,new te(new N,new N),!1),u=new ee,l=X(e,new N,!1),_=X(e,new te(new N,new N),!1),f=X(e,new te(new N,new N),!1),d=X(e,new te(new N,new N),!1),g=X(e,new te(new N,new N),!1),p=new ee,P=new ee,x=new ee,b=new ee,y=0;let w=1;const C=o.val,v=m.val,S=C-.5*Math.PI,D=v+.5*Math.PI,I=a.val;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,i.x,i.y,n,S,_.at(0),_.at(1)),p.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,D,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const s=.5*(y+w);k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,s*I,C,h.at(0),h.at(1),this.m_curveType),u.setCoords(h.at(0).val,h.at(1).val),k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,u.x,u.y,null,null,l,this.m_curveType);const o=l.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,u.x,u.y,n,o,d.at(0),d.at(1)),x.setCoords(d.at(0).val,d.at(1).val);const m=X(e,new N,!1),a=X(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,p.x,p.y,P.x,P.y,m,a,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,p.x,p.y,.5*m.val,a.val,g.at(0),g.at(1),2),b.setCoords(g.at(0).val,g.at(1).val);const _=X(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,x.x,x.y,b.x,b.y,_,null,null,2);if(_.val<=this.m_convergenceOffset)break;{const e={stack:[],error:void 0,hasError:!1};try{w*=.9,k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,w*I,C,c.at(0),c.at(1),this.m_curveType),r.setCoords(c.at(0).val,c.at(1).val);const t=X(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,null,null,t,this.m_curveType);const s=t.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,s,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}let G=w*I;G>1e5&&(G=1e5),this.m_segmentStep=G}catch(n){e.error=n,e.hasError=!0}finally{Y(e)}}setConvergenceOffset(){let e;e=this.m_absDistance>5e4?100:this.m_absDistance>1e4?10:1,this.m_absDistance/e<500&&(e=this.m_absDistance/500),e<.01&&(e=.01),this.m_convergenceOffset=e}}function he(e,t,s,n,i,r,o){if(e.isEmpty())return new O({vd:e.getDescription()});let f=e;if(a(f)){const e=10*t.getTolerance(0);f=(new oe).execute(f,0,e,0,o,12e3)}const w=new ae(o);w.m_sr=t,w.m_gcs=t.getGCS(),w.m_transform=d(t,w.m_gcs,null);const C=g();w.m_gcs.querySpheroidData(C);const v=new _;f.queryEnvelope(v),w.m_a=C.majorSemiAxis,w.m_eSquared=C.e2,w.m_rpu=w.m_gcs.getUnit().getUnitToBaseFactor(),w.m_gcs90=.5*Math.PI/w.m_rpu,w.m_gcs180=Math.PI/w.m_rpu,w.m_gcs360=2*Math.PI/w.m_rpu,w.m_gcs60=w.m_gcs360/6,w.m_q90=p.q90(w.m_a,w.m_eSquared),w.m_ellipticToGeodesicMaxRatio=.5*w.m_a*Math.PI/w.m_q90;const S=w.m_gcs.getTolerance(0);w.m_radTolerance=S*w.m_rpu,4===s?(w.m_curveType=2,w.m_bShapePreserving=!0):(w.m_curveType=s,w.m_bShapePreserving=!1),w.m_distance=n,w.m_absDistance=Math.abs(n),Number.isNaN(i)||i<=0?w.setConvergenceOffset():w.m_convergenceOffset=Math.max(i,.001),w.m_convergenceOffset/=r;let D,I=f.getGeometryType();if(h(I)){const e=new j({vd:f.getDescription()});e.addSegment(f,!0),D=e,I=m.enumPolyline}else if(I===m.enumEnvelope){const e=f,t=new _;e.queryEnvelope(t);const s=W(J(w.m_sr,v,!0));if(t.minDimension()<=s)if(0===t.maxDimension()){const t=new U({vd:f.getDescription()});e.getCenter(t),D=t,I=m.enumPoint}else{const t=new j({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolyline}else{const t=new O({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolygon}}else D=f;if(w.setMinCornerStep(),c(I)||w.setMinSegmentStep(),w.m_absDistance<=.5*w.m_convergenceOffset)return I!==m.enumPolygon?new O({vd:D.getDescription()}):w.m_bShapePreserving?D:P(D,w.m_sr,w.m_curveType,w.m_segmentStep,-1,o);if(w.m_distance<0&&I!==m.enumPolygon)return new O({vd:D.getDescription()});if(w.m_bShapePreserving&&u(I)){const e=P(D,t,4,Number.NaN,w.m_convergenceOffset,o);D=(new x).execute(e,w.m_transform,o)}else D=(new x).execute(D,w.m_transform,o);if(D=b(D,w.m_gcs),D.isEmpty())return new O({vd:D.getDescription()});!w.m_bShapePreserving&&u(I)&&(D=y(w.m_rpu,D)),D=fe(D,w.m_gcs);let G=new O;switch(I){case m.enumPolygon:G=w.bufferPolygon(D);break;case m.enumPolyline:G=w.bufferPolyline(D);break;case m.enumMultiPoint:G=w.bufferMultiPoint(D);break;case m.enumPoint:G=w.bufferPoint(D);break;default:l("")}const M=(new x).execute(G,w.m_transform.getInverse(),o);return M.mergeVertexDescription(D.getDescription()),M}function ce(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const l=new ee;l.setNAN(),a||c.getPointCount()>0&&(l.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),l.scale(s));const _=X(u,new N,!1),f=X(u,new te(new N,new N),!1),d=new ee,g=new ee,p=r.at(-1),P=1/s;for(let s=0;s<r.length;s++){const u=r[s];let x;0===s?x=o:s===r.length-1?x=m:(k.geodeticDistance(e,t,p.x,p.y,u.x,u.y,null,null,_,i),x=_.val-.5*Math.PI),k.geodesicCoordinate(e,t,u.x,u.y,n,x,f.at(0),f.at(1)),a?g.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(u.x,d.x,l.x,h),g.setCoords(h+d.x,d.y),l.setCoordsPoint2D(g)),g.scale(P),c.insertPoint2D(0,-1,g)}return h}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function ue(e,t,s,n,i,r,o,m,a,h,c,u=Number.NaN,l=Number.NaN){const _={stack:[],error:void 0,hasError:!1};try{if(o-r<m)return h;const f=X(_,new te(new N,new N),!1),d=new ee,g=new ee,p=new ee;g.setNAN(),a||c.getPointCount()>0&&(g.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),g.scale(s));let P=Math.ceil(r/m),x=P++*m;x===r&&(x=P++*m);let b=r;const y=1/s;for(;x<o+m&&(b<u&&u<x?(x=u,P--):b<l&&l<x&&(x=l,P--),!(x>=o));)k.geodesicCoordinate(e,t,i.x,i.y,n,x,f.at(0),f.at(1)),a?p.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(i.x,d.x,g.x,h),p.setCoords(h+d.x,d.y),g.setCoordsPoint2D(p)),p.scale(y),c.insertPoint2D(0,-1,p),b=x,x=P++*m;return h}catch(f){_.error=f,_.hasError=!0}finally{Y(_)}}function le(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const s=new ee,l=new ee,_=X(u,new te(new N,new N),!1);k.geodesicCoordinate(e,t,i.x,i.y,n,r,_.at(0),_.at(1)),s.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(e,t,i.x,i.y,n,o,_.at(0),_.at(1)),l.setCoords(_.at(0).val,_.at(1).val);const f=X(u,new N,!1);for(k.geodeticDistance(e,t,m.x,m.y,s.x,s.y,null,f,null,0),h[0]=f.val,k.geodeticDistance(e,t,m.x,m.y,l.x,l.y,null,f,null,0),c[0]=f.val;h[0]<=c[0];)h[0]+=ne;for(;h[0]>c[0];)h[0]-=ne;for(;h[0]>=a;)h[0]-=ne,c[0]-=ne;for(;h[0]<a;)h[0]+=ne,c[0]+=ne}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function _e(e,t,s,n){if(Number.isNaN(s)){for(;n+t-e>Math.PI;)n-=ne;for(;e-(n+t)>Math.PI;)n+=ne;return n}return n+t-s>Math.PI?n-=ne:s-(n+t)>Math.PI&&(n+=ne),n}function fe(e,t){const s=e.getGeometryType();let n;if(n=u(s)?e.getPathCount():s===m.enumMultiPoint?e.getPointCount():1,1===n)return e;const i=[],r=[];for(let m=0;m<n;m++){i.push(m);const n=new ee;if(u(s)){const t=new _;e.queryPathEnvelope(m,t),n.assign(t.getCenter())}else n.assign(e.getXY(m));const o=t.toGeohash(n);r.push(o)}i.sort(((e,t)=>r[e]<r[t]?-1:r[e]>r[t]?1:0));const o=e.createInstance();for(let m=0;m<n;m++){const t=i[m];u(s)?o.addPath(e,t,!0):o.addPoints(e,t,t+1)}return o}function de(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=s[0],a=s.at(-1),h=X(o,new N,!1),c=X(o,new N,!1),u=X(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,m.x,m.y,h,null,null),k.greatEllipticDistance(e,t,i.x,i.y,a.x,a.y,c,null,null),k.greatEllipticDistance(e,t,m.x,m.y,a.x,a.y,u,null,null);let l=Math.min(h.val,c.val)+u.val,_=l+n;if(_<r)return!0;const f=X(o,new N,!1);l=Math.max(h.val,c.val);for(let n=1;n<s.length-1;n++){const r=s[n];k.greatEllipticDistance(e,t,i.x,i.y,r.x,r.y,f,null,null),f.val>l&&(l=f.val)}return _=l+n,_<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function ge(e,t,s,n,i,r,o,m){let a;if(n.length%2==0){const e=n.length>>1,t=n[e],s=n[e-1];a=ee.lerp(t,s,.5)}else{a=n[n.length-1>>1].clone()}const h=a.clone(),c=A(e,t,h,75/180*Math.PI);return!!de(e,t,n,i,h,c)&&(null!==r&&(r.setCoordsPoint2D(a),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(h),null!==m&&(m[0]=c),!0)}function pe(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=X(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,s.x,s.y,m,null,null);return m.val+n<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function Pe(e,t,s,n,i,r,o,m){const a=A(e,t,n,75/180*Math.PI);return!!pe(e,t,n,i,n,a)&&(null!==r&&(r.setCoordsPoint2D(n),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(n),null!==m&&(m[0]=a),!0)}function xe(e,t){return new B(e,t)}function be(e){return V(e,0)||Q(e,0),e}class ye{constructor(e){this.m_bRunningInGnomonic=!1,this.m_bNeedsSimplify=!1,this.m_gnomonic=null,this.m_gnomonicCenterRad=new ee,this.m_minGnomonicRadius=Number.NaN,this.m_progressTracker=e}isRunningInGnomonic(){return this.m_bRunningInGnomonic}needsSimplify(){return this.m_bNeedsSimplify}getGnomonic(){return this.m_gnomonic}}class we extends ye{constructor(e,t,s){super(e.m_progressTracker),this.m_segIter=null,this.m_bNextSegmentCannotJoin=!1,this.m_currentDensifiedDelta=[0],this.m_currentBufferedDelta=0,this.m_lastAzimuth=0,this.m_startAzimuth=[0],this.m_endAzimuth=[0],this.m_numWinds=0,this.m_debugCounter=0,this.m_bufferHelper=new O,this.m_densifiedPoints=[],this.m_bufferer=e,this.m_multiPath=t,this.m_densified=s,this.m_bNeedsSimplify=!0;const n=new _;this.m_multiPath.queryEnvelope(n);const i=n.getCenter(),r=i.clone();r.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,i),this.m_gnomonicCenterRad=r.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,r,75/180*Math.PI)}next(){let e;if(this.m_bNextSegmentCannotJoin)return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e;if(null===this.m_segIter){if(this.m_segIter=this.m_multiPath.getImpl().querySegmentIterator(),!this.m_segIter.nextPath())return null;null!==this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}if(!this.m_segIter.hasNextSegment()){if(!this.m_segIter.nextPath())return null;null!=this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}let t=null;this.m_currentBufferedDelta=0,this.m_currentDensifiedDelta=[0],this.m_numWinds=0,this.m_lastAzimuth=Number.NaN,this.m_bNextSegmentCannotJoin=!1,this.m_densifiedPoints.length=0;const s=16;let n=0;const i=new ee,r=new ee;for(;this.m_segIter.hasNextSegment()&&this.m_numWinds<s;){const e=this.m_segIter.nextSegment();if(i.setCoordsPoint2D(e.getStartXY()),r.setCoordsPoint2D(e.getEndXY()),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0;const s=R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,i,r,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta);if(0===n)this.m_bRunningInGnomonic=this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(this.m_densifiedPoints));else if(this.m_bRunningInGnomonic){if(!this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}else{if(ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_densifiedPoints,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,null,null,null)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}if(0===s||z(i,r)?(this.m_bufferHelper.setEmpty(),this.m_bufferer.bufferPoint2D(i,this.m_bRunningInGnomonic,this.m_bufferHelper),this.m_bNextSegmentCannotJoin=!0):(this.m_bufferHelper.setEmpty(),this.m_bNextSegmentCannotJoin=this.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(s,this.m_bufferHelper)),this.m_bNextSegmentCannotJoin){this.m_segIter.previousSegment(),this.m_segIter.hasPreviousSegment()?(this.m_segIter.previousSegment(),this.m_segIter.nextSegment()):this.m_segIter.resetToFirstSegment(),null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0);break}null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0),null===t&&(t=new O,t.addPathPoint2D(null,0,!0)),this.addJoinAndBufferLeftSide(t),n++}if(this.m_currentDensifiedDelta=[0],n>0){const e=this.m_segIter.getStartPointIndex(),s=this.m_segIter.getPathIndex();for(;n>0;){if(this.m_segIter.previousSegment(),i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),r.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getEndPointIndex())),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic)if(E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0,R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,r,i,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta),this.addJoinAndBufferLeftSide(t),n--}return i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),i.scale(this.m_bufferer.m_rpu),this.m_currentBufferedDelta=ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,i,this.m_lastAzimuth+.5*Math.PI,this.m_lastAzimuth+1.5*Math.PI,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,t),this.m_segIter.resetToVertex(e,s),this.m_segIter.nextSegment(),t}return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e}isSegmentBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&de(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t){return this.m_bufferer.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(this.m_densifiedPoints,e,this.m_startAzimuth[0],this.m_endAzimuth[0],this.m_bRunningInGnomonic,t)}addJoinAndBufferLeftSide(e){const t=this.m_densifiedPoints[0];let s=Number.NaN,n=this.m_startAzimuth[0]-se;const i=this.m_endAzimuth[0]+se;let r=!1;if(!Number.isNaN(this.m_lastAzimuth)){this.m_lastAzimuth>=this.m_startAzimuth[0]?(s=this.m_lastAzimuth+se,n=s+Math.PI-(this.m_lastAzimuth-this.m_startAzimuth[0])):(s=this.m_lastAzimuth+se,n=s+Math.PI-(ne-(this.m_startAzimuth[0]-this.m_lastAzimuth))),r=!(this.m_lastAzimuth>=this.m_startAzimuth[0]&&this.m_lastAzimuth-this.m_startAzimuth[0]<=Math.PI)&&!(this.m_lastAzimuth<this.m_startAzimuth[0]&&this.m_startAzimuth[0]-this.m_lastAzimuth>=Math.PI);let i=!1;if(Math.abs(n-s)<=.5*this.m_bufferer.m_cornerStep&&(r||(i=!0)),i){if(e.removePointFromPath(0,e.getPointCount()-1),!this.m_bRunningInGnomonic){const t=new ee;t.setCoordsPoint2D(e.getXY(e.getPointCount()-1)),t.scale(this.m_bufferer.m_rpu),t.x-this.m_currentBufferedDelta<-Math.PI?this.m_currentBufferedDelta-=ne:t.x-this.m_currentBufferedDelta>Math.PI&&(this.m_currentBufferedDelta+=ne)}n=.5*(n+s)}else if(r){const s=new ee;s.setCoordsPoint2D(t),s.scale(1/this.m_bufferer.m_rpu),e.insertPoint2D(0,-1,s)}else ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_densifiedPoints[0],s,n,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e)}this.m_startAzimuth[0]!==this.m_lastAzimuth&&this.m_numWinds++,ce(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_bufferer.m_curveType,this.m_densifiedPoints,n,i,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e),this.m_lastAzimuth=this.m_endAzimuth[0]}}class Ce extends ye{constructor(e,t){super(e.m_progressTracker),this.m_pointIndex=-1,this.m_bufferer=e,this.m_multiPoint=t,this.m_bNeedsSimplify=!1;const s=new _;this.m_multiPoint.queryEnvelope(s);const n=s.getCenter(),i=n.clone();i.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,n),this.m_gnomonicCenterRad=i.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,i,75/180*Math.PI)}next(){if(this.m_bNeedsSimplify=!1,++this.m_pointIndex===this.m_multiPoint.getPointCount())return null;const e=this.m_multiPoint.getXY(this.m_pointIndex);e.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic=this.isPointBufferInCurrentGnomonic(e),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(e));const t=new O,s=this.m_bufferer.bufferPoint2D(e,this.m_bRunningInGnomonic,t);return this.m_bNeedsSimplify=s,t}isPointBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return Pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}}class ve{getOperatorType(){return 10110}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n,i,r,o,m){if(o){const o=new Se(e,t,s,n,i,!1,r,m);return(new f).executeMany(o,t,m)}return new Se(e,t,s,n,i,!1,r,m)}execute(t,n,i,r,o,m,a){const h=new e([t]),c=[r],u=this.executeMany(h,n,i,c,o,!1,m,a).next();return u||s("geodesic buffer null output"),u}}class Se extends t{constructor(e,t,s,r,o,m,a,h){super(),this.m_currentUnionEnvelope2D=new _,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=h,m&&n(""),t||i("");0===t.getCoordinateSystemType()&&i(""),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=s,this.m_distances=r,this.m_convergenceOffset=o,this.m_bOutlineOnly=m,this.m_bUnion=a}next(){let e;for(;e=this.m_inputGeoms.next();)return r(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.geodesicBuffer(e,this.m_distances[this.m_dindex]);return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodesicBuffer(e,t){return me(e,this.m_spatialReference,this.m_curveType,t,this.m_convergenceOffset,this.m_progressTracker)}}export{ve as OperatorGeodesicBuffer};
5
+ import{S as e,G as t}from"./SimpleGeometryCursor.js";import{d as s,t as n,a as i,c as r,i as o,G as m,m as a,f as h,e as c,h as u,n as l}from"./Geometry.js";import{Envelope2D as _}from"./Envelope2D.js";import{j as f,B as d,v as g,J as p,L as P,A as x,H as b,Q as y,p as w,R as C,S as v,U as S,f as D,O as I,V as G,W as M,X as T,P as N,z as k,Y as A,Z as E,_ as q,$ as R,a0 as z,a1 as X}from"./ProjectionTransformation.js";import{b as B,c as Y}from"./tslib.es6.js";import{a as O,P as j,E as F}from"./MultiPathImpl.js";import{e as W,c as J,P as U,b as H,f as L,h as V,s as Q}from"./Envelope.js";import{T as Z}from"./Transformation2D.js";import{d as $,m as K,P as ee,S as te,o as se,p as ne}from"./Point2D.js";import{c as ie}from"./OperatorClip.js";import{c as re}from"./GeometryCleaner-BEJM7I4l.js";import{O as oe}from"./OperatorDensify.js";function me(e,t,s,n,a,h){n<Number.MAX_VALUE&&n>-Number.MAX_VALUE||i("Geodesic_bufferer.buffer - bad distance"),r(e);const c=re(e),u=c.getGeometryType();if(o(u)){const e=c.getPointCount(),i=8e6;if(Math.abs(n)>i&&(e>50||u!==m.enumMultiPoint&&4===s&&e>2)){let e=c;const r=n>0?1:-1,o=7e6;let m=n,u=1;do{u++,m=(Math.abs(m)-o)*r}while(Math.abs(m)>i);m=n;for(let n=0;n<u-1;n++)e=he(e,t,s,o*r,a,u,h),m=(Math.abs(m)-o)*r;return e=he(e,t,s,m,a,u,h),e}}return he(c,t,s,n,a,1,h)}class ae{constructor(e){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_radTolerance=0,this.m_q90=0,this.m_gcs90=0,this.m_gcs180=0,this.m_gcs360=0,this.m_gcs60=0,this.m_ellipticToGeodesicMaxRatio=0,this.m_curveType=0,this.m_bShapePreserving=!1,this.m_distance=0,this.m_absDistance=0,this.m_convergenceOffset=0,this.m_cornerStep=0,this.m_segmentStep=0,this.m_progressTracker=e}bufferPolygon(e){const t=new O,s=new we(this,e,t);return this.processGnomonicBufferPiecesCursor(!0,s)}bufferPolyline(e){const t=new we(this,e,null);return this.processGnomonicBufferPiecesCursor(!0,t)}bufferMultiPoint(e){const t=new Ce(this,e);return this.processGnomonicBufferPiecesCursor(!1,t)}bufferPoint(e){const t=e.getXY();t.scale(this.m_rpu);let s=new O;if(this.bufferPoint2D(t,!1,s)){const e=H(null,s,!0);s=w(s,e,!0,!0,-1,this.m_progressTracker,0,!1)}return s=(new x).foldInto360RangeGeodetic(s,this.m_gcs,2),s}processGnomonicBufferPiecesCursor(e,t){const s=t;let n=s.getGnomonic();const i=C(v());let r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2);const m=$(6,!1),a=K(_,6);this.initializeGrid(m,a);const h=[null,null,null,null,null,null],c=[null,null,null,null,null,null],u=[null,null,null,null,null,null];let l,d,g;for(;null!==(l=s.next());){if(d=s.getGnomonic(),d!==n){if(null!==n){let t=o.next();if(r=null,o=null,null!=t){const s=H(i,t,!0),r=W(s);t=n.unproject(t,r,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}}null!==d&&(r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2)),n=d}if(s.isRunningInGnomonic()){if(d.project(l),s.needsSimplify()){const e=H(null,l,!0);l=w(l,e,!0,!0,-1,this.m_progressTracker,0,!1)}r.tick(be(l)),o.tock()}else this.putInGridCursors(e,l,i,!0,m,a,h,c,u)}let p=!1;for(let _=0;_<6;_++)if(null!=u[_]){p=!0;break}if(p){let t=!1;const l=[null,null,null,null,null,null];if(e){const n=s.m_densified;if(s.m_densified=null,null!==n){const s=new Z;s.scale(1/this.m_rpu,1/this.m_rpu),n.applyTransformation(s),this.m_distance>0?this.putInGridCursors(e,n,i,!1,m,a,h,c,u):(this.processInGrid(e,n,!1,m,a,h,l),t=!0)}}const _=new S,d=(new f).executeMany(_,this.m_gcs,this.m_progressTracker,2);if(null!==o){let t=o.next();r=null,o=null;const s=H(i,t,!0),l=W(s);t=n.unproject(t,l,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}for(let e=0;e<6;e++)if(null!=u[e]){let s=u[e].next();u[e]=null,c[e]=null,t&&null!==l[e]&&(s=(new D).execute(l[e],s,i,this.m_progressTracker));const n=H(i,s,!0),r=W(n);s=h[e].unproject(s,r,this.m_progressTracker),s=(new I).execute(s,this.m_gcs,!0,this.m_progressTracker),_.tick(be(s)),d.tock()}g=d.next()}else{let t,m=!1;if(e){let e=s.m_densified;if(s.m_densified=null,null!==e){const s=new Z;s.scale(1/this.m_rpu,1/this.m_rpu),e.applyTransformation(s),d.project(e);const n=H(null,e,!0);e=w(e,n,!1,!0,-1,this.m_progressTracker,0,!1),this.m_distance>0?(r.tick(be(e)),o.tock()):(t=e,m=!0)}}let a=o.next();r=null,o=null,m&&(a=(new D).execute(t,a,i,this.m_progressTracker));const h=H(i,a,!0),c=W(h);g=n.unproject(a,c,this.m_progressTracker),g=(new I).execute(g,this.m_gcs,!0,this.m_progressTracker)}return g=(new x).foldInto360RangeGeodetic(g,this.m_gcs,2),g}putInGridCursors(e,t,s,n,i,r,o,m,a){const h=[null,null,null,null,null,null];this.processInGrid(e,t,n,i,r,o,h);for(let c=0;c<6;c++)null!==h[c]&&(null===m[c]&&(m[c]=new S,a[c]=(new f).executeMany(m[c],s,this.m_progressTracker,2)),m[c].tick(be(h[c])),a[c].tock())}processInGrid(e,t,s,n,i,r,o){const m=.01,a=this.insertGeodeticPointsAlongGrid(t,i,m);for(let h=0;h<6;h++){if(n[h])continue;const e=i[h].clone();e.inflateCoords(m,m);const c=L(t,e),u=J(null,c,!1).total();let l=ie(a,e,u,Number.NaN,this.m_progressTracker);if(null!==l&&!l.isEmpty()){if(l===a&&(l=l.clone()),null===r[h]){const e=new ee;h<3?e.setCoords(0,1):e.setCoords(0,-1);const t=new ee;t.setAdd(i[h].getCenter(),e),r[h]=xe(this.m_gcs,t)}r[h].project(l);const e=H(null,l,!0);l=w(l,e,s,!0,-1,this.m_progressTracker,0,!1),o[h]=l}}}insertGeodeticPointsAlongGrid(e,t,s){const n=_.construct(t[3].xmin,t[3].ymin,t[2].xmax,t[2].ymax),i=G(this.m_gcs,n,e,!0,this.m_progressTracker),r=new F,o=r.addGeometry(i);return M(r,o,this.m_gcs,0,2,!0,t[0].xmax+s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax+s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin+s),0!==s&&(M(r,o,this.m_gcs,0,2,!0,t[0].xmax-s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax-s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin-s)),r.getGeometry(o)}initializeGrid(e,t){for(let s=0;s<6;s++)e[s]=!1;t[0].setCoords({xmin:-this.m_gcs180,ymin:0,xmax:-this.m_gcs60,ymax:this.m_gcs90}),t[1].setCoords({xmin:-this.m_gcs60,ymin:0,xmax:this.m_gcs60,ymax:this.m_gcs90}),t[2].setCoords({xmin:this.m_gcs60,ymin:0,xmax:this.m_gcs180,ymax:this.m_gcs90}),t[3].setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:-this.m_gcs60,ymax:0}),t[4].setCoords({xmin:-this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs60,ymax:0}),t[5].setCoords({xmin:this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:0})}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t,s,n,i,r){const o=e[0],m=e.at(-1),a=o.y<m.y?o.y:m.y,h=o.y>m.y?o.y:m.y,c=p.q(this.m_a,this.m_eSquared,a),u=p.q(this.m_a,this.m_eSquared,h);if(this.m_q90-(c+t+this.m_absDistance)>.001&&this.m_q90+(u-t-this.m_absDistance)>.001)return!1;const l=s-se,_=n+se,f=l-Math.PI,d=l+Math.PI,g=_+Math.PI,P=[Number.NaN],x=[Number.NaN],b=[Number.NaN],y=[Number.NaN];let w=!1;if(le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,l,f,m,_,P,x),le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,g,_,o,f,b,y),(_<P[0]&&P[0]<g||_<x[0]&&x[0]<g)&&(w=!0),w||(f<b[0]&&b[0]<l||f<y[0]&&y[0]<l)&&(w=!0),!w&&i)return!1;const C=[];for(let p=e.length-1;p>=0;p--)C.push(e[p]);r.setEmpty(),r.addPathPoint2D(null,0,!0);let v=0;v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,e,l,_,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,_,g,this.m_cornerStep,i,v,r,P[0],x[0]),v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,C,g,d,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,f,l,this.m_cornerStep,i,v,r,b[0],y[0]);let S=!1;return i||(S=this.checkAndPrepForPole(r)),w||S}bufferPoint2D(e,t,s){s.setEmpty(),s.addPathPoint2D(null,0,!0);const n=0;ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,e,-this.m_cornerStep,2*Math.PI,this.m_cornerStep,t,n,s);let i=!1;return t||(i=this.checkAndPrepForPole(s)),i}checkAndPrepForPole(e){const t=this.checkAndPrepForPoleTouch(e),s=this.checkAndPrepForPoleWrap(e);return t||s}checkAndPrepForPoleTouch(e){const t=new _;return e.queryEnvelope(t),!(!T(t.ymax,this.m_gcs90)&&!T(t.ymin,-this.m_gcs90))&&(this.prepPoleTouch(e),!0)}checkAndPrepForPoleWrap(e){const t=e.getXY(0),s=e.getXY(e.getPointCount()-1);return Math.abs(t.x-s.x)>this.m_gcs180?(this.prepSinglePoleWrap(e),!0):this.checkAndPrepForDoublePoleWrap(e)}checkAndPrepForDoublePoleWrap(e){return e.calculateArea2D()<0&&(this.prepDoublePoleWrap(e),!0)}prepPoleTouch(e){const t=new O;t.insertPath2D(-1,null,0,0,!0);const s=e.getPathStart(0),n=e.getPathEnd(0),i=n-s;let r=-1;for(r=s;r<n;r++){const t=e.getXY(r),s=T(t.y,this.m_gcs90),n=T(t.y,-this.m_gcs90);if(!s&&!n)break}let o=r,m=!1,a=Number.NaN;do{const n=e.getXY(o),r=T(n.y,this.m_gcs90),h=T(n.y,-this.m_gcs90),c=s+(o+1-s)%i;if(r||h){let s=ee.construct(a,n.y);t.insertPoint2D(0,-1,s);const i=e.getXY(c),r=T(i.y,this.m_gcs90),o=T(i.y,-this.m_gcs90);r||o||(s=ee.construct(i.x,n.y),m?t.setXY(t.getPointCount()-1,s):t.insertPoint2D(0,-1,s)),m=!0}else t.insertPoint2D(0,-1,n),a=n.x,m=!1;o=c}while(o!==r);e.setEmpty(),e.add(t,!1)}prepSinglePoleWrap(e){const t=new O,s=new O,n=new Z,i=e.getXY(e.getPathStart(0)),r=e.getXY(e.getPathEnd(0)-1),o=this.m_gcs360,m=this.m_gcs180,a=new _;a.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const h=new _;e.queryEnvelope(h);const c=Math.ceil(h.width()/o);let u,l;i.x>r.x?(u=-o,l=this.m_gcs90):(u=o,l=-this.m_gcs90),n.setShiftCoords(u,0),t.addPath(e,0,!0),s.add(t,!1);const f=new U;for(let _=0;_<c;_++)s.applyTransformation(n),s.getPointByVal(0,f),t.lineToPoint(f),t.addSegmentsFromPath(s,0,0,s.getSegmentCount()-1,!1);const d=t.getXY(0),g=t.getXY(t.getPointCount()-1);d.y=l,g.y=l,t.lineTo(g);const p=new ee;for(p.setCoordsPoint2D(g),p.x-=.5*u;Math.abs(p.x-d.x)>m;)t.lineTo(p),p.x-=.5*u;t.lineTo(d);const P=a.getCenterX(),x=new _;t.queryEnvelope(x);let b=0;const y=x.getCenter().x;y-P>m?b=-Math.ceil((y-P-m)/o):P-y>m&&(b=Math.ceil((P-y-m)/o)),0!==b&&(n.setShiftCoords(b*o,0),t.applyTransformation(n));const w=new F,C=w.addGeometry(t);M(w,C,this.m_gcs,0,2,!0,a.xmin),M(w,C,this.m_gcs,0,2,!0,a.xmax);const v=w.getGeometry(C),S=L(v,a);S.inflateCoords(0,1);const D=J(null,S,!0).total(),I=ie(v,a,D,Number.NaN,this.m_progressTracker);e.setEmpty(),e.add(I,!1)}prepDoublePoleWrap(e){const t=this.m_gcs360,s=this.m_gcs180,n=new _;n.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const i=n.getCenter().x,r=new _;e.queryPathEnvelope(0,r);let o,m=0,a=r.getCenter().x;if(a-i>s?m=-Math.ceil((a-i-s)/t):i-a>s&&(m=Math.ceil((i-a-s)/t)),0!==m){const s=new Z;s.setShiftCoords(m*t,0),e.getImpl().applyTransformationToPath(s,0),e.queryPathEnvelope(0,r),a=r.getCenter().x}const h=new _;n.containsExclusiveEnvelope(r)?(o=!1,h.setCoords({env2D:n})):(o=!0,h.setCoords({env2D:n}),h.xmin-=t,h.xmax+=t);let c=e.createInstance();c.addPathPoint2D(null,0,!0);const u=new ee;if(u.setCoords(h.xmin,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(h.xmin,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymin),c.insertPoint2D(0,-1,u),o){c.addPath(e,0,!0);const s=new Z;a<i?s.setShiftCoords(t,0):s.setShiftCoords(-t,0),e.getImpl().applyTransformationToPath(s,0),c.addPath(e,0,!0);const r=new F,o=r.addGeometry(c);M(r,o,this.m_gcs,0,2,!0,n.xmin),M(r,o,this.m_gcs,0,2,!0,n.xmax),c=r.getGeometry(o);const m=L(c,n);m.inflateCoords(0,1);const h=J(null,m,!0).total();c=ie(c,n,h,Number.NaN,this.m_progressTracker)}else c.addPath(e,0,!0);e.setEmpty(),e.add(c,!1)}setMinCornerStep(){const e={stack:[],error:void 0,hasError:!1};try{let s=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);s=Math.min(s,.125*this.m_a*Math.PI);const n=new ee;n.setCoords(0,10*this.m_rpu);const i=0;let r=45*this.m_rpu;const o=B(e,new te(new N,new N),!1),m=B(e,new te(new N,new N),!1),a=B(e,new te(new N,new N),!1),h=B(e,new te(new N,new N),!1),c=new ee,u=new ee,l=new ee,_=new ee;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,i,o.at(0),o.at(1)),c.setCoords(o.at(0).val,o.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const t=.5*(i+r);k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,t,a.at(0),a.at(1)),l.setCoords(a.at(0).val,a.at(1).val);const o=B(e,new N,!1),f=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,u.x,u.y,o,f,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,c.x,c.y,.5*o.val,f.val,h.at(0),h.at(1),2),_.setCoords(h.at(0).val,h.at(1).val);const d=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,_.x,_.y,d,null,null,2);if(d.val<=this.m_convergenceOffset)break;r*=.9,k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}const f=r-i,d=2*Math.PI/Math.ceil(2*Math.PI/f);this.m_cornerStep=d}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}setMinSegmentStep(){const e={stack:[],error:void 0,hasError:!1};try{let n=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);n=Math.min(n,.125*this.m_a*Math.PI);const i=new ee,r=new ee;i.setCoords(0,10*this.m_rpu),r.setCoords(10*this.m_rpu,10*this.m_rpu);const o=B(e,new N,!1),m=B(e,new N,!1),a=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,a,o,m,this.m_curveType);const h=B(e,new te(new N,new N),!1),c=B(e,new te(new N,new N),!1),u=new ee,l=B(e,new N,!1),_=B(e,new te(new N,new N),!1),f=B(e,new te(new N,new N),!1),d=B(e,new te(new N,new N),!1),g=B(e,new te(new N,new N),!1),p=new ee,P=new ee,x=new ee,b=new ee,y=0;let w=1;const C=o.val,v=m.val,S=C-.5*Math.PI,D=v+.5*Math.PI,I=a.val;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,i.x,i.y,n,S,_.at(0),_.at(1)),p.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,D,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const s=.5*(y+w);k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,s*I,C,h.at(0),h.at(1),this.m_curveType),u.setCoords(h.at(0).val,h.at(1).val),k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,u.x,u.y,null,null,l,this.m_curveType);const o=l.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,u.x,u.y,n,o,d.at(0),d.at(1)),x.setCoords(d.at(0).val,d.at(1).val);const m=B(e,new N,!1),a=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,p.x,p.y,P.x,P.y,m,a,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,p.x,p.y,.5*m.val,a.val,g.at(0),g.at(1),2),b.setCoords(g.at(0).val,g.at(1).val);const _=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,x.x,x.y,b.x,b.y,_,null,null,2);if(_.val<=this.m_convergenceOffset)break;{const e={stack:[],error:void 0,hasError:!1};try{w*=.9,k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,w*I,C,c.at(0),c.at(1),this.m_curveType),r.setCoords(c.at(0).val,c.at(1).val);const t=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,null,null,t,this.m_curveType);const s=t.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,s,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}let G=w*I;G>1e5&&(G=1e5),this.m_segmentStep=G}catch(n){e.error=n,e.hasError=!0}finally{Y(e)}}setConvergenceOffset(){let e;e=this.m_absDistance>5e4?100:this.m_absDistance>1e4?10:1,this.m_absDistance/e<500&&(e=this.m_absDistance/500),e<.01&&(e=.01),this.m_convergenceOffset=e}}function he(e,t,s,n,i,r,o){if(e.isEmpty())return new O({vd:e.getDescription()});let f=e;if(a(f)){const e=10*t.getTolerance(0);f=(new oe).execute(f,0,e,0,o,12e3)}const w=new ae(o);w.m_sr=t,w.m_gcs=t.getGCS(),w.m_transform=d(t,w.m_gcs,null);const C=g();w.m_gcs.querySpheroidData(C);const v=new _;f.queryEnvelope(v),w.m_a=C.majorSemiAxis,w.m_eSquared=C.e2,w.m_rpu=w.m_gcs.getUnit().getUnitToBaseFactor(),w.m_gcs90=.5*Math.PI/w.m_rpu,w.m_gcs180=Math.PI/w.m_rpu,w.m_gcs360=2*Math.PI/w.m_rpu,w.m_gcs60=w.m_gcs360/6,w.m_q90=p.q90(w.m_a,w.m_eSquared),w.m_ellipticToGeodesicMaxRatio=.5*w.m_a*Math.PI/w.m_q90;const S=w.m_gcs.getTolerance(0);w.m_radTolerance=S*w.m_rpu,4===s?(w.m_curveType=2,w.m_bShapePreserving=!0):(w.m_curveType=s,w.m_bShapePreserving=!1),w.m_distance=n,w.m_absDistance=Math.abs(n),Number.isNaN(i)||i<=0?w.setConvergenceOffset():w.m_convergenceOffset=Math.max(i,.001),w.m_convergenceOffset/=r;let D,I=f.getGeometryType();if(h(I)){const e=new j({vd:f.getDescription()});e.addSegment(f,!0),D=e,I=m.enumPolyline}else if(I===m.enumEnvelope){const e=f,t=new _;e.queryEnvelope(t);const s=W(J(w.m_sr,v,!0));if(t.minDimension()<=s)if(0===t.maxDimension()){const t=new U({vd:f.getDescription()});e.getCenter(t),D=t,I=m.enumPoint}else{const t=new j({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolyline}else{const t=new O({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolygon}}else D=f;if(w.setMinCornerStep(),c(I)||w.setMinSegmentStep(),w.m_absDistance<=.5*w.m_convergenceOffset)return I!==m.enumPolygon?new O({vd:D.getDescription()}):w.m_bShapePreserving?D:P(D,w.m_sr,w.m_curveType,w.m_segmentStep,-1,o);if(w.m_distance<0&&I!==m.enumPolygon)return new O({vd:D.getDescription()});if(w.m_bShapePreserving&&u(I)){const e=P(D,t,4,Number.NaN,w.m_convergenceOffset,o);D=(new x).execute(e,w.m_transform,o)}else D=(new x).execute(D,w.m_transform,o);if(D=b(D,w.m_gcs),D.isEmpty())return new O({vd:D.getDescription()});!w.m_bShapePreserving&&u(I)&&(D=y(w.m_rpu,D)),D=fe(D,w.m_gcs);let G=new O;switch(I){case m.enumPolygon:G=w.bufferPolygon(D);break;case m.enumPolyline:G=w.bufferPolyline(D);break;case m.enumMultiPoint:G=w.bufferMultiPoint(D);break;case m.enumPoint:G=w.bufferPoint(D);break;default:l("")}const M=(new x).execute(G,w.m_transform.getInverse(),o);return M.mergeVertexDescription(D.getDescription()),M}function ce(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const l=new ee;l.setNAN(),a||c.getPointCount()>0&&(l.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),l.scale(s));const _=B(u,new N,!1),f=B(u,new te(new N,new N),!1),d=new ee,g=new ee,p=r.at(-1),P=1/s;for(let s=0;s<r.length;s++){const u=r[s];let x;0===s?x=o:s===r.length-1?x=m:(k.geodeticDistance(e,t,p.x,p.y,u.x,u.y,null,null,_,i),x=_.val-.5*Math.PI),k.geodesicCoordinate(e,t,u.x,u.y,n,x,f.at(0),f.at(1)),a?g.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(u.x,d.x,l.x,h),g.setCoords(h+d.x,d.y),l.setCoordsPoint2D(g)),g.scale(P),c.insertPoint2D(0,-1,g)}return h}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function ue(e,t,s,n,i,r,o,m,a,h,c,u=Number.NaN,l=Number.NaN){const _={stack:[],error:void 0,hasError:!1};try{if(o-r<m)return h;const f=B(_,new te(new N,new N),!1),d=new ee,g=new ee,p=new ee;g.setNAN(),a||c.getPointCount()>0&&(g.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),g.scale(s));let P=Math.ceil(r/m),x=P++*m;x===r&&(x=P++*m);let b=r;const y=1/s;for(;x<o+m&&(b<u&&u<x?(x=u,P--):b<l&&l<x&&(x=l,P--),!(x>=o));)k.geodesicCoordinate(e,t,i.x,i.y,n,x,f.at(0),f.at(1)),a?p.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(i.x,d.x,g.x,h),p.setCoords(h+d.x,d.y),g.setCoordsPoint2D(p)),p.scale(y),c.insertPoint2D(0,-1,p),b=x,x=P++*m;return h}catch(f){_.error=f,_.hasError=!0}finally{Y(_)}}function le(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const s=new ee,l=new ee,_=B(u,new te(new N,new N),!1);k.geodesicCoordinate(e,t,i.x,i.y,n,r,_.at(0),_.at(1)),s.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(e,t,i.x,i.y,n,o,_.at(0),_.at(1)),l.setCoords(_.at(0).val,_.at(1).val);const f=B(u,new N,!1);for(k.geodeticDistance(e,t,m.x,m.y,s.x,s.y,null,f,null,0),h[0]=f.val,k.geodeticDistance(e,t,m.x,m.y,l.x,l.y,null,f,null,0),c[0]=f.val;h[0]<=c[0];)h[0]+=ne;for(;h[0]>c[0];)h[0]-=ne;for(;h[0]>=a;)h[0]-=ne,c[0]-=ne;for(;h[0]<a;)h[0]+=ne,c[0]+=ne}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function _e(e,t,s,n){if(Number.isNaN(s)){for(;n+t-e>Math.PI;)n-=ne;for(;e-(n+t)>Math.PI;)n+=ne;return n}return n+t-s>Math.PI?n-=ne:s-(n+t)>Math.PI&&(n+=ne),n}function fe(e,t){const s=e.getGeometryType();let n;if(n=u(s)?e.getPathCount():s===m.enumMultiPoint?e.getPointCount():1,1===n)return e;const i=[],r=[];for(let m=0;m<n;m++){i.push(m);const n=new ee;if(u(s)){const t=new _;e.queryPathEnvelope(m,t),n.assign(t.getCenter())}else n.assign(e.getXY(m));const o=t.toGeohash(n);r.push(o)}i.sort(((e,t)=>r[e]<r[t]?-1:r[e]>r[t]?1:0));const o=e.createInstance();for(let m=0;m<n;m++){const t=i[m];u(s)?o.addPath(e,t,!0):o.addPoints(e,t,t+1)}return o}function de(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=s[0],a=s.at(-1),h=B(o,new N,!1),c=B(o,new N,!1),u=B(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,m.x,m.y,h,null,null),k.greatEllipticDistance(e,t,i.x,i.y,a.x,a.y,c,null,null),k.greatEllipticDistance(e,t,m.x,m.y,a.x,a.y,u,null,null);let l=Math.min(h.val,c.val)+u.val,_=l+n;if(_<r)return!0;const f=B(o,new N,!1);l=Math.max(h.val,c.val);for(let n=1;n<s.length-1;n++){const r=s[n];k.greatEllipticDistance(e,t,i.x,i.y,r.x,r.y,f,null,null),f.val>l&&(l=f.val)}return _=l+n,_<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function ge(e,t,s,n,i,r,o,m){let a;if(n.length%2==0){const e=n.length>>1,t=n[e],s=n[e-1];a=ee.lerp(t,s,.5)}else{a=n[n.length-1>>1].clone()}const h=a.clone(),c=A(e,t,h,75/180*Math.PI);return!!de(e,t,n,i,h,c)&&(null!==r&&(r.setCoordsPoint2D(a),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(h),null!==m&&(m[0]=c),!0)}function pe(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=B(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,s.x,s.y,m,null,null);return m.val+n<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function Pe(e,t,s,n,i,r,o,m){const a=A(e,t,n,75/180*Math.PI);return!!pe(e,t,n,i,n,a)&&(null!==r&&(r.setCoordsPoint2D(n),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(n),null!==m&&(m[0]=a),!0)}function xe(e,t){return new X(e,t)}function be(e){return V(e,0)||Q(e,0),e}class ye{constructor(e){this.m_bRunningInGnomonic=!1,this.m_bNeedsSimplify=!1,this.m_gnomonic=null,this.m_gnomonicCenterRad=new ee,this.m_minGnomonicRadius=Number.NaN,this.m_progressTracker=e}isRunningInGnomonic(){return this.m_bRunningInGnomonic}needsSimplify(){return this.m_bNeedsSimplify}getGnomonic(){return this.m_gnomonic}}class we extends ye{constructor(e,t,s){super(e.m_progressTracker),this.m_segIter=null,this.m_bNextSegmentCannotJoin=!1,this.m_currentDensifiedDelta=[0],this.m_currentBufferedDelta=0,this.m_lastAzimuth=0,this.m_startAzimuth=[0],this.m_endAzimuth=[0],this.m_numWinds=0,this.m_debugCounter=0,this.m_bufferHelper=new O,this.m_densifiedPoints=[],this.m_bufferer=e,this.m_multiPath=t,this.m_densified=s,this.m_bNeedsSimplify=!0;const n=new _;this.m_multiPath.queryEnvelope(n);const i=n.getCenter(),r=i.clone();r.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,i),this.m_gnomonicCenterRad=r.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,r,75/180*Math.PI)}next(){let e;if(this.m_bNextSegmentCannotJoin)return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e;if(null===this.m_segIter){if(this.m_segIter=this.m_multiPath.getImpl().querySegmentIterator(),!this.m_segIter.nextPath())return null;null!==this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}if(!this.m_segIter.hasNextSegment()){if(!this.m_segIter.nextPath())return null;null!=this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}let t=null;this.m_currentBufferedDelta=0,this.m_currentDensifiedDelta=[0],this.m_numWinds=0,this.m_lastAzimuth=Number.NaN,this.m_bNextSegmentCannotJoin=!1,this.m_densifiedPoints.length=0;const s=16;let n=0;const i=new ee,r=new ee;for(;this.m_segIter.hasNextSegment()&&this.m_numWinds<s;){const e=this.m_segIter.nextSegment();if(i.setCoordsPoint2D(e.getStartXY()),r.setCoordsPoint2D(e.getEndXY()),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0;const s=R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,i,r,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta);if(0===n)this.m_bRunningInGnomonic=this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(this.m_densifiedPoints));else if(this.m_bRunningInGnomonic){if(!this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}else{if(ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_densifiedPoints,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,null,null,null)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}if(0===s||z(i,r)?(this.m_bufferHelper.setEmpty(),this.m_bufferer.bufferPoint2D(i,this.m_bRunningInGnomonic,this.m_bufferHelper),this.m_bNextSegmentCannotJoin=!0):(this.m_bufferHelper.setEmpty(),this.m_bNextSegmentCannotJoin=this.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(s,this.m_bufferHelper)),this.m_bNextSegmentCannotJoin){this.m_segIter.previousSegment(),this.m_segIter.hasPreviousSegment()?(this.m_segIter.previousSegment(),this.m_segIter.nextSegment()):this.m_segIter.resetToFirstSegment(),null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0);break}null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0),null===t&&(t=new O,t.addPathPoint2D(null,0,!0)),this.addJoinAndBufferLeftSide(t),n++}if(this.m_currentDensifiedDelta=[0],n>0){const e=this.m_segIter.getStartPointIndex(),s=this.m_segIter.getPathIndex();for(;n>0;){if(this.m_segIter.previousSegment(),i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),r.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getEndPointIndex())),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic)if(E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0,R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,r,i,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta),this.addJoinAndBufferLeftSide(t),n--}return i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),i.scale(this.m_bufferer.m_rpu),this.m_currentBufferedDelta=ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,i,this.m_lastAzimuth+.5*Math.PI,this.m_lastAzimuth+1.5*Math.PI,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,t),this.m_segIter.resetToVertex(e,s),this.m_segIter.nextSegment(),t}return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e}isSegmentBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&de(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t){return this.m_bufferer.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(this.m_densifiedPoints,e,this.m_startAzimuth[0],this.m_endAzimuth[0],this.m_bRunningInGnomonic,t)}addJoinAndBufferLeftSide(e){const t=this.m_densifiedPoints[0];let s=Number.NaN,n=this.m_startAzimuth[0]-se;const i=this.m_endAzimuth[0]+se;let r=!1;if(!Number.isNaN(this.m_lastAzimuth)){this.m_lastAzimuth>=this.m_startAzimuth[0]?(s=this.m_lastAzimuth+se,n=s+Math.PI-(this.m_lastAzimuth-this.m_startAzimuth[0])):(s=this.m_lastAzimuth+se,n=s+Math.PI-(ne-(this.m_startAzimuth[0]-this.m_lastAzimuth))),r=!(this.m_lastAzimuth>=this.m_startAzimuth[0]&&this.m_lastAzimuth-this.m_startAzimuth[0]<=Math.PI)&&!(this.m_lastAzimuth<this.m_startAzimuth[0]&&this.m_startAzimuth[0]-this.m_lastAzimuth>=Math.PI);let i=!1;if(Math.abs(n-s)<=.5*this.m_bufferer.m_cornerStep&&(r||(i=!0)),i){if(e.removePointFromPath(0,e.getPointCount()-1),!this.m_bRunningInGnomonic){const t=new ee;t.setCoordsPoint2D(e.getXY(e.getPointCount()-1)),t.scale(this.m_bufferer.m_rpu),t.x-this.m_currentBufferedDelta<-Math.PI?this.m_currentBufferedDelta-=ne:t.x-this.m_currentBufferedDelta>Math.PI&&(this.m_currentBufferedDelta+=ne)}n=.5*(n+s)}else if(r){const s=new ee;s.setCoordsPoint2D(t),s.scale(1/this.m_bufferer.m_rpu),e.insertPoint2D(0,-1,s)}else ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_densifiedPoints[0],s,n,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e)}this.m_startAzimuth[0]!==this.m_lastAzimuth&&this.m_numWinds++,ce(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_bufferer.m_curveType,this.m_densifiedPoints,n,i,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e),this.m_lastAzimuth=this.m_endAzimuth[0]}}class Ce extends ye{constructor(e,t){super(e.m_progressTracker),this.m_pointIndex=-1,this.m_bufferer=e,this.m_multiPoint=t,this.m_bNeedsSimplify=!1;const s=new _;this.m_multiPoint.queryEnvelope(s);const n=s.getCenter(),i=n.clone();i.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,n),this.m_gnomonicCenterRad=i.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,i,75/180*Math.PI)}next(){if(this.m_bNeedsSimplify=!1,++this.m_pointIndex===this.m_multiPoint.getPointCount())return null;const e=this.m_multiPoint.getXY(this.m_pointIndex);e.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic=this.isPointBufferInCurrentGnomonic(e),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(e));const t=new O,s=this.m_bufferer.bufferPoint2D(e,this.m_bRunningInGnomonic,t);return this.m_bNeedsSimplify=s,t}isPointBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return Pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}}class ve{getOperatorType(){return 10110}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n,i,r,o,m){if(o){const o=new Se(e,t,s,n,i,!1,r,m);return(new f).executeMany(o,t,m)}return new Se(e,t,s,n,i,!1,r,m)}execute(t,n,i,r,o,m,a){const h=new e([t]),c=[r],u=this.executeMany(h,n,i,c,o,!1,m,a).next();return u||s("geodesic buffer null output"),u}}class Se extends t{constructor(e,t,s,r,o,m,a,h){super(),this.m_currentUnionEnvelope2D=new _,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=h,m&&n(""),t||i("");0===t.getCoordinateSystemType()&&i(""),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=s,this.m_distances=r,this.m_convergenceOffset=o,this.m_bOutlineOnly=m,this.m_bUnion=a}next(){let e;for(;e=this.m_inputGeoms.next();)return r(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.geodesicBuffer(e,this.m_distances[this.m_dindex]);return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodesicBuffer(e,t){return me(e,this.m_spatialReference,this.m_curveType,t,this.m_convergenceOffset,this.m_progressTracker)}}export{ve as OperatorGeodesicBuffer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{a as e,c as t,G as i,d as s,g as n}from"./Geometry.js";import{a,v as _,L as r}from"./QuadraticBezier.js";import{O as h}from"./OperatorDensify.js";import{B as o,O as m,v as l,K as p,A as u,a9 as c,aw as g,a as d,H as E,N as f,ax as P,ay as S,P as A,z as x,w as y,az as R,y as M,E as C}from"./ProjectionTransformation.js";import{P as T,K as w,d as N,k as q,o as b,a as I,E as v,n as $,f as z,c as O,x as D,y as G,z as k}from"./Point2D.js";import{Envelope2D as L}from"./Envelope2D.js";import{c as F,d as J}from"./Envelope.js";import{O as Y}from"./OperatorClip.js";import{O as U}from"./OperatorShapePreservingLength.js";import{b as X,c as j}from"./tslib.es6.js";import{T as B}from"./Transformation2D.js";import{a as H}from"./GeodeticDistanceCalculator-CcF1gMZX.js";class Q{constructor(e,t,i,s,n=100){this.m_startPt=e.clone(),this.m_endPt=t.clone(),this.m_cE2=s,this.m_cE=Math.sqrt(this.m_cE2),this.m_c1By2e=1/(2*this.m_cE),this.m_cRpu=i.getGCS().getUnit().getUnitToBaseFactor(),this.isPcs=2===i.getCoordinateSystemType(),this.PEProjcs=i.getPECoordSys(),this.m_points=N(2*n,Number.NaN)}setSegmentEndPoints(e,t){this.m_startPt.assign(e),this.m_endPt.assign(t)}makeFunctor(){return e=>{const t=[0,0];t[0]=this.m_startPt.x*(1-e)+this.m_endPt.x*e,t[1]=this.m_startPt.y*(1-e)+this.m_endPt.y*e,this.isPcs&&p.projToGeogCenter(this.PEProjcs,1,t,0);const i=Math.sin(t[1]*this.m_cRpu);if(0===this.m_cE2)return i;return-Math.log((1-this.m_cE*i)/(1+this.m_cE*i))*this.m_c1By2e+i/(1-this.m_cE2*i*i)}}}function V(e,t,i){const s=new L;e.queryEnvelope(s);const n=F(t,s,!0).total(),a=t.getPannableExtent();a.xmin=s.xmin-10*n,a.xmax=s.xmax+10*n;const r=(new Y).execute(e,a,t,i).getImpl().querySegmentIterator();r.stripAttributes();const h=l();t.querySpheroidData(h);const o=h.e2,m=0===o?2:1,p=new T(0,0),u=new T(0,0),c=new w(0),g=new Q(p,u,t,o,100);for(;r.nextPath();)for(;r.hasNextSegment();){const e=r.nextSegment();p.assign(e.getStartXY()),u.assign(e.getEndXY()),g.setSegmentEndPoints(p,u);const t=_(6,0,1,1e-12,1e-15,g.makeFunctor());c.pe((u.x-p.x)*t)}const d=h.majorSemiAxis;return m*d*d*(1-o)*Math.PI*c.getResult()/t.getPannableExtent().width()}function Z(e,t,i,s,n){const a=se(e,t,n);let _=K(e,a.first,i,s,n),r=1,h=0,o=0;do{if(r++,a.first*=.5,a.first<50*t.getTolerance(0))return _;a.second*=2,o=K(e,a.first,i,s,n),h=Math.abs(o-_),_=o}while(Math.abs(_)>1&&h>1e-8*Math.abs(_)&&(a.second<65e3&&r<8||r<4));return o}function K(e,t,i,s,n){const a=(new h).execute(e,t,0,0,n);let _;_=s?(new u).execute(a,s,n):a;const r=1===i.getUnit().getUnitToBaseFactor()?Math.PI/180:1,o=new L;_.queryEnvelope(o);const m=new L,l=new L,p=new L;m.setCoords({xmin:o.xmin,ymin:75*r,xmax:o.xmax,ymax:90*r}),l.setCoords({xmin:o.xmin,ymin:-60*r,xmax:o.xmax,ymax:75*r}),p.setCoords({xmin:o.xmin,ymin:-90*r,xmax:o.xmax,ymax:-60*r}),m.inflateCoords(.01*m.width(),0),l.inflateCoords(.01*l.width(),0),p.inflateCoords(.01*p.width(),0);let c=0;return c+=W(_,m,i,n),c+=W(_,l,i,n),c+=W(_,p,i,n),c}function W(e,t,i,s){const n=(new Y).execute(e,t,i,s);if(null!==n&&!n.isEmpty()){const e=new L;n.queryEnvelope(e);const{first:t,second:a}=ie(i,e,!1),_=o(i,t,null),r=(new u).execute(n,_,s).calculateArea2D();return a&&t.destroy(),r}return 0}const ee=[null,null,null,null,null,null,null];function te(e,t,i){const a=e.getUnit().getUnitToBaseFactor(),_=t.getCenter();_.scale(180*a/Math.PI);const r=new T;r.x=0,r.y=0;let h=0;if(0===h){_.y>45?(r.y=b,h=0):_.y<-45?(r.y=-b,h=1):_.x>=45&&_.x<135?(r.x=b,h=2):_.x>=135||_.x<-135?(r.x=b,h=3):_.x<-45&&_.x>=-135?(r.x=-b,h=4):(r.x=0,h=5);const e=a*Math.sqrt(I(t.xmin-t.xmax)+I(t.ymin-t.ymax)),i=r.clone(),s=t.getCenter();s.scale(a),h<2&&(i.x=s.x);if(T.distance(i,s)+.5*e>b)return null}const o=ee[h];if(null!==o&&o.getGCS().equalHorizontal(e))return o;const m=e.getText(),l=r.x,p=r.y,u=0,E=0;let f=0,P=-1;6!==h?P=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:(n(i),f=0,P=c.PE_PRJ_CYLINDRICAL_EQAREA);const S=g("EqualAreaPCS");let A;P===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${E}],PARAMETER["Central_Meridian",${l}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:P===c.PE_PRJ_CYLINDRICAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${E}],PARAMETER["Central_Meridian",${l}],PARAMETER["Standard_Parallel_1",${f}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:s("getEqualAreaPcsFixed");const x=d(A);return ee[h]&&ee[h].destroy(),ee[h]=x,x}function ie(e,t,i){const n=te(e,t,i);if(null!==n)return q(n,!1);const a=e.getText(),_=e.getUnit().getUnitToBaseFactor(),r=(t.xmin+t.width()/2)*_,h=(t.ymin+t.height()/2)*_,o=0,m=0;let l=0,p=0,u=-1;t.ymin*_>=75*Math.PI/180||t.ymax*_<=-60*Math.PI/180?u=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:t.ymin>0||t.ymax<0?(l=(t.ymin+1/3*t.height())*_,p=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_ALBERS):(l=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_CYLINDRICAL_EQAREA);const E=g("EqualAreaPCS");let f;return u===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?f=`PROJCS["${E}",${a},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_ALBERS?f=`PROJCS["${E}",${a},PROJECTION["Albers"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Standard_Parallel_2",${p}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_CYLINDRICAL_EQAREA?f=`PROJCS["${E}",${a},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:s("getEqualAreaPCSInstance"),q(d(f),!0)}function se(e,t,i){const s=e.calculateLength2D(),n=(new U).execute(e,t,i)/25e3,a=s/e.getSegmentCount()*2;let _=Math.min(a,s/n);0===_&&(_=1);return q(_,s/_)}class ne{getOperatorType(){return 10314}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(s,n,_){if(0===n.getCoordinateSystemType()&&e(""),s.isEmpty()||s.getDimension()<2)return 0;if(t(s),s.getGeometryType()===i.enumEnvelope){const e=new a;return e.addEnvelope(s,!1),this.execute(e,n,_)}let r=s;s.getDescription().getAttributeCount()>1&&(r=s.clone(),r.dropAllAttributes());const l=(new h).execute(r,0,n.getTolerance(0),0,_);let p=null;const u=n.getGCS();u!==n&&(p=o(n,u));let c=(new m).execute(l,n,!1,_);return c.isEmpty()?0:(c===s&&(c=s.clone()),n.isPannable()?V(c,n,_):Z(c,n,u,p,_))}}function ae(){return{m_p_PCS:new T,m_factor:Number.NaN,setValues:_e,assign:re}}function _e(e,t){this.m_factor=e,this.m_p_PCS.assign(t)}function re(e){this.m_factor=e.m_factor,this.m_p_PCS.assign(e.m_p_PCS)}class he{constructor(e,t,i,s){this.m_ptStart=new J,this.m_ptEnd=new J,this.m_ptStart.assign(t),this.m_ptEnd.assign(i),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y,this.m_e=Math.sqrt(e),this.m_e2=e,this.m_c1MinusE2=1-e;const n=Math.sin(s);let a;a=0===this.m_e2?2*n:n*(G(this.m_e*n)+1/(1-this.m_e2*n*n)),this.m_baseA=a}setSegmentEndPoints(e,t){this.m_ptStart.assign(e),this.m_ptEnd.assign(t),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y}makeFunctor(){return e=>{const t=1-e,i=t*this.m_ptStart.x+e*this.m_ptEnd.x,s=t*this.m_ptStart.y+e*this.m_ptEnd.y,n=t*this.m_ptStart.z+e*this.m_ptEnd.z,a=i*i+s*s,_=n/Math.sqrt(n*n+this.m_c1MinusE2*this.m_c1MinusE2*a);let r;if(0===this.m_e2)r=2*_;else{r=_*(G(this.m_e*_)+1/(1-this.m_e2*_*_))}return(this.m_deltaY*i-this.m_deltaX*s)/a*(r-this.m_baseA)}}}function oe(){return{e:Number.NaN,one_p_e:Number.NaN,one_m_e:Number.NaN,one_m_e_2:Number.NaN,atanh_e_over_e:Number.NaN,half_qp:Number.NaN,f:Number.NaN,z:Number.NaN}}function me(){return{sin_phi:Number.NaN,one_p_sin_phi:Number.NaN,one_m_sin_phi:Number.NaN,one_m_e_2_sin_2_phi:Number.NaN,sin_half_phi_pf:Number.NaN,sin_half_phi_pz:Number.NaN,sin_half_asin_e_sin_phi_pf:Number.NaN,sin_half_asin_e_sin_phi_pz:Number.NaN,atanh_sin_phi:Number.NaN,atanh_esin_phi:Number.NaN,make_negative:!1,initialize:le,changeSign:pe,assign:ue,clone:ce}}function le(e,t,i,s){const n=.5*e;this.sin_phi=Math.sin(e);const a=t*this.sin_phi,_=.5*Math.asin(a);this.one_p_sin_phi=1+this.sin_phi,this.one_m_sin_phi=1-this.sin_phi,this.one_m_e_2_sin_2_phi=(1+a)*(1-a),this.sin_half_phi_pf=Math.sin(n+i),this.sin_half_phi_pz=Math.sin(n+s),this.sin_half_asin_e_sin_phi_pf=Math.sin(_+i),this.sin_half_asin_e_sin_phi_pz=Math.sin(_+s),this.atanh_sin_phi=Math.log(this.sin_half_phi_pf/this.sin_half_phi_pz),this.atanh_esin_phi=Math.log(this.sin_half_asin_e_sin_phi_pf/this.sin_half_asin_e_sin_phi_pz)}function pe(){this.sin_phi=-this.sin_phi;let e=this.one_p_sin_phi;this.one_p_sin_phi=this.one_m_sin_phi,this.one_m_sin_phi=e,e=this.sin_half_phi_pf,this.sin_half_phi_pf=this.sin_half_phi_pz,this.sin_half_phi_pz=e,e=this.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pf=this.sin_half_asin_e_sin_phi_pz,this.sin_half_asin_e_sin_phi_pz=e,this.atanh_sin_phi=-this.atanh_sin_phi,this.atanh_esin_phi=-this.atanh_esin_phi}function ue(e){this.sin_phi=e.sin_phi,this.one_p_sin_phi=e.one_p_sin_phi,this.one_m_sin_phi=e.one_m_sin_phi,this.one_m_e_2_sin_2_phi=e.one_m_e_2_sin_2_phi,this.sin_half_phi_pf=e.sin_half_phi_pf,this.sin_half_phi_pz=e.sin_half_phi_pz,this.sin_half_asin_e_sin_phi_pf=e.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pz=e.sin_half_asin_e_sin_phi_pz,this.atanh_sin_phi=e.atanh_sin_phi,this.atanh_esin_phi=e.atanh_esin_phi,this.make_negative=e.make_negative}function ce(){return{...this}}class ge{constructor(t,i,s){this.m_transformPCS2GCS=null,this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_progressTracker=s,n(4!==i),this.m_curveType=i,this.m_inputSR=t,t&&0!==t.getCoordinateSystemType()||e(""),this.m_inputGCS=t.getGCS(),this.m_a=0,this.m_eSquared=0,this.m_b=0,this.m_rpu=0}executePolygonGeodeticArea(e){let t,i=e.clone();if(i.dropAllAttributes(),e.hasNonLinearSegments()){i=(new h).execute(i,0,this.m_inputSR.getTolerance(0),0,this.m_progressTracker)}if(this.m_inputSR.isPannable()){const e=new L;i.queryEnvelope(e);const t=this.m_inputSR.getPannableExtent();if(!t.containsEnvelope(e)){const s=t.getCenterX()-e.getCenterX(),n=new B;n.setShiftCoords(s,0),i.applyTransformation(n),e.move(s,0);const a=new v;t.queryIntervalX(a);const _=new v;e.queryIntervalX(_),i=a.contains(_)?E(i,this.m_inputSR):(new u).foldInto360RangeGeodetic(i,this.m_inputSR,this.m_curveType)}}if(this.m_transformPCS2GCS?(i=(new m).execute(i,this.m_inputSR,!1,this.m_progressTracker),t=i.createInstance(),f(this.m_transformPCS2GCS,i,t,this.m_progressTracker)||(t=(new u).execute(i,this.m_transformPCS2GCS,this.m_progressTracker))):t=(new m).execute(i,this.m_inputGCS,!1,this.m_progressTracker),t.isEmpty())return 0;if(1===this.m_curveType){const e=l();return this.m_inputGCS.querySpheroidData(e),this.m_a=e.majorSemiAxis,this.m_eSquared=e.e2,this.loxodromeArea(t)}const s=t.getImpl();this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_scaleToRadians.setScale(this.m_rpu),s.applyTransformation(this.m_scaleToRadians),this.m_scaleToDegrees=this.m_scaleToRadians,this.m_scaleToDegrees.invertThis();const n=l();if(this.m_inputGCS.querySpheroidData(n),this.m_a=n.majorSemiAxis,this.m_b=n.minorSemiAxis,this.m_eSquared=n.e2,2===this.m_curveType)return this.executeClippedPolygonGreatEllipticArea(t);{const e={stack:[],error:void 0,hasError:!1};try{const i=P.unit(9101),s=this.m_inputGCS.getPECoordSys(),n=X(e,s.cloneAlterUnits(i),!1);let a,_,r=this.executeClippedPolygonGeodeticArea(t,n,0),h=0;do{h++,a=this.executeClippedPolygonGeodeticArea(t,n,h),_=Math.abs(a-r),r=a}while(Math.abs(a)>1&&_>1e-8*Math.abs(a)&&h<7);return a}catch(a){e.error=a,e.hasError=!0}finally{j(e)}}}executeClippedPolygonGeodeticArea(e,t,i){const s={stack:[],error:void 0,hasError:!1};try{const n=new L;e.queryEnvelope(n);const a=X(s,this.getEqualAreaPCSInstance(t,n),!1),_=e.clone();S(a,_);const r=50,h=_.getImpl().getAttributeStreamRef(0),o=e.getImpl().getAttributeStreamRef(0),m=X(s,new A,!1),l=X(s,new A,!1),u=40,c=[0,0],g=$(ae,u),d=N(u,-1),E=ae(),f=ae();let P,y;const R=a;let M=_.calculateArea2D();const C=new w(0),q=.5*Math.PI,b=1e-10*Math.abs(M)+1e-6,I=e.getPathCount();let v,O,D,G;const k=new T,F=new T,J=new T,Y=new T,U=new T,j=new T;let B,H;for(O=e.getPathStart(0),v=0;v<I;v++,O=D)for(D=e.getPathEnd(v),h.queryPoint2D(D-1<<1,J),o.queryPoint2D(D-1<<1,k),Math.abs(k.y)>q&&(k.y=z(q,k.y)),G=O;G<D;G++,J.assign(Y),k.assign(F)){if(h.queryPoint2D(G<<1,Y),o.queryPoint2D(G<<1,F),Math.abs(F.y)>q&&(F.y=z(q,F.y)),B=T.distance(J,Y),B<r||0===k.y&&0===F.y)continue;x.geodeticDistance(this.m_a,this.m_eSquared,k.x,k.y,F.x,F.y,m,l,null,this.m_curveType);const e=m.val,t=l.val;for(E.setValues(0,J),f.setValues(1,Y),y=i,g[0].assign(f),d[0]=i,P=0;P>=0;){H=.5*(E.m_factor+f.m_factor),x.geodeticCoordinate(this.m_a,this.m_eSquared,k.x,k.y,e*H,t,m,l,this.m_curveType),U.x=m.val,U.y=l.val,c[0]=U.x,c[1]=U.y,p.geogToProj(R,1,c),j.x=c[0],j.y=c[1];const i=-j.offset(E.m_p_PCS,f.m_p_PCS),s=.5*i*T.distance(E.m_p_PCS,f.m_p_PCS);if(C.pe(s),Math.abs(s)>b||Math.abs(s)>0&&y>0)f.setValues(H,j),P++,g[P].assign(f),Math.abs(s)<=b?(y--,d[P-1]=y,d[P]=y):(y=d[P-1],d[P]=y);else{if(P<=0)break;E.assign(f),P--,f.assign(g[P]),y=d[P]}}}return M+=C.getResult(),Math.abs(M)}catch(n){s.error=n,s.hasError=!0}finally{j(s)}}executeClippedPolygonGreatEllipticArea(e){const t=[],i=[],s=new T,n=new T,a=y(1,this.m_eSquared,new T(0,.5*Math.PI)),_=new w(0),r=new w(0),h=new w(0),o=new J,m=new J,l=new L;e.queryLooseEnvelope(l);let p=0;l.containsCoords(l.xmin,0)||(p=Math.abs(l.ymin)<Math.abs(l.ymax)?l.ymin:l.ymax);const u=new he(this.m_eSquared,o,m,p),c=this.m_a*this.m_a,g=e.getImpl().querySegmentIterator();for(g.stripAttributes();g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();s.assign(e.getStartXY()),n.assign(e.getEndXY()),n.x-s.x>Math.PI?s.x+=2*Math.PI:n.x-s.x<-Math.PI&&(n.x+=2*Math.PI),this.splitSegmentCrossingItegralThreshold(e,t,i);for(let i of t)o.assign(y(this.m_a,this.m_eSquared,i.getStartXY())),m.assign(y(this.m_a,this.m_eSquared,i.getEndXY())),u.setSegmentEndPoints(o,m),this.adaptiveIntegrationWithRomberg(u,_);for(let t of i){let e=t.getStartXY(),i=t.getEndXY(),s=p;e.y<0&&(i=O(e,e=i),e.y=-e.y,i.y=-i.y,s=-s);const n=y(1,this.m_eSquared,e),_=y(1,this.m_eSquared,i),o=Math.min(e.y,i.y),m=R(this.m_eSquared,e.x,i.x,s,o);r.pe(m);const l=Math.abs(R(this.m_eSquared,e.x,i.x,o,b)),u=new J;u.setSub(n,a);const g=new J;g.setSub(_,a);const d=new J;d.setCrossProductVector(u,g);let E=c*(l-.5*d.length());E=z(E,i.x-e.x),h.pe(E)}t.length=0,i.length=0}return h.getResult()+c*(.5*(1-this.m_eSquared)*_.getResult()+r.getResult())}getEqualAreaPCSInstance(e,t){const i=t.getCenterX(),s=0,n=0;let a,_;const r=t.height();let h,o;(h=t.ymin>45*Math.PI/180||t.ymax<45*-Math.PI/180)?a=z(.5*Math.PI,t.getCenterY()):(a=t.getCenterY(),_=t.ymin+r*(2/3));const m=g("EqualAreaPCS"),l=e.toString();return o=h?P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}], PARAMETER["Latitude_of_Origin", ${a}], UNIT["Meter",1.0]]`):P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting", ${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}],PARAMETER["Standard_Parallel_1", ${_}],PARAMETER["Latitude_of_Origin", ${a}],UNIT["Meter",1.0]]`),o}splitSegmentCrossingItegralThreshold(e,t,i){const s=100,n=20,a=n*n,_=y(this.m_a,this.m_eSquared,new T(0,b)),h=y(this.m_a,this.m_eSquared,new T(0,-b)),o=this.splitSegmentPassingThroughPole(e);for(let m of o){const e=m.getStartXY(),o=m.getEndXY(),l=y(this.m_a,this.m_eSquared,e),p=y(this.m_a,this.m_eSquared,o),u=new T,c=new J;let g=J.sqrDistance(_,l),d=J.sqrDistance(l,p);if(g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),g=J.sqrDistance(_,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,l),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}t.push(new r({start:e,end:o}))}}splitSegmentPassingThroughPole(e){const t={stack:[],error:void 0,hasError:!1};try{const i=[],s=new J,n=new J,a=new J,_=new T,h=20,o=3.124139361,m=10,l=e.getStartXY(),p=e.getEndXY(),u=X(t,new A,!1);if(x.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,p.x,p.y,u,null,null,2),Math.abs(p.x-l.x)>o&&u.val>h){const e=new H(new T(0,90),l.divide(this.m_rpu),p.divide(this.m_rpu),this.m_inputGCS,2,2);let t=C(e.makeFunctor(),0,1,1e-10);if(t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i;if(e.setPointDistFrom(new T(0,-90)),t=C(e.makeFunctor(),0,1,1e-10),t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i}return i.push(new r({start:l,end:p})),i}catch(i){t.error=i,t.hasError=!0}finally{j(t)}}adaptiveIntegrationWithRomberg(e,t){const i=e.makeFunctor();let s=0,n=1,a=i(s),r=i(n);const h=1e-17,o=1e-14;let m=(s+n)/2,l=i(m),p=Math.abs(l-a),u=Math.abs(r-l),c=0;for(;c++<32&&(p/u<.1||u/p<.1);)p<u?(t.pe(_(5,s,m,o,h,i)),s=m,a=l):(t.pe(_(5,m,n,o,h,i)),n=m,r=l),m=(s+n)/2,l=Math.abs(i(m)),p=Math.abs(l-a),u=Math.abs(r-l);t.pe(_(5,s,n,o,h,i))}loxodromeAreaHemi(e,t,i,s,n){const a=i.clone(),_=n.clone();let r,h,o,m,l,p,u,c,g,d,E,f,P,S,A,x;return a.make_negative&&a.changeSign(),_.make_negative&&_.changeSign(),E=s-t,1===Math.abs(a.sin_phi)||1===Math.abs(_.sin_phi)?e.half_qp*E:a.sin_phi===_.sin_phi?(d=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi))*E,d):(A=Math.log(_.sin_half_phi_pf*a.sin_half_phi_pz/(_.sin_half_phi_pz*a.sin_half_phi_pf)),x=Math.log(_.sin_half_asin_e_sin_phi_pf*a.sin_half_asin_e_sin_phi_pz/(_.sin_half_asin_e_sin_phi_pz*a.sin_half_asin_e_sin_phi_pf)),1===this.m_eSquared?(l=0,r=.5*(A+_.sin_phi/_.one_m_e_2_sin_2_phi-a.sin_phi/a.one_m_e_2_sin_2_phi),h=0):(l=-2*e.atanh_e_over_e*(Math.log(_.one_p_sin_phi/a.one_p_sin_phi)-e.e*x),r=(A-e.e*x)/e.one_m_e_2,h=(Math.log(_.one_m_e_2_sin_2_phi/a.one_m_e_2_sin_2_phi)+l/e.atanh_e_over_e)/e.one_m_e_2),o=-x*(a.atanh_esin_phi+_.atanh_esin_phi),m=1/a.one_m_e_2_sin_2_phi-1/_.one_m_e_2_sin_2_phi,p=k(_.one_m_sin_phi/e.one_p_e,e.e)-k(a.one_m_sin_phi/e.one_p_e,e.e),u=k(_.one_p_sin_phi/e.one_p_e,e.e)-k(a.one_p_sin_phi/e.one_p_e,e.e),c=k(a.one_m_sin_phi/-e.one_m_e,e.e)-k(_.one_m_sin_phi/-e.one_m_e,e.e),g=k(a.one_p_sin_phi/-e.one_m_e,e.e)-k(_.one_p_sin_phi/-e.one_m_e,e.e),d=.25/r*(h+o+m+l+.5*(p+u+c+g)),d+=e.half_qp,f=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi)),P=.5*e.one_m_e_2*_.sin_phi*(1/_.one_m_e_2_sin_2_phi+G(e.e*_.sin_phi)),P<f&&(S=f,f=P,P=S),d<f&&(d=f),d>P&&(d=P),d*=E,d)}loxodromeArea(e){const t=Math.PI/180;let i=0;const s=oe(),n=me(),a=me();s.e=Math.sqrt(this.m_eSquared),s.one_p_e=1+s.e,s.one_m_e=1-s.e,s.one_m_e_2=1-this.m_eSquared,s.atanh_e_over_e=G(s.e),this.m_eSquared>=1?s.half_qp=1:s.half_qp=.5*(1+s.atanh_e_over_e*s.one_m_e_2),s.f=.25*Math.PI,s.z=.75*Math.PI,a.initialize(0,s.e,s.f,s.z);const _=e.getPathCount(),r=new T,h=new T,o=e.getImpl().getAttributeStreamRef(0);for(let m=0;m<_;m++){const _=e.getPathStart(m),l=e.getPathEnd(m);if(!(l-_<=1)){o.queryPoint2D(2*(l-1),r);for(let e=_;e<l;e++){o.queryPoint2D(2*e,h);const m=r.y*t,l=h.y*t;if(e===_?(n.initialize(m,s.e,s.f,s.z),n.make_negative=!1):n.assign(a),a.initialize(l,s.e,s.f,s.z),a.make_negative=!1,r.y*h.y<0){if(r.y>=90&&h.y<=-90||h.y>=90&&r.y<=-90)return Number.NaN;const e=me();e.initialize(0,s.e,s.f,s.z),e.make_negative=!1;const _=n.atanh_sin_phi-s.e*n.atanh_esin_phi,o=a.atanh_sin_phi-s.e*a.atanh_esin_phi,l=(o*r.x-_*h.x)/(o-_);m<0?(n.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),n.make_negative=!1,i+=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a)):(i+=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),a.make_negative=!0,i-=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a),a.make_negative=!1)}else r.y>=0?i+=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a):(n.make_negative=!0,a.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a),n.make_negative=!1,a.make_negative=!1);r.assign(h)}}}return this.m_a*i*this.m_a}calculate(e){if(e.isEmpty()||e.getDimension()<2)return 0;if(e.getGeometryType()===i.enumEnvelope){const t=new a;return t.addEnvelope(e,!1),this.calculate(t)}return this.m_inputSR!==this.m_inputGCS&&null===this.m_transformPCS2GCS&&(this.m_transformPCS2GCS=o(this.m_inputSR,this.m_inputGCS,null)),this.executePolygonGeodeticArea(e)}}class de{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(e,i,s,n){if(t(e),4===s)return(new ne).execute(e,i,n);return new ge(i,s,n).calculate(e)}}export{de as OperatorGeodeticArea};
5
+ import{a as e,c as t,G as i,d as s,g as n}from"./Geometry.js";import{a,x as _,L as r}from"./MultiPathImpl.js";import{O as h}from"./OperatorDensify.js";import{B as o,O as m,v as l,K as p,A as u,a9 as c,aw as g,a as d,H as E,N as f,ax as P,ay as S,P as A,z as x,w as y,az as R,y as M,E as C}from"./ProjectionTransformation.js";import{P as T,K as w,d as N,k as q,o as b,a as I,E as v,n as $,f as z,c as O,x as D,y as G,z as k}from"./Point2D.js";import{Envelope2D as L}from"./Envelope2D.js";import{c as F,d as J}from"./Envelope.js";import{O as Y}from"./OperatorClip.js";import{O as U}from"./OperatorShapePreservingLength.js";import{b as j,c as X}from"./tslib.es6.js";import{T as B}from"./Transformation2D.js";import{a as H}from"./GeodeticDistanceCalculator-Ce-woMPw.js";class Q{constructor(e,t,i,s,n=100){this.m_startPt=e.clone(),this.m_endPt=t.clone(),this.m_cE2=s,this.m_cE=Math.sqrt(this.m_cE2),this.m_c1By2e=1/(2*this.m_cE),this.m_cRpu=i.getGCS().getUnit().getUnitToBaseFactor(),this.isPcs=2===i.getCoordinateSystemType(),this.PEProjcs=i.getPECoordSys(),this.m_points=N(2*n,Number.NaN)}setSegmentEndPoints(e,t){this.m_startPt.assign(e),this.m_endPt.assign(t)}makeFunctor(){return e=>{const t=[0,0];t[0]=this.m_startPt.x*(1-e)+this.m_endPt.x*e,t[1]=this.m_startPt.y*(1-e)+this.m_endPt.y*e,this.isPcs&&p.projToGeogCenter(this.PEProjcs,1,t,0);const i=Math.sin(t[1]*this.m_cRpu);if(0===this.m_cE2)return i;return-Math.log((1-this.m_cE*i)/(1+this.m_cE*i))*this.m_c1By2e+i/(1-this.m_cE2*i*i)}}}function V(e,t,i){const s=new L;e.queryEnvelope(s);const n=F(t,s,!0).total(),a=t.getPannableExtent();a.xmin=s.xmin-10*n,a.xmax=s.xmax+10*n;const r=(new Y).execute(e,a,t,i).getImpl().querySegmentIterator();r.stripAttributes();const h=l();t.querySpheroidData(h);const o=h.e2,m=0===o?2:1,p=new T(0,0),u=new T(0,0),c=new w(0),g=new Q(p,u,t,o,100);for(;r.nextPath();)for(;r.hasNextSegment();){const e=r.nextSegment();p.assign(e.getStartXY()),u.assign(e.getEndXY()),g.setSegmentEndPoints(p,u);const t=_(6,0,1,1e-12,1e-15,g.makeFunctor());c.pe((u.x-p.x)*t)}const d=h.majorSemiAxis;return m*d*d*(1-o)*Math.PI*c.getResult()/t.getPannableExtent().width()}function Z(e,t,i,s,n){const a=se(e,t,n);let _=K(e,a.first,i,s,n),r=1,h=0,o=0;do{if(r++,a.first*=.5,a.first<50*t.getTolerance(0))return _;a.second*=2,o=K(e,a.first,i,s,n),h=Math.abs(o-_),_=o}while(Math.abs(_)>1&&h>1e-8*Math.abs(_)&&(a.second<65e3&&r<8||r<4));return o}function K(e,t,i,s,n){const a=(new h).execute(e,t,0,0,n);let _;_=s?(new u).execute(a,s,n):a;const r=1===i.getUnit().getUnitToBaseFactor()?Math.PI/180:1,o=new L;_.queryEnvelope(o);const m=new L,l=new L,p=new L;m.setCoords({xmin:o.xmin,ymin:75*r,xmax:o.xmax,ymax:90*r}),l.setCoords({xmin:o.xmin,ymin:-60*r,xmax:o.xmax,ymax:75*r}),p.setCoords({xmin:o.xmin,ymin:-90*r,xmax:o.xmax,ymax:-60*r}),m.inflateCoords(.01*m.width(),0),l.inflateCoords(.01*l.width(),0),p.inflateCoords(.01*p.width(),0);let c=0;return c+=W(_,m,i,n),c+=W(_,l,i,n),c+=W(_,p,i,n),c}function W(e,t,i,s){const n=(new Y).execute(e,t,i,s);if(null!==n&&!n.isEmpty()){const e=new L;n.queryEnvelope(e);const{first:t,second:a}=ie(i,e,!1),_=o(i,t,null),r=(new u).execute(n,_,s).calculateArea2D();return a&&t.destroy(),r}return 0}const ee=[null,null,null,null,null,null,null];function te(e,t,i){const a=e.getUnit().getUnitToBaseFactor(),_=t.getCenter();_.scale(180*a/Math.PI);const r=new T;r.x=0,r.y=0;let h=0;if(0===h){_.y>45?(r.y=b,h=0):_.y<-45?(r.y=-b,h=1):_.x>=45&&_.x<135?(r.x=b,h=2):_.x>=135||_.x<-135?(r.x=b,h=3):_.x<-45&&_.x>=-135?(r.x=-b,h=4):(r.x=0,h=5);const e=a*Math.sqrt(I(t.xmin-t.xmax)+I(t.ymin-t.ymax)),i=r.clone(),s=t.getCenter();s.scale(a),h<2&&(i.x=s.x);if(T.distance(i,s)+.5*e>b)return null}const o=ee[h];if(null!==o&&o.getGCS().equalHorizontal(e))return o;const m=e.getText(),l=r.x,p=r.y,u=0,E=0;let f=0,P=-1;6!==h?P=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:(n(i),f=0,P=c.PE_PRJ_CYLINDRICAL_EQAREA);const S=g("EqualAreaPCS");let A;P===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${E}],PARAMETER["Central_Meridian",${l}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:P===c.PE_PRJ_CYLINDRICAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${E}],PARAMETER["Central_Meridian",${l}],PARAMETER["Standard_Parallel_1",${f}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:s("getEqualAreaPcsFixed");const x=d(A);return ee[h]&&ee[h].destroy(),ee[h]=x,x}function ie(e,t,i){const n=te(e,t,i);if(null!==n)return q(n,!1);const a=e.getText(),_=e.getUnit().getUnitToBaseFactor(),r=(t.xmin+t.width()/2)*_,h=(t.ymin+t.height()/2)*_,o=0,m=0;let l=0,p=0,u=-1;t.ymin*_>=75*Math.PI/180||t.ymax*_<=-60*Math.PI/180?u=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:t.ymin>0||t.ymax<0?(l=(t.ymin+1/3*t.height())*_,p=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_ALBERS):(l=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_CYLINDRICAL_EQAREA);const E=g("EqualAreaPCS");let f;return u===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?f=`PROJCS["${E}",${a},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_ALBERS?f=`PROJCS["${E}",${a},PROJECTION["Albers"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Standard_Parallel_2",${p}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_CYLINDRICAL_EQAREA?f=`PROJCS["${E}",${a},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:s("getEqualAreaPCSInstance"),q(d(f),!0)}function se(e,t,i){const s=e.calculateLength2D(),n=(new U).execute(e,t,i)/25e3,a=s/e.getSegmentCount()*2;let _=Math.min(a,s/n);0===_&&(_=1);return q(_,s/_)}class ne{getOperatorType(){return 10314}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(s,n,_){if(0===n.getCoordinateSystemType()&&e(""),s.isEmpty()||s.getDimension()<2)return 0;if(t(s),s.getGeometryType()===i.enumEnvelope){const e=new a;return e.addEnvelope(s,!1),this.execute(e,n,_)}let r=s;s.getDescription().getAttributeCount()>1&&(r=s.clone(),r.dropAllAttributes());const l=(new h).execute(r,0,n.getTolerance(0),0,_);let p=null;const u=n.getGCS();u!==n&&(p=o(n,u));let c=(new m).execute(l,n,!1,_);return c.isEmpty()?0:(c===s&&(c=s.clone()),n.isPannable()?V(c,n,_):Z(c,n,u,p,_))}}function ae(){return{m_p_PCS:new T,m_factor:Number.NaN,setValues:_e,assign:re}}function _e(e,t){this.m_factor=e,this.m_p_PCS.assign(t)}function re(e){this.m_factor=e.m_factor,this.m_p_PCS.assign(e.m_p_PCS)}class he{constructor(e,t,i,s){this.m_ptStart=new J,this.m_ptEnd=new J,this.m_ptStart.assign(t),this.m_ptEnd.assign(i),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y,this.m_e=Math.sqrt(e),this.m_e2=e,this.m_c1MinusE2=1-e;const n=Math.sin(s);let a;a=0===this.m_e2?2*n:n*(G(this.m_e*n)+1/(1-this.m_e2*n*n)),this.m_baseA=a}setSegmentEndPoints(e,t){this.m_ptStart.assign(e),this.m_ptEnd.assign(t),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y}makeFunctor(){return e=>{const t=1-e,i=t*this.m_ptStart.x+e*this.m_ptEnd.x,s=t*this.m_ptStart.y+e*this.m_ptEnd.y,n=t*this.m_ptStart.z+e*this.m_ptEnd.z,a=i*i+s*s,_=n/Math.sqrt(n*n+this.m_c1MinusE2*this.m_c1MinusE2*a);let r;if(0===this.m_e2)r=2*_;else{r=_*(G(this.m_e*_)+1/(1-this.m_e2*_*_))}return(this.m_deltaY*i-this.m_deltaX*s)/a*(r-this.m_baseA)}}}function oe(){return{e:Number.NaN,one_p_e:Number.NaN,one_m_e:Number.NaN,one_m_e_2:Number.NaN,atanh_e_over_e:Number.NaN,half_qp:Number.NaN,f:Number.NaN,z:Number.NaN}}function me(){return{sin_phi:Number.NaN,one_p_sin_phi:Number.NaN,one_m_sin_phi:Number.NaN,one_m_e_2_sin_2_phi:Number.NaN,sin_half_phi_pf:Number.NaN,sin_half_phi_pz:Number.NaN,sin_half_asin_e_sin_phi_pf:Number.NaN,sin_half_asin_e_sin_phi_pz:Number.NaN,atanh_sin_phi:Number.NaN,atanh_esin_phi:Number.NaN,make_negative:!1,initialize:le,changeSign:pe,assign:ue,clone:ce}}function le(e,t,i,s){const n=.5*e;this.sin_phi=Math.sin(e);const a=t*this.sin_phi,_=.5*Math.asin(a);this.one_p_sin_phi=1+this.sin_phi,this.one_m_sin_phi=1-this.sin_phi,this.one_m_e_2_sin_2_phi=(1+a)*(1-a),this.sin_half_phi_pf=Math.sin(n+i),this.sin_half_phi_pz=Math.sin(n+s),this.sin_half_asin_e_sin_phi_pf=Math.sin(_+i),this.sin_half_asin_e_sin_phi_pz=Math.sin(_+s),this.atanh_sin_phi=Math.log(this.sin_half_phi_pf/this.sin_half_phi_pz),this.atanh_esin_phi=Math.log(this.sin_half_asin_e_sin_phi_pf/this.sin_half_asin_e_sin_phi_pz)}function pe(){this.sin_phi=-this.sin_phi;let e=this.one_p_sin_phi;this.one_p_sin_phi=this.one_m_sin_phi,this.one_m_sin_phi=e,e=this.sin_half_phi_pf,this.sin_half_phi_pf=this.sin_half_phi_pz,this.sin_half_phi_pz=e,e=this.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pf=this.sin_half_asin_e_sin_phi_pz,this.sin_half_asin_e_sin_phi_pz=e,this.atanh_sin_phi=-this.atanh_sin_phi,this.atanh_esin_phi=-this.atanh_esin_phi}function ue(e){this.sin_phi=e.sin_phi,this.one_p_sin_phi=e.one_p_sin_phi,this.one_m_sin_phi=e.one_m_sin_phi,this.one_m_e_2_sin_2_phi=e.one_m_e_2_sin_2_phi,this.sin_half_phi_pf=e.sin_half_phi_pf,this.sin_half_phi_pz=e.sin_half_phi_pz,this.sin_half_asin_e_sin_phi_pf=e.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pz=e.sin_half_asin_e_sin_phi_pz,this.atanh_sin_phi=e.atanh_sin_phi,this.atanh_esin_phi=e.atanh_esin_phi,this.make_negative=e.make_negative}function ce(){return{...this}}class ge{constructor(t,i,s){this.m_transformPCS2GCS=null,this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_progressTracker=s,n(4!==i),this.m_curveType=i,this.m_inputSR=t,t&&0!==t.getCoordinateSystemType()||e(""),this.m_inputGCS=t.getGCS(),this.m_a=0,this.m_eSquared=0,this.m_b=0,this.m_rpu=0}executePolygonGeodeticArea(e){let t,i=e.clone();if(i.dropAllAttributes(),e.hasNonLinearSegments()){i=(new h).execute(i,0,this.m_inputSR.getTolerance(0),0,this.m_progressTracker)}if(this.m_inputSR.isPannable()){const e=new L;i.queryEnvelope(e);const t=this.m_inputSR.getPannableExtent();if(!t.containsEnvelope(e)){const s=t.getCenterX()-e.getCenterX(),n=new B;n.setShiftCoords(s,0),i.applyTransformation(n),e.move(s,0);const a=new v;t.queryIntervalX(a);const _=new v;e.queryIntervalX(_),i=a.contains(_)?E(i,this.m_inputSR):(new u).foldInto360RangeGeodetic(i,this.m_inputSR,this.m_curveType)}}if(this.m_transformPCS2GCS?(i=(new m).execute(i,this.m_inputSR,!1,this.m_progressTracker),t=i.createInstance(),f(this.m_transformPCS2GCS,i,t,this.m_progressTracker)||(t=(new u).execute(i,this.m_transformPCS2GCS,this.m_progressTracker))):t=(new m).execute(i,this.m_inputGCS,!1,this.m_progressTracker),t.isEmpty())return 0;if(1===this.m_curveType){const e=l();return this.m_inputGCS.querySpheroidData(e),this.m_a=e.majorSemiAxis,this.m_eSquared=e.e2,this.loxodromeArea(t)}const s=t.getImpl();this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_scaleToRadians.setScale(this.m_rpu),s.applyTransformation(this.m_scaleToRadians),this.m_scaleToDegrees=this.m_scaleToRadians,this.m_scaleToDegrees.invertThis();const n=l();if(this.m_inputGCS.querySpheroidData(n),this.m_a=n.majorSemiAxis,this.m_b=n.minorSemiAxis,this.m_eSquared=n.e2,2===this.m_curveType)return this.executeClippedPolygonGreatEllipticArea(t);{const e={stack:[],error:void 0,hasError:!1};try{const i=P.unit(9101),s=this.m_inputGCS.getPECoordSys(),n=j(e,s.cloneAlterUnits(i),!1);let a,_,r=this.executeClippedPolygonGeodeticArea(t,n,0),h=0;do{h++,a=this.executeClippedPolygonGeodeticArea(t,n,h),_=Math.abs(a-r),r=a}while(Math.abs(a)>1&&_>1e-8*Math.abs(a)&&h<7);return a}catch(a){e.error=a,e.hasError=!0}finally{X(e)}}}executeClippedPolygonGeodeticArea(e,t,i){const s={stack:[],error:void 0,hasError:!1};try{const n=new L;e.queryEnvelope(n);const a=j(s,this.getEqualAreaPCSInstance(t,n),!1),_=e.clone();S(a,_);const r=50,h=_.getImpl().getAttributeStreamRef(0),o=e.getImpl().getAttributeStreamRef(0),m=j(s,new A,!1),l=j(s,new A,!1),u=40,c=[0,0],g=$(ae,u),d=N(u,-1),E=ae(),f=ae();let P,y;const R=a;let M=_.calculateArea2D();const C=new w(0),q=.5*Math.PI,b=1e-10*Math.abs(M)+1e-6,I=e.getPathCount();let v,O,D,G;const k=new T,F=new T,J=new T,Y=new T,U=new T,X=new T;let B,H;for(O=e.getPathStart(0),v=0;v<I;v++,O=D)for(D=e.getPathEnd(v),h.queryPoint2D(D-1<<1,J),o.queryPoint2D(D-1<<1,k),Math.abs(k.y)>q&&(k.y=z(q,k.y)),G=O;G<D;G++,J.assign(Y),k.assign(F)){if(h.queryPoint2D(G<<1,Y),o.queryPoint2D(G<<1,F),Math.abs(F.y)>q&&(F.y=z(q,F.y)),B=T.distance(J,Y),B<r||0===k.y&&0===F.y)continue;x.geodeticDistance(this.m_a,this.m_eSquared,k.x,k.y,F.x,F.y,m,l,null,this.m_curveType);const e=m.val,t=l.val;for(E.setValues(0,J),f.setValues(1,Y),y=i,g[0].assign(f),d[0]=i,P=0;P>=0;){H=.5*(E.m_factor+f.m_factor),x.geodeticCoordinate(this.m_a,this.m_eSquared,k.x,k.y,e*H,t,m,l,this.m_curveType),U.x=m.val,U.y=l.val,c[0]=U.x,c[1]=U.y,p.geogToProj(R,1,c),X.x=c[0],X.y=c[1];const i=-X.offset(E.m_p_PCS,f.m_p_PCS),s=.5*i*T.distance(E.m_p_PCS,f.m_p_PCS);if(C.pe(s),Math.abs(s)>b||Math.abs(s)>0&&y>0)f.setValues(H,X),P++,g[P].assign(f),Math.abs(s)<=b?(y--,d[P-1]=y,d[P]=y):(y=d[P-1],d[P]=y);else{if(P<=0)break;E.assign(f),P--,f.assign(g[P]),y=d[P]}}}return M+=C.getResult(),Math.abs(M)}catch(n){s.error=n,s.hasError=!0}finally{X(s)}}executeClippedPolygonGreatEllipticArea(e){const t=[],i=[],s=new T,n=new T,a=y(1,this.m_eSquared,new T(0,.5*Math.PI)),_=new w(0),r=new w(0),h=new w(0),o=new J,m=new J,l=new L;e.queryLooseEnvelope(l);let p=0;l.containsCoords(l.xmin,0)||(p=Math.abs(l.ymin)<Math.abs(l.ymax)?l.ymin:l.ymax);const u=new he(this.m_eSquared,o,m,p),c=this.m_a*this.m_a,g=e.getImpl().querySegmentIterator();for(g.stripAttributes();g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();s.assign(e.getStartXY()),n.assign(e.getEndXY()),n.x-s.x>Math.PI?s.x+=2*Math.PI:n.x-s.x<-Math.PI&&(n.x+=2*Math.PI),this.splitSegmentCrossingItegralThreshold(e,t,i);for(let i of t)o.assign(y(this.m_a,this.m_eSquared,i.getStartXY())),m.assign(y(this.m_a,this.m_eSquared,i.getEndXY())),u.setSegmentEndPoints(o,m),this.adaptiveIntegrationWithRomberg(u,_);for(let t of i){let e=t.getStartXY(),i=t.getEndXY(),s=p;e.y<0&&(i=O(e,e=i),e.y=-e.y,i.y=-i.y,s=-s);const n=y(1,this.m_eSquared,e),_=y(1,this.m_eSquared,i),o=Math.min(e.y,i.y),m=R(this.m_eSquared,e.x,i.x,s,o);r.pe(m);const l=Math.abs(R(this.m_eSquared,e.x,i.x,o,b)),u=new J;u.setSub(n,a);const g=new J;g.setSub(_,a);const d=new J;d.setCrossProductVector(u,g);let E=c*(l-.5*d.length());E=z(E,i.x-e.x),h.pe(E)}t.length=0,i.length=0}return h.getResult()+c*(.5*(1-this.m_eSquared)*_.getResult()+r.getResult())}getEqualAreaPCSInstance(e,t){const i=t.getCenterX(),s=0,n=0;let a,_;const r=t.height();let h,o;(h=t.ymin>45*Math.PI/180||t.ymax<45*-Math.PI/180)?a=z(.5*Math.PI,t.getCenterY()):(a=t.getCenterY(),_=t.ymin+r*(2/3));const m=g("EqualAreaPCS"),l=e.toString();return o=h?P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}], PARAMETER["Latitude_of_Origin", ${a}], UNIT["Meter",1.0]]`):P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting", ${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}],PARAMETER["Standard_Parallel_1", ${_}],PARAMETER["Latitude_of_Origin", ${a}],UNIT["Meter",1.0]]`),o}splitSegmentCrossingItegralThreshold(e,t,i){const s=100,n=20,a=n*n,_=y(this.m_a,this.m_eSquared,new T(0,b)),h=y(this.m_a,this.m_eSquared,new T(0,-b)),o=this.splitSegmentPassingThroughPole(e);for(let m of o){const e=m.getStartXY(),o=m.getEndXY(),l=y(this.m_a,this.m_eSquared,e),p=y(this.m_a,this.m_eSquared,o),u=new T,c=new J;let g=J.sqrDistance(_,l),d=J.sqrDistance(l,p);if(g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),g=J.sqrDistance(_,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,l),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}t.push(new r({start:e,end:o}))}}splitSegmentPassingThroughPole(e){const t={stack:[],error:void 0,hasError:!1};try{const i=[],s=new J,n=new J,a=new J,_=new T,h=20,o=3.124139361,m=10,l=e.getStartXY(),p=e.getEndXY(),u=j(t,new A,!1);if(x.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,p.x,p.y,u,null,null,2),Math.abs(p.x-l.x)>o&&u.val>h){const e=new H(new T(0,90),l.divide(this.m_rpu),p.divide(this.m_rpu),this.m_inputGCS,2,2);let t=C(e.makeFunctor(),0,1,1e-10);if(t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i;if(e.setPointDistFrom(new T(0,-90)),t=C(e.makeFunctor(),0,1,1e-10),t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i}return i.push(new r({start:l,end:p})),i}catch(i){t.error=i,t.hasError=!0}finally{X(t)}}adaptiveIntegrationWithRomberg(e,t){const i=e.makeFunctor();let s=0,n=1,a=i(s),r=i(n);const h=1e-17,o=1e-14;let m=(s+n)/2,l=i(m),p=Math.abs(l-a),u=Math.abs(r-l),c=0;for(;c++<32&&(p/u<.1||u/p<.1);)p<u?(t.pe(_(5,s,m,o,h,i)),s=m,a=l):(t.pe(_(5,m,n,o,h,i)),n=m,r=l),m=(s+n)/2,l=Math.abs(i(m)),p=Math.abs(l-a),u=Math.abs(r-l);t.pe(_(5,s,n,o,h,i))}loxodromeAreaHemi(e,t,i,s,n){const a=i.clone(),_=n.clone();let r,h,o,m,l,p,u,c,g,d,E,f,P,S,A,x;return a.make_negative&&a.changeSign(),_.make_negative&&_.changeSign(),E=s-t,1===Math.abs(a.sin_phi)||1===Math.abs(_.sin_phi)?e.half_qp*E:a.sin_phi===_.sin_phi?(d=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi))*E,d):(A=Math.log(_.sin_half_phi_pf*a.sin_half_phi_pz/(_.sin_half_phi_pz*a.sin_half_phi_pf)),x=Math.log(_.sin_half_asin_e_sin_phi_pf*a.sin_half_asin_e_sin_phi_pz/(_.sin_half_asin_e_sin_phi_pz*a.sin_half_asin_e_sin_phi_pf)),1===this.m_eSquared?(l=0,r=.5*(A+_.sin_phi/_.one_m_e_2_sin_2_phi-a.sin_phi/a.one_m_e_2_sin_2_phi),h=0):(l=-2*e.atanh_e_over_e*(Math.log(_.one_p_sin_phi/a.one_p_sin_phi)-e.e*x),r=(A-e.e*x)/e.one_m_e_2,h=(Math.log(_.one_m_e_2_sin_2_phi/a.one_m_e_2_sin_2_phi)+l/e.atanh_e_over_e)/e.one_m_e_2),o=-x*(a.atanh_esin_phi+_.atanh_esin_phi),m=1/a.one_m_e_2_sin_2_phi-1/_.one_m_e_2_sin_2_phi,p=k(_.one_m_sin_phi/e.one_p_e,e.e)-k(a.one_m_sin_phi/e.one_p_e,e.e),u=k(_.one_p_sin_phi/e.one_p_e,e.e)-k(a.one_p_sin_phi/e.one_p_e,e.e),c=k(a.one_m_sin_phi/-e.one_m_e,e.e)-k(_.one_m_sin_phi/-e.one_m_e,e.e),g=k(a.one_p_sin_phi/-e.one_m_e,e.e)-k(_.one_p_sin_phi/-e.one_m_e,e.e),d=.25/r*(h+o+m+l+.5*(p+u+c+g)),d+=e.half_qp,f=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi)),P=.5*e.one_m_e_2*_.sin_phi*(1/_.one_m_e_2_sin_2_phi+G(e.e*_.sin_phi)),P<f&&(S=f,f=P,P=S),d<f&&(d=f),d>P&&(d=P),d*=E,d)}loxodromeArea(e){const t=Math.PI/180;let i=0;const s=oe(),n=me(),a=me();s.e=Math.sqrt(this.m_eSquared),s.one_p_e=1+s.e,s.one_m_e=1-s.e,s.one_m_e_2=1-this.m_eSquared,s.atanh_e_over_e=G(s.e),this.m_eSquared>=1?s.half_qp=1:s.half_qp=.5*(1+s.atanh_e_over_e*s.one_m_e_2),s.f=.25*Math.PI,s.z=.75*Math.PI,a.initialize(0,s.e,s.f,s.z);const _=e.getPathCount(),r=new T,h=new T,o=e.getImpl().getAttributeStreamRef(0);for(let m=0;m<_;m++){const _=e.getPathStart(m),l=e.getPathEnd(m);if(!(l-_<=1)){o.queryPoint2D(2*(l-1),r);for(let e=_;e<l;e++){o.queryPoint2D(2*e,h);const m=r.y*t,l=h.y*t;if(e===_?(n.initialize(m,s.e,s.f,s.z),n.make_negative=!1):n.assign(a),a.initialize(l,s.e,s.f,s.z),a.make_negative=!1,r.y*h.y<0){if(r.y>=90&&h.y<=-90||h.y>=90&&r.y<=-90)return Number.NaN;const e=me();e.initialize(0,s.e,s.f,s.z),e.make_negative=!1;const _=n.atanh_sin_phi-s.e*n.atanh_esin_phi,o=a.atanh_sin_phi-s.e*a.atanh_esin_phi,l=(o*r.x-_*h.x)/(o-_);m<0?(n.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),n.make_negative=!1,i+=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a)):(i+=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),a.make_negative=!0,i-=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a),a.make_negative=!1)}else r.y>=0?i+=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a):(n.make_negative=!0,a.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a),n.make_negative=!1,a.make_negative=!1);r.assign(h)}}}return this.m_a*i*this.m_a}calculate(e){if(e.isEmpty()||e.getDimension()<2)return 0;if(e.getGeometryType()===i.enumEnvelope){const t=new a;return t.addEnvelope(e,!1),this.calculate(t)}return this.m_inputSR!==this.m_inputGCS&&null===this.m_transformPCS2GCS&&(this.m_transformPCS2GCS=o(this.m_inputSR,this.m_inputGCS,null)),this.executePolygonGeodeticArea(e)}}class de{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(e,i,s,n){if(t(e),4===s)return(new ne).execute(e,i,n);return new ge(i,s,n).calculate(e)}}export{de as OperatorGeodeticArea};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{b as e,c as r}from"./tslib.es6.js";import{a as t,c as o}from"./Geometry.js";import{G as s,m as a}from"./GeodeticDistanceCalculator-CcF1gMZX.js";class u{getOperatorType(){return 10316}supportsCurves(){return!0}accelerateGeometry(e,r,t){return!1}canAccelerateGeometry(e){return!1}execute(e,r,t,o,s){return this.executeEx(e,r,t,o,s,null,null,Number.NaN)}executeEx(u,c,n,i,m,l,p,y){const N={stack:[],error:void 0,hasError:!1};try{if(0===n.getCoordinateSystemType()&&t(""),o(u),o(c),u.isEmpty()||c.isEmpty())return Number.NaN;Number.isNaN(y)&&(y=Number.MAX_VALUE);const r=e(N,new s(n,i,m,y,1),!1),E=a(),b=a(),x=r.calculate(u,c,E,b);return l&&l.outPoint.assign(E.outPoint),p&&p.outPoint.assign(b.outPoint),x}catch(E){N.error=E,N.hasError=!0}finally{r(N)}}}export{u as OperatorGeodeticDistance,a as makeOutput};
5
+ import{b as e,c as r}from"./tslib.es6.js";import{a as t,c as o}from"./Geometry.js";import{G as s,m as a}from"./GeodeticDistanceCalculator-Ce-woMPw.js";class u{getOperatorType(){return 10316}supportsCurves(){return!0}accelerateGeometry(e,r,t){return!1}canAccelerateGeometry(e){return!1}execute(e,r,t,o,s){return this.executeEx(e,r,t,o,s,null,null,Number.NaN)}executeEx(u,n,c,i,m,l,p,y){const N={stack:[],error:void 0,hasError:!1};try{if(0===c.getCoordinateSystemType()&&t(""),o(u),o(n),u.isEmpty()||n.isEmpty())return Number.NaN;Number.isNaN(y)&&(y=Number.MAX_VALUE);const r=e(N,new s(c,i,m,y,1),!1),E=a(),b=a(),x=r.calculate(u,n,E,b);return l&&l.outPoint.assign(E.outPoint),p&&p.outPoint.assign(b.outPoint),x}catch(E){N.error=E,N.hasError=!0}finally{r(N)}}}export{u as OperatorGeodeticDistance,a as makeOutput};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{b as e,c as t}from"./tslib.es6.js";import{a as r,c as n,G as o,f as a}from"./Geometry.js";import{O as s}from"./OperatorShapePreservingLength.js";import{c as i,P as c}from"./QuadraticBezier.js";import{E as m}from"./Point2D.js";import{v as u,H as g,M as l,N as p,A as f,P as y,z as x}from"./ProjectionTransformation.js";import{O as h}from"./OperatorDensify.js";class P{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}execute(e,t,y,x){if(4===y)return(new s).execute(e,t,x);if(0===t.getCoordinateSystemType()&&r(""),n(e),e.isEmpty()||e.getDimension()<1)return 0;const P=t.getGCS(),S=u();P.querySpheroidData(S);const d=S.majorSemiAxis,j=S.e2,E=P.getUnit().getUnitToBaseFactor();let G;const v=e.getGeometryType();if(v===o.enumPolygon?G=e.getBoundary():v===o.enumEnvelope?G=i(e):a(v)?(G=new c({vd:e.getDescription()}),G.addSegment(e,!0)):G=e,G.hasNonLinearSegments()){G=(new h).execute(G,0,t.getTolerance(0),0,x)}if(P!==t){const r=t.getSRToGCSTransform();if(t.isPannable()){G=g(G,t),v===o.enumPolyline&&G===e&&(G=e.clone());const r=new m;t.getPannableExtent().queryIntervalX(r);for(let e=0,t=G.getPointCount();e<t;e++){const t=G.getXY(e);t.x=l(t.x,r),G.setXY(e,t)}}const n=G.createInstance();G=p(r,G,n,x)?n:(new f).execute(G,r,x)}return this._ExecuteMultiPathGeodeticLength(G,y,d,j,E)}_ExecuteMultiPathGeodeticLength(r,n,o,a,s){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,new y,!1);let c=0;const m=r.querySegmentIterator();for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment(),r=e.getStartXY(),i=e.getEndXY();r.scale(s),i.scale(s),x.geodeticDistance(o,a,r.x,r.y,i.x,i.y,t,null,null,n),c+=t.val}return c}catch(c){i.error=c,i.hasError=!0}finally{t(i)}}}export{P as OperatorGeodeticLength};
5
+ import{b as e,c as t}from"./tslib.es6.js";import{a as r,c as n,G as o,f as s}from"./Geometry.js";import{O as a}from"./OperatorShapePreservingLength.js";import{c as i,P as c}from"./MultiPathImpl.js";import{E as m}from"./Point2D.js";import{v as l,H as u,M as g,N as p,A as f,P as y,z as x}from"./ProjectionTransformation.js";import{O as h}from"./OperatorDensify.js";class P{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}execute(e,t,y,x){if(4===y)return(new a).execute(e,t,x);if(0===t.getCoordinateSystemType()&&r(""),n(e),e.isEmpty()||e.getDimension()<1)return 0;const P=t.getGCS(),S=l();P.querySpheroidData(S);const d=S.majorSemiAxis,j=S.e2,E=P.getUnit().getUnitToBaseFactor();let G;const v=e.getGeometryType();if(v===o.enumPolygon?G=e.getBoundary():v===o.enumEnvelope?G=i(e):s(v)?(G=new c({vd:e.getDescription()}),G.addSegment(e,!0)):G=e,G.hasNonLinearSegments()){G=(new h).execute(G,0,t.getTolerance(0),0,x)}if(P!==t){const r=t.getSRToGCSTransform();if(t.isPannable()){G=u(G,t),v===o.enumPolyline&&G===e&&(G=e.clone());const r=new m;t.getPannableExtent().queryIntervalX(r);for(let e=0,t=G.getPointCount();e<t;e++){const t=G.getXY(e);t.x=g(t.x,r),G.setXY(e,t)}}const n=G.createInstance();G=p(r,G,n,x)?n:(new f).execute(G,r,x)}return this._ExecuteMultiPathGeodeticLength(G,y,d,j,E)}_ExecuteMultiPathGeodeticLength(r,n,o,s,a){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,new y,!1);let c=0;const m=r.querySegmentIterator();for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment(),r=e.getStartXY(),i=e.getEndXY();r.scale(a),i.scale(a),x.geodeticDistance(o,s,r.x,r.y,i.x,i.y,t,null,null,n),c+=t.val}return c}catch(c){i.error=c,i.hasError=!0}finally{t(i)}}}export{P as OperatorGeodeticLength};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{G as e}from"./SimpleGeometryCursor.js";import{E as t,n as s,a as r}from"./QuadraticBezier.js";import{c as n,G as o,g as a,a as i}from"./Geometry.js";import{Envelope2D as m}from"./Envelope2D.js";import{i as l,b as g,P as h}from"./Envelope.js";import{O as u,m as c,q as p,t as P,C as y,u as _}from"./ProjectionTransformation.js";class d{getOperatorType(){return 10700}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}executeMany(e,t,s,r=1){return new I(e,t,s,r)}}class I extends e{constructor(e,t,s,r){super(),this.m_progressTracker=s,this.m_inputGeoms=e,this.m_spatialReference=t,this.m_currentGeometry=null,this.m_singlePartIndex=-1,this.m_singlePartCount=-1,this.m_polygonStart=-1,this.m_index=-1,this.m_options=r}tock(){return!0}getRank(){return 1}next(){if(this.m_singlePartIndex===this.m_singlePartCount){const e=this.m_inputGeoms.next();if(null===e)return null;if(n(e),e.getGeometryType()===o.enumPolygon)if(1===this.m_options)this.m_currentGeometry=(new u).execute(e,this.m_spatialReference,!1,this.m_progressTracker);else if(2===this.m_options)if(e.getPathCount()<2)this.m_currentGeometry=e;else{const n=[0],o=e.getImpl().getIsSimple(0,n);if(l(o))this.m_currentGeometry=e;else{const n=new t,o=n.addGeometry(e);let i=null;if(n.hasCurves()){i=new y;const t=new m;e.queryEnvelope(t);const s=g(null,e,!0),r=c(s.total(),t);p(n,r,s.total(),12e3,null,i,null,this.m_progressTracker)}const l=n.createPathUserIndex();{let e=0;for(let t=n.getFirstPath(o);t!==s;t=n.getNextPath(t))n.setPathUserIndex(t,l,e++)}const h=P(n,o,this.m_progressTracker);a(h>=0);const u=[];for(let e=n.getFirstPath(o);e!==s;e=n.getNextPath(e))u.push(e);u.sort(((e,t)=>Math.abs(n.getPathUserIndex(e,h))-Math.abs(n.getPathUserIndex(t,h))));const _=e,d=new r({vd:e.getDescription()});d.reserveParts(_.getPointCount(),_.getPathCount());for(let e=0,t=u.length;e<t;e++){const t=u[e],s=n.getPathUserIndex(t,l),r=_.calculateRingArea2D(s)>0,o=n.getPathUserIndex(t,h)>=0;d.addPath(_,s,r===o)}this.m_currentGeometry=d}}else i("");else this.m_currentGeometry=e;this.m_singlePartCount=f(this.m_currentGeometry),this.m_singlePartIndex=0,this.m_polygonStart=0,this.m_index=this.m_inputGeoms.getGeometryID()}const e=this.getSingleGeometry(this.m_singlePartIndex,this.m_singlePartCount,this.m_polygonStart,this.m_currentGeometry);return e.getGeometryType()===o.enumPolygon&&(this.m_polygonStart+=e.getPathCount()),this.m_singlePartIndex++,e}getGeometryID(){return this.m_index}getSingleGeometry(e,t,s,r){let n=null;switch(r.getGeometryType()){case o.enumMultiPoint:n=new h({vd:r.getDescription()}),r.isEmpty()||r.getPointByVal(e,n);break;case o.enumPolyline:if(1===t)n=r;else{n=r.createInstance(),n.getImpl().addPath(r.getImpl(),e,!0);const t=[0],s=r.getImpl().getIsSimple(0,t);n.getImpl().setIsSimple(s,t[0],!0)}break;case o.enumPolygon:if(1===t)n=r;else{n=r.createInstance();const e=n.getImpl(),t=r.getImpl(),o=t.getPathFlagsStreamRef();let a=s;const i=t.getPathCount();do{e.addPath(t,a,!0),a++}while(a<i&&!(8&o.read(a)));e.getPathFlagsStreamRef().setBits(0,8);const m=[0],l=t.getIsSimple(0,m);e.setIsSimple(l,m[0],!0)}break;default:n=r}return n}}function f(e){return e.isEmpty()?1:_(e)}export{d as O};
5
+ import{G as e}from"./SimpleGeometryCursor.js";import{E as t,n as s,a as r}from"./MultiPathImpl.js";import{c as n,G as o,g as a,a as i}from"./Geometry.js";import{Envelope2D as m}from"./Envelope2D.js";import{i as l,b as g,P as h}from"./Envelope.js";import{O as u,m as c,q as p,t as P,C as y,u as _}from"./ProjectionTransformation.js";class d{getOperatorType(){return 10700}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}executeMany(e,t,s,r=1){return new I(e,t,s,r)}}class I extends e{constructor(e,t,s,r){super(),this.m_progressTracker=s,this.m_inputGeoms=e,this.m_spatialReference=t,this.m_currentGeometry=null,this.m_singlePartIndex=-1,this.m_singlePartCount=-1,this.m_polygonStart=-1,this.m_index=-1,this.m_options=r}tock(){return!0}getRank(){return 1}next(){if(this.m_singlePartIndex===this.m_singlePartCount){const e=this.m_inputGeoms.next();if(null===e)return null;if(n(e),e.getGeometryType()===o.enumPolygon)if(1===this.m_options)this.m_currentGeometry=(new u).execute(e,this.m_spatialReference,!1,this.m_progressTracker);else if(2===this.m_options)if(e.getPathCount()<2)this.m_currentGeometry=e;else{const n=[0],o=e.getImpl().getIsSimple(0,n);if(l(o))this.m_currentGeometry=e;else{const n=new t,o=n.addGeometry(e);let i=null;if(n.hasCurves()){i=new y;const t=new m;e.queryEnvelope(t);const s=g(null,e,!0),r=c(s.total(),t);p(n,r,s.total(),12e3,null,i,null,this.m_progressTracker)}const l=n.createPathUserIndex();{let e=0;for(let t=n.getFirstPath(o);t!==s;t=n.getNextPath(t))n.setPathUserIndex(t,l,e++)}const h=P(n,o,this.m_progressTracker);a(h>=0);const u=[];for(let e=n.getFirstPath(o);e!==s;e=n.getNextPath(e))u.push(e);u.sort(((e,t)=>Math.abs(n.getPathUserIndex(e,h))-Math.abs(n.getPathUserIndex(t,h))));const _=e,d=new r({vd:e.getDescription()});d.reserveParts(_.getPointCount(),_.getPathCount());for(let e=0,t=u.length;e<t;e++){const t=u[e],s=n.getPathUserIndex(t,l),r=_.calculateRingArea2D(s)>0,o=n.getPathUserIndex(t,h)>=0;d.addPath(_,s,r===o)}this.m_currentGeometry=d}}else i("");else this.m_currentGeometry=e;this.m_singlePartCount=f(this.m_currentGeometry),this.m_singlePartIndex=0,this.m_polygonStart=0,this.m_index=this.m_inputGeoms.getGeometryID()}const e=this.getSingleGeometry(this.m_singlePartIndex,this.m_singlePartCount,this.m_polygonStart,this.m_currentGeometry);return e.getGeometryType()===o.enumPolygon&&(this.m_polygonStart+=e.getPathCount()),this.m_singlePartIndex++,e}getGeometryID(){return this.m_index}getSingleGeometry(e,t,s,r){let n=null;switch(r.getGeometryType()){case o.enumMultiPoint:n=new h({vd:r.getDescription()}),r.isEmpty()||r.getPointByVal(e,n);break;case o.enumPolyline:if(1===t)n=r;else{n=r.createInstance(),n.getImpl().addPath(r.getImpl(),e,!0);const t=[0],s=r.getImpl().getIsSimple(0,t);n.getImpl().setIsSimple(s,t[0],!0)}break;case o.enumPolygon:if(1===t)n=r;else{n=r.createInstance();const e=n.getImpl(),t=r.getImpl(),o=t.getPathFlagsStreamRef();let a=s;const i=t.getPathCount();do{e.addPath(t,a,!0),a++}while(a<i&&!(8&o.read(a)));e.getPathFlagsStreamRef().setBits(0,8);const m=[0],l=t.getIsSimple(0,m);e.setIsSimple(l,m[0],!0)}break;default:n=r}return n}}function f(e){return e.isEmpty()?1:_(e)}export{d as O};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{b as e,c as t}from"./tslib.es6.js";import{a as n,G as s,h as o,t as r,d as i,g as a}from"./Geometry.js";import{m as c,a as m,c as l}from"./SideCalculator2D-BNwb5gvz.js";import{a as u,b as g,S as f,s as y}from"./QuadraticBezier.js";import{P as S,d,c as N,m as x}from"./Point2D.js";import{P as h,d as p}from"./Envelope.js";import{G as A}from"./SimpleGeometryCursor.js";import{A as C,b as P,F as w,v as E,w as _,a2 as T,a3 as j,a4 as G,y as I,a5 as D,a6 as v,a7 as b,P as R,z as U,a8 as q,a9 as B}from"./ProjectionTransformation.js";import{O as F}from"./OperatorShapePreservingDensify.js";class V{getOperatorType(){return 10501}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}getNearestCoordinate(e,t,y,d,N,x){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();if(Number.isNaN(d)&&(d=0),d>=0||n("maxDeviationMeters"),0===e.getDimension())return this.getNearestVertex(e,t,y);const A=e.getGeometryType();if(A===s.enumGeometryCollection){const n=e;let s=c();for(let e=0,o=n.getGeometryCount();e<o;++e){const o=n.getGeometry(e),r=this.getNearestCoordinate(o,t,y,d,N,x);if(!r.isEmpty()){if(0===r.m_distance)return r;r.m_distance>=s.m_distance||(s=r,s.m_geometryIndex=e)}}return s}if(A===s.enumEnvelope){const n=new u;return n.addEnvelope(e,!1),this.getNearestCoordinate(n,t,y,d,N,x)}o(A)||r("Operation is not implemented for this geometry type");const D=e;if((N||x)&&A===s.enumPolygon){const n=()=>{const e=m(t,-1,0);return e.m_bRightSide=!0,e};if(y.isPannable()){const s=(new C).foldInto360Range(new h(t),y);if(s.isEmpty())return c();const o=(new C).foldInto360Range(e,y);if(o.isEmpty())return c();if((new P).execute(o,s,y,null)&&N)return n()}else{const e=(new C).clipToSpatialReference(new h(t),y,null,1);if(e.isEmpty())return c();const s=w(D,y,0,null);if(s.isEmpty())return c();if((new P).execute(s,e,y,null)&&N)return n()}}const v=y!==y.getGCS()?y.getSRToGCSTransform():null,b=new S;if(v?(new C).transform(v,[t],1,[b],!1):b.assign(t),b.isNAN())return c();const R=k(D,t,y,1);let U=R.m_distance;if(0===U)return R;Number.isNaN(U)?U=Number.POSITIVE_INFINITY:U*=1+1e-7;const q=y.getGCS(),B=q.getUnit().getUnitToBaseFactor(),V=b.clone();V.scale(B);const Y=E();y.querySpheroidData(Y);const X=_(Y.majorSemiAxis,Y.e2,V),L=T(Y.majorSemiAxis,Y.e2),z=new M(D.querySegmentIterator());0===d&&(d=.01);const Q=Y.majorSemiAxis*g(45),H=(new F).executeMany(z,y,Q,d,0,null),J=[];let K=-1;const W=new p,Z=new f;for(let n=H.next();null!==n;n=H.next()){if(n.isEmpty())continue;const t=H.getGeometryID(),s=e.getPathIndexFromPointIndex(t);e.isClosedPath(s)&&D.getPathEnd(s);const o=n;for(let e=0,n=o.getPathCount();e<n;++e){J.length=0;for(let t=o.getPathStart(e),r=o.getPathEnd(e);t<r;++t)J.push(o.getXY(t));if(v&&(new C).transform(v,J,J.length,J,!1),J.length>3){const e=O(J,J.length,b,q,1);if(e.m_distance<U){U=e.m_distance,W.assign(_(Y.majorSemiAxis,Y.e2,e.m_coordinate.mul(B))),K=t;let n=e.m_vertexIndex;n+1===J.length&&(n-=1),o.getSegmentBuffer(n,Z,!0)}}J.forEach((e=>e.mulThis(B)));const n=_(Y.majorSemiAxis,Y.e2,J[0]),s=new p;for(let e=1,r=J.length;e<r;++e){const r=_(Y.majorSemiAxis,Y.e2,J[e]);if(j(L,X,n,r,s)<U){const{second:s}=G(Y.majorSemiAxis,Y.e2,X,n,r,2,null);if(s<=U){const s=new p,{second:i}=G(Y.majorSemiAxis,Y.e2,X,n,r,0,s);i<U&&(U=i,W.assign(s),K=t,o.getSegmentBuffer(e-1,Z,!0))}}n.assign(r)}}}if(!Number.isFinite(U))return c();-1===K&&n("");const $=I(Y.majorSemiAxis,Y.e2,W);$.divThis(B);const ee=$.clone(),te=y!==y.getGCS()?y.getGCSToSRTransform():null;te&&(new C).transform(te,[$],1,[ee],!1),ee.isNAN()&&i("closestPoint2DSr.isNAN()"),a(!Z.empty());const ne=Z.get().getClosestCoordinate(ee,!1);ee.assign(Z.get().getCoord2D(ne)),v?(new C).transform(v,[ee],1,[$],!1):$.assign(ee),a(!$.isNAN());const se=this.getNearestVertex(new h($),b,y.getGCS()),oe=m(ee,K,se.m_distance);if(x&&e.getDimension()>0){const n=l(e,t,-1,-1),s=0!==n&&3!==n;oe.m_bRightSide=s}return oe}getNearestVertex(e,t,o){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();switch(e.getGeometryType()){case s.enumPoint:return Y(e,t,o);case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return k(e,t,o);default:r("")}}getNearestVertexPoint2D(e,t,n,s){return O(e,t,n,s)}getNearestVertices(e,t,o,i,a){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return[];switch(e.getGeometryType()){case s.enumPoint:{const n=Y(e,t,o);if(!n.isEmpty()&&n.m_distance<i&&a>=1){const e=[];return e.push(n),e}return[]}case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return X(e,t,o,i,a);default:r("")}}}function Y(s,o,r){const i={stack:[],error:void 0,hasError:!1};try{if(0===r.getCoordinateSystemType()&&n("Cannot use local SR"),1!==r.getCoordinateSystemType()){const e=new Array(2);e[0]=s.getXY(),e[1]=o.clone();const t=x(S,2);2!==q(r,e,2,t)&&n("Point cannot be projected to GCS");const i=r.getGCS(),a=Y(new h(t[0]),t[1],i);return m(a.m_coordinate,0,a.m_distance)}const t=r.getUnit().getUnitToBaseFactor(),a=s.getXY();a.scale(t);const c=o.clone();c.scale(t);const l=E();r.querySpheroidData(l);const u=e(i,new R,!1);U.geodeticDistance(l.majorSemiAxis,l.e2,a.x,a.y,c.x,c.y,u,null,null,B.PE_LINETYPE_GEODESIC);const g=s.getXY();return m(g,0,u.val)}catch(a){i.error=a,i.hasError=!0}finally{t(i)}}function k(s,o,r,i=0){0===r.getCoordinateSystemType()&&n("Cannot use local SR");let a=s.getAttributeStreamRef(0),c=s.getPointCount();const l=r.getGCS(),u=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[u],null),u.isNAN())return m(S.getNAN(),-1,Number.NaN);const t=(new C).execute(s,e,null);a=t.getAttributeStreamRef(0),c=t.getPointCount()}const g=l.getUnit().getUnitToBaseFactor(),f=d(c,0);for(let e=0;e<c;++e)f[e]=e;y(c,f);const x=E();l.querySpheroidData(x);const h=u.clone();h.scale(g);const A=_(x.majorSemiAxis,x.e2,h);let P=-1,w=Number.MAX_VALUE;const T=v(x.majorSemiAxis,x.e2);let j=c;const G=new S,I=new S;for(let e=0;e<j;){if(a.queryPoint2D(2*f[e],G),G.isNAN())continue;I.assign(G),I.scale(g);const t=_(x.majorSemiAxis,x.e2,I);if(p.distance(t,A)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const n=b(T,t,A);n<w&&(P=f[e],w=n),e++}if(0!==x.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){if(a.queryPoint2D(2*f[e],G),G.isNAN())continue;I.assign(G),I.scale(g);const n=_(x.majorSemiAxis,x.e2,I);p.distance(n,A)>w||(U.geodeticDistance(x.majorSemiAxis,x.e2,h.x,h.y,I.x,I.y,t,null,null,i),t.val<w&&(P=f[e],w=t.val))}}catch(B){n.error=B,n.hasError=!0}finally{t(n)}}const q=new S;return-1!==P&&q.assign(s.getXY(P)),m(q,P,w)}function O(s,o,r,i,a=0){0===i.getCoordinateSystemType()&&n("Cannot use local SR");const l=i.getGCS(),u=r.clone();if(1!==i.getCoordinateSystemType()){const e=i.getSRToGCSTransform();if(D(e,[r],1,[u],null),u.isNAN())return c();const t=x(S,o);D(e,s,o,t,null);const n=O(t,o,r,l,a);return n.isEmpty()?n:m(s[n.m_vertexIndex],n.m_vertexIndex,n.m_distance)}const g=l.getUnit().getUnitToBaseFactor(),f=d(o,0);for(let e=0;e<o;++e)f[e]=e;y(o,f);const h=E();l.querySpheroidData(h);const A=u.clone();A.scale(g);const C=_(h.majorSemiAxis,h.e2,A);let P=-1,w=Number.MAX_VALUE;const T=v(h.majorSemiAxis,h.e2);let j=o;for(let e=0;e<j;){const t=s[f[e]];if(t.isNAN())continue;const n=t.clone();n.scale(g);const o=_(h.majorSemiAxis,h.e2,n);if(p.distance(o,C)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const r=b(T,o,C);r<w&&(P=f[e],w=r),e++}if(0!==h.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){const n=s[f[e]];if(n.isNAN())continue;const o=n.clone();o.scale(g);const r=_(h.majorSemiAxis,h.e2,o);p.distance(r,C)>w||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,o.x,o.y,t,null,null,a),t.val<w&&(P=f[e],w=t.val))}}catch(I){n.error=I,n.hasError=!0}finally{t(n)}}const G=new S;return-1!==P&&G.assign(s[P]),m(G,P,w)}function X(s,o,r,i,a){const c={stack:[],error:void 0,hasError:!1};try{0===r.getCoordinateSystemType()&&n("Cannot use local SR");let t=s.getAttributeStreamRef(0),l=s.getPointCount();const u=r.getGCS(),g=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[g],null),g.isNAN())return[];const n=(new C).execute(s,e,null);t=n.getAttributeStreamRef(0),l=n.getPointCount()}const f=u.getUnit().getUnitToBaseFactor(),x=d(l,0);for(let e=0;e<l;++e)x[e]=e;y(l,x);const h=E();u.querySpheroidData(h);const A=g.clone();A.scale(f);const P=_(h.majorSemiAxis,h.e2,A),w=[];let T=l;const j=new S,G=new S;for(let e=0;e<T;){if(t.queryPoint2D(2*x[e],j),j.isNAN())continue;G.assign(j),G.scale(f);const n=_(h.majorSemiAxis,h.e2,G);p.distance(n,P)>i?(x[T-1]=N(x[e],x[e]=x[T-1]),T--):e++}const I=(e,t)=>e.m_distance-t.m_distance,v=e(c,new R,!1);for(let e=0;e<T;e++)t.queryPoint2D(2*x[e],j),j.isNAN()||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,j.x*f,j.y*f,v,null,null,B.PE_LINETYPE_GEODESIC),v.val<i&&w.push(m(j,x[e],v.val)));return w.sort(I),w.slice(0,a)}catch(l){c.error=l,c.hasError=!0}finally{t(c)}}class M extends A{constructor(e){super(),this.m_first=!0,this.m_segIter=e,this.m_segIter.stripAttributes()}tock(){return!0}getRank(){return 1}next(){if(this.m_first){if(!this.m_segIter.nextPath())return null;this.m_first=!1}for(;;){if(this.m_segIter.hasNextSegment())return this.m_segIter.nextSegment().clone();if(!this.m_segIter.nextPath())break}return null}getGeometryID(){return this.m_segIter.getStartPointIndex()}}export{V as OperatorProximityGeodesic};
5
+ import{b as e,c as t}from"./tslib.es6.js";import{a as n,G as s,h as o,t as r,d as i,g as a}from"./Geometry.js";import{m as c,a as m,c as l}from"./SideCalculator2D-BNwb5gvz.js";import{a as u,b as g,S as f,s as y}from"./MultiPathImpl.js";import{P as S,d,c as N,m as x}from"./Point2D.js";import{P as h,d as p}from"./Envelope.js";import{G as A}from"./SimpleGeometryCursor.js";import{A as C,b as P,F as w,v as E,w as _,a2 as T,a3 as j,a4 as G,y as I,a5 as D,a6 as v,a7 as b,P as R,z as U,a8 as q,a9 as F}from"./ProjectionTransformation.js";import{O as B}from"./OperatorShapePreservingDensify.js";class V{getOperatorType(){return 10501}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}getNearestCoordinate(e,t,y,d,N,x){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();if(Number.isNaN(d)&&(d=0),d>=0||n("maxDeviationMeters"),0===e.getDimension())return this.getNearestVertex(e,t,y);const A=e.getGeometryType();if(A===s.enumGeometryCollection){const n=e;let s=c();for(let e=0,o=n.getGeometryCount();e<o;++e){const o=n.getGeometry(e),r=this.getNearestCoordinate(o,t,y,d,N,x);if(!r.isEmpty()){if(0===r.m_distance)return r;r.m_distance>=s.m_distance||(s=r,s.m_geometryIndex=e)}}return s}if(A===s.enumEnvelope){const n=new u;return n.addEnvelope(e,!1),this.getNearestCoordinate(n,t,y,d,N,x)}o(A)||r("Operation is not implemented for this geometry type");const D=e;if((N||x)&&A===s.enumPolygon){const n=()=>{const e=m(t,-1,0);return e.m_bRightSide=!0,e};if(y.isPannable()){const s=(new C).foldInto360Range(new h(t),y);if(s.isEmpty())return c();const o=(new C).foldInto360Range(e,y);if(o.isEmpty())return c();if((new P).execute(o,s,y,null)&&N)return n()}else{const e=(new C).clipToSpatialReference(new h(t),y,null,1);if(e.isEmpty())return c();const s=w(D,y,0,null);if(s.isEmpty())return c();if((new P).execute(s,e,y,null)&&N)return n()}}const v=y!==y.getGCS()?y.getSRToGCSTransform():null,b=new S;if(v?(new C).transform(v,[t],1,[b],!1):b.assign(t),b.isNAN())return c();const R=k(D,t,y,1);let U=R.m_distance;if(0===U)return R;Number.isNaN(U)?U=Number.POSITIVE_INFINITY:U*=1+1e-7;const q=y.getGCS(),F=q.getUnit().getUnitToBaseFactor(),V=b.clone();V.scale(F);const Y=E();y.querySpheroidData(Y);const O=_(Y.majorSemiAxis,Y.e2,V),L=T(Y.majorSemiAxis,Y.e2),z=new X(D.querySegmentIterator());0===d&&(d=.01);const H=Y.majorSemiAxis*g(45),J=(new B).executeMany(z,y,H,d,0,null),K=[];let Q=-1;const W=new p,Z=new f;for(let n=J.next();null!==n;n=J.next()){if(n.isEmpty())continue;const t=J.getGeometryID(),s=e.getPathIndexFromPointIndex(t);e.isClosedPath(s)&&D.getPathEnd(s);const o=n;for(let e=0,n=o.getPathCount();e<n;++e){K.length=0;for(let t=o.getPathStart(e),r=o.getPathEnd(e);t<r;++t)K.push(o.getXY(t));if(v&&(new C).transform(v,K,K.length,K,!1),K.length>3){const e=M(K,K.length,b,q,1);if(e.m_distance<U){U=e.m_distance,W.assign(_(Y.majorSemiAxis,Y.e2,e.m_coordinate.mul(F))),Q=t;let n=e.m_vertexIndex;n+1===K.length&&(n-=1),o.getSegmentBuffer(n,Z,!0)}}K.forEach((e=>e.mulThis(F)));const n=_(Y.majorSemiAxis,Y.e2,K[0]),s=new p;for(let e=1,r=K.length;e<r;++e){const r=_(Y.majorSemiAxis,Y.e2,K[e]);if(j(L,O,n,r,s)<U){const{second:s}=G(Y.majorSemiAxis,Y.e2,O,n,r,2,null);if(s<=U){const s=new p,{second:i}=G(Y.majorSemiAxis,Y.e2,O,n,r,0,s);i<U&&(U=i,W.assign(s),Q=t,o.getSegmentBuffer(e-1,Z,!0))}}n.assign(r)}}}if(!Number.isFinite(U))return c();-1===Q&&n("");const $=I(Y.majorSemiAxis,Y.e2,W);$.divThis(F);const ee=$.clone(),te=y!==y.getGCS()?y.getGCSToSRTransform():null;te&&(new C).transform(te,[$],1,[ee],!1),ee.isNAN()&&i("closestPoint2DSr.isNAN()"),a(!Z.empty());const ne=Z.get().getClosestCoordinate(ee,!1);ee.assign(Z.get().getCoord2D(ne)),v?(new C).transform(v,[ee],1,[$],!1):$.assign(ee),a(!$.isNAN());const se=this.getNearestVertex(new h($),b,y.getGCS()),oe=m(ee,Q,se.m_distance);if(x&&e.getDimension()>0){const n=l(e,t,-1,-1),s=0!==n&&3!==n;oe.m_bRightSide=s}return oe}getNearestVertex(e,t,o){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();switch(e.getGeometryType()){case s.enumPoint:return Y(e,t,o);case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return k(e,t,o);default:r("")}}getNearestVertexPoint2D(e,t,n,s){return M(e,t,n,s)}getNearestVertices(e,t,o,i,a){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return[];switch(e.getGeometryType()){case s.enumPoint:{const n=Y(e,t,o);if(!n.isEmpty()&&n.m_distance<i&&a>=1){const e=[];return e.push(n),e}return[]}case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return O(e,t,o,i,a);default:r("")}}}function Y(s,o,r){const i={stack:[],error:void 0,hasError:!1};try{if(0===r.getCoordinateSystemType()&&n("Cannot use local SR"),1!==r.getCoordinateSystemType()){const e=new Array(2);e[0]=s.getXY(),e[1]=o.clone();const t=x(S,2);2!==q(r,e,2,t)&&n("Point cannot be projected to GCS");const i=r.getGCS(),a=Y(new h(t[0]),t[1],i);return m(a.m_coordinate,0,a.m_distance)}const t=r.getUnit().getUnitToBaseFactor(),a=s.getXY();a.scale(t);const c=o.clone();c.scale(t);const l=E();r.querySpheroidData(l);const u=e(i,new R,!1);U.geodeticDistance(l.majorSemiAxis,l.e2,a.x,a.y,c.x,c.y,u,null,null,F.PE_LINETYPE_GEODESIC);const g=s.getXY();return m(g,0,u.val)}catch(a){i.error=a,i.hasError=!0}finally{t(i)}}function k(s,o,r,i=0){0===r.getCoordinateSystemType()&&n("Cannot use local SR");let a=s.getAttributeStreamRef(0),c=s.getPointCount();const l=r.getGCS(),u=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[u],null),u.isNAN())return m(S.getNAN(),-1,Number.NaN);const t=(new C).execute(s,e,null);a=t.getAttributeStreamRef(0),c=t.getPointCount()}const g=l.getUnit().getUnitToBaseFactor(),f=d(c,0);for(let e=0;e<c;++e)f[e]=e;y(c,f);const x=E();l.querySpheroidData(x);const h=u.clone();h.scale(g);const A=_(x.majorSemiAxis,x.e2,h);let P=-1,w=Number.MAX_VALUE;const T=v(x.majorSemiAxis,x.e2);let j=c;const G=new S,I=new S;for(let e=0;e<j;){if(a.queryPoint2D(2*f[e],G),G.isNAN())continue;I.assign(G),I.scale(g);const t=_(x.majorSemiAxis,x.e2,I);if(p.distance(t,A)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const n=b(T,t,A);n<w&&(P=f[e],w=n),e++}if(0!==x.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){if(a.queryPoint2D(2*f[e],G),G.isNAN())continue;I.assign(G),I.scale(g);const n=_(x.majorSemiAxis,x.e2,I);p.distance(n,A)>w||(U.geodeticDistance(x.majorSemiAxis,x.e2,h.x,h.y,I.x,I.y,t,null,null,i),t.val<w&&(P=f[e],w=t.val))}}catch(F){n.error=F,n.hasError=!0}finally{t(n)}}const q=new S;return-1!==P&&q.assign(s.getXY(P)),m(q,P,w)}function M(s,o,r,i,a=0){0===i.getCoordinateSystemType()&&n("Cannot use local SR");const l=i.getGCS(),u=r.clone();if(1!==i.getCoordinateSystemType()){const e=i.getSRToGCSTransform();if(D(e,[r],1,[u],null),u.isNAN())return c();const t=x(S,o);D(e,s,o,t,null);const n=M(t,o,r,l,a);return n.isEmpty()?n:m(s[n.m_vertexIndex],n.m_vertexIndex,n.m_distance)}const g=l.getUnit().getUnitToBaseFactor(),f=d(o,0);for(let e=0;e<o;++e)f[e]=e;y(o,f);const h=E();l.querySpheroidData(h);const A=u.clone();A.scale(g);const C=_(h.majorSemiAxis,h.e2,A);let P=-1,w=Number.MAX_VALUE;const T=v(h.majorSemiAxis,h.e2);let j=o;for(let e=0;e<j;){const t=s[f[e]];if(t.isNAN())continue;const n=t.clone();n.scale(g);const o=_(h.majorSemiAxis,h.e2,n);if(p.distance(o,C)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const r=b(T,o,C);r<w&&(P=f[e],w=r),e++}if(0!==h.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){const n=s[f[e]];if(n.isNAN())continue;const o=n.clone();o.scale(g);const r=_(h.majorSemiAxis,h.e2,o);p.distance(r,C)>w||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,o.x,o.y,t,null,null,a),t.val<w&&(P=f[e],w=t.val))}}catch(I){n.error=I,n.hasError=!0}finally{t(n)}}const G=new S;return-1!==P&&G.assign(s[P]),m(G,P,w)}function O(s,o,r,i,a){const c={stack:[],error:void 0,hasError:!1};try{0===r.getCoordinateSystemType()&&n("Cannot use local SR");let t=s.getAttributeStreamRef(0),l=s.getPointCount();const u=r.getGCS(),g=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[g],null),g.isNAN())return[];const n=(new C).execute(s,e,null);t=n.getAttributeStreamRef(0),l=n.getPointCount()}const f=u.getUnit().getUnitToBaseFactor(),x=d(l,0);for(let e=0;e<l;++e)x[e]=e;y(l,x);const h=E();u.querySpheroidData(h);const A=g.clone();A.scale(f);const P=_(h.majorSemiAxis,h.e2,A),w=[];let T=l;const j=new S,G=new S;for(let e=0;e<T;){if(t.queryPoint2D(2*x[e],j),j.isNAN())continue;G.assign(j),G.scale(f);const n=_(h.majorSemiAxis,h.e2,G);p.distance(n,P)>i?(x[T-1]=N(x[e],x[e]=x[T-1]),T--):e++}const I=(e,t)=>e.m_distance-t.m_distance,v=e(c,new R,!1);for(let e=0;e<T;e++)t.queryPoint2D(2*x[e],j),j.isNAN()||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,j.x*f,j.y*f,v,null,null,F.PE_LINETYPE_GEODESIC),v.val<i&&w.push(m(j,x[e],v.val)));return w.sort(I),w.slice(0,a)}catch(l){c.error=l,c.hasError=!0}finally{t(c)}}class X extends A{constructor(e){super(),this.m_first=!0,this.m_segIter=e,this.m_segIter.stripAttributes()}tock(){return!0}getRank(){return 1}next(){if(this.m_first){if(!this.m_segIter.nextPath())return null;this.m_first=!1}for(;;){if(this.m_segIter.hasNextSegment())return this.m_segIter.nextSegment().clone();if(!this.m_segIter.nextPath())break}return null}getGeometryID(){return this.m_segIter.getStartPointIndex()}}export{V as OperatorProximityGeodesic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{a as e,G as t,f as s,d as n}from"./Geometry.js";import{K as o,g as r,v as a,B as i,w as m}from"./ProjectionTransformation.js";import{a as c,P as g}from"./QuadraticBezier.js";import{n as u,d as p,P as h}from"./Point2D.js";import{d as y}from"./Envelope.js";import{Envelope2D as f}from"./Envelope2D.js";import{O as l}from"./OperatorDensify.js";import{O as _}from"./OperatorClip.js";function x(){return{m_pGcs:new h,m_xyz:new y,m_factor:Number.NaN,m_geoLength:Number.NaN,setValues:d,setLength:P,assign:S}}function d(e,t,s,n){this.m_factor=e,this.m_pGcs.assign(t),this.m_xyz.assign(n),this.m_geoLength=s}function P(e){this.m_geoLength=e}function S(e){this.m_pGcs.assign(e.m_pGcs),this.m_xyz.assign(e.m_xyz),this.m_factor=e.m_factor,this.m_geoLength=e.m_geoLength}class w{getOperatorType(){return 10315}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}_ExecuteShapePreservingLength(e,t,s,n,a){if(e.hasNonLinearSegments()){e=(new l).execute(e,0,t.getTolerance(0),0,a)}if(t.isPannable()){let n=90,r=-90;if(1===s.getUnit().getUnitToBaseFactor()&&(n*=Math.PI/180,r*=Math.PI/180),2===t.getCoordinateSystemType()){let e=null;const s=[0,0,0,0];e=t.getPECoordSys(),s[0]=0,s[1]=n,s[2]=0,s[3]=r,o.geogToProj(e,2,s),n=s[1],r=s[3]}const i=new f;e.queryEnvelope(i),i.ymin=r,i.ymax=n,e=(new _).execute(e,i,t,a)}else{const s=t.getPCSHorizon();if((e=(new r).execute(e,s,t,a))===s){const t=e.clone();e=t}}return e.isEmpty()?0:this._ExecuteIterativeApproach(e,t,s,n,1,a)}_ExecuteIterativeApproach(e,t,s,r,i,m){const c=a();s.querySpheroidData(c);const g=c.majorSemiAxis,f=c.e2,l=s.getUnit().getUnitToBaseFactor(),_=40,d=u(x,_),P=p(_,Number.NaN),S=x(),w=x();let E;const G=[0,0,0,0],j=t.getPECoordSys(),v=new h,L=new h,T=new h,D=new h,b=new h;let z=0;const O=e.querySegmentIterator();for(;O.nextPath();)for(;O.hasNextSegment();){const e=O.nextSegment();v.assign(e.getStartXY()),L.assign(e.getEndXY()),2===t.getCoordinateSystemType()?(G[0]=v.x,G[1]=v.y,G[2]=L.x,G[3]=L.y,o.projToGeog(j,2,G),T.x=G[0]*l,T.y=G[1]*l,D.x=G[2]*l,D.y=G[3]*l):(T.setCoordsPoint2D(v),D.setCoordsPoint2D(L),T.scale(l),D.scale(l));const s=new y,r=new y;N(g,f,T,s),N(g,f,D,r);let a=C(g,s,r);S.setValues(0,T,Number.NaN,s),w.setValues(1,D,a,r),E=i,d[0].assign(w),P[0]=i;let m=0;for(;;){m>128&&n("iterations exceeded");const s=.5*(S.m_factor+w.m_factor),r=e.getCoord2D(s);2===t.getCoordinateSystemType()?(G[0]=r.x,G[1]=r.y,o.projToGeog(j,1,G),b.x=G[0]*l,b.y=G[1]*l):(b.setCoordsPoint2D(r),b.scale(l)),T.setCoordsPoint2D(S.m_pGcs),D.setCoordsPoint2D(w.m_pGcs);const c=new y;N(g,f,b,c);const u=C(g,S.m_xyz,c),p=C(g,w.m_xyz,c);a=w.m_geoLength,Number.isNaN(a)&&(a=C(g,S.m_xyz,w.m_xyz));const h=u+p,x=E===i&&h>=20&&Math.abs(h-a)>1e-8*(a+h);if(m+2<_&&(x||Math.abs(h-a)>0&&E>0))w.setLength(p),d[m].assign(w),w.setValues(s,b,u,c),d[++m].assign(w),x?(E=i,P[m]=i):(E--,P[m-1]=E,P[m]=E);else{if(z+=h,0===m)break;S.assign(w),w.assign(d[--m]),E=P[m]}}}return z}execute(n,o,r){if(o&&0!==o.getCoordinateSystemType()||e(""),n.isEmpty()||n.getDimension()<1)return 0;let a=null;const m=o.getGCS();m!==o&&(a=i(o,m,null));const u=n.getGeometryType();if(u===t.enumEnvelope){const e=new c;return e.addEnvelope(n,!1),this._ExecuteShapePreservingLength(e,o,m,a,r)}if(s(u)){const e=new g;return e.addSegment(n,!0),this._ExecuteShapePreservingLength(e,o,m,a,r)}return this._ExecuteShapePreservingLength(n,o,m,a,r)}}function N(e,t,s,n){n.assign(m(e,t,s))}function C(e,t,s){const n=e,o=new y;o.setSub(t,s);const r=o.length();return 2*n*Math.asin(r/(2*n))}export{w as O};
5
+ import{a as e,G as t,f as s,d as n}from"./Geometry.js";import{K as o,g as r,v as a,B as i,w as m}from"./ProjectionTransformation.js";import{a as c,P as g}from"./MultiPathImpl.js";import{n as u,d as p,P as h}from"./Point2D.js";import{d as y}from"./Envelope.js";import{Envelope2D as l}from"./Envelope2D.js";import{O as f}from"./OperatorDensify.js";import{O as _}from"./OperatorClip.js";function x(){return{m_pGcs:new h,m_xyz:new y,m_factor:Number.NaN,m_geoLength:Number.NaN,setValues:d,setLength:P,assign:S}}function d(e,t,s,n){this.m_factor=e,this.m_pGcs.assign(t),this.m_xyz.assign(n),this.m_geoLength=s}function P(e){this.m_geoLength=e}function S(e){this.m_pGcs.assign(e.m_pGcs),this.m_xyz.assign(e.m_xyz),this.m_factor=e.m_factor,this.m_geoLength=e.m_geoLength}class w{getOperatorType(){return 10315}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}_ExecuteShapePreservingLength(e,t,s,n,a){if(e.hasNonLinearSegments()){e=(new f).execute(e,0,t.getTolerance(0),0,a)}if(t.isPannable()){let n=90,r=-90;if(1===s.getUnit().getUnitToBaseFactor()&&(n*=Math.PI/180,r*=Math.PI/180),2===t.getCoordinateSystemType()){let e=null;const s=[0,0,0,0];e=t.getPECoordSys(),s[0]=0,s[1]=n,s[2]=0,s[3]=r,o.geogToProj(e,2,s),n=s[1],r=s[3]}const i=new l;e.queryEnvelope(i),i.ymin=r,i.ymax=n,e=(new _).execute(e,i,t,a)}else{const s=t.getPCSHorizon();if((e=(new r).execute(e,s,t,a))===s){const t=e.clone();e=t}}return e.isEmpty()?0:this._ExecuteIterativeApproach(e,t,s,n,1,a)}_ExecuteIterativeApproach(e,t,s,r,i,m){const c=a();s.querySpheroidData(c);const g=c.majorSemiAxis,l=c.e2,f=s.getUnit().getUnitToBaseFactor(),_=40,d=u(x,_),P=p(_,Number.NaN),S=x(),w=x();let E;const G=[0,0,0,0],j=t.getPECoordSys(),v=new h,L=new h,T=new h,D=new h,b=new h;let z=0;const I=e.querySegmentIterator();for(;I.nextPath();)for(;I.hasNextSegment();){const e=I.nextSegment();v.assign(e.getStartXY()),L.assign(e.getEndXY()),2===t.getCoordinateSystemType()?(G[0]=v.x,G[1]=v.y,G[2]=L.x,G[3]=L.y,o.projToGeog(j,2,G),T.x=G[0]*f,T.y=G[1]*f,D.x=G[2]*f,D.y=G[3]*f):(T.setCoordsPoint2D(v),D.setCoordsPoint2D(L),T.scale(f),D.scale(f));const s=new y,r=new y;N(g,l,T,s),N(g,l,D,r);let a=C(g,s,r);S.setValues(0,T,Number.NaN,s),w.setValues(1,D,a,r),E=i,d[0].assign(w),P[0]=i;let m=0;for(;;){m>128&&n("iterations exceeded");const s=.5*(S.m_factor+w.m_factor),r=e.getCoord2D(s);2===t.getCoordinateSystemType()?(G[0]=r.x,G[1]=r.y,o.projToGeog(j,1,G),b.x=G[0]*f,b.y=G[1]*f):(b.setCoordsPoint2D(r),b.scale(f)),T.setCoordsPoint2D(S.m_pGcs),D.setCoordsPoint2D(w.m_pGcs);const c=new y;N(g,l,b,c);const u=C(g,S.m_xyz,c),p=C(g,w.m_xyz,c);a=w.m_geoLength,Number.isNaN(a)&&(a=C(g,S.m_xyz,w.m_xyz));const h=u+p,x=E===i&&h>=20&&Math.abs(h-a)>1e-8*(a+h);if(m+2<_&&(x||Math.abs(h-a)>0&&E>0))w.setLength(p),d[m].assign(w),w.setValues(s,b,u,c),d[++m].assign(w),x?(E=i,P[m]=i):(E--,P[m-1]=E,P[m]=E);else{if(z+=h,0===m)break;S.assign(w),w.assign(d[--m]),E=P[m]}}}return z}execute(n,o,r){if(o&&0!==o.getCoordinateSystemType()||e(""),n.isEmpty()||n.getDimension()<1)return 0;let a=null;const m=o.getGCS();m!==o&&(a=i(o,m,null));const u=n.getGeometryType();if(u===t.enumEnvelope){const e=new c;return e.addEnvelope(n,!1),this._ExecuteShapePreservingLength(e,o,m,a,r)}if(s(u)){const e=new g;return e.addSegment(n,!0),this._ExecuteShapePreservingLength(e,o,m,a,r)}return this._ExecuteShapePreservingLength(n,o,m,a,r)}}function N(e,t,s,n){n.assign(m(e,t,s))}function C(e,t,s){const n=e,o=new y;o.setSub(t,s);const r=o.length();return 2*n*Math.asin(r/(2*n))}export{w as O};