@arcgis/core 4.32.0-next.20250102 → 4.32.0-next.20250103

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 (261) hide show
  1. package/Color.js +1 -1
  2. package/PopupTemplate.js +1 -1
  3. package/arcade/functions/date.js +1 -1
  4. package/arcade/functions/featuresetbase.js +1 -1
  5. package/arcade/functions/featuresetstats.js +1 -1
  6. package/arcade/functions/featuresetstring.js +1 -1
  7. package/arcade/functions/geomasync.js +1 -1
  8. package/arcade/functions/geometry.js +1 -1
  9. package/arcade/functions/geomsync.js +1 -1
  10. package/arcade/functions/knowledgegraph.js +1 -1
  11. package/arcade/functions/string.js +1 -1
  12. package/arcade/geometry/extendedUnitData.js +5 -0
  13. package/arcade/geometry/functions.js +5 -0
  14. package/arcade/geometry/operators.js +5 -0
  15. package/arcade/geometry/unitConversion.js +5 -0
  16. package/arcade/geometry/wkt.js +5 -0
  17. package/arcade/languageUtils.js +1 -1
  18. package/assets/esri/core/workers/RemoteClient.js +1 -1
  19. package/assets/esri/core/workers/chunks/{e371f4f0eb3c22f222df.js → 005727711cca0614c2ab.js} +2 -2
  20. package/assets/esri/core/workers/chunks/{e371f4f0eb3c22f222df.js.LICENSE.txt → 005727711cca0614c2ab.js.LICENSE.txt} +1 -1
  21. package/assets/esri/core/workers/chunks/{2d908c115ea18e813b95.js → 00c0fbe19c12691cf2c3.js} +1 -1
  22. package/assets/esri/core/workers/chunks/08e28328385066c519c2.js +1 -0
  23. package/assets/esri/core/workers/chunks/{0e735d01296d340b393e.js → 0b95ec12218f3c04df18.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{59bf879b4802a5ba431e.js → 0ee669947c23f469e357.js} +1 -1
  25. package/assets/esri/core/workers/chunks/116103ecec27cce47a2f.js +1 -0
  26. package/assets/esri/core/workers/chunks/11f00218905f0db447ff.js +1 -0
  27. package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +1 -0
  28. package/assets/esri/core/workers/chunks/16d7c07e1c11b88dae84.js +1 -0
  29. package/assets/esri/core/workers/chunks/1d04fe800cb98e4d6bc4.js +1 -0
  30. package/assets/esri/core/workers/chunks/{71f6e5742cf0c482066b.js → 1dc6b5b177022b80c473.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{59455e2dd44b4c01cc76.js → 2586741c359057b3f626.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{250a810dd4e1ff293564.js → 318a39b56851e707edad.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{b1e4813f0c73fc2a483c.js → 370b230fd2d7703d0698.js} +2 -2
  34. package/assets/esri/core/workers/chunks/{b1e4813f0c73fc2a483c.js.LICENSE.txt → 370b230fd2d7703d0698.js.LICENSE.txt} +1 -1
  35. package/assets/esri/core/workers/chunks/38d03fe352057fb375b5.js +1 -0
  36. package/assets/esri/core/workers/chunks/{ebf9caf2dc8af89afec2.js → 42aa697b4718b75b8cb2.js} +2 -2
  37. package/assets/esri/core/workers/chunks/{ebf9caf2dc8af89afec2.js.LICENSE.txt → 42aa697b4718b75b8cb2.js.LICENSE.txt} +1 -1
  38. package/assets/esri/core/workers/chunks/{801dbea20966806db1c9.js → 53cd990b2c988518de6d.js} +1 -1
  39. package/assets/esri/core/workers/chunks/5a1eb0d1e25ff5574c43.js +1 -0
  40. package/assets/esri/core/workers/chunks/6157c49e7431f5868c77.js +1 -0
  41. package/assets/esri/core/workers/chunks/{eef2d94a73064f9bc085.js → 61d64f163840563017d5.js} +1 -1
  42. package/assets/esri/core/workers/chunks/6d218fb5e0f0a04d72c5.js +2 -0
  43. package/assets/esri/core/workers/chunks/{d82b3e2905cab511ff3a.js.LICENSE.txt → 6d218fb5e0f0a04d72c5.js.LICENSE.txt} +1 -1
  44. package/assets/esri/core/workers/chunks/6ed57d01be6bc054c7cd.js +1 -0
  45. package/assets/esri/core/workers/chunks/7254956381e823219db0.js +1 -0
  46. package/assets/esri/core/workers/chunks/740e6bdb3b76f2ea6d61.js +1 -0
  47. package/assets/esri/core/workers/chunks/756c2f7c8659deab6c96.js.LICENSE.txt +1 -1
  48. package/assets/esri/core/workers/chunks/{56fc353421252f2d0a99.js → 75e8ba7e02647b7216ae.js} +1 -1
  49. package/assets/esri/core/workers/chunks/89d7eec47e5b29935d92.js +1 -0
  50. package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +1 -0
  51. package/assets/esri/core/workers/chunks/{0b3e1e903120da297641.js → 932375de79e3d33bc4d7.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{263adfd1c2641ef5c0f5.js → 95f23bd17ce9e07fc8ef.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{7de9c01849c4aa1940e7.js → 986889cea53c4a470347.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{cc6160e8ab3cea4040c2.js → 9e9b2fd958e816b1b5f6.js} +1 -1
  55. package/assets/esri/core/workers/chunks/a57cead317eb2fc9afd8.js +1 -0
  56. package/assets/esri/core/workers/chunks/acec58a7f23b2cc938ee.js +1 -0
  57. package/assets/esri/core/workers/chunks/b0f4254d8a32dd713009.js +1 -0
  58. package/assets/esri/core/workers/chunks/b277b8c2f556918e4f9a.js +1 -0
  59. package/assets/esri/core/workers/chunks/{deffd56e39ce725ce377.js → b30046a40bcfbec8abe4.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{5c11e2e65b97565e5003.js → b7db64b07edb0b37ece1.js} +1 -1
  61. package/assets/esri/core/workers/chunks/bd1fb82e8bac439d05ea.js +1 -0
  62. package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js.LICENSE.txt +1 -1
  63. package/assets/esri/core/workers/chunks/c44ce0302dc82fb66ada.js +1 -0
  64. package/assets/esri/core/workers/chunks/c52872a50a5989121388.js +1 -0
  65. package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +2 -0
  66. package/assets/esri/core/workers/chunks/{a100fb789d72410f8d4f.js.LICENSE.txt → c8cd6ba5600d8ff8db0b.js.LICENSE.txt} +1 -1
  67. package/assets/esri/core/workers/chunks/{57c1370b310768c0790a.js → ca1e186f136abb23ae4b.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{d14e4fc82ad772899336.js → ca4a37bdc0f7fb705146.js} +1 -1
  69. package/assets/esri/core/workers/chunks/cb94fc9b0f613ad50b3f.js +1 -0
  70. package/assets/esri/core/workers/chunks/d20764cc99fcabcb7cbf.js +1 -0
  71. package/assets/esri/core/workers/chunks/df18a72e3625cbe31935.js +1 -0
  72. package/assets/esri/core/workers/chunks/eff8fcb6393cd1193cbc.js +1 -0
  73. package/assets/esri/core/workers/chunks/f19d3c855f6e93544918.js +1 -0
  74. package/assets/esri/core/workers/chunks/{60b40b2319d1651dd150.js → f7e50a8284d12da21355.js} +1 -1
  75. package/assets/esri/core/workers/chunks/f9c0d571f62e611ffe2b.js +1 -0
  76. package/assets/esri/core/workers/chunks/fdfe8e0d942b78f08191.js +1 -0
  77. package/assets/esri/core/workers/chunks/ff21207f46a354786eed.js +1 -0
  78. package/chunks/Bufferer-BiY2mtjI.js +1 -1
  79. package/chunks/Centroid-DZi-eb9F.js +1 -1
  80. package/chunks/Clipper-a9xfvRaw.js +1 -1
  81. package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
  82. package/chunks/Distance2DCalculator-eS0piaux.js +1 -1
  83. package/chunks/GeodeticDistanceCalculator-bNilDneE.js +1 -1
  84. package/chunks/Geometry.js +1 -1
  85. package/chunks/GeometryCleaner-DVgW95-D.js +1 -1
  86. package/chunks/Intersector-K1VmdfQW.js +1 -1
  87. package/chunks/LineSeries.js +1 -1
  88. package/chunks/OperatorClip.js +1 -1
  89. package/chunks/OperatorCrosses.js +1 -1
  90. package/chunks/OperatorCut.js +1 -1
  91. package/chunks/OperatorDensify.js +1 -1
  92. package/chunks/OperatorDifference.js +1 -1
  93. package/chunks/OperatorGeneralize.js +1 -1
  94. package/chunks/OperatorGeodesicBuffer.js +1 -1
  95. package/chunks/OperatorGeodeticArea.js +1 -1
  96. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  97. package/chunks/OperatorGeodeticDistance.js +1 -1
  98. package/chunks/OperatorGeodeticLength.js +1 -1
  99. package/chunks/OperatorIntersection.js +1 -1
  100. package/chunks/OperatorIntersects.js +1 -1
  101. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  102. package/chunks/OperatorOverlaps.js +1 -1
  103. package/chunks/OperatorProject.js +1 -1
  104. package/chunks/OperatorProximity.js +1 -1
  105. package/chunks/OperatorProximityGeodesic.js +1 -1
  106. package/chunks/OperatorShapePreservingDensify.js +1 -1
  107. package/chunks/OperatorShapePreservingLength.js +1 -1
  108. package/chunks/OperatorSimplify.js +1 -1
  109. package/chunks/OperatorTouches.js +1 -1
  110. package/chunks/OperatorUnion.js +1 -1
  111. package/chunks/OperatorWithin.js +1 -1
  112. package/chunks/QuadraticBezier.js +1 -1
  113. package/chunks/SideCalculator2D-Bf4QCxCR.js +1 -1
  114. package/chunks/Theme.js +1 -1
  115. package/chunks/Tick.js +1 -1
  116. package/chunks/Transformation2D.js +1 -1
  117. package/chunks/arcade.js +1 -1
  118. package/chunks/areaOperator.js +5 -0
  119. package/chunks/array.js +1 -1
  120. package/chunks/bufferOperator.js +5 -0
  121. package/chunks/centroidOperator.js +5 -0
  122. package/chunks/chartUtilsAm5.js +1 -1
  123. package/chunks/clipOperator.js +5 -0
  124. package/chunks/containsOperator.js +5 -0
  125. package/chunks/convexHullOperator.js +5 -0
  126. package/chunks/crossesOperator.js +5 -0
  127. package/chunks/cutOperator.js +5 -0
  128. package/chunks/densifyOperator.js +5 -0
  129. package/chunks/differenceOperator.js +5 -0
  130. package/chunks/disjointOperator.js +5 -0
  131. package/chunks/distanceOperator.js +5 -0
  132. package/chunks/equalsOperator.js +5 -0
  133. package/chunks/generalizeOperator.js +5 -0
  134. package/chunks/geodesicBufferOperator.js +5 -0
  135. package/chunks/geodeticAreaOperator.js +5 -0
  136. package/chunks/geodeticDensifyOperator.js +5 -0
  137. package/chunks/geodeticLengthOperator.js +5 -0
  138. package/chunks/i3s.js +1 -1
  139. package/chunks/intersectionOperator.js +5 -0
  140. package/chunks/intersectsOperator.js +5 -0
  141. package/chunks/languageUtils.js +1 -1
  142. package/chunks/lclayout.js +1 -1
  143. package/chunks/lengthOperator.js +5 -0
  144. package/chunks/lyr3DMain.js +1 -1
  145. package/chunks/lyr3DWorker.js +1 -1
  146. package/chunks/offsetOperator.js +5 -0
  147. package/chunks/overlapsOperator.js +5 -0
  148. package/chunks/pe-wasm.js +1 -1
  149. package/chunks/proximityOperator.js +5 -0
  150. package/chunks/relateOperator.js +5 -0
  151. package/chunks/simplifyOperator.js +5 -0
  152. package/chunks/symmetricDifferenceOperator.js +5 -0
  153. package/chunks/touchesOperator.js +5 -0
  154. package/chunks/unionOperator.js +5 -0
  155. package/chunks/vxlLayer.js +1 -1
  156. package/chunks/withinOperator.js +5 -0
  157. package/copyright.txt +2 -2
  158. package/core/Evented.js +1 -1
  159. package/geometry/operators/areaOperator.js +1 -1
  160. package/geometry/operators/bufferOperator.js +1 -1
  161. package/geometry/operators/centroidOperator.js +1 -1
  162. package/geometry/operators/clipOperator.js +1 -1
  163. package/geometry/operators/containsOperator.js +1 -1
  164. package/geometry/operators/convexHullOperator.js +1 -1
  165. package/geometry/operators/crossesOperator.js +1 -1
  166. package/geometry/operators/cutOperator.js +1 -1
  167. package/geometry/operators/densifyOperator.js +1 -1
  168. package/geometry/operators/differenceOperator.js +1 -1
  169. package/geometry/operators/disjointOperator.js +1 -1
  170. package/geometry/operators/distanceOperator.js +1 -1
  171. package/geometry/operators/equalsOperator.js +1 -1
  172. package/geometry/operators/extendOperator.js +1 -1
  173. package/geometry/operators/generalizeOperator.js +1 -1
  174. package/geometry/operators/geodesicBufferOperator.js +1 -1
  175. package/geometry/operators/geodeticAreaOperator.js +1 -1
  176. package/geometry/operators/geodeticDensifyOperator.js +1 -1
  177. package/geometry/operators/geodeticLengthOperator.js +1 -1
  178. package/geometry/operators/gx/operatorAffineTransform.js +1 -1
  179. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  180. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  181. package/geometry/operators/gx/operatorBoundary.js +1 -1
  182. package/geometry/operators/gx/operatorBuffer.js +1 -1
  183. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  184. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  185. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  186. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  187. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  188. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  189. package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
  190. package/geometry/operators/gx/operatorOffset.js +1 -1
  191. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  192. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  193. package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
  194. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  195. package/geometry/operators/intersectionOperator.js +1 -1
  196. package/geometry/operators/intersectsOperator.js +1 -1
  197. package/geometry/operators/isNearOperator.js +1 -1
  198. package/geometry/operators/json/disjointOperator.js +1 -1
  199. package/geometry/operators/lengthOperator.js +1 -1
  200. package/geometry/operators/offsetOperator.js +1 -1
  201. package/geometry/operators/overlapsOperator.js +1 -1
  202. package/geometry/operators/proximityOperator.js +1 -1
  203. package/geometry/operators/relateOperator.js +1 -1
  204. package/geometry/operators/reshapeOperator.js +1 -1
  205. package/geometry/operators/simplifyOperator.js +1 -1
  206. package/geometry/operators/support/apiConverter.js +1 -1
  207. package/geometry/operators/support/jsonConverter.js +1 -1
  208. package/geometry/operators/symmetricDifferenceOperator.js +1 -1
  209. package/geometry/operators/touchesOperator.js +1 -1
  210. package/geometry/operators/unionOperator.js +1 -1
  211. package/geometry/operators/withinOperator.js +1 -1
  212. package/geometry/support/contains.js +1 -1
  213. package/kernel.js +1 -1
  214. package/layers/KMLLayer.js +1 -1
  215. package/layers/WCSLayer.js +1 -1
  216. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  217. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  218. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  219. package/layers/support/wmtsUtils.js +1 -1
  220. package/package.json +3 -3
  221. package/smartMapping/renderers/support/utils.js +1 -1
  222. package/smartMapping/symbology/support/Theme.js +1 -1
  223. package/support/revision.js +1 -1
  224. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  225. package/views/3d/support/DisplayQualityProfile.js +1 -1
  226. package/views/3d/webgl-engine/core/shaderModules/interfaces.js +1 -1
  227. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  228. package/views/SelectionManager.js +1 -1
  229. package/widgets/BatchAttributeForm.js +1 -1
  230. package/widgets/Feature/support/featureUtils.js +1 -1
  231. package/widgets/Legend/support/heatmapRampUtils.js +1 -1
  232. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
  233. package/widgets/OrientedImageryViewer.js +1 -1
  234. package/assets/esri/core/workers/chunks/015285436ca965f94e17.js +0 -1
  235. package/assets/esri/core/workers/chunks/048d296efa26ccd79056.js +0 -1
  236. package/assets/esri/core/workers/chunks/0e0b978459d70b15acb5.js +0 -1
  237. package/assets/esri/core/workers/chunks/10fa211987b16fd71a1a.js +0 -1
  238. package/assets/esri/core/workers/chunks/200a5f1864c2c2f7536c.js +0 -1
  239. package/assets/esri/core/workers/chunks/23a697d48f6e45cc033e.js +0 -1
  240. package/assets/esri/core/workers/chunks/29b610ff44708e044cbd.js +0 -1
  241. package/assets/esri/core/workers/chunks/3600125c58d5d04c515a.js +0 -1
  242. package/assets/esri/core/workers/chunks/457d4abc938d14f28e31.js +0 -1
  243. package/assets/esri/core/workers/chunks/4b5dbdcad438cb2dd4bf.js +0 -1
  244. package/assets/esri/core/workers/chunks/69efc716991a407c3d23.js +0 -1
  245. package/assets/esri/core/workers/chunks/6e254e846e284223ef63.js +0 -1
  246. package/assets/esri/core/workers/chunks/785610aa615198fd3815.js +0 -1
  247. package/assets/esri/core/workers/chunks/7bf7aace72f81f5de4e4.js +0 -1
  248. package/assets/esri/core/workers/chunks/7ea3d652536e1d79dfc6.js +0 -1
  249. package/assets/esri/core/workers/chunks/816c9c81352cd0ca8ce8.js +0 -1
  250. package/assets/esri/core/workers/chunks/9291508232b23f030178.js +0 -1
  251. package/assets/esri/core/workers/chunks/9fc49968dea8e2b64f3e.js +0 -1
  252. package/assets/esri/core/workers/chunks/a0b3d70a1b0360084593.js +0 -1
  253. package/assets/esri/core/workers/chunks/a100fb789d72410f8d4f.js +0 -2
  254. package/assets/esri/core/workers/chunks/b4d76d46661aba356ea3.js +0 -1
  255. package/assets/esri/core/workers/chunks/cb3af81e1fe6405c4885.js +0 -1
  256. package/assets/esri/core/workers/chunks/cbf57abb537e86c1dd7f.js +0 -1
  257. package/assets/esri/core/workers/chunks/cebdf2f88c4d2ad8baab.js +0 -1
  258. package/assets/esri/core/workers/chunks/d56d77125798beb7e493.js +0 -1
  259. package/assets/esri/core/workers/chunks/d82b3e2905cab511ff3a.js +0 -2
  260. package/assets/esri/core/workers/chunks/e2f91098793b8742fae6.js +0 -1
  261. package/assets/esri/core/workers/chunks/f25c04cf1a4bc1d2636a.js +0 -1
package/chunks/Tick.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{d as e}from"./tslib.es6.js";import{F as t,S as s,g as i,i as a,H as l,k as r,a as n,I as o,C as h,P as u,J as d,L as c,K as m,e as p,N as f}from"./Theme.js";class b extends t{constructor(){super(...arguments),Object.defineProperty(this,"processor",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}incrementRef(){}decrementRef(){}_onPush(e){this.processor&&this.processor.processRow(e),super._onPush(e)}_onInsertIndex(e,t){this.processor&&this.processor.processRow(t),super._onInsertIndex(e,t)}_onSetIndex(e,t,s){this.processor&&this.processor.processRow(s),super._onSetIndex(e,t,s)}}class g extends s{constructor(e,t,s){super(s),Object.defineProperty(this,"component",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dataContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bullets",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"open",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"close",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.dataContext=t,this.component=e,this._settings.visible=!0,this._checkDirty()}markDirty(){this.component.markDirtyValues(this)}_startAnimation(){this.component._root._addAnimation(this)}_animationTime(){return this.component._root.animationTime}_dispose(){this.component&&this.component.disposeDataItem(this),super._dispose()}show(e){this.setRaw("visible",!0),this.component&&this.component.showDataItem(this,e)}hide(e){this.setRaw("visible",!1),this.component&&this.component.hideDataItem(this,e)}isHidden(){return!this.get("visible")}}class _ extends i{constructor(){super(...arguments),Object.defineProperty(this,"_data",{enumerable:!0,configurable:!0,writable:!0,value:new b}),Object.defineProperty(this,"_dataItems",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_mainDataItems",{enumerable:!0,configurable:!0,writable:!0,value:this._dataItems}),Object.defineProperty(this,"valueFields",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"fields",{enumerable:!0,configurable:!0,writable:!0,value:["id"]}),Object.defineProperty(this,"_valueFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valueFieldsF",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fieldsF",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valuesDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataChanged",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataGrouped",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"inited",{enumerable:!0,configurable:!0,writable:!0,value:!1})}set data(e){e.incrementRef(),this._data.decrementRef(),this._data=e}get data(){return this._data}_dispose(){super._dispose(),this._data.decrementRef()}_onDataClear(){}_afterNew(){super._afterNew(),this._data.incrementRef(),this._updateFields(),this._disposers.push(this.data.events.onAll((e=>{const t=this._mainDataItems;if(this.markDirtyValues(),this._markDirtyGroup(),this._dataChanged=!0,"clear"===e.type)a(t,(e=>{e.dispose()})),t.length=0,this._onDataClear();else if("push"===e.type){const s=new g(this,e.newValue,this._makeDataItem(e.newValue));t.push(s),this.processDataItem(s)}else if("setIndex"===e.type){const s=t[e.index],i=this._makeDataItem(e.newValue);s.bullets&&0==s.bullets.length&&(s.bullets=void 0),l(i).forEach((e=>{s.animate({key:e,to:i[e],duration:this.get("interpolationDuration",0),easing:this.get("interpolationEasing")})})),s.dataContext=e.newValue}else if("insertIndex"===e.type){const s=new g(this,e.newValue,this._makeDataItem(e.newValue));t.splice(e.index,0,s),this.processDataItem(s)}else if("removeIndex"===e.type){t[e.index].dispose(),t.splice(e.index,1)}else{if("moveIndex"!==e.type)throw new Error("Unknown IStreamEvent type");{const s=t[e.oldIndex];t.splice(e.oldIndex,1),t.splice(e.newIndex,0,s)}}this._afterDataChange()})))}_updateFields(){this.valueFields&&(this._valueFields=[],this._valueFieldsF={},a(this.valueFields,(e=>{this.get(e+"Field")&&(this._valueFields.push(e),this._valueFieldsF[e]={fieldKey:e+"Field",workingKey:e+"Working"})}))),this.fields&&(this._fields=[],this._fieldsF={},a(this.fields,(e=>{this.get(e+"Field")&&(this._fields.push(e),this._fieldsF[e]=e+"Field")})))}get dataItems(){return this._dataItems}processDataItem(e){}_makeDataItem(e){const t={};return this._valueFields&&a(this._valueFields,(s=>{const i=this.get(this._valueFieldsF[s].fieldKey);t[s]=e[i],t[this._valueFieldsF[s].workingKey]=t[s]})),this._fields&&a(this._fields,(s=>{const i=this.get(this._fieldsF[s]);t[s]=e[i]})),t}makeDataItem(e,t){let s=new g(this,t,e);return this.processDataItem(s),s}pushDataItem(e,t){const s=this.makeDataItem(e,t);return this._mainDataItems.push(s),s}disposeDataItem(e){}showDataItem(t,s){return e(this,void 0,void 0,(function*(){t.set("visible",!0)}))}hideDataItem(t,s){return e(this,void 0,void 0,(function*(){t.set("visible",!1)}))}_clearDirty(){super._clearDirty(),this._valuesDirty=!1}_afterDataChange(){}_afterChanged(){if(super._afterChanged(),this._dataChanged){const e="datavalidated";this.events.isEnabled(e)&&this.events.dispatch(e,{type:e,target:this}),this._dataChanged=!1}this.inited=!0}markDirtyValues(e){this.markDirty(),this._valuesDirty=!0}_markDirtyGroup(){this._dataGrouped=!1}markDirtySize(){this._sizeDirty=!0,this.markDirty()}}function v(e){return new Promise(((t,s)=>{setTimeout(t,e)}))}Object.defineProperty(_,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Component"}),Object.defineProperty(_,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:i.classNames.concat([_.className])});let y={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:2629742400,year:31536e6};function w(e,t){return null==t&&(t=1),y[e]*t}function I(e,t,s,i,a,l,n){if(!n||a){let n=0;switch(a||"millisecond"==t||(n=e.getTimezoneOffset(),e.setUTCMinutes(e.getUTCMinutes()-n)),t){case"day":let t=e.getUTCDate();if(s>1){if(l){l=I(l,"day",1);let t=e.getTime()-l.getTime(),i=Math.floor(t/w("day")/s),a=w("day",i*s);e.setTime(l.getTime()+a-n*w("minute"))}}else e.setUTCDate(t);e.setUTCHours(0,0,0,0);break;case"second":let a=e.getUTCSeconds();s>1&&(a=Math.floor(a/s)*s),e.setUTCSeconds(a,0);break;case"millisecond":if(1==s)return e;let o=e.getUTCMilliseconds();o=Math.floor(o/s)*s,e.setUTCMilliseconds(o);break;case"hour":let h=e.getUTCHours();s>1&&(h=Math.floor(h/s)*s),e.setUTCHours(h,0,0,0);break;case"minute":let u=e.getUTCMinutes();s>1&&(u=Math.floor(u/s)*s),e.setUTCMinutes(u,0,0);break;case"month":let d=e.getUTCMonth();s>1&&(d=Math.floor(d/s)*s),e.setUTCMonth(d,1),e.setUTCHours(0,0,0,0);break;case"year":let c=e.getUTCFullYear();s>1&&(c=Math.floor(c/s)*s),e.setUTCFullYear(c,0,1),e.setUTCHours(0,0,0,0);break;case"week":if(s>1&&l){l=I(l,"week",1);let t=e.getTime()-l.getTime(),i=Math.floor(t/w("week")/s),a=w("week",i*s);e.setTime(l.getTime()+a-n*w("minute"))}let m=e.getUTCDate(),p=e.getUTCDay();r(i)||(i=1),m=p>=i?m-p+i:m-(7+p)+i,e.setUTCDate(m),e.setUTCHours(0,0,0,0)}if(!a&&"millisecond"!=t&&(e.setUTCMinutes(e.getUTCMinutes()+n),"day"==t||"week"==t||"month"==t||"year"==t)){let t=e.getTimezoneOffset();if(t!=n){let s=t-n;e.setUTCMinutes(e.getUTCMinutes()+s)}}return e}{if(isNaN(e.getTime()))return e;let o=n.offsetUTC(e),h=e.getTimezoneOffset(),u=n.parseDate(e),d=u.year,c=u.month,m=u.day,p=u.hour,f=u.minute,b=u.second,g=u.millisecond,_=u.weekday,v=o-h;switch(t){case"day":if(s>1&&l){l=I(l,"day",1,i,a,void 0,n);let t=e.getTime()-l.getTime(),r=Math.floor(t/w("day")/s),o=w("day",r*s);e.setTime(l.getTime()+o),u=n.parseDate(e),d=u.year,c=u.month,m=u.day}p=0,f=v,b=0,g=0;break;case"second":f+=v,s>1&&(b=Math.floor(b/s)*s),g=0;break;case"millisecond":f+=v,s>1&&(g=Math.floor(g/s)*s);break;case"hour":s>1&&(p=Math.floor(p/s)*s),f=v,b=0,g=0;break;case"minute":s>1&&(f=Math.floor(f/s)*s),f+=v,b=0,g=0;break;case"month":s>1&&(c=Math.floor(c/s)*s),m=1,p=0,f=v,b=0,g=0;break;case"year":s>1&&(d=Math.floor(d/s)*s),c=0,m=1,p=0,f=v,b=0,g=0;break;case"week":r(i)||(i=1),m=_>=i?m-_+i:m-(7+_)+i,p=0,f=v,b=0,g=0}let y=(e=new Date(d,c,m,p,f,b,g)).getTimezoneOffset(),D=n.offsetUTC(e)-y;return D!=v&&e.setTime(e.getTime()+6e4*(D-v)),e}}class D extends _{constructor(){super(...arguments),Object.defineProperty(this,"_aggregatesCalculated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_selectionAggregatesCalculated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataProcessed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_psi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pei",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bullets",{enumerable:!0,configurable:!0,writable:!0,value:new t}),Object.defineProperty(this,"bulletsContainer",{enumerable:!0,configurable:!0,writable:!0,value:i.new(this._root,{width:n,height:n,position:"absolute"})})}_afterNew(){this.valueFields.push("value","customValue"),super._afterNew(),this.setPrivate("customData",{}),this._disposers.push(this.bullets.events.onAll((e=>{if("clear"===e.type)this._handleBullets(this.dataItems);else if("push"===e.type)this._handleBullets(this.dataItems);else if("setIndex"===e.type)this._handleBullets(this.dataItems);else if("insertIndex"===e.type)this._handleBullets(this.dataItems);else if("removeIndex"===e.type)this._handleBullets(this.dataItems);else{if("moveIndex"!==e.type)throw new Error("Unknown IListEvent type");this._handleBullets(this.dataItems)}})))}_dispose(){this.bulletsContainer.dispose(),super._dispose()}startIndex(){let e=this.dataItems.length;return Math.min(this.getPrivate("startIndex",0),e)}endIndex(){let e=this.dataItems.length;return Math.min(this.getPrivate("endIndex",e),e)}_handleBullets(e){a(e,(e=>{const t=e.bullets;t&&(a(t,(e=>{e.dispose()})),e.bullets=void 0)})),this.markDirtyValues()}getDataItemById(e){return o(this.dataItems,(t=>t.get("id")==e))}_makeBullets(e){this._shouldMakeBullet(e)&&(e.bullets=[],this.bullets.each((t=>{this._makeBullet(e,t)})))}_shouldMakeBullet(e){return!0}_makeBullet(e,t,s){const i=t(this._root,this,e);return i&&(i._index=s,this._makeBulletReal(e,i)),i}_makeBulletReal(e,t){let s=t.get("sprite");s&&(s._setDataItem(e),s.setRaw("position","absolute"),this.bulletsContainer.children.push(s)),t.series=this,e.bullets.push(t)}addBullet(e,t){e.bullets||(e.bullets=[]),t&&this._makeBulletReal(e,t)}_clearDirty(){super._clearDirty(),this._aggregatesCalculated=!1,this._selectionAggregatesCalculated=!1}_prepareChildren(){super._prepareChildren();let e=this.startIndex(),t=this.endIndex();if(this.isDirty("name")&&this.updateLegendValue(),this.isDirty("heatRules")&&(this._valuesDirty=!0),this.isPrivateDirty("baseValueSeries")){const e=this.getPrivate("baseValueSeries");e&&this._disposers.push(e.onPrivate("startIndex",(()=>{this.markDirtyValues()})))}if(this.get("calculateAggregates")&&(this._valuesDirty&&!this._dataProcessed&&(this._aggregatesCalculated||(this._calculateAggregates(0,this.dataItems.length),this._aggregatesCalculated=!0,0!=e&&(this._psi=void 0))),this._psi==e&&this._pei==t&&!this.isPrivateDirty("adjustedStartIndex")||this._selectionAggregatesCalculated||(0===e&&t===this.dataItems.length&&this._aggregatesCalculated||this._calculateAggregates(e,t),this._selectionAggregatesCalculated=!0)),this.isDirty("tooltip")){let e=this.get("tooltip");e&&(e.hide(0),e.set("tooltipTarget",this))}if(this.isDirty("fill")||this.isDirty("stroke")){let e;const t=this.get("legendDataItem");if(t&&(e=t.get("markerRectangle"),e&&this.isVisible())){if(this.isDirty("stroke")){let t=this.get("stroke");e.set("stroke",t)}if(this.isDirty("fill")){let t=this.get("fill");e.set("fill",t)}}this.updateLegendMarker(void 0)}if(this.bullets.length>0){let e=this.startIndex(),t=this.endIndex();t<this.dataItems.length&&t++;for(let s=e;s<t;s++){let e=this.dataItems[s];e.bullets||this._makeBullets(e)}}}_adjustStartIndex(e){return e}_calculateAggregates(e,t){let s=this._valueFields;if(!s)throw new Error("No value fields are set for the series.");const i={},l={},r={},n={},o={},h={},u={},d={},c={};a(s,(e=>{i[e]=0,l[e]=0,r[e]=0})),a(s,(s=>{let a=s+"Change",m=s+"ChangePercent",p=s+"ChangePrevious",f=s+"ChangePreviousPercent",b=s+"ChangeSelection",g=s+"ChangeSelectionPercent",_="valueY";"valueX"!=s&&"openValueX"!=s&&"lowValueX"!=s&&"highValueX"!=s||(_="valueX");const v=this.getPrivate("baseValueSeries"),y=this.getPrivate("adjustedStartIndex",e);for(let w=y;w<t;w++){const t=this.dataItems[w];if(t){let y=t.get(s);null!=y&&(r[s]++,i[s]+=y,l[s]+=Math.abs(y),d[s]=i[s]/r[s],(n[s]>y||null==n[s])&&(n[s]=y),(o[s]<y||null==o[s])&&(o[s]=y),u[s]=y,null==h[s]&&(h[s]=y,c[s]=y,v&&(h[_]=v._getBase(_))),0===e&&(t.setRaw(a,y-h[_]),t.setRaw(m,(y-h[_])/h[_]*100)),t.setRaw(p,y-c[_]),t.setRaw(f,(y-c[_])/c[_]*100),t.setRaw(b,y-h[_]),t.setRaw(g,(y-h[_])/h[_]*100),c[s]=y)}}if(t<this.dataItems.length-1){const e=this.dataItems[t];if(e){let t=e.get(s);e.setRaw(p,t-c[_]),e.setRaw(f,(t-c[_])/c[_]*100),e.setRaw(b,t-h[_]),e.setRaw(g,(t-h[_])/h[_]*100)}}e>0&&e--,delete c[s];for(let t=e;t<y;t++){const e=this.dataItems[t];if(e){let t=e.get(s);null==c[s]&&(c[s]=t),null!=t&&(e.setRaw(p,t-c[_]),e.setRaw(f,(t-c[_])/c[_]*100),e.setRaw(b,t-h[_]),e.setRaw(g,(t-h[_])/h[_]*100),c[s]=t)}}})),a(s,(e=>{this.setPrivate(e+"AverageSelection",d[e]),this.setPrivate(e+"CountSelection",r[e]),this.setPrivate(e+"SumSelection",i[e]),this.setPrivate(e+"AbsoluteSumSelection",l[e]),this.setPrivate(e+"LowSelection",n[e]),this.setPrivate(e+"HighSelection",o[e]),this.setPrivate(e+"OpenSelection",h[e]),this.setPrivate(e+"CloseSelection",u[e])})),0===e&&t===this.dataItems.length&&a(s,(e=>{this.setPrivate(e+"Average",d[e]),this.setPrivate(e+"Count",r[e]),this.setPrivate(e+"Sum",i[e]),this.setPrivate(e+"AbsoluteSum",l[e]),this.setPrivate(e+"Low",n[e]),this.setPrivate(e+"High",o[e]),this.setPrivate(e+"Open",h[e]),this.setPrivate(e+"Close",u[e])}))}_updateChildren(){super._updateChildren(),this._psi=this.startIndex(),this._pei=this.endIndex(),this.isDirty("visible")&&this.bulletsContainer.set("visible",this.get("visible"));const e=this.get("heatRules");if(this._valuesDirty&&e&&e.length>0&&a(e,(e=>{const t=e.minValue||this.getPrivate(e.dataField+"Low")||0,s=e.maxValue||this.getPrivate(e.dataField+"High")||0;a(e.target._entities,(i=>{const a=i.dataItem.get(e.dataField);if(!r(a)){e.neutral&&i.set(e.key,e.neutral);const t=i.states;if(t){const s=t.lookup("default");s&&e.neutral&&s.set(e.key,e.neutral)}if(!e.customFunction)return}if(e.customFunction)e.customFunction.call(this,i,t,s,a);else{let l,n;l=e.logarithmic?(Math.log(a)*Math.LOG10E-Math.log(t)*Math.LOG10E)/(Math.log(s)*Math.LOG10E-Math.log(t)*Math.LOG10E):(a-t)/(s-t),!r(a)||r(l)&&Math.abs(l)!=1/0||(l=.5),r(e.min)?n=e.min+(e.max-e.min)*l:e.min instanceof h?n=h.interpolate(l,e.min,e.max):e.min instanceof u&&(n=d(l,e.min,e.max)),i.set(e.key,n);const o=i.states;if(o){const t=o.lookup("default");t&&t.set(e.key,n)}}}))})),this.get("visible")){let e=this.dataItems.length,t=this.startIndex(),s=this.endIndex();s<e&&s++,t>0&&t--;for(let i=0;i<t;i++)this._hideBullets(this.dataItems[i]);for(let i=t;i<s;i++)this._positionBullets(this.dataItems[i]);for(let i=s;i<e;i++)this._hideBullets(this.dataItems[i])}}_positionBullets(e){e.bullets&&a(e.bullets,(e=>{this._positionBullet(e);const t=e.get("sprite");e.get("dynamic")&&(t&&(t._markDirtyKey("fill"),t.markDirtySize()),t instanceof i&&t.walkChildren((e=>{e._markDirtyKey("fill"),e.markDirtySize(),e instanceof c&&e.text.markDirtyText()}))),t instanceof c&&t.get("populateText")&&t.text.markDirtyText()}))}_hideBullets(e){e.bullets&&a(e.bullets,(e=>{let t=e.get("sprite");t&&t.setPrivate("visible",!1)}))}_positionBullet(e){}_placeBulletsContainer(e){e.bulletsContainer.children.moveValue(this.bulletsContainer)}_removeBulletsContainer(){const e=this.bulletsContainer;e.parent&&e.parent.children.removeValue(e)}disposeDataItem(e){const t=e.bullets;t&&a(t,(e=>{e.dispose()}))}_getItemReaderLabel(){return""}showDataItem(t,s){const i=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return e(this,void 0,void 0,(function*(){const e=[i.showDataItem.call(this,t,s)],l=t.bullets;l&&a(l,(t=>{const i=t.get("sprite");i&&e.push(i.show(s))})),yield Promise.all(e)}))}hideDataItem(t,s){const i=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return e(this,void 0,void 0,(function*(){const e=[i.hideDataItem.call(this,t,s)],l=t.bullets;l&&a(l,(t=>{const i=t.get("sprite");i&&e.push(i.hide(s))})),yield Promise.all(e)}))}_sequencedShowHide(t,s){return e(this,void 0,void 0,(function*(){if(this.get("sequencedInterpolation"))if(r(s)||(s=this.get("interpolationDuration",0)),s>0){const i=this.startIndex(),a=this.endIndex();yield Promise.all(m(this.dataItems,((l,r)=>e(this,void 0,void 0,(function*(){let e=s||0;(r<i-10||r>a+10)&&(e=0);let n=this.get("sequencedDelay",0)+e/(a-i);yield v(n*(r-i)),t?yield this.showDataItem(l,e):yield this.hideDataItem(l,e)})))))}else yield Promise.all(m(this.dataItems,(e=>t?this.showDataItem(e,0):this.hideDataItem(e,0))))}))}updateLegendValue(e){if(e){const t=e.get("legendDataItem");if(t){const s=t.get("valueLabel");if(s){const t=s.text;let i="";s._setDataItem(e),i=this.get("legendValueText",t.get("text","")),s.set("text",i),t.markDirtyText()}const i=t.get("label");if(i){const t=i.text;let s="";i._setDataItem(e),s=this.get("legendLabelText",t.get("text","")),i.set("text",s),t.markDirtyText()}}}}updateLegendMarker(e){}_onHide(){super._onHide();const e=this.getTooltip();e&&e.hide()}hoverDataItem(e){}unhoverDataItem(e){}_getBase(e){const t=this.dataItems[this.startIndex()];return t?t.get(e):0}}function x(e,t){for(let s=0,i=t.length;s<i;s++){const i=t[s];if(i.length>0){let t=i[0];if(t.length>0){let s=t[0];e.moveTo(s.x,s.y);for(let t=0,a=i.length;t<a;t++)C(e,i[t])}}}}function C(e,t){for(let s=0,i=t.length;s<i;s++){const i=t[s];e.lineTo(i.x,i.y)}}Object.defineProperty(D,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Series"}),Object.defineProperty(D,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:_.classNames.concat([D.className])});class P extends p{_beforeChanged(){super._beforeChanged(),(this.isDirty("points")||this.isDirty("segments")||this._sizeDirty||this.isPrivateDirty("width")||this.isPrivateDirty("height"))&&(this._clear=!0)}_changed(){if(super._changed(),this._clear){const e=this.get("points"),t=this.get("segments");if(e&&e.length>0){let t=e[0];this._display.moveTo(t.x,t.y),x(this._display,[[e]])}else if(t)x(this._display,t);else if(!this.get("draw")){let e=this.width(),t=this.height();this._display.moveTo(0,0),this._display.lineTo(e,t)}}}}function k(e){return function(){return e}}Object.defineProperty(P,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Line"}),Object.defineProperty(P,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:p.classNames.concat([P.className])});const T=Math.PI,M=2*T,O=1e-6,$=M-O;function j(e){this._+=e[0];for(let t=1,s=e.length;t<s;++t)this._+=arguments[t]+e[t]}function S(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return j;const s=10**t;return function(e){this._+=e[0];for(let t=1,i=e.length;t<i;++t)this._+=Math.round(arguments[t]*s)/s+e[t]}}class F{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?j:S(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,s,i){this._append`Q${+e},${+t},${this._x1=+s},${this._y1=+i}`}bezierCurveTo(e,t,s,i,a,l){this._append`C${+e},${+t},${+s},${+i},${this._x1=+a},${this._y1=+l}`}arcTo(e,t,s,i,a){if(e=+e,t=+t,s=+s,i=+i,(a=+a)<0)throw new Error(`negative radius: ${a}`);let l=this._x1,r=this._y1,n=s-e,o=i-t,h=l-e,u=r-t,d=h*h+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>O)if(Math.abs(u*n-o*h)>O&&a){let c=s-l,m=i-r,p=n*n+o*o,f=c*c+m*m,b=Math.sqrt(p),g=Math.sqrt(d),_=a*Math.tan((T-Math.acos((p+d-f)/(2*b*g)))/2),v=_/g,y=_/b;Math.abs(v-1)>O&&this._append`L${e+v*h},${t+v*u}`,this._append`A${a},${a},0,0,${+(u*c>h*m)},${this._x1=e+y*n},${this._y1=t+y*o}`}else this._append`L${this._x1=e},${this._y1=t}`;else;}arc(e,t,s,i,a,l){if(e=+e,t=+t,l=!!l,(s=+s)<0)throw new Error(`negative radius: ${s}`);let r=s*Math.cos(i),n=s*Math.sin(i),o=e+r,h=t+n,u=1^l,d=l?i-a:a-i;null===this._x1?this._append`M${o},${h}`:(Math.abs(this._x1-o)>O||Math.abs(this._y1-h)>O)&&this._append`L${o},${h}`,s&&(d<0&&(d=d%M+M),d>$?this._append`A${s},${s},0,1,${u},${e-r},${t-n}A${s},${s},0,1,${u},${this._x1=o},${this._y1=h}`:d>O&&this._append`A${s},${s},0,${+(d>=T)},${u},${this._x1=e+s*Math.cos(a)},${this._y1=t+s*Math.sin(a)}`)}rect(e,t,s,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${s=+s}v${+i}h${-s}Z`}toString(){return this._}}function V(e){let t=3;return e.digits=function(s){if(!arguments.length)return t;if(null==s)t=null;else{const e=Math.floor(s);if(!(e>=0))throw new RangeError(`invalid digits: ${s}`);t=e}return e},()=>new F(t)}class N extends i{constructor(){super(...arguments),Object.defineProperty(this,"chartContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(i.new(this._root,{width:n,height:n,interactiveChildren:!1}))}),Object.defineProperty(this,"bulletsContainer",{enumerable:!0,configurable:!0,writable:!0,value:i.new(this._root,{interactiveChildren:!1,isMeasured:!1,position:"absolute",width:n,height:n})})}}Object.defineProperty(N,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Chart"}),Object.defineProperty(N,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:i.classNames.concat([N.className])});class R extends N{constructor(){super(...arguments),Object.defineProperty(this,"seriesContainer",{enumerable:!0,configurable:!0,writable:!0,value:i.new(this._root,{width:n,height:n,isMeasured:!1})}),Object.defineProperty(this,"series",{enumerable:!0,configurable:!0,writable:!0,value:new f})}_afterNew(){super._afterNew(),this._disposers.push(this.series);const e=this.seriesContainer.children;this._disposers.push(this.series.events.onAll((t=>{if("clear"===t.type){a(t.oldValues,(e=>{this._removeSeries(e)}));const e=this.get("colors");e&&e.reset();const s=this.get("patterns");s&&s.reset()}else if("push"===t.type)e.moveValue(t.newValue),this._processSeries(t.newValue);else if("setIndex"===t.type)e.setIndex(t.index,t.newValue),this._processSeries(t.newValue);else if("insertIndex"===t.type)e.insertIndex(t.index,t.newValue),this._processSeries(t.newValue);else if("removeIndex"===t.type)this._removeSeries(t.oldValue);else{if("moveIndex"!==t.type)throw new Error("Unknown IListEvent type");e.moveValue(t.value,t.newIndex),this._processSeries(t.value)}})))}_processSeries(e){e.chart=this,e._placeBulletsContainer(this)}_removeSeries(e){e.isDisposed()||(this.seriesContainer.children.removeValue(e),e._removeBulletsContainer())}}Object.defineProperty(R,"className",{enumerable:!0,configurable:!0,writable:!0,value:"SerialChart"}),Object.defineProperty(R,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:N.classNames.concat([R.className])});class U extends P{}Object.defineProperty(U,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Tick"}),Object.defineProperty(U,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:P.classNames.concat([U.className])});export{_ as C,g as D,R as S,U as T,D as a,k as c,I as r,V as w};
5
+ import{d as e}from"./tslib.es6.js";import{F as t,S as s,g as i,i as a,H as l,k as r,a as n,I as o,C as h,P as u,J as d,L as c,K as m,e as p,N as f}from"./Theme.js";class b extends t{constructor(){super(...arguments),Object.defineProperty(this,"processor",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}incrementRef(){}decrementRef(){}_onPush(e){this.processor&&this.processor.processRow(e),super._onPush(e)}_onInsertIndex(e,t){this.processor&&this.processor.processRow(t),super._onInsertIndex(e,t)}_onSetIndex(e,t,s){this.processor&&this.processor.processRow(s),super._onSetIndex(e,t,s)}}class g extends s{constructor(e,t,s){super(s),Object.defineProperty(this,"component",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dataContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bullets",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"open",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"close",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.dataContext=t,this.component=e,this._settings.visible=!0,this._checkDirty()}markDirty(){this.component.markDirtyValues(this)}_startAnimation(){this.component._root._addAnimation(this)}_animationTime(){return this.component._root.animationTime}_dispose(){this.component&&this.component.disposeDataItem(this),super._dispose()}show(e){this.setRaw("visible",!0),this.component&&this.component.showDataItem(this,e)}hide(e){this.setRaw("visible",!1),this.component&&this.component.hideDataItem(this,e)}isHidden(){return!this.get("visible")}}class _ extends i{constructor(){super(...arguments),Object.defineProperty(this,"_data",{enumerable:!0,configurable:!0,writable:!0,value:new b}),Object.defineProperty(this,"_dataItems",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_mainDataItems",{enumerable:!0,configurable:!0,writable:!0,value:this._dataItems}),Object.defineProperty(this,"valueFields",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"fields",{enumerable:!0,configurable:!0,writable:!0,value:["id"]}),Object.defineProperty(this,"_valueFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valueFieldsF",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fieldsF",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valuesDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataChanged",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataGrouped",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"inited",{enumerable:!0,configurable:!0,writable:!0,value:!1})}set data(e){e.incrementRef(),this._data.decrementRef(),this._data=e}get data(){return this._data}_dispose(){super._dispose(),this._data.decrementRef()}_onDataClear(){}_afterNew(){super._afterNew(),this._data.incrementRef(),this._updateFields(),this._disposers.push(this.data.events.onAll((e=>{const t=this._mainDataItems;if(this.markDirtyValues(),this._markDirtyGroup(),this._dataChanged=!0,"clear"===e.type)a(t,(e=>{e.dispose()})),t.length=0,this._onDataClear();else if("push"===e.type){const s=new g(this,e.newValue,this._makeDataItem(e.newValue));t.push(s),this.processDataItem(s)}else if("setIndex"===e.type){const s=t[e.index],i=this._makeDataItem(e.newValue);s.bullets&&0==s.bullets.length&&(s.bullets=void 0),l(i).forEach((e=>{s.animate({key:e,to:i[e],duration:this.get("interpolationDuration",0),easing:this.get("interpolationEasing")})})),s.dataContext=e.newValue}else if("insertIndex"===e.type){const s=new g(this,e.newValue,this._makeDataItem(e.newValue));t.splice(e.index,0,s),this.processDataItem(s)}else if("removeIndex"===e.type){t[e.index].dispose(),t.splice(e.index,1)}else{if("moveIndex"!==e.type)throw new Error("Unknown IStreamEvent type");{const s=t[e.oldIndex];t.splice(e.oldIndex,1),t.splice(e.newIndex,0,s)}}this._afterDataChange()})))}_updateFields(){this.valueFields&&(this._valueFields=[],this._valueFieldsF={},a(this.valueFields,(e=>{this.get(e+"Field")&&(this._valueFields.push(e),this._valueFieldsF[e]={fieldKey:e+"Field",workingKey:e+"Working"})}))),this.fields&&(this._fields=[],this._fieldsF={},a(this.fields,(e=>{this.get(e+"Field")&&(this._fields.push(e),this._fieldsF[e]=e+"Field")})))}get dataItems(){return this._dataItems}processDataItem(e){}_makeDataItem(e){const t={};return this._valueFields&&a(this._valueFields,(s=>{const i=this.get(this._valueFieldsF[s].fieldKey);t[s]=e[i],t[this._valueFieldsF[s].workingKey]=t[s]})),this._fields&&a(this._fields,(s=>{const i=this.get(this._fieldsF[s]);t[s]=e[i]})),t}makeDataItem(e,t){let s=new g(this,t,e);return this.processDataItem(s),s}pushDataItem(e,t){const s=this.makeDataItem(e,t);return this._mainDataItems.push(s),s}disposeDataItem(e){}showDataItem(t,s){return e(this,void 0,void 0,(function*(){t.set("visible",!0)}))}hideDataItem(t,s){return e(this,void 0,void 0,(function*(){t.set("visible",!1)}))}_clearDirty(){super._clearDirty(),this._valuesDirty=!1}_afterDataChange(){}_afterChanged(){if(super._afterChanged(),this._dataChanged){const e="datavalidated";this.events.isEnabled(e)&&this.events.dispatch(e,{type:e,target:this}),this._dataChanged=!1}this.inited=!0}markDirtyValues(e){this.markDirty(),this._valuesDirty=!0}_markDirtyGroup(){this._dataGrouped=!1}markDirtySize(){this._sizeDirty=!0,this.markDirty()}}function v(e){return new Promise(((t,s)=>{setTimeout(t,e)}))}function y(e,t,s,i,a,l,n){if(!n||a){let l=0;switch(a||"millisecond"==t||(l=e.getTimezoneOffset(),e.setUTCMinutes(e.getUTCMinutes()-l)),t){case"day":let t=e.getUTCDate();s>1||e.setUTCDate(t),e.setUTCHours(0,0,0,0);break;case"second":let a=e.getUTCSeconds();s>1&&(a=Math.floor(a/s)*s),e.setUTCSeconds(a,0);break;case"millisecond":if(1==s)return e;let l=e.getUTCMilliseconds();l=Math.floor(l/s)*s,e.setUTCMilliseconds(l);break;case"hour":let n=e.getUTCHours();s>1&&(n=Math.floor(n/s)*s),e.setUTCHours(n,0,0,0);break;case"minute":let o=e.getUTCMinutes();s>1&&(o=Math.floor(o/s)*s),e.setUTCMinutes(o,0,0);break;case"month":let h=e.getUTCMonth();s>1&&(h=Math.floor(h/s)*s),e.setUTCMonth(h,1),e.setUTCHours(0,0,0,0);break;case"year":let u=e.getUTCFullYear();s>1&&(u=Math.floor(u/s)*s),e.setUTCFullYear(u,0,1),e.setUTCHours(0,0,0,0);break;case"week":let d=e.getUTCDate(),c=e.getUTCDay();r(i)||(i=1),d=c>=i?d-c+i:d-(7+c)+i,e.setUTCDate(d),e.setUTCHours(0,0,0,0)}if(!a&&"millisecond"!=t&&(e.setUTCMinutes(e.getUTCMinutes()+l),"day"==t||"week"==t||"month"==t||"year"==t)){let t=e.getTimezoneOffset();if(t!=l){let s=t-l;e.setUTCMinutes(e.getUTCMinutes()+s)}}return e}{if(isNaN(e.getTime()))return e;let a=n.offsetUTC(e),l=e.getTimezoneOffset(),o=n.parseDate(e),h=o.year,u=o.month,d=o.day,c=o.hour,m=o.minute,p=o.second,f=o.millisecond,b=o.weekday,g=a-l;switch(t){case"day":c=0,m=g,p=0,f=0;break;case"second":m+=g,s>1&&(p=Math.floor(p/s)*s),f=0;break;case"millisecond":m+=g,s>1&&(f=Math.floor(f/s)*s);break;case"hour":s>1&&(c=Math.floor(c/s)*s),m=g,p=0,f=0;break;case"minute":s>1&&(m=Math.floor(m/s)*s),m+=g,p=0,f=0;break;case"month":s>1&&(u=Math.floor(u/s)*s),d=1,c=0,m=g,p=0,f=0;break;case"year":s>1&&(h=Math.floor(h/s)*s),u=0,d=1,c=0,m=g,p=0,f=0;break;case"week":r(i)||(i=1),d=b>=i?d-b+i:d-(7+b)+i,c=0,m=g,p=0,f=0}let _=(e=new Date(h,u,d,c,m,p,f)).getTimezoneOffset(),v=n.offsetUTC(e)-_;return v!=g&&e.setTime(e.getTime()+6e4*(v-g)),e}}Object.defineProperty(_,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Component"}),Object.defineProperty(_,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:i.classNames.concat([_.className])});class w extends _{constructor(){super(...arguments),Object.defineProperty(this,"_aggregatesCalculated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_selectionAggregatesCalculated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataProcessed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_psi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pei",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bullets",{enumerable:!0,configurable:!0,writable:!0,value:new t}),Object.defineProperty(this,"bulletsContainer",{enumerable:!0,configurable:!0,writable:!0,value:i.new(this._root,{width:n,height:n,position:"absolute"})})}_afterNew(){this.valueFields.push("value","customValue"),super._afterNew(),this.setPrivate("customData",{}),this._disposers.push(this.bullets.events.onAll((e=>{if("clear"===e.type)this._handleBullets(this.dataItems);else if("push"===e.type)this._handleBullets(this.dataItems);else if("setIndex"===e.type)this._handleBullets(this.dataItems);else if("insertIndex"===e.type)this._handleBullets(this.dataItems);else if("removeIndex"===e.type)this._handleBullets(this.dataItems);else{if("moveIndex"!==e.type)throw new Error("Unknown IListEvent type");this._handleBullets(this.dataItems)}})))}_dispose(){this.bulletsContainer.dispose(),super._dispose()}startIndex(){let e=this.dataItems.length;return Math.min(this.getPrivate("startIndex",0),e)}endIndex(){let e=this.dataItems.length;return Math.min(this.getPrivate("endIndex",e),e)}_handleBullets(e){a(e,(e=>{const t=e.bullets;t&&(a(t,(e=>{e.dispose()})),e.bullets=void 0)})),this.markDirtyValues()}getDataItemById(e){return o(this.dataItems,(t=>t.get("id")==e))}_makeBullets(e){this._shouldMakeBullet(e)&&(e.bullets=[],this.bullets.each((t=>{this._makeBullet(e,t)})))}_shouldMakeBullet(e){return!0}_makeBullet(e,t,s){const i=t(this._root,this,e);return i&&(i._index=s,this._makeBulletReal(e,i)),i}_makeBulletReal(e,t){let s=t.get("sprite");s&&(s._setDataItem(e),s.setRaw("position","absolute"),this.bulletsContainer.children.push(s)),t.series=this,e.bullets.push(t)}addBullet(e,t){e.bullets||(e.bullets=[]),t&&this._makeBulletReal(e,t)}_clearDirty(){super._clearDirty(),this._aggregatesCalculated=!1,this._selectionAggregatesCalculated=!1}_prepareChildren(){super._prepareChildren();let e=this.startIndex(),t=this.endIndex();if(this.isDirty("name")&&this.updateLegendValue(),this.isDirty("heatRules")&&(this._valuesDirty=!0),this.isPrivateDirty("baseValueSeries")){const e=this.getPrivate("baseValueSeries");e&&this._disposers.push(e.onPrivate("startIndex",(()=>{this.markDirtyValues()})))}if(this.get("calculateAggregates")&&(this._valuesDirty&&!this._dataProcessed&&(this._aggregatesCalculated||(this._calculateAggregates(0,this.dataItems.length),this._aggregatesCalculated=!0,0!=e&&(this._psi=void 0))),this._psi==e&&this._pei==t&&!this.isPrivateDirty("adjustedStartIndex")||this._selectionAggregatesCalculated||(0===e&&t===this.dataItems.length&&this._aggregatesCalculated||this._calculateAggregates(e,t),this._selectionAggregatesCalculated=!0)),this.isDirty("tooltip")){let e=this.get("tooltip");e&&(e.hide(0),e.set("tooltipTarget",this))}if(this.isDirty("fill")||this.isDirty("stroke")){let e;const t=this.get("legendDataItem");if(t&&(e=t.get("markerRectangle"),e&&this.isVisible())){if(this.isDirty("stroke")){let t=this.get("stroke");e.set("stroke",t)}if(this.isDirty("fill")){let t=this.get("fill");e.set("fill",t)}}this.updateLegendMarker(void 0)}if(this.bullets.length>0){let e=this.startIndex(),t=this.endIndex();t<this.dataItems.length&&t++;for(let s=e;s<t;s++){let e=this.dataItems[s];e.bullets||this._makeBullets(e)}}}_adjustStartIndex(e){return e}_calculateAggregates(e,t){let s=this._valueFields;if(!s)throw new Error("No value fields are set for the series.");const i={},l={},r={},n={},o={},h={},u={},d={},c={};a(s,(e=>{i[e]=0,l[e]=0,r[e]=0})),a(s,(s=>{let a=s+"Change",m=s+"ChangePercent",p=s+"ChangePrevious",f=s+"ChangePreviousPercent",b=s+"ChangeSelection",g=s+"ChangeSelectionPercent",_="valueY";"valueX"!=s&&"openValueX"!=s&&"lowValueX"!=s&&"highValueX"!=s||(_="valueX");const v=this.getPrivate("baseValueSeries"),y=this.getPrivate("adjustedStartIndex",e);for(let w=y;w<t;w++){const t=this.dataItems[w];if(t){let y=t.get(s);null!=y&&(r[s]++,i[s]+=y,l[s]+=Math.abs(y),d[s]=i[s]/r[s],(n[s]>y||null==n[s])&&(n[s]=y),(o[s]<y||null==o[s])&&(o[s]=y),u[s]=y,null==h[s]&&(h[s]=y,c[s]=y,v&&(h[_]=v._getBase(_))),0===e&&(t.setRaw(a,y-h[_]),t.setRaw(m,(y-h[_])/h[_]*100)),t.setRaw(p,y-c[_]),t.setRaw(f,(y-c[_])/c[_]*100),t.setRaw(b,y-h[_]),t.setRaw(g,(y-h[_])/h[_]*100),c[s]=y)}}if(t<this.dataItems.length-1){const e=this.dataItems[t];if(e){let t=e.get(s);e.setRaw(p,t-c[_]),e.setRaw(f,(t-c[_])/c[_]*100),e.setRaw(b,t-h[_]),e.setRaw(g,(t-h[_])/h[_]*100)}}e>0&&e--,delete c[s];for(let t=e;t<y;t++){const e=this.dataItems[t];if(e){let t=e.get(s);null==c[s]&&(c[s]=t),null!=t&&(e.setRaw(p,t-c[_]),e.setRaw(f,(t-c[_])/c[_]*100),e.setRaw(b,t-h[_]),e.setRaw(g,(t-h[_])/h[_]*100),c[s]=t)}}})),a(s,(e=>{this.setPrivate(e+"AverageSelection",d[e]),this.setPrivate(e+"CountSelection",r[e]),this.setPrivate(e+"SumSelection",i[e]),this.setPrivate(e+"AbsoluteSumSelection",l[e]),this.setPrivate(e+"LowSelection",n[e]),this.setPrivate(e+"HighSelection",o[e]),this.setPrivate(e+"OpenSelection",h[e]),this.setPrivate(e+"CloseSelection",u[e])})),0===e&&t===this.dataItems.length&&a(s,(e=>{this.setPrivate(e+"Average",d[e]),this.setPrivate(e+"Count",r[e]),this.setPrivate(e+"Sum",i[e]),this.setPrivate(e+"AbsoluteSum",l[e]),this.setPrivate(e+"Low",n[e]),this.setPrivate(e+"High",o[e]),this.setPrivate(e+"Open",h[e]),this.setPrivate(e+"Close",u[e])}))}_updateChildren(){super._updateChildren(),this._psi=this.startIndex(),this._pei=this.endIndex(),this.isDirty("visible")&&this.bulletsContainer.set("visible",this.get("visible"));const e=this.get("heatRules");if(this._valuesDirty&&e&&e.length>0&&a(e,(e=>{const t=e.minValue||this.getPrivate(e.dataField+"Low")||0,s=e.maxValue||this.getPrivate(e.dataField+"High")||0;a(e.target._entities,(i=>{const a=i.dataItem.get(e.dataField);if(!r(a)){e.neutral&&i.set(e.key,e.neutral);const t=i.states;if(t){const s=t.lookup("default");s&&e.neutral&&s.set(e.key,e.neutral)}if(!e.customFunction)return}if(e.customFunction)e.customFunction.call(this,i,t,s,a);else{let l,n;l=e.logarithmic?(Math.log(a)*Math.LOG10E-Math.log(t)*Math.LOG10E)/(Math.log(s)*Math.LOG10E-Math.log(t)*Math.LOG10E):(a-t)/(s-t),!r(a)||r(l)&&Math.abs(l)!=1/0||(l=.5),r(e.min)?n=e.min+(e.max-e.min)*l:e.min instanceof h?n=h.interpolate(l,e.min,e.max):e.min instanceof u&&(n=d(l,e.min,e.max)),i.set(e.key,n);const o=i.states;if(o){const t=o.lookup("default");t&&t.set(e.key,n)}}}))})),this.get("visible")){let e=this.dataItems.length,t=this.startIndex(),s=this.endIndex();s<e&&s++,t>0&&t--;for(let i=0;i<t;i++)this._hideBullets(this.dataItems[i]);for(let i=t;i<s;i++)this._positionBullets(this.dataItems[i]);for(let i=s;i<e;i++)this._hideBullets(this.dataItems[i])}}_positionBullets(e){e.bullets&&a(e.bullets,(e=>{this._positionBullet(e);const t=e.get("sprite");e.get("dynamic")&&(t&&(t._markDirtyKey("fill"),t.markDirtySize()),t instanceof i&&t.walkChildren((e=>{e._markDirtyKey("fill"),e.markDirtySize(),e instanceof c&&e.text.markDirtyText()}))),t instanceof c&&t.get("populateText")&&t.text.markDirtyText()}))}_hideBullets(e){e.bullets&&a(e.bullets,(e=>{let t=e.get("sprite");t&&t.setPrivate("visible",!1)}))}_positionBullet(e){}_placeBulletsContainer(e){e.bulletsContainer.children.moveValue(this.bulletsContainer)}_removeBulletsContainer(){const e=this.bulletsContainer;e.parent&&e.parent.children.removeValue(e)}disposeDataItem(e){const t=e.bullets;t&&a(t,(e=>{e.dispose()}))}_getItemReaderLabel(){return""}showDataItem(t,s){const i=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return e(this,void 0,void 0,(function*(){const e=[i.showDataItem.call(this,t,s)],l=t.bullets;l&&a(l,(t=>{const i=t.get("sprite");i&&e.push(i.show(s))})),yield Promise.all(e)}))}hideDataItem(t,s){const i=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return e(this,void 0,void 0,(function*(){const e=[i.hideDataItem.call(this,t,s)],l=t.bullets;l&&a(l,(t=>{const i=t.get("sprite");i&&e.push(i.hide(s))})),yield Promise.all(e)}))}_sequencedShowHide(t,s){return e(this,void 0,void 0,(function*(){if(this.get("sequencedInterpolation"))if(r(s)||(s=this.get("interpolationDuration",0)),s>0){const i=this.startIndex(),a=this.endIndex();yield Promise.all(m(this.dataItems,((l,r)=>e(this,void 0,void 0,(function*(){let e=s||0;(r<i-10||r>a+10)&&(e=0);let n=this.get("sequencedDelay",0)+e/(a-i);yield v(n*(r-i)),t?yield this.showDataItem(l,e):yield this.hideDataItem(l,e)})))))}else yield Promise.all(m(this.dataItems,(e=>t?this.showDataItem(e,0):this.hideDataItem(e,0))))}))}updateLegendValue(e){if(e){const t=e.get("legendDataItem");if(t){const s=t.get("valueLabel");if(s){const t=s.text;let i="";s._setDataItem(e),i=this.get("legendValueText",t.get("text","")),s.set("text",i),t.markDirtyText()}const i=t.get("label");if(i){const t=i.text;let s="";i._setDataItem(e),s=this.get("legendLabelText",t.get("text","")),i.set("text",s),t.markDirtyText()}}}}updateLegendMarker(e){}_onHide(){super._onHide();const e=this.getTooltip();e&&e.hide()}hoverDataItem(e){}unhoverDataItem(e){}_getBase(e){const t=this.dataItems[this.startIndex()];return t?t.get(e):0}}function I(e,t){for(let s=0,i=t.length;s<i;s++){const i=t[s];if(i.length>0){let t=i[0];if(t.length>0){let s=t[0];e.moveTo(s.x,s.y);for(let t=0,a=i.length;t<a;t++)D(e,i[t])}}}}function D(e,t){for(let s=0,i=t.length;s<i;s++){const i=t[s];e.lineTo(i.x,i.y)}}Object.defineProperty(w,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Series"}),Object.defineProperty(w,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:_.classNames.concat([w.className])});class x extends p{_beforeChanged(){super._beforeChanged(),(this.isDirty("points")||this.isDirty("segments")||this._sizeDirty||this.isPrivateDirty("width")||this.isPrivateDirty("height"))&&(this._clear=!0)}_changed(){if(super._changed(),this._clear){const e=this.get("points"),t=this.get("segments");if(e&&e.length>0){let t=e[0];this._display.moveTo(t.x,t.y),I(this._display,[[e]])}else if(t)I(this._display,t);else if(!this.get("draw")){let e=this.width(),t=this.height();this._display.moveTo(0,0),this._display.lineTo(e,t)}}}}function C(e){return function(){return e}}Object.defineProperty(x,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Line"}),Object.defineProperty(x,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:p.classNames.concat([x.className])});const P=Math.PI,k=2*P,M=1e-6,T=k-M;function O(e){this._+=e[0];for(let t=1,s=e.length;t<s;++t)this._+=arguments[t]+e[t]}function $(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return O;const s=10**t;return function(e){this._+=e[0];for(let t=1,i=e.length;t<i;++t)this._+=Math.round(arguments[t]*s)/s+e[t]}}class j{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?O:$(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,s,i){this._append`Q${+e},${+t},${this._x1=+s},${this._y1=+i}`}bezierCurveTo(e,t,s,i,a,l){this._append`C${+e},${+t},${+s},${+i},${this._x1=+a},${this._y1=+l}`}arcTo(e,t,s,i,a){if(e=+e,t=+t,s=+s,i=+i,(a=+a)<0)throw new Error(`negative radius: ${a}`);let l=this._x1,r=this._y1,n=s-e,o=i-t,h=l-e,u=r-t,d=h*h+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>M)if(Math.abs(u*n-o*h)>M&&a){let c=s-l,m=i-r,p=n*n+o*o,f=c*c+m*m,b=Math.sqrt(p),g=Math.sqrt(d),_=a*Math.tan((P-Math.acos((p+d-f)/(2*b*g)))/2),v=_/g,y=_/b;Math.abs(v-1)>M&&this._append`L${e+v*h},${t+v*u}`,this._append`A${a},${a},0,0,${+(u*c>h*m)},${this._x1=e+y*n},${this._y1=t+y*o}`}else this._append`L${this._x1=e},${this._y1=t}`;else;}arc(e,t,s,i,a,l){if(e=+e,t=+t,l=!!l,(s=+s)<0)throw new Error(`negative radius: ${s}`);let r=s*Math.cos(i),n=s*Math.sin(i),o=e+r,h=t+n,u=1^l,d=l?i-a:a-i;null===this._x1?this._append`M${o},${h}`:(Math.abs(this._x1-o)>M||Math.abs(this._y1-h)>M)&&this._append`L${o},${h}`,s&&(d<0&&(d=d%k+k),d>T?this._append`A${s},${s},0,1,${u},${e-r},${t-n}A${s},${s},0,1,${u},${this._x1=o},${this._y1=h}`:d>M&&this._append`A${s},${s},0,${+(d>=P)},${u},${this._x1=e+s*Math.cos(a)},${this._y1=t+s*Math.sin(a)}`)}rect(e,t,s,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${s=+s}v${+i}h${-s}Z`}toString(){return this._}}function S(e){let t=3;return e.digits=function(s){if(!arguments.length)return t;if(null==s)t=null;else{const e=Math.floor(s);if(!(e>=0))throw new RangeError(`invalid digits: ${s}`);t=e}return e},()=>new j(t)}class F extends i{constructor(){super(...arguments),Object.defineProperty(this,"chartContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(i.new(this._root,{width:n,height:n,interactiveChildren:!1}))}),Object.defineProperty(this,"bulletsContainer",{enumerable:!0,configurable:!0,writable:!0,value:i.new(this._root,{interactiveChildren:!1,isMeasured:!1,position:"absolute",width:n,height:n})})}}Object.defineProperty(F,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Chart"}),Object.defineProperty(F,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:i.classNames.concat([F.className])});class V extends F{constructor(){super(...arguments),Object.defineProperty(this,"seriesContainer",{enumerable:!0,configurable:!0,writable:!0,value:i.new(this._root,{width:n,height:n,isMeasured:!1})}),Object.defineProperty(this,"series",{enumerable:!0,configurable:!0,writable:!0,value:new f})}_afterNew(){super._afterNew(),this._disposers.push(this.series);const e=this.seriesContainer.children;this._disposers.push(this.series.events.onAll((t=>{if("clear"===t.type){a(t.oldValues,(e=>{this._removeSeries(e)}));const e=this.get("colors");e&&e.reset();const s=this.get("patterns");s&&s.reset()}else if("push"===t.type)e.moveValue(t.newValue),this._processSeries(t.newValue);else if("setIndex"===t.type)e.setIndex(t.index,t.newValue),this._processSeries(t.newValue);else if("insertIndex"===t.type)e.insertIndex(t.index,t.newValue),this._processSeries(t.newValue);else if("removeIndex"===t.type)this._removeSeries(t.oldValue);else{if("moveIndex"!==t.type)throw new Error("Unknown IListEvent type");e.moveValue(t.value,t.newIndex),this._processSeries(t.value)}})))}_processSeries(e){e.chart=this,e._placeBulletsContainer(this)}_removeSeries(e){e.isDisposed()||(this.seriesContainer.children.removeValue(e),e._removeBulletsContainer())}}Object.defineProperty(V,"className",{enumerable:!0,configurable:!0,writable:!0,value:"SerialChart"}),Object.defineProperty(V,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:F.classNames.concat([V.className])});class N extends x{}Object.defineProperty(N,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Tick"}),Object.defineProperty(N,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:x.classNames.concat([N.className])});export{_ as C,g as D,V as S,N as T,w as a,C as c,y as r,S as w};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{k as t,g as s,w as i,t as e,x as n}from"./Geometry.js";class r{constructor(t){this.sum=t,this.compensation=0}assign(t){return this.compensation=t.compensation,this.sum=t.sum,this}reset(){this.sum=this.compensation=0}resetToStart(t){this.sum=t,this.compensation=0}normalize(){const t=[Number.NaN];this.sum=ct(this.sum,this.compensation,t),this.compensation=t[0]}add(t){const s=this.sum+t;let i;if(Math.abs(this.sum)>=Math.abs(t)){const e=this.sum-s+t;i=this.compensation+e}else{const e=t-s+this.sum;i=this.compensation+e}this.sum=s,this.compensation=i}sub(t){this.add(-t)}addProduct(t,s){const i=[0],e=ot(t,s,i);this.add(e),this.add(i[0])}mul(t){const s=new r(0);s.addProduct(this.sum,t),s.addProduct(this.compensation,t),this.assign(s)}getResult(){return this.sum+this.compensation}pe(t){return this.add(t),this}me(t){return this.add(-t),this}}const h=0x00000000ffffffffn,o=0x0000ffffn,a=0x000000ffn,u=0x0fn,l=0xffff0000n,m=0xff00n,c=0xf0n,y=[5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1],x=[-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3];function f(t){let s=0;return t&o||(s+=16,t>>=16n),t&a||(s+=8,t>>=8n),t&u||(s+=4,t>>=4n),s+y[Number(BigInt.asUintN(4,t))]}function d(t){let s=0;return t&l&&(s+=16,t>>=16n),t&m&&(s+=8,t>>=8n),t&c&&(s+=4,t>>=4n),s+x[Number(BigInt.asUintN(4,t))]+1}function b(t){let s=0;return t&h||(s=32,t>>=32n),s+f(BigInt.asUintN(32,t))}function v(t){let s=0;return 0xffffffff00000000n&t&&(s=32,t>>=32n),s+d(t)}class _{constructor(t,s){if(this.m_EnvelopeType=1,void 0!==t){if(t instanceof _)return this.vmin=t.vmin,void(this.vmax=t.vmax);this.vmin=t,this.vmax=s,this.normalize()}else this.setEmpty()}static construct(t,s){return new _(t,s)}static constructEmpty(){return new _}setCoords(t,s){this.vmin=t,this.vmax=s,this.normalize()}setCoordsFromEnvelope(t){this.vmin=t.vmin,this.vmax=t.vmax}setEmpty(){this.vmin=Number.NaN,this.vmax=Number.NaN}getCenter(){return.5*(this.vmin+this.vmax)}equalsRange(t,s){return ns(this.vmin,t)&&ns(this.vmax,s)}equals(t,s){return!(!this.isEmpty()||!t.isEmpty())||(void 0!==s?Math.abs(this.vmin-t.vmin)<=s&&Math.abs(this.vmax-t.vmax)<=s:this.vmin===t.vmin&&this.vmax===t.vmax)}width(){return this.vmax-this.vmin}isEmpty(){return Number.isNaN(this.vmin)||Number.isNaN(this.vmax)}isZero(){return this.vmin===this.vmax}setInfinite(){this.vmin=Number.NEGATIVE_INFINITY,this.vmax=Number.POSITIVE_INFINITY}move(t){this.isEmpty()||(this.vmin+=t,this.vmax+=t)}contains(t){return t.vmin>=this.vmin&&t.vmax<=this.vmax}containsCoordinate(t){return t>=this.vmin&&t<=this.vmax}containsRightExclusive(t){return t>=this.vmin&&t<this.vmax}containsExclusiveCoordinate(t){return t>this.vmin&&t<this.vmax}containsExclusive(t){return t.vmin>this.vmin&&t.vmax<this.vmax}isIntersecting(t){return this.vmin<=t.vmin?this.vmax>=t.vmin:t.vmax>=this.vmin}mergeCoordinate(t){if(this.isEmpty())return this.vmin=t,void(this.vmax=t);this.mergeNeCoordinate(t)}merge(t){if(t.isEmpty())return;const s=t.vmin,i=t.vmax;this.mergeCoordinate(s),this.mergeCoordinate(i)}mergeNe(t){const s=t.vmin,i=t.vmax;this.mergeNeCoordinate(s),this.mergeNeCoordinate(i)}mergeNeCoordinate(t){t<this.vmin?this.vmin=t:t>this.vmax&&(this.vmax=t)}intersect(t){this.isEmpty()||t.isEmpty()?this.setEmpty():(this.vmin<t.vmin&&(this.vmin=t.vmin),this.vmax>t.vmax&&(this.vmax=t.vmax),this.vmin>this.vmax&&this.setEmpty())}inflate(t){this.isEmpty()||(this.vmin-=t,this.vmax+=t,this.vmax<this.vmin&&this.setEmpty())}normalize(){this.vmin<=this.vmax||(this.vmin>this.vmax?this.vmax=Tt(this.vmin,this.vmin=this.vmax):this.setEmpty())}isValid(){return this.isEmpty()||this.vmin<=this.vmax}snapClip(t){return Fs(t,this.vmin,this.vmax)}calculateToleranceFromEnvelope(){if(this.isEmpty())return As();return(Math.abs(this.vmin)+Math.abs(this.vmax)+1)*As()}static unit(){return N}normalizeNoNAN(){this.vmin>this.vmax&&(this.vmax=Tt(this.vmin,this.vmin=this.vmax))}setCoordsNoNAN(t,s){this.vmin=t,this.vmax=s,this.normalizeNoNAN()}clone(){return new _(this.vmin,this.vmax)}}const N=new _(0,1);class w{static getNAN(){return new w(Number.NaN)}constructor(t,s){this.m_value=t??0,this.m_eps=s??0}[Symbol.toPrimitive](t){return this}clone(){return new w(this.m_value,this.m_eps)}assign(t){return this.m_value=t.m_value,this.m_eps=t.m_eps,this}scaleError(t){this.m_eps*=t}setError(t){this.m_eps=t}set(t,s){return this.m_value=t,this.m_eps=s??0,this}setWithEps(t,s){return void 0===s&&(s=1),this.m_value=t,this.m_eps=w.ulp(t)*s,this}setE(t){return this.m_value=t.m_value,this.m_eps=t.m_eps,this}precise(){return new w(this.m_value)}value(){return this.m_value}toDouble(){return this.m_value}eps(){return this.m_eps}resetError(){return this.m_eps=0,this}absThis(){return this.m_value=Math.abs(this.m_value),this}add(t){return this.clone().addThis(t)}addE(t){return this.clone().addThisE(t)}addThisE(t){const s=this.m_value+t.m_value,i=this.m_eps+t.m_eps+w.ulp(s);return this.m_value=s,this.m_eps=i,this}addThis(t){const s=this.m_value+t,i=this.m_eps+w.ulp(s);return this.m_value=s,this.m_eps=i,this}subE(t){return this.clone().subThisE(t)}sub(t){return this.clone().subThis(t)}subThisE(t){const s=this.m_value-t.m_value,i=this.m_eps+t.m_eps+w.ulp(s);return this.m_value=s,this.m_eps=i,this}subThis(t){const s=this.m_value-t,i=this.m_eps+w.ulp(s);return this.m_value=s,this.m_eps=i,this}setAddE(t,s){return this.m_value=t.m_value+s.m_value,this.m_eps=t.m_eps+s.m_eps+w.ulp(this.m_value),this}setAdd(t,s){return this.m_value=t+s,this.m_eps=w.ulp(this.m_value),this}setAddEN(t,s){return this.m_value=t.m_value+s,this.m_eps=t.m_eps+w.ulp(this.m_value),this}setAddNE(t,s){return this.m_value=t+s.m_value,this.m_eps=s.m_eps+w.ulp(this.m_value),this}setSubE(t,s){return this.m_value=t.m_value-s.m_value,this.m_eps=t.m_eps+s.m_eps+w.ulp(this.m_value),this}setSub(t,s){return this.m_value=t-s,this.m_eps=w.ulp(this.m_value),this}setSubEN(t,s){return this.m_value=t.m_value-s,this.m_eps=t.m_eps+w.ulp(this.m_value),this}setSubNE(t,s){return this.m_value=t-s.m_value,this.m_eps=s.m_eps+w.ulp(this.m_value),this}mulThisE(t){const s=this.m_value*t.m_value;return this.m_eps=this.m_eps*Math.abs(t.m_value)+t.m_eps*Math.abs(this.m_value)+this.m_eps*t.m_eps+w.ulp(s),this.m_value=s,this}mulThis(t){const s=this.m_value*t;return this.m_eps=this.m_eps*Math.abs(t)+w.ulp(s),this.m_value=s,this}mul(t){return this.clone().mulThis(t)}mulE(t){return this.clone().mulThisE(t)}setMulE(t,s){const i=t.m_value*s.m_value;return this.m_eps=t.m_eps*Math.abs(s.m_value)+s.m_eps*Math.abs(t.m_value)+t.m_eps*s.m_eps+w.ulp(i),this.m_value=i,this}setMul(t,s){return this.m_value=t*s,this.m_eps=w.ulp(this.m_value),this}setMulEN(t,s){return this.setE(t),this.mulThis(s)}setMulNE(t,s){return this.setE(s),this.mulThis(t)}mulThisByPower2(t){return this.m_value*=t,this.m_eps*=Math.abs(t),this}static st_mulByPower2(t,s){return new w(t.m_value,t.m_eps).mulThisByPower2(s)}divE(t){return this.clone().divThisE(t)}divThisE(t){const s=Math.abs(t.m_value),i=this.m_value/t.m_value;let e=(this.m_eps+Math.abs(i)*t.m_eps)/s;if(t.m_eps>.01*s){const i=t.m_eps/s;e*=1+(1+i)*i}return this.m_value=i,this.m_eps=e+w.ulp(i),this}divThis(t){const s=Math.abs(t);return this.m_value/=t,this.m_eps=this.m_eps/s+w.ulp(this.m_value),this}setDivE(t,s){return this.setE(t),this.divThisE(s)}setDiv(t,s){return this.m_value=t/s,this.m_eps=w.ulp(this.m_value),this}setDivEN(t,s){return this.setE(t),this.divThis(s)}setDivNE(t,s){return this.set(t),this.divThisE(s)}divThisByPower2(t){return this.m_value/=t,this.m_eps/=Math.abs(t),this}invThis(){return this.setE(E.clone().divThisE(this)),this}sqrt(){return this.clone().sqrtThis()}sqrtThis(){let t,s;return this.m_value>=0?(t=Math.sqrt(this.m_value),s=this.m_value>10*this.m_eps?.5*this.m_eps/t:this.m_value>this.m_eps?t-Math.sqrt(this.m_value-this.m_eps):Math.max(t,Math.sqrt(this.m_value+this.m_eps)-t),s+=w.ulp(t)):this.m_value<-this.m_eps?(t=Number.NaN,s=Number.NaN):(t=0,s=Math.sqrt(this.m_eps)),this.m_value=t,this.m_eps=s,this}sqr(){return this.clone().sqrThis()}sqrThis(){const t=this.m_value*this.m_value;return this.m_eps=2*this.m_eps*Math.abs(this.m_value)+this.m_eps*this.m_eps+w.ulp(t),this.m_value=t,this}setSin(t){const s=Math.sin(t.m_value),i=Math.cos(t.m_value);this.m_value=s;const e=Math.abs(s),n=Math.abs(t.value());return this.m_eps=(Math.abs(i)+.5*e*t.m_eps)*t.m_eps+w.ulp(e+n),this}static ulp(t){let s=Kt(t);const i=((0x7ff0000000000000n&s)>>52n)-1075n;return i>-1023n?(s=i+0x3ffn<<52n,ts(s)):0===t?0:Number.MIN_VALUE}setCos(t){const s=Math.sin(t.m_value),i=Math.cos(t.m_value);this.m_value=i;const e=Math.abs(i),n=Math.abs(t.value());return this.m_eps=(Math.abs(s)+.5*e*t.m_eps)*t.m_eps+w.ulp(e+n),this}static st_cosAndSin(t,s,i){const e=Math.sin(t.m_value),n=Math.cos(t.m_value);i.m_value=e,s.m_value=n;const r=Math.abs(e),h=Math.abs(n),o=Math.abs(t.value());i.m_eps=(Math.abs(n)+.5*r*t.m_eps)*t.m_eps+w.ulp(r+o),s.m_eps=(Math.abs(e)+.5*h*t.m_eps)*t.m_eps+w.ulp(h+o)}negate(){return this.clone().negateThis()}negateThis(){return this.m_value=-this.m_value,this}setAbs(){return this.m_value=Math.abs(this.m_value),this}isInInterval(t){return _.construct(this.m_value-this.m_eps,this.m_value+this.m_eps).isIntersecting(t)}eq(t){return Math.abs(this.m_value-t.m_value)<=this.m_eps+t.m_eps}ne(t){return!this.eq(t)}gt(t){return this.m_value-t.m_value>this.m_eps+t.m_eps}lt(t){return t.m_value-this.m_value>this.m_eps+t.m_eps}ge(t){return!this.lt(t)}le(t){return!this.gt(t)}tolEQ(t,s){return Math.abs(this.m_value-t.m_value)<=s||this.eq(t)}tolNE(t,s){return!this.tolEQ(t,s)}tolGT(t,s){return this.m_value-t.m_value>s&&this.gt(t)}tolLT(t,s){return t.m_value-this.m_value>s&&this.lt(t)}tolGE(t,s){return!this.tolLT(t,s)}tolLE(t,s){return!this.tolGT(t,s)}isZero(){return Math.abs(this.m_value)<=this.m_eps}isFuzzyZero(){return this.isZero()&&0!==this.m_eps}tolIsZero(t){return Math.abs(this.m_value)<=Math.max(this.m_eps,t)}setPi(){this.setE(R)}setEuler(){this.set(2.718281828459045,T())}static size(){return 1}}function M(t,s){const i=ss(t),e=ss(s),n=53-b(i),r=53-b(e);return(n>=0?n:0)+(r>=0?r:0)<=52}function p(t,s){const i=t+s;return i-t===s&&i-s===t}function C(t,s){const i=t-s;return t-i===s&&s+i===t}function T(){return zs()}w.dimensions=1;const R=new w(Math.PI,.5*T()),g=new w(0,0),E=new w(1,0),I=new w(4,0);function D(t,s,i){return t.addE(s.subE(t).mulE(i))}function A(t,s,i){return s.subE(s.subE(t).mulE(E.subE(i)))}function P(t){return Math.atanh(t)}function q(t){let s;if(0===t)s=1;else if(Math.abs(t)>.01)s=P(t)/t;else{let i;const e=-36.841361487904734;s=0;const n=t*t;for(let t=2*Math.trunc(e/Math.log(n)+2.5)-1;t>1;t-=2)i=1/t,s=(s+i)*n;s+=1}return s}function z(t){const s=Math.PI*Math.PI/6;let i;if(1===t)i=s;else if(t>1)i=s;else if(0===t)i=t;else if(t<0){const s=1+(t=Math.abs(t)),e=Math.log(s);i=e*e/-2-z(t/s)}else if(t>.5){const e=1-t,n=Math.log(t)*Math.log(e);i=s-z(e)-n}else{i=0;const s=1+Math.trunc(-16*Math.log(10)/Math.log(t)+1.5);let e=s;for(let n=s;n>0;n--,e-=1)i*=t,i+=1/(e*e);i*=t}return i}function Z(t,s){const i=s*t;if(Math.abs(s)<.1){let s=0;for(let t=60;t>=1;t--)s*=i,s+=1/t/t;return s*=t,s}return z(i)/s}function F(t,s){return t<s?Gt(t,s):Gt(s,t)}function S(t,s){const i=Math.abs(t);return s>=0?i:-i}function k(t){return Math.round(t)}function L(t,s,i,e,n){n[0]=s[0]+(i[0]-s[0])*e,n[1]=s[1]+(i[1]-s[1])*e,3===t&&(n[2]=s[2]+(i[2]-s[2])*e)}function B(t,s,i,e,n){n[0]=i[0]-(i[0]-s[0])*(1-e),n[1]=i[1]-(i[1]-s[1])*(1-e),3===t&&(n[2]=i[2]-(i[2]-s[2])*(1-e))}function O(t,s,i,e,n){e<=.5?L(t,s,i,e,n):B(t,s,i,e,n)}function G(t,s,i,e,n){n[0]=s[0].addE(i[0].subE(s[0]).mulE(e)),n[1]=s[1].addE(i[1].subE(s[1]).mulE(e))}function Q(t,s,i,e,n){n[0]=i[0].subE(i[0].subE(s[0]).mulE(E.subE(e))),n[1]=i[1].subE(i[1].subE(s[1]).mulE(E.subE(e)))}function V(t,s,i){let e;return e=i<=.5?t+(s-t)*i:s-(s-t)*(1-i),e}function U(t,s,i){return t+(s-t)*i}function W(t,s,i){return s-(s-t)*(1-i)}function Y(t,s,i,e){i<=.5?(e.x=t.x+(s.x-t.x)*i,e.y=t.y+(s.y-t.y)*i):(e.x=s.x-(s.x-t.x)*(1-i),e.y=s.y-(s.y-t.y)*(1-i))}function j(t,s,i,e){i<=.5?(e.x=t.x+(s.x-t.x)*i,e.y=t.y+(s.y-t.y)*i,e.z=t.z+(s.z-t.z)*i):(e.x=s.x-(s.x-t.x)*(1-i),e.y=s.y-(s.y-t.y)*(1-i),e.z=s.z-(s.z-t.z)*(1-i))}function X(t){return t*t}function $(t){return t*t*t}function H(t){return 1/Math.sqrt(t)}function J(t){return t<0?-1:t>0?1:0}function K(t,s,i,e){const n=[0],r=[0],h=[0];return ct(ot(t,i,n),ot(s,e,r),h)+(n[0]+r[0]+h[0])}const tt=[0],st=[0];function it(t,s,i){return mt(ot(t,s,tt),i,tt[0],st)}const et=[0],nt=[0],rt=[0],ht=[0];function ot(t,s,i){const e=t*s;return at(t,et,nt),at(s,rt,ht),i[0]=nt[0]*ht[0]-(e-et[0]*rt[0]-nt[0]*rt[0]-et[0]*ht[0]),e}function at(t,s,i){const e=134217729*t;s[0]=e-(e-t),i[0]=t-s[0]}const ut=[0],lt=[0];function mt(t,s,i,e){const n=ct(t,s,ut),r=ct(n,i,lt);return ct(r,ut[0]+lt[0],e)}function ct(t,s,i){const e=t+s;return Math.abs(t)>Math.abs(s)?i[0]=t-e+s:i[0]=s-e+t,e}function yt(t,s){return t%s}function xt(t){const s=1-t;if(0===s)return 1;let i;if(s<=.01){const t=s,e=Math.log(t);i=1+t*(.4431471805599453-.25*e+t*(.05680519270997949-.09375*e+t*(.02183137044373718-.05859375*e+t*(.011544521417308362-.042724609375*e+t*(.00714200031339596-.0336456298828125*e+t*(.004854743337164948-.027757644653320312*e+t*(.003514687963781376-.023627042770385742*e)))))))}else{if(t<.016){const s=t,i=.25,e=.046875,n=.01953125,r=.01068115234375,h=.0067291259765625,o=.004626274108886719,a=.0033752918243408203,u=.0025710230693221092;return Os()*(1-s*(i+s*(e+s*(n+s*(r+s*(h+s*(o+s*(a+s*u))))))))}i=bt(0,s,1)-t*vt(0,s,1)/3}return Fs(i,1,Os())}function ft(t,i,e=Number.NaN){if(s(i>=0&&i<=1),0===i)return t;let n=1,r=t;if(r<0&&(r=-r,n=-1),1===i){const t=Math.round(r/Ls()),s=r-t*Ls();return n*(2*t+Math.sin(s))}const h=Os(),o=Math.floor(r/h);1&o?r=(o+1)*h-r:r-=o*h;const a=Math.sin(r),u=Number.isNaN(e)?xt(i):e;let l;if(1===a)l=u+Math.sqrt(1-i)*(r-h);else{const t=r*r;if(.01424*Math.pow(t,4)<=2*zs()){l=r*(1+t*i*(-1/6+t*((4-3*i)/120-(16+(45*i-60)*i)/5040*t)))}else if(i<=.01){const t=Math.sin(2*r),s=Math.sin(4*r),e=Math.sin(6*r),n=Math.sin(8*r),h=Math.sin(10*r);l=r+i*((2*-r+t)/8+i*((-3*r+2*t-.25*s)/64+i*((-20*r+15*t-3*s+e/3)/1024+i*(5*(-140*r+112*t-28*s+16/3*e-.5*n)/65536+7*i*((-63*r+52.5*t-15*s+3.75*e-.625*n+.05*h)/65536+i*(-693*r+594*t-185.625*s+1.375*e-12.375*n+1.8*h-.125*Math.sin(12*r))/1048576)))))}else{const t=a*a,s=Math.cos(r),e=s*s,n=_t(a,s,i);l=a*(bt(e,n,1)-i*t*vt(e,n,1)/3)}}if(1&o){l=u*(o+1)-l}else l+=u*o;return n*l}function dt(t,s,i=Number.NaN){if(0===t)return 0;let e=1,n=t;t<0&&(n=-n,e=-1);const r=Number.isNaN(i)?xt(s):i,h=Math.floor(n/r);1&h?n=(h+1)*r-n:n-=h*r;let o=n<=0?0:n>=r?Os():Nt(n,s,r);return 1&h?o=Os()*(h+1)-o:o+=Os()*h,e*o}function bt(t,i,e){s((0!==t?1:0)+(0!==i?1:0)+1>1);let n=t,r=i,h=e;for(;;){const t=Math.sqrt(n*r)+Math.sqrt(r*h)+Math.sqrt(h*n);n=.25*(n+t),r=.25*(r+t),h=.25*(h+t);const s=(n+r+h)/3,i=(s-n)/s,e=(s-r)/s,o=(s-h)/s;if(Math.abs(i)<=.0024&&Math.abs(e)<=.0024&&Math.abs(o)<=.0024){const t=i*e-o*o,n=i*e*o;return(1+(1/24*t-.1-3/44*n-5*t*t/208+t*n/16)*t+(1/14+3*n/104)*n)/Math.sqrt(s)}}}function vt(t,i,e){s(0!==t||0!==i);let n=t,h=i,o=e;const a=new r(0);let u=1;for(;;){const t=.2*(n+h+3*o),s=(t-n)/t,i=(t-h)/t,e=(t-o)/t;if(Math.abs(s)<=.0015&&Math.abs(i)<=.0015&&Math.abs(e)<=.0015){const n=s*i,r=e*e,h=n-r,o=n-6*r,l=o+h+h,m=9/22,c=3/26,y=o*(.25*m*o-3/14-1.5*c*e*l),x=e*(1/6*l+e*(-m*h+e*c*n));return 3*a.getResult()+u*(1+y+x)/(t*Math.sqrt(t))}const r=Math.sqrt(n),l=Math.sqrt(h),m=Math.sqrt(o),c=r*(l+m)+l*m;a.add(u/(m*(o+c))),u*=.25,n=.25*(n+c),h=.25*(h+c),o=.25*(o+c)}}function _t(t,s,i){return t<.999?1-i*X(t):1-i+i*X(s)}function Nt(t,s,i){if(0===s)return t;if(1===s)return Math.asin(t);let e=0,n=!0;if(t<.2){const i=t*t,r=t*(1+i*s*(1/6+i*((13*s-4)/120+(16-284*s+493*s*s)/5040*i))),h=Math.abs(s*(4944*s-64-31224*s*s+37369*s*s*s)/362880*Math.pow(t,9));if(h<Math.abs(r)*zs())return r;e=r,n=h>.1*r}if(n){const n=1-s,r=1-t/i,h=Math.sqrt(r*r+n*n),o=Math.atan2(n,t+zs());e=Os()+Math.sqrt(h)*(o-Os())}let r=0;for(let h=0;h<7;h++){r=ft(e,s,i);const n=_t(Math.sin(e),Math.cos(e),s);if(e-=(r-t)/Math.sqrt(n),h>0&&Math.abs(r-t)<=4*zs()*t)break}return e}function wt(s,i,e,n,r){return 0===s?0===n?i:1===n?e:r:1===s?0===n?i:1===n?e:V(i,e,n):(2===s&&t("angular interpolation"),void t(""))}function Mt(s,i,e,n,r,h,o,a){if(0===s)for(let t=0;t<h;++t)n[t+r]=0===o?i[t]:1===o?e[t]:a;else if(1===s)if(0===o)pt(n,i,r,0,h);else if(1===o)pt(n,e,r,0,h);else for(let t=0;t<h;++t)n[t+r]=V(i[t],e[t],o);else if(2===s)if(0===o)pt(n,i,r,0,h);else if(1===o)pt(n,e,r,0,h);else{let t=0;for(let s=0,a=r;s<h;++s,++a)n[a]=V(i[s],e[s],o),t+=n[a]*n[a];if(t>0){t=Math.sqrt(t);for(let s=r;s<r+h;++s)n[s]/=t}else{for(let t=r;t<r+h;++t)n[t]=0;n[r]=1}}else t("")}function pt(t,s,i,e,n){if(0===n)return;let r=0,h=i,o=e;for(;r++<n;)t[h++]=s[o++]}function Ct(t,s,i){let e=0;for(let n=0;!e&&n<i;++n)e=t[n]-s[n];return e}function Tt(t,s){return t}function Rt(t){t.sort(((t,s)=>t<s?-1:t>s?1:0))}function gt(t,s){const i=t.slice(0,s);Rt(i),pt(t,i,0,0,s)}function Et(t,s,i,e){const n=t.slice(s,s+i);n.sort(e),pt(t,n,s,0,i)}function It(t,s){return t<s?-1:t>s?1:0}function Dt(t,s,i,e){return t<i?-1:t>i?1:s<e?-1:s>e?1:0}function At(t,s){if(t.length<2)return t.length;let i=0;for(let e=1;e<t.length;++e)s(t[e],t[i])||(i++,t[e]=Tt(t[i],t[i]=t[e]));return 1+i}function Pt(t,s){t[s]=t.at(-1),t.pop()}function qt(t,s=!1){return{[Symbol.dispose](){this.bForget||t()},bForget:s}}function zt(t,s){return Array.from({length:s},(()=>new t))}function Zt(t,s,i){for(let e=0;e<i;++e)t[e].assign(s[e]);return i}function Ft(t,s){const i=t.slice(0,s);for(let e=0;e<s;++e)i[e]=i[e].clone();return i}function St(t){return Array.from({length:t},(()=>null))}function kt(t,s){return Array.from({length:s},(()=>t()))}function Lt(t,s){return Array.from({length:t},(()=>s))}function Bt(t,s){return s in t&&1===Object.getOwnPropertyNames(t).length}class Ot{constructor(...t){this.m_elts=t}get length(){return this.m_elts.length}at(t){return this.m_elts[t]}[Symbol.dispose](){for(const t of this.m_elts)t[Symbol.dispose]()}}function Gt(t,s){return{first:t,second:s}}const Qt=Math.PI,Vt=2*Math.PI,Ut=.5*Math.PI;class Wt{constructor(t,s){this.m_cr=t,this.m_cc=s,this.m_v=Lt(t*s,0)}get(t,s){return this.m_v[t*this.m_cc+s]}set(t,s,i){this.m_v[t*this.m_cc+s]=i}inc(t,s){return++this.m_v[t*this.m_cc+s]}}const Yt=new ArrayBuffer(8),jt=new Float64Array(Yt),Xt=new BigUint64Array(Yt),$t=0x0fffffffffffffn,Ht=0x7ff0000000000000n;function Jt(){return Number.EPSILON*Ds}function Kt(t){return jt[0]=t,Xt[0]}function ts(t){return Xt[0]=t,jt[0]}function ss(t){return Kt(t)&$t}function is(t){return Number((Kt(t)&Ht)>>52n)}function es(t){if(0n===t)return-1n;if(1n===t||-1n===t)return 0n;t<0n&&(t=-t);let s=0n,i=512n,e=1n<<s+i;for(;t>=e;)s+=i,i<<=1n,e<<=i;let n=s;i>>=1n;let r=n+i;for(;i>0n;)t<1n<<r||(n=r),i>>=1n,r=n+i;return n}function ns(t,s){return t===s||Number.isNaN(t)&&Number.isNaN(s)}function rs(t,s,i){return t===s||Math.abs(t-s)<=i||Number.isNaN(t)&&Number.isNaN(s)}function hs(t,s){return t<s?-1:t>s?1:0}function os(t,s){if(t<s)return-1;if(t>s)return 1;if(t===s)return 0;{const i=Number.isNaN(t),e=Number.isNaN(s);return i<e?-1:i>e?1:0}}function as(){return 2147483647}function us(){return 32767}function ls(){return 2147483647}function ms(){return-2147483648}const cs=ls(),ys=BigInt(cs),xs=2166136261,fs=16777619;function ds(t){let s=xs,i=t;return s=(s^255&i)*fs,i>>=8,s=(s^255&i)*fs,i>>=8,s=(s^255&i)*fs,i>>=8,s=(s^255&i)*fs,s&cs}const bs=14695981039346656037n,vs=1099511628211n;function _s(t){let s=bs,i=t;return s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,s&ys}function Ns(t){return 1103515245*t+12345&2147483647}function ws(t){let s=xs;for(let i=0,e=t.length;i<e;++i)s=(s^t.charCodeAt(i))*fs;return s&cs}function Ms(t,s){return s+2654435769+(t<<6)+(t>>2)&cs}function ps(t,s){return Ms(t,gs(s))}function Cs(t){return Ms(3735928559,t)}function Ts(t,s){return Ms(t,Cs(s))}function Rs(t){return ds(t)}function gs(t){return Number(_s(t))}function Es(t){return Ns(t)}const Is=100,Ds=100;function As(){return Number.EPSILON*Is}function Ps(){return.38196601125010515}function qs(){return 1.4142135623730951}function zs(){return Number.EPSILON}function Zs(t,s,i){return t===s||t===i}function Fs(t,s,i){return t>=s?t<=i?t:i:s}function Ss(t,s,i){const e=t[0];if(e>=s){if(e<=i)return!1;t[0]=i}else t[0]=s;return!0}function ks(t,s){return t>=s?s:t<-s?-s:t}function Ls(){return Qt}function Bs(){return Vt}function Os(){return Ut}const Gs=3*Os();function Qs(){return Gs}function Vs(t){return t+0}function Us(t){return{v:t}}class Ws{constructor(){this.m_rn=Us(0n),this.m_rd=Us(1n),this.m_bNaN=!1,this.m_bNormalized=!1,this.m_power=0,this.m_sign=0}static constructAssign(t,s){const i=t.clone();return void 0!==s&&i.limitPrecisionThis(s),i}static constructDouble(t){return(new Ws).setDouble(t)}static constructInt64(t){return(new Ws).setInt64(t)}static constructRational(t,s){return(new Ws).setRational(t,s)}static constructInt32(t){return this.constructInt64(BigInt(Math.trunc(t)))}[Symbol.toPrimitive](t){return this}compare(t){return this.lt(t)?-1:this.gt(t)?1:0}assignCopy(t){return this.setThis(t)}abs(){return this.clone().absThis()}absThis(){return this.isNAN()||(this.m_sign*=this.m_sign),this}clone(){return(new Ws).setThis(this)}setThis(t){return this.m_bNaN=t.m_bNaN,this.m_bNormalized=t.m_bNormalized,this.m_rn.v=t.m_rn.v,this.m_rd.v=t.m_rd.v,this.m_power=t.m_power,this.m_sign=t.m_sign,this}setZero(){return this.m_rn.v=0n,this.m_rd.v=1n,this.m_bNaN=!1,this.m_power=0,this.m_bNormalized=!0,this.m_sign=0,this}setDouble(s){if(this.setZero(),0===s)return this;if(Number.isInteger(s)&&Math.abs(s)<ls())return this.setInt32(s);const i=Kt(s),e=(i&Ws.s_em)>>52n,n=!!(i&Ws.s_sm),r=i&Ws.s_fm;if(e===Ws.s_emax)return r?(this.m_rn.v=this.m_rd.v=0n,this.m_bNaN=!0,this):(this.m_rn.v=n?-1n:1n,this.m_rd.v=0n,this);0n===e&&t("denormalized numbers not yet implemented");const h=e-1023n,o=h>=0n?h:0n,a=h<0n?-h:0n;return this.m_rn.v=(1n<<52n|r)<<o,this.m_rd.v=1n<<52n+a,this.m_sign=n?-1:1,this.m_bNormalized=!1,this.normalizeThis()}setInt64(t){return 0n===t?this.setZero():(this.m_bNaN=!1,this.m_sign=t>0n?1:-1,this.m_rn.v=t>0n?t:-t,this.m_rd.v=1n,this.m_power=0,this.m_bNormalized=!1,this.normalizeThis())}setRational(t,s){return 0n===t?0n===s?this.setNAN():this.setZero():0n===s?t>0n?this.setPositiveInf():this.setNegativeInf():(this.m_sign=(t>0n?1:-1)*(s>0n?1:-1),this.m_rn.v=t>0n?t:-t,this.m_rd.v=s>0n?s:-s,this.m_power=0,this.m_bNormalized=!1,this.normalizeThis())}setInt32(t){return this.setInt64(BigInt(Math.trunc(t)))}getDouble(){return this.convertToDouble()}toDouble(){return this.convertToDouble()}value(){return this.convertToDouble()}isNAN(){return this.m_bNaN}isPositiveInf(){return!this.isNAN()&&(0n===this.m_rd.v&&1===this.m_sign)}isNegativeInf(){return!this.isNAN()&&(0n===this.m_rd.v&&-1===this.m_sign)}isFinite(){return!this.isNAN()&&0n!==this.m_rd.v}setNAN(){return this.m_bNaN=!0,this.m_rn.v=0n,this.m_rd.v=0n,this.m_power=0,this.m_bNormalized=!0,this}setPositiveInf(){return this.m_rn.v=1n,this.m_rd.v=0n,this.m_bNaN=!1,this.m_bNormalized=!0,this.m_sign=1,this.m_power=0,this}setNegativeInf(){return this.m_rn.v=1n,this.m_rd.v=0n,this.m_bNaN=!1,this.m_bNormalized=!0,this.m_sign=-1,this.m_power=0,this}subThis(t){if(t.isNAN()&&this.setNAN(),this.isPositiveInf()&&t.isPositiveInf())this.setNAN();else{if(this.isPositiveInf()&&t.isNegativeInf())return this.setPositiveInf(),this;if(this.isNegativeInf()&&t.isNegativeInf())this.setNAN();else if(this.isNegativeInf()&&t.isPositiveInf())return this.setNegativeInf(),this}return this.isNAN()?this:this.opPlusMinus(t,!1)}thisSubAbs(t){return s(0),this}mulThis(t){return t.isNAN()&&this.setNAN(),this.isNAN()?this:(this.m_sign*=t.m_sign,0===this.m_sign?this.setZero():(this.m_rn.v*=t.m_rn.v,this.m_rd.v*=t.m_rd.v,this.m_power+=t.m_power,this.m_bNormalized=!1,this.normalizeThis(),this))}mulDoubleThis(t){return this.mulThis(Ws.constructDouble(t))}thisMulInt64(t){return s(0),this}thisMulInt32(t){return s(0),this}divThis(t){return this.mulThis(t.clone().invertThis())}divDoubleThis(t){return this.divThis(Ws.constructDouble(t))}addDoubleThis(t){return this.addThis(Ws.constructDouble(t))}subDoubleThis(t){return this.subThis(Ws.constructDouble(t))}mul(t){return this.clone().mulThis(t)}mulBigIntThis(t){return this.mulThis(Ws.constructInt64(t))}mulDouble(t){return this.clone().mulThis(Ws.constructDouble(t))}div(t){return this.clone().divThis(t)}divDouble(t){return this.clone().divDoubleThis(t)}add(t){return this.clone().addThis(t)}fmSubThis(t,s){return this.subThis(t.clone().mulThis(s))}fmAddThis(t,s){return this.addThis(t.clone().mulThis(s))}addThis(t){if(t.isNAN()&&this.setNAN(),this.isPositiveInf()&&t.isPositiveInf())return this.setPositiveInf(),this;if(this.isPositiveInf()&&t.isNegativeInf())this.setNAN();else{if(this.isNegativeInf()&&t.isNegativeInf())return this.setNegativeInf(),this;this.isNegativeInf()&&t.isPositiveInf()&&this.setNAN()}return this.isNAN()?this:this.opPlusMinus(t,!0)}addDouble(t){return this.clone().addThis(Ws.constructDouble(t))}sub(t){return this.clone().subThis(t)}subDouble(t){return this.clone().subThis(Ws.constructDouble(t))}isZero(){return 0===this.m_sign}equals(t){return this.clone().subThis(t).isZero()}lt(t){return!this.isNAN()&&!t.isNAN()&&(!(this.isPositiveInf()&&t.isPositiveInf()||this.isNegativeInf()&&t.isNegativeInf())&&(!this.isPositiveInf()&&(!!t.isPositiveInf()||this.clone().sub(t).LZ())))}absLessAbs(t){return this.abs().lt(t.abs())}gt(t){return this.clone().sub(t).GZ()}lte(t){return this.sub(t).LEZ()}gte(t){return this.sub(t).GEZ()}normalizeThis(){if(this.m_bNormalized)return this;if(0n===this.m_rn.v)return this.setZero();let t=0,s=0xffffffffn;for(;0n===(this.m_rn.v&s)&&s<=this.m_rn.v;)s<<=32n,t+=32;s&=this.m_rn.v,s>>=BigInt(t),t+=f(BigInt.asUintN(32,s))-1;let i=0;for(s=0xffffffffn;0n===(this.m_rd.v&s)&&s<=this.m_rd.v;)s<<=32n,i+=32;return s&=this.m_rd.v,s>>=BigInt(i),i+=f(BigInt.asUintN(32,s))-1,this.m_rn.v>>=BigInt(t),this.m_rd.v>>=BigInt(i),this.m_power+=t-i,this.m_rn.v>1n&&this.m_rd.v>1n&&(this.m_rn.v%this.m_rd.v===0n?(this.m_rn.v/=this.m_rd.v,this.m_rd.v=1n):this.m_rd.v%this.m_rn.v===0n&&(this.m_rd.v/=this.m_rn.v,this.m_rn.v=1n)),this.m_bNormalized=!0,this}negateThis(){return this.isNAN()||(this.m_sign*=-1),this}negate(){return this.clone().negateThis()}invertThis(){return this.isNAN()?this:this.isPositiveInf()||this.isNegativeInf()?(this.setZero(),this):0n===this.m_rn.v?(this.setPositiveInf(),this):(this.m_rd=Tt(this.m_rn,this.m_rn=this.m_rd),this.m_power=-this.m_power,this)}limitPrecisionThis(t){if(0===t)return this;if(this.isZero())return this.setZero();if(!this.isFinite())return this;this.normalizeThis();let s=Number(es(this.m_rn.v));if(s>t){const i=s-t;this.m_rn.v>>=BigInt(s-t),this.m_power+=i}if(s=Number(es(this.m_rd.v)),s>t){const i=s-t;this.m_rd.v>>=BigInt(s-t),this.m_power-=i}return this}hiBitIndex(){return Math.max(Number(es(this.m_rn.v)),Number(es(this.m_rd.v)))}ldexp(t){return this.clone().ldexpThis(t)}ldexpThis(t){return t&&(this.m_bNormalized=!1,this.m_power+=t,this.normalizeThis()),this}LZ(){return!this.isNAN()&&-1===this.m_sign}GZ(){return!this.isNAN()&&1===this.m_sign}LEZ(){return!this.isNAN()&&this.m_sign<=0}GEZ(){return!this.isNAN()&&this.m_sign>=0}toString(){return this.toDouble().toString()}sqr(){return this.clone().sqrThis()}sqrThis(){return this.mulThis(this.clone())}static sqrt(t,e){if(t.m_sign<0n&&i("MP_value: sqrt(-1)"),t.isZero())return t.clone();let n=52,r=2220446049250313e-31;for(;n<e;)2*n<=e?(r*=r,n*=2):(r*=2220446049250313e-31,n+=52);n+=52;const h=es(t.m_rn.v),o=es(t.m_rd.v);let a,u=t.m_power+Number(h-o);const l=new Ws;Math.abs(u)>200?(1&Math.abs(u)&&(u+=1),a=Ws.constructAssign(t,53).ldexpThis(-u).value(),l.setThis(t).ldexpThis(-u),s(Number.isFinite(a))):(l.setThis(t),a=l.value(),s(Number.isFinite(a)),u=0),a=Math.sqrt(a);const m=Ws.constructDouble(a),c=Ws.constructDouble(r);c.mulThis(m).ldexpThis(1);const y=r*a*2,x=m.clone(),f=new Ws;let d;for(let s=0;s<10;++s){x.mulThis(m),f.setThis(l).subThis(x).absThis();let t=f.value();if(d=1,t<.9)for(;t>y;)t*=t,++d;else d=4;if(f.lte(c))break;for(let s=0;s<d;s++)x.setThis(m).divThis(l).invertThis().addThis(m).ldexpThis(-1).limitPrecisionThis(n),m.setThis(x)}return m.ldexpThis(u/2)}static cubicRoot(t,s){if(t.isZero())return t.clone();let i=52,e=2220446049250313e-31;for(;i<s;)2*i<=s?(e*=e,i*=2):(e*=2220446049250313e-31,i+=52);i+=52;const n=Math.pow(Math.abs(t.value()),1/3),r=Ws.constructDouble(n),h=r.clone();h.sqrThis().mulDoubleThis(3).mulDoubleThis(e),h.limitPrecisionThis(32),t.LZ()&&r.negateThis();for(let o=0;o<10;++o){const s=r.clone();s.sqrThis().mulThis(r);const e=s.clone();if(e.subThis(t),e.absThis().limitPrecisionThis(32),e.lte(h))break;e.setThis(t),e.ldexpThis(1),e.addThis(s);const n=s.clone();n.ldexpThis(1),n.addThis(t),e.divThis(n),r.mulThis(e),r.limitPrecisionThis(i)}return r}isInTheRangeOfDouble(){return s(0),!1}sign(){return this.m_sign}cosAndSin(t,i){s(0)}static nan(){return s(0),new Ws}convertToDouble(){if(this.m_bNaN)return Number.NaN;if(this.isZero())return 0;if(0n===this.m_rd.v)return 1===this.m_sign?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;const t=-1===this.m_sign,s=this.m_rn.v<<(this.m_power>=0?BigInt(this.m_power):0n);let i=this.m_rd.v<<(this.m_power<0?BigInt(-this.m_power):0n);const e=s/i;let n=Number(e);if(BigInt(n)!==e)return t?-n:n;let r=s-e*i;if(r){let t=es(i)-1023n;t>0n&&(i>>=t,r<<=52n,r>>=t);let s=Number(r);Number.isFinite(s)||(r>>=52n,s=Number(r),t=0n),t>0n&&(s/=Math.pow(2,52));n+=s/Number(i)}return t?-n:n}signVal(){return 1===this.m_sign?1n:-1===this.m_sign?-1n:0n}opPlusMinus(t,s){const i=Math.min(this.m_power,t.m_power);let e,n;this.m_power>i?(e=BigInt(this.m_power-i),n=0n):(e=0n,n=BigInt(t.m_power-i));const r=this.signVal()*this.m_rn.v*t.m_rd.v<<e,h=t.signVal()*t.m_rn.v*this.m_rd.v<<n;return this.m_rn.v=s?r+h:r-h,this.m_rd.v*=t.m_rd.v,this.m_power=i,this.m_sign=1,this.m_rn.v<0n&&(this.m_sign=-1,this.m_rn.v=-this.m_rn.v),this.m_bNormalized=!1,this.normalizeThis(),this}}Ws.s_sm=0x8000000000000000n,Ws.s_em=0x7ff0000000000000n,Ws.s_fm=0x000fffffffffffffn,Ws.s_emax=0x7ffn;const Ys=Ws.constructInt32(1),js=Ws.constructInt32(0);function Xs(t,s){return v(t^s)}function $s(t,s){let i=is(t);const e=is(s);if(i===e){return i-=53-Xs(ss(t),ss(s)),i}return i>e?i:e}function Hs(t){const s=zt(Js,t.length);for(let i=0,e=t.length;i<e;++i)s[i].setCoords(t[i][0],t[i][1]);return s}class Js{static construct(t,s){return new Js(t,s)}constructor(t,s){void 0!==t?(this.x=t,this.y=s):this.x=this.y=Number.NaN}clone(){return new Js(this.x,this.y)}assign(t){this.setCoordsPoint2D(t)}setCoords(t,s){return this.x=t,this.y=s,this}setCoordsPoint2D(t){this.x=t.x,this.y=t.y}isEqualPoint2D(t,s){return void 0!==s?Math.abs(this.x-t.x)<=s&&Math.abs(this.y-t.y)<=s:this.x===t.x&&this.y===t.y}isEqual(t,s,i){return void 0!==i?Math.abs(this.x-t)<=i&&Math.abs(this.y-s)<=i:this.x===t&&this.y===s}equalsPoint2D(t,s){return this.isEqualPoint2D(t,s)}setSub(t,s){this.x=t.x-s.x,this.y=t.y-s.y}addThis(t){return this.x+=t.x,this.y+=t.y,this}setAdd(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}absoluteOther(t){}absolute(){return s(0),this}setNegate(){this.x=-this.x,this.y=-this.y}setNegateOther(t){this.x=-t.x,this.y=-t.y}interpolateThis(t,s){}interpolate(t,i,e){s(0)}scaleAddThis(t,s){this.x=this.x*t+s.x,this.y=this.y*t+s.y}setScaleAdd(t,s,i){this.x=s.x*t+i.x,this.y=s.y*t+i.y}scaleOther(t,i){s(0)}scale(t){this.x*=t,this.y*=t}compare(t){return this.y<t.y?-1:this.y>t.y?1:this.x<t.x?-1:this.x>t.x?1:0}compareX(t){return this.x<t.x?-1:this.x>t.x?1:this.y<t.y?-1:this.y>t.y?1:0}normalizeOther(t){s(0)}normalize(){const t=this.length();return t?(this.x/=t,this.y/=t):(this.x=1,this.y=0),this}getUnitVector(){return this.clone().normalize()}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}sqrLength(){return this.x*this.x+this.y*this.y}static averageFast(t,i){return s(0),{}}static average(t,s){const i=new Js;if(0===s)return i.setNAN(),i;if(1===s)return i.assign(t[0]),i;const e=new r(t[0].x),n=new r(t[0].y);for(let r=1;r<s;r++)e.add(t[r].x),n.add(t[r].y),255&r||(e.normalize(),n.normalize());return i.x=e.getResult()/s,i.y=n.getResult()/s,i}offset(t,s){const i=Js.distance(t,s),e=Js.construct(this.x,this.y);if(0===i)return Js.distance(e,t);const n=s.clone();n.subThis(t),e.subThis(t);return e.crossProduct(n)/i}side(t,s){return t.equals(s)?this.equals(t)?0:1:Js.orientationRobust(s,t,this)}static sqrDistance(t,s){const i=t.x-s.x,e=t.y-s.y;return i*i+e*e}static sqrDistanceCoords(t,s,i,e){const n=i-t,r=e-s;return n*n+r*r}static distance(t,s){return Math.sqrt(Js.sqrDistance(t,s))}dotProduct(t){return this.x*t.x+this.y*t.y}dotProductAbs(t){return Math.abs(this.x*t.x)+Math.abs(this.y*t.y)}crossProduct(t){return this.x*t.y-this.y*t.x}crossProductAbs(t){return s(0),0}rotateDirect(t,s){const i=this.x*t-this.y*s,e=this.x*s+this.y*t;this.x=i,this.y=e}rotateReverse(t,s){const i=this.x*t+this.y*s,e=-this.x*s+this.y*t;this.x=i,this.y=e}leftPerpendicularThis(){const t=this.x;this.x=-this.y,this.y=t}leftPerpendicularOther(t){const s=t.x;this.x=-t.y,this.y=s}rightPerpendicularThis(){const t=this.x;this.x=this.y,this.y=-t}rightPerpendicularOther(t){const s=t.x;this.x=t.y,this.y=-s}equals(t){return this.x===t.x&&this.y===t.y}notequals(t){return this.x!==t.x||this.y!==t.y}not(){return!this.x&&!this.y}gt(t){return this.y>t.y||this.y===t.y&&this.x>t.x}gte(t){return!this.lt(t)}lt(t){return this.y<t.y||this.y===t.y&&this.x<t.x}lte(t){return!this.gt(t)}subThis(t){return this.x-=t.x,this.y-=t.y,this}divThis(t){return this.x/=t,this.y/=t,this}add(t){return new Js(this.x+t.x,this.y+t.y)}sub(t){return new Js(this.x-t.x,this.y-t.y)}negateThis(){return this.x=-this.x,this.y=-this.y,this}negate(){return new Js(-this.x,-this.y)}mul(t){return new Js(this.x*t,this.y*t)}mulThis(t){return this.x*=t,this.y*=t,this}divide(t){return new Js(this.x/t,this.y/t)}setNAN(){this.x=this.y=Number.NaN}isNAN(){return Number.isNaN(this.x)||Number.isNaN(this.y)}static getNAN(){return new Js(Number.NaN,Number.NaN)}isFinite(){return Number.isFinite(this.x)&&Number.isFinite(this.y)}isZero(){return 0===this.x&&0===this.y}norm(t){switch(t){case 0:{const t=Math.abs(this.x),s=Math.abs(this.y),i=t-s;return i>=0?t:i<=0?s:Number.NaN}case 1:return Math.abs(this.x)+Math.abs(this.y);case 2:return Math.sqrt(this.x*this.x+this.y*this.y);default:e("norm")}}getQuarter(){return Js.getQuarterCoords(this.x,this.y)}static getQuarterCoords(t,s){return t>0?s>=0?1:4:s>0?2:0===t?4:3}static compareVectors(t,s){const i=t.getQuarter(),e=s.getQuarter();return e===i?Js.orientationRobustImpl(Js.construct(0,0),s,t,!0):i<e?-1:1}static compareVectorsOrigin(t,s,i){const e=s.sub(t),n=i.sub(t),r=e.getQuarter(),h=n.getQuarter();return h===r?Js.orientationRobustImpl(t,i,s,!0):r<h?-1:1}static orientationRobust(t,s,i){return Js.orientationRobustImpl(t,s,i,!1)}static orientationRobustEx(t,s,i,e){if(t.equals(s)||i.equals(e))return 0;const n=s.x-t.x,r=s.y-t.y,h=e.x-i.x,o=e.y-i.y;{const t=Js.getQuarterCoords(n,r)-1,s=Js.getQuarterCoords(h,o)-1,i=Js.d[t][s];if(0!==i)return i}const a=n*o,u=r*h,l=4*zs()*(Math.abs(a)+Math.abs(u)),m=a-u;if(Math.abs(m)>=l){return m<0?-1:m>0?1:0}return Js.orientationRobustExMp(t,s,i,e)}static orientationRobustExMp(t,s,i,e){const n=Ws.constructDouble(s.x),r=Ws.constructDouble(e.x);n.subThis(Ws.constructDouble(t.x)),r.subThis(Ws.constructDouble(i.x));const h=Ws.constructDouble(s.y),o=Ws.constructDouble(e.y);return h.subThis(Ws.constructDouble(t.y)),o.subThis(Ws.constructDouble(i.y)),n.mulThis(o),h.mulThis(r),n.subThis(h),n.LZ()?-1:n.GZ()?1:0}static orientationNonRobust(t,s,i){const e=s.sub(t).crossProduct(i.sub(t));return e<0?-1:e>0?1:0}static orientationRobustImpl(t,s,i,e){if(s.isEqualPoint2D(t)||i.isEqualPoint2D(t)||s.isEqualPoint2D(i))return 0;const n=s.x-t.x,r=s.y-t.y,h=i.x-t.x,o=i.y-t.y;if(!e){const t=Js.getQuarterCoords(n,r)-1,s=Js.getQuarterCoords(h,o)-1,i=Js.d[t][s];if(0!==i)return i}const a=(Math.abs(n)+Math.abs(r)+Math.abs(h)+Math.abs(o))*(Math.abs(s.x)+Math.abs(s.y)+Math.abs(i.x)+Math.abs(i.y))*8*T(),u=n*o-r*h;if(Math.abs(u)>a){return u<0?-1:1}if(C(s.x,t.x)&&C(i.y,t.y)&&C(s.y,t.y)&&C(i.x,t.x)&&M(n,o)&&M(r,h)){const t=n*o,s=r*h;if(C(t,s)){const i=t-s;return i<0?-1:i>0?1:0}}return Js.orientationRobustMp(t,s,i)}static orientationRobustMp(t,s,i){const e=Ws.constructDouble(s.x),n=Ws.constructDouble(i.x);{const s=Ws.constructDouble(t.x);e.subThis(s),n.subThis(s)}const r=Ws.constructDouble(i.y),h=Ws.constructDouble(s.y);{const s=Ws.constructDouble(t.y);r.subThis(s),h.subThis(s)}return e.mulThis(r),h.mulThis(n),e.subThis(h),e.LZ()?-1:e.GZ()?1:0}static inCircleRobust(t,s,i,e){const n=new w,r=new w;n.set(t.x),n.subThis(e.x),r.set(t.y),r.subThis(e.y);const h=new w,o=new w;h.set(s.x),h.subThis(e.x),o.set(s.y),o.subThis(e.y);const a=new w,u=new w;a.set(i.x),a.subThis(e.x),u.set(i.y),u.subThis(e.y);const l=n.mulE(o).subE(r.mulE(h)),m=h.mulE(u).subE(o.mulE(a)),c=n.mulE(u).subE(r.mulE(a)),y=n.mulE(n).addE(r.mulE(r)),x=h.mulE(h).addE(o.mulE(o)),f=a.mulE(a).addE(u.mulE(u)),d=y.mulE(m).subE(x.mulE(c)).addE(f.mulE(l));if(!d.isFuzzyZero()){const t=d.value();return t<0?-1:t>0?1:0}return Js.inCircleRobustMp(t,s,i,e)}static inCircleRobustMp(t,s,i,e){do{if(!C(t.x,e.x)||!C(t.y,e.y))break;if(!C(s.x,e.x)||!C(s.y,e.y))break;if(!C(i.x,e.x)||!C(i.y,e.y))break;const n=t.x-e.x,r=t.y-e.y,h=s.x-e.x,o=s.y-e.y,a=i.x-e.x,u=i.y-e.y;if(!M(n,o)||!M(r,h))break;if(!M(h,u)||!M(o,a))break;if(!M(n,u)||!M(r,a))break;if(!M(n,n)||!M(r,r))break;if(!M(h,h)||!M(o,o))break;if(!M(a,a)||!M(u,u))break;const l=n*o,m=r*h,c=h*u,y=o*a,x=n*u,f=r*a,d=n*n,b=r*r,v=h*h,_=o*o,N=a*a,w=u*u;if(!C(l,m))break;if(!C(c,y))break;if(!C(x,f))break;if(!p(d,b))break;if(!p(v,_))break;if(!p(N,w))break;const T=l-m,R=c-y,g=x-f,E=d+b,I=v+_,D=N+w;if(!M(E,R))break;if(!M(I,g))break;if(!M(D,T))break;const A=E*R,P=I*g,q=D*T;if(!C(A,P))break;const z=A-P;if(!p(z,q))break;const Z=z+q;return Z<0?-1:Z>0?1:0}while(0);const n=Ws.constructDouble(e.x),r=Ws.constructDouble(e.y),h=Ws.constructDouble(t.x),o=Ws.constructDouble(t.y);h.subThis(n),o.subThis(r);const a=Ws.constructDouble(s.x),u=Ws.constructDouble(s.y);a.subThis(n),u.subThis(r);const l=Ws.constructDouble(i.x),m=Ws.constructDouble(i.y);l.subThis(n),m.subThis(r);const c=h.mul(u).sub(o.mul(a)),y=a.mul(m).sub(u.mul(l)),x=h.mul(m).sub(o.mul(l)),f=h.mul(h).add(o.mul(o)),d=a.mul(a).add(u.mul(u)),b=l.mul(l).add(m.mul(m)),v=f.mul(y).sub(d.mul(x)).add(b.mul(c));return v.LZ()?-1:v.GZ()?1:0}static inCircleRobustMp3Point(t,s,i){const e=Ws.constructDouble(t.x),n=Ws.constructDouble(t.y),r=Ws.constructDouble(s.x),h=Ws.constructDouble(s.y),o=Ws.constructDouble(i.x),a=Ws.constructDouble(i.y),u=o.mul(o).add(a.mul(a)).sub(o.mul(e).add(a.mul(n)).add(o.mul(r)).add(a.mul(h))).add(e.mul(r).add(n.mul(h)));return u.LZ()?-1:u.GZ()?1:0}static inCircleRobust3Point(t,s,i){const e=new w(t.x),n=new w(t.y),r=new w(s.x),h=new w(s.y),o=new w(i.x),a=new w(i.y),u=o.mulE(o).addE(a.mulE(a)).subE(o.mulE(e).addE(a.mulE(n)).addE(o.mulE(r)).addE(a.mulE(h))).addE(e.mulE(r).addE(n.mulE(h)));if(!u.isFuzzyZero()){const t=u.value();return t<0?-1:t>0?1:0}return Js.inCircleRobustMp3Point(t,s,i)}static calculateCircleCenterFromThreePoints(t,s,i){if(t.equals(i)||t.equals(s)||i.equals(s))return Js.getNAN();const e=Ks(t,s,i);return e.isNAN()?ti(t,s,i):e}static calculateAngle(t,s){return Math.atan2(t.crossProduct(s),t.dotProduct(s))}static isBisectorRobust(t,i,e){return s(0),!1}static size(){return 2}get 0(){return this.x}get 1(){return this.y}set 0(t){this.x=t}set 1(t){this.y=t}static compareZorder(t,s){const i=Js.c_compare_zorder_xx[t.x<0?1:0]|Js.c_compare_zorder_yy[t.y<0?1:0],e=Js.c_compare_zorder_xx[s.x<0?1:0]|Js.c_compare_zorder_yy[s.y<0?1:0];if(i===e){let i=0,e=0;for(let n=0;n<2;++n){const r=$s(t[n],s[n]);r>i&&(i=r,e=n)}return t[e]<s[e]}return i<e}static lerp(t,s,i){const e=new Js;return Y(t,s,i,e),e}static getClosestCoordinate(t,s,i,e=!1){const n=Js.getNAN();n.setSub(s,t);const r=n.sqrLength();if(0===r)return.5;if(s.isEqualPoint2D(i))return 1;const h=Js.getNAN();h.setSub(i,t);let o=h.dotProduct(n)/r;return e||(o<0?o=0:o>1&&(o=1)),o}static intersectLinesAtOnePoint(t,s,i,e){if(t.equals(s)||i.equals(e))return Js.getNAN();const n=s.x-t.x,r=i.x-e.x,h=s.y-t.y,o=i.y-e.y,a=n*o-r*h;if(!a)return Js.getNAN();const u=a;if(0===u)return Js.getNAN();let l=(i.x-t.x)*o-(i.y-t.y)*r;l/=u;const m=new Js;return Y(t,s,l,m),m.isFinite()?m:Js.getNAN()}toString(){return`[${this.x},${this.y}]`}}function Ks(t,s,i){const e=new w(s.x);e.subThis(t.x);const n=new w(s.y);n.subThis(t.y);const r=new w(i.x);r.subThis(t.x);const h=new w(i.y);h.subThis(t.y);const o=e.clone();o.mulThisE(h);let a=n.clone();if(a.mulThisE(r),o.subThisE(a),0===o.value())return Js.getNAN();o.mulThis(2);const u=e.clone();u.mulThisE(e);const l=n.clone();l.mulThisE(n);const m=u.clone();m.addThisE(l);const c=r.clone();c.mulThisE(r);const y=h.clone();y.mulThisE(h);const x=c.clone();x.addThisE(y);const f=n.clone();f.mulThisE(x),a=h.clone(),a.mulThisE(m),f.subThisE(a),f.divThisE(o);const d=e.clone();d.mulThisE(x),a=r.clone(),a.mulThisE(m),d.subThisE(a),d.divThisE(o);const b=Js.construct(t.x-f.value(),t.y+d.value()),v=t.sub(b).length(),_=s.sub(b).length(),N=i.sub(b).length(),M=1e-15*(v+Math.abs(t.x)+Math.abs(s.x)+Math.abs(i.x)+Math.abs(t.y)+Math.abs(s.y)+Math.abs(i.y));return Math.abs(v-_)<=M&&Math.abs(v-N)<=M&&f.eps()<M&&d.eps()<M?b:Js.getNAN()}function ti(t,s,i){const e=Ws.constructDouble(s.x);e.subDoubleThis(t.x);const n=Ws.constructDouble(s.y);n.subDoubleThis(t.y);const r=Ws.constructDouble(i.x);r.subDoubleThis(t.x);const h=Ws.constructDouble(i.y);h.subDoubleThis(t.y);const o=e.clone();o.mulThis(h);let a=n.clone();if(a.mulThis(r),o.subThis(a),o.isZero())return Js.getNAN();o.mulDoubleThis(2);const u=e.clone();u.mulThis(e);const l=n.clone();l.mulThis(n);const m=u.clone();m.addThis(l);const c=r.clone();c.mulThis(r);const y=h.clone();y.mulThis(h);const x=c.clone();x.addThis(y);const f=n.clone();f.mulThis(x),a=h.clone(),a.mulThis(m),f.subThis(a),f.divThis(o);const d=e.clone();d.mulThis(x),a=r.clone(),a.mulThis(m),d.subThis(a),d.divThis(o);return Js.construct(t.x-f.value(),t.y+d.value())}Js.dimensions=2,Js.d=[[0,1,0,-1],[-1,0,1,0],[0,-1,0,1],[1,0,-1,0]],Js.c_compare_zorder_xx=[2,0],Js.c_compare_zorder_yy=[1,0];class si{constructor(t,s,i){if(t instanceof si)return this.data=t.data,this.N=t.N,this.M=t.M,t.data=null,t.N=0,void(t.M=0);this.data=t,this.N=s,this.M=i}assignCopy(t){return this===t||(s(this.N*this.M==t.N*t.M),this.data.set(t.data),this.N=t.N,this.M=t.M),this}setZero(){return this.data?.fill(0),this}setIdentity(){const t=0,s=1;for(let i=0;i<this.N;i++)for(let e=0;e<this.M;e++)this.setRowCol(i,e,i===e?s:t);return this}rows(){return this.N}cols(){return this.M}row(t){return s(0),{}}set(t,s){return this.data[t]=s,this}setRowCol(t,s,i){return this.data[t*this.M+s]=i,this}at(t){return this.data[t]}atRowCol(t,s){return this.data[t*this.M+s]}mulScalar(t,i){s(0)}mul(t,i){if(s(this.M===t.rows()),s(this.N===i.rows()),s(t.cols()===i.cols()),i===this){const s=new Float64Array(this.N*this.M),e=new si(s,this.N,this.M);return this.mul(t,e),void i.assignCopy(e)}if(i===t){const s=new Float64Array(t.N*t.M),e=new si(s,t.N,t.M);return this.mul(t,e),void i.assignCopy(e)}const e=t.cols();for(let s=0;s<this.N;s++)for(let n=0;n<e;n++){let e=0;for(let i=0;i<this.M;i++)e+=this.atRowCol(s,i)*t.atRowCol(i,n);i.setRowCol(s,n,e)}}mulTranspose(t,i){if(s(this.M===t.cols()),s(this.N===i.rows()),s(t.rows()===i.cols()),i===this){const s=new Float64Array(this.N*this.M),e=new si(s,this.N,this.M);return this.mulTranspose(t,e),void i.assignCopy(e)}if(i===t){const s=new Float64Array(t.N*t.M),e=new si(s,t.N,t.M);return this.mulTranspose(t,e),void i.assignCopy(e)}const e=t.rows();for(let s=0;s<this.N;s++)for(let n=0;n<e;n++){let e=0;for(let i=0;i<this.M;i++)e+=this.atRowCol(s,i)*t.atRowCol(n,i);i.setRowCol(s,n,e)}}mulLeft(t,i){s(0)}mulLeftTranspose(t,i){s(0)}mulDiag(t,i){if(s(this.M===t.N*t.M),s(this.N===i.rows()),s(this.M===i.cols()),i===this){const s=new Float64Array(this.N*this.M),e=new si(s,this.N,this.M);return this.mulDiag(t,e),void i.assignCopy(e)}const e=this.M;for(let s=0;s<this.N;s++)for(let n=0;n<e;n++)i.setRowCol(s,n,this.atRowCol(s,n)*t.at(n))}transposeInPlace(){if(this.N===this.M){for(let t=0;t<this.N;t++)for(let s=t+1;s<this.M;s++){const i=this.atRowCol(t,s);this.setRowCol(t,s,this.atRowCol(s,t)),this.setRowCol(s,t,i)}return this}const t=new Float64Array(this.N*this.M),s=new si(t,this.N,this.M);return s.assignCopy(this),this.M=Tt(this.N,this.N=this.M),s.transpose(this),this}transpose(t){if(this!==t){si.checkDims(t,this.M,this.N);for(let s=0;s<this.N;s++)for(let i=0;i<this.M;i++)t.setRowCol(i,s,this.atRowCol(s,i))}else t.transposeInPlace()}add(t,s){}svd(t,i,e,n=!1){if(si.checkDims(t,this.N,this.M),si.checkDims(i,this.M,1),si.checkDims(e,this.M,this.M),n){if(s(this.N===this.M),!this.symmetricEigen(i,e))return!1;for(let t=0;t<this.M;++t)i.at(t)<0&&i.set(t,0);return t.assignCopy(e),!0}let r,h,o,a,u,l,m,c=0,y=0,x=0,f=0,d=0;const b=this.M,v=this.N;t.assignCopy(this);const _=new Float64Array(b),N=new si(_,b,1),w=(t,s)=>s>=0?Math.abs(t):-Math.abs(t),M=(t,s)=>{if((t=Math.abs(t))>(s=Math.abs(s))){const i=s/t;return t*Math.sqrt(i*i+1)}if(s>0){const i=t/s;return s*Math.sqrt(i*i+1)}return 0};for(let s=0;s<b;s++){if(c=s+1,N.set(s,f*x),x=a=f=0,s<v){for(let i=s;i<v;i++)f+=Math.abs(t.atRowCol(i,s));if(f){for(let i=s;i<v;i++)t.setRowCol(i,s,t.atRowCol(i,s)/f),a+=t.atRowCol(i,s)*t.atRowCol(i,s);h=t.atRowCol(s,s),x=-w(Math.sqrt(a),h),o=h*x-a,t.setRowCol(s,s,h-x);for(let i=c;i<b;i++){a=0;for(let e=s;e<v;e++)a+=t.atRowCol(e,s)*t.atRowCol(e,i);h=a/o;for(let e=s;e<v;e++)t.setRowCol(e,i,t.atRowCol(e,i)+h*t.atRowCol(e,s))}for(let i=s;i<v;i++)t.setRowCol(i,s,t.atRowCol(i,s)*f)}}if(i.set(s,f*x),x=a=f=0,s<v&&s!==b-1){for(let i=c;i<b;i++)f+=Math.abs(t.atRowCol(s,i));if(f){for(let i=c;i<b;i++)t.setRowCol(s,i,t.atRowCol(s,i)/f),a+=t.atRowCol(s,i)*t.atRowCol(s,i);h=t.atRowCol(s,c),x=-w(Math.sqrt(a),h),o=h*x-a,t.setRowCol(s,c,h-x);for(let i=c;i<b;i++)N.set(i,t.atRowCol(s,i)/o);for(let i=c;i<v;i++){a=0;for(let e=c;e<b;e++)a+=t.atRowCol(i,e)*t.atRowCol(s,e);for(let s=c;s<b;s++)t.setRowCol(i,s,t.atRowCol(i,s)+a*N.at(s))}for(let i=c;i<b;i++)t.setRowCol(s,i,t.atRowCol(s,i)*f)}}const e=Math.abs(i.at(s))+Math.abs(N.at(s));d=e>d?e:d}for(let s=b-1;s>=0;s--){if(s<b-1){if(x){for(let i=c;i<b;i++)e.setRowCol(i,s,t.atRowCol(s,i)/t.atRowCol(s,c)/x);for(let i=c;i<b;i++){a=0;for(let n=c;n<b;n++)a+=t.atRowCol(s,n)*e.atRowCol(n,i);for(let t=c;t<b;t++)e.setRowCol(t,i,e.atRowCol(t,i)+a*e.atRowCol(t,s))}}for(let t=c;t<b;t++)e.setRowCol(s,t,0),e.setRowCol(t,s,0)}e.setRowCol(s,s,1),x=N.at(s),c=s}for(let s=(v<b?v:b)-1;s>=0;s--){c=s+1,x=i.at(s);for(let i=c;i<b;i++)t.setRowCol(s,i,0);if(x){x=1/x;for(let i=c;i<b;i++){a=0;for(let e=c;e<v;e++)a+=t.atRowCol(e,s)*t.atRowCol(e,i);h=a/t.atRowCol(s,s)*x;for(let e=s;e<v;e++)t.setRowCol(e,i,t.atRowCol(e,i)+h*t.atRowCol(e,s))}for(let i=s;i<v;i++)t.setRowCol(i,s,t.atRowCol(i,s)*x)}else for(let i=s;i<v;i++)t.setRowCol(i,s,0);t.setRowCol(s,s,t.atRowCol(s,s)+1)}for(let s=b-1;s>=0;s--)for(let n=1;;n++){let f=1;for(c=s;c>=0;c--){if(y=c-1,Math.abs(N.at(c))+d===d){f=0;break}if(Math.abs(i.at(y))+d===d)break}if(f){r=0,a=1;for(let e=c;e<=s&&(h=a*N.at(e),N.set(e,N.at(e)*r),Math.abs(h)+d!==d);e++){x=i.at(e),o=M(h,x),i.set(e,o),o=1/o,r=x*o,a=-h*o;for(let s=0;s<v;s++)l=t.atRowCol(s,y),m=t.atRowCol(s,e),t.setRowCol(s,y,l*r+m*a),t.setRowCol(s,e,m*r-l*a)}}if(m=i.at(s),c===s){if(m<0){i.set(s,-m);for(let t=0;t<b;t++)e.setRowCol(t,s,-e.atRowCol(t,s))}break}if(100===n)return!1;u=i.at(c),y=s-1,l=i.at(y),x=N.at(y),o=N.at(s),h=((l-m)*(l+m)+(x-o)*(x+o))/(2*o*l),x=M(h,1),h=((u-m)*(u+m)+o*(l/(h+w(x,h))-o))/u,r=a=1;for(let s=c;s<=y;s++){const n=s+1;x=N.at(n),l=i.at(n),o=a*x,x*=r,m=M(h,o),N.set(s,m),r=h/m,a=o/m,h=u*r+x*a,x=x*r-u*a,o=l*a,l*=r;for(let t=0;t<b;t++)u=e.atRowCol(t,s),m=e.atRowCol(t,n),e.setRowCol(t,s,u*r+m*a),e.setRowCol(t,n,m*r-u*a);m=M(h,o),i.set(s,m),m&&(m=1/m,r=h*m,a=o*m),h=r*x+a*l,u=r*l-a*x;for(let i=0;i<v;i++)l=t.atRowCol(i,s),m=t.atRowCol(i,n),t.setRowCol(i,s,l*r+m*a),t.setRowCol(i,n,m*r-l*a)}N.set(c,0),N.set(s,h),i.set(s,u)}const p=new Float64Array(this.N),C=new Float64Array(this.M),T=new si(p,this.N,1),R=new si(C,this.M,1);let g=1;do{g*=3,g++}while(g<=this.M);do{g/=3,g=Math.trunc(g);for(let s=g;s<this.M;s++){const n=i.at(s);for(let i=0;i<this.N;i++)T.set(i,t.atRowCol(i,s));for(let t=0;t<this.M;t++)R.set(t,e.atRowCol(t,s));let r=s;for(;i.at(r-g)<n;){i.set(r,i.at(r-g));for(let s=0;s<this.N;s++)t.setRowCol(s,r,t.atRowCol(s,r-g));for(let t=0;t<this.M;t++)e.setRowCol(t,r,e.atRowCol(t,r-g));if(r-=g,r<g)break}i.set(r,n);for(let s=0;s<this.N;s++)t.setRowCol(s,r,T.at(s));for(let t=0;t<this.M;t++)e.setRowCol(t,r,R.at(t))}}while(g>1);for(let s=0;s<this.M;s++){let i=0;for(let e=0;e<this.N;e++)t.atRowCol(e,s)<0&&i++;for(let t=0;t<this.M;t++)e.atRowCol(t,s)<0&&i++;if(i>Math.trunc((this.N+this.M)/2)){for(let i=0;i<this.N;i++)t.setRowCol(i,s,-t.atRowCol(i,s));for(let t=0;t<this.M;t++)e.setRowCol(t,s,-e.atRowCol(t,s))}}return!0}isSymmetric(){if(this.N!==this.M)return!1;for(let t=0;t<this.N;t++)for(let s=t+1;s<this.M;s++)if(this.atRowCol(t,s)!==this.atRowCol(s,t))return!1;return!0}isZero(){return s(0),!1}isIdentity(){return s(0),!1}equals(t,i){if(void 0!==i&&s(0),this.N!==t.N||this.M!==t.M)return!1;for(let s=0;s<this.N*this.M;s++)if(this.data[s]!==t.data[s])return!1;return!0}maxElement(){return s(0),0}minElement(){return s(0),0}determinant(){if(s(this.N===this.M),1===this.N)return this.data[0];if(2===this.N)return this.data[0]*this.data[3]-this.data[1]*this.data[2];if(3===this.N){const t=this;return t.atRowCol(0,0)*(t.atRowCol(1,1)*t.atRowCol(2,2)-t.atRowCol(1,2)*t.atRowCol(2,1))-t.atRowCol(0,1)*(t.atRowCol(1,0)*t.atRowCol(2,2)-t.atRowCol(2,0)*t.atRowCol(1,2))+t.atRowCol(0,2)*(t.atRowCol(1,0)*t.atRowCol(2,1)-t.atRowCol(1,1)*t.atRowCol(2,0))}const t=new Float64Array(this.N*this.N),i=new si(t,this.N,this.N),e=new Float64Array(this.N);if(!this.luDecomposition(i,e))return 0;let n=1;for(let s=0;s<this.N;s++)n*=i.atRowCol(s,s),e[s]!==s&&(n=-n);return n}submatrix(t,i,e){s(0)}inverse(t){s(0)}pseudoInverse(t,s=!1,i=2220446049250313e-31){if(t.setZero(),1===this.N&&1===this.M)return 0!==this.atRowCol(0,0)?t.setRowCol(0,0,1/this.atRowCol(0,0)):t.setRowCol(0,0,0),!0;if(2===this.N&&2===this.M){const s=this.atRowCol(0,0)*this.atRowCol(1,1)-this.atRowCol(0,1)*this.atRowCol(1,0),i=1e-5*(Math.abs(this.atRowCol(0,0)*this.atRowCol(1,1))+Math.abs(this.atRowCol(0,1)*this.atRowCol(1,0)));if(Math.abs(s)>i)return t.setRowCol(0,0,this.atRowCol(1,1)/s),t.setRowCol(0,1,-this.atRowCol(0,1)/s),t.setRowCol(1,0,-this.atRowCol(1,0)/s),t.setRowCol(1,1,this.atRowCol(0,0)/s),!0}const e=new Float64Array(this.N*this.M),n=new si(e,this.N,this.M),r=new Float64Array(this.M),h=new si(r,this.M,1),o=new Float64Array(this.M*this.M),a=new si(o,this.M,this.M);if(!this.svd(n,h,a,s))return!1;const u=Math.max(this.N,this.M),l=i*Math.abs(h.at(0))*u;for(let m=0;m<this.M;m++)h.at(m)>l?h.set(m,1/h.at(m)):h.set(m,0);return a.mulDiag(h,t),t.mulTranspose(n,t),!0}luDecomposition(t,i){return s(0),!1}symmetricEigen(t,i){s(this.rows()===this.cols()),s(this.rows()===t.rows()),s(i.rows()===i.cols()&&i.rows()===this.rows()),s(this.isSymmetric());const e=new Float64Array(this.N*this.M),n=new si(e,this.N,this.M);n.assignCopy(this);const r=100/Number.EPSILON,h=this.rows(),o=new Float64Array(h),a=new Float64Array(h),u=new si(o,h,1),l=new si(a,h,1);for(let s=0;s<h;s++)u.set(s,n.atRowCol(s,s)),t.set(s,n.atRowCol(s,s)),l.set(s,0);i.setIdentity();const m=()=>{const s=u;i.transposeInPlace();let e=1;do{e*=3,e++}while(e<=h);do{e/=3,e=Math.trunc(e);for(let n=e;n<h;n++){const r=t.at(n),h=Math.abs(r);for(let t=0;t<this.M;t++)s.set(t,i.atRowCol(t,n));let o=n;for(;Math.abs(t.at(o-e))<h;){t.set(o,t.at(o-e));for(let t=0;t<this.M;t++)i.setRowCol(t,o,i.atRowCol(t,o-e));if(o-=e,o<e)break}if(o!==n){t.set(o,r);for(let t=0;t<this.M;t++)i.setRowCol(t,o,s.at(t))}}}while(e>1)};for(let s=1;;s++){let e=0;for(let t=1;t<h;t++)for(let s=0;s<t;s++)e+=Math.abs(n.atRowCol(t,s));if(0===e)return m(),!0;const o=s<4?.2*e/(h*h):0;for(let a=0;a<h;a++)for(let e=a+1;e<h;e++){let u=r*Math.abs(n.atRowCol(e,a));if(s>4&&u<=Math.abs(t.at(a))&&u<=Math.abs(t.at(e)))n.setRowCol(e,a,0);else if(Math.abs(n.atRowCol(e,a))>o){let s,r=t.at(e)-t.at(a);if(u<Math.abs(r))s=n.atRowCol(e,a)/r;else{const t=.5*r/n.atRowCol(e,a);s=1/(Math.abs(t)+Math.sqrt(1+t*t)),t<0&&(s=-s)}const o=1/Math.sqrt(1+s*s),m=s*o,c=m/(1+o);r=s*n.atRowCol(e,a),l.set(a,l.at(a)-r),l.set(e,l.at(e)+r),t.set(a,t.at(a)-r),t.set(e,t.at(e)+r),n.setRowCol(e,a,0);let y=0;for(;y<a;y++)u=n.atRowCol(a,y),r=n.atRowCol(e,y),n.setRowCol(a,y,u-m*(r+u*c)),n.setRowCol(e,y,r+m*(u-r*c));for(y++;y<e;y++)u=n.atRowCol(y,a),r=n.atRowCol(e,y),n.setRowCol(y,a,u-m*(r+u*c)),n.setRowCol(e,y,r+m*(u-r*c));for(y++;y<h;y++)u=n.atRowCol(y,a),r=n.atRowCol(y,e),n.setRowCol(y,a,u-m*(r+u*c)),n.setRowCol(y,e,r+m*(u-r*c));for(y=0;y<h;y++)u=i.atRowCol(a,y),r=i.atRowCol(e,y),i.setRowCol(a,y,u-m*(r+u*c)),i.setRowCol(e,y,r+m*(u-r*c))}}for(let s=0;s<h;s++)u.set(s,u.at(s)+l.at(s)),t.set(s,u.at(s)),l.set(s,0)}}static checkDims(t,i,e){s(t.rows()===i&&t.cols()===e)}}class ii extends si{constructor(t){if(t.copy){const s=new Float64Array(t.copy.N*t.copy.M);return super(s,t.copy.N,t.copy.M),this.buffer=s,void this.assignCopy(t.copy)}const s=new Float64Array(t.NN*t.MM);super(s,t.NN,t.MM),this.buffer=s,t.initializerList&&pt(this.buffer,t.initializerList,0,0,t.initializerList.length)}assignCopy(t){return this===t||super.assignCopy(t),this}}class ei{constructor(t){this.m_TransformationType=1,void 0===t?this.setIdentity():t instanceof ei?this.set(t):this.setScale(t)}set(t){return this.xx=t.xx,this.xy=t.xy,this.xd=t.xd,this.yx=t.yx,this.yy=t.yy,this.yd=t.yd,this}clone(){return(new ei).set(this)}setZero(){this.xx=0,this.yy=0,this.xy=0,this.yx=0,this.xd=0,this.yd=0}isEqual(t){return this===t||this.xx===t.xx&&this.xy===t.xy&&this.xd===t.xd&&this.yx===t.yx&&this.yy===t.yy&&this.yd===t.yd}transformInPlace(t){const s=this.xx*t.x+this.xy*t.y+this.xd,i=this.yx*t.x+this.yy*t.y+this.yd;t.x=s,t.y=i}transform(t){const s=t.clone();return this.transformInPlace(s),s}queryTransform(t,s){const i=this.xx*t.x+this.xy*t.y+this.xd,e=this.yx*t.x+this.yy*t.y+this.yd;s.setCoords(i,e)}transformEnvInPlace(t){if(t.isEmpty())return;const s=zt(Js,4);t.queryCorners(s),this.transformPoints2D(s,4,s),t.setFromPoints(s,4)}queryTransformEnv(t,i){s(0)}transformPoints2D(t,s,i){for(let e=0;e<s;++e)this.queryTransform(t[e],i[e])}transformInterleavedPoints(t,s,i){s*=2;const e=Js.getNAN();for(let n=0;n<s;n+=2)e.x=t[n],e.y=t[n+1],this.transformInPlace(e),i[n]=e.x,i[n+1]=e.y}multiply(t){return ei.st_multiply(this,t,this),this}mulLeft(t){return s(0),this}static st_multiply(t,s,i){const e=t.xx*s.xx+t.yx*s.xy,n=t.xy*s.xx+t.yy*s.xy,r=t.xd*s.xx+t.yd*s.xy+s.xd,h=t.xx*s.yx+t.yx*s.yy,o=t.xy*s.yx+t.yy*s.yy,a=t.xd*s.yx+t.yd*s.yy+s.yd;i.xx=e,i.xy=n,i.xd=r,i.yx=h,i.yy=o,i.yd=a}getCoefficients(t){s(t.length>=6),t[0]=this.xx,t[1]=this.xy,t[2]=this.xd,t[3]=this.yx,t[4]=this.yy,t[5]=this.yd}setCoefficients(t){s(t.length>=6),this.xx=t[0],this.xy=t[1],this.xd=t[2],this.yx=t[3],this.yy=t[4],this.yd=t[5]}copyTo(t){s(0)}initializeFromRect(t,s){t.isEmpty()||s.isEmpty()||!t.width()||!t.height()?this.setZero():(this.xy=this.yx=0,this.xx=s.width()/t.width(),this.yy=s.height()/t.height(),this.xd=s.xmin-t.xmin*this.xx,this.yd=s.ymin-t.ymin*this.yy)}initializeFromRectIsotropic(t,s){if(t.isEmpty()||!t.width()||!t.height()||s.isEmpty())this.setZero();else{this.yx=0,this.xy=0,this.xx=s.width()/t.width(),this.yy=s.height()/t.height(),this.xx>this.yy?this.xx=this.yy:this.yy=this.xx;const i=s.getCenter(),e=t.getCenter();this.xd=i.x-e.x*this.xx,this.yd=i.y-e.y*this.yy}}initializeFromTwoPointsArray(t,s){if(t[0].equals(s[0])&&t[1].equals(s[1]))return void this.setIdentity();if(t[0].equals(t[1])){if(s[0].equals(s[1]))return void this.setShift(s[0].sub(t[0]));e("")}if(!t[0].equals(t[1])&&s[0].equals(s[1]))return this.setZero(),void this.shift(s[0]);this.setShiftCoords(-t[0].x,-t[0].y);const i=Js.distance(t[0],t[1]),n=Js.distance(s[0],s[1]),r=n/i;this.scale(r,r);const h=t[1].sub(t[0]);h.divThis(i);const o=s[1].sub(s[0]);o.divThis(n);const a=h.crossProduct(o),u=h.dotProduct(o);this.rotate(u,a),this.shiftCoords(s[0].x,s[0].y)}initializeFromTwoPoints(t,s,i,e){const n=[t,s],r=[i,e];this.initializeFromTwoPointsArray(n,r)}transformSizeInPlace(t){s(0)}transformSize(t,i){s(0)}transformTol(t){return s(0),0}transformWithoutTranslateArray(t,s,i){for(let e=0;e<s;++e)this.transformWithoutTranslate(t[e],i[e])}transformWithoutTranslateInPlace(t){const s=this.xx*t.x+this.xy*t.y,i=this.yx*t.x+this.yy*t.y;t.setCoords(s,i)}transformWithoutTranslate(t,s){const i=this.xx*t.x+this.xy*t.y,e=this.yx*t.x+this.yy*t.y;s.setCoords(i,e)}setIdentity(){this.xx=1,this.xy=0,this.xd=0,this.yx=0,this.yy=1,this.yd=0}isIdentity(){return!(1!==this.xx||1!==this.yy||this.xy||this.xd||this.yx||this.yd)}isIdentityTol(t){const s=t*t;return!(X(this.xd)+X(this.yd)>s)&&(!(X(this.xy+this.xd)+X(this.yy+this.yd-1)>s)&&!(X(this.xx+this.xd-1)+X(this.yx+this.yd)>s))}isReflective(){return this.xx*this.yy-this.yx*this.xy<0}isUniform(t){const s=this.xx*this.xx+this.yx*this.yx,i=this.xy*this.xy+this.yy*this.yy,e=(s+i)*t;return Math.abs(s-i)<=e&&Math.abs(this.xx*this.xy+this.yx*this.yy)<=e}isUniformNoRotation(){return 0!==this.xx&&Math.abs(this.xx)===Math.abs(this.yy)&&0===this.xy&&0===this.yx}isTranslate(){return 1===this.xx&&1===this.yy&&!this.xy&&!this.yx}isTranslateTol(t){const s=new Js;return s.setCoords(0,1),this.transformWithoutTranslateInPlace(s),s.y-=1,!(s.sqrLength()>t*t)&&(s.setCoords(1,0),this.transformWithoutTranslateInPlace(s),s.x-=1,s.sqrLength()<=t*t)}isOrthonormal(t){const s=new ei;return s.xx=this.xx*this.xx+this.xy*this.xy,s.xy=this.xx*this.yx+this.xy*this.yy,s.yx=this.yx*this.xx+this.yy*this.xy,s.yy=this.yx*this.yx+this.yy*this.yy,s.xd=0,s.yd=0,s.isIdentityTol(t)}isDegenerate(t){return Math.abs(this.xx*this.yy-this.yx*this.xy)<=2*t*(Math.abs(this.xx*this.yy)+Math.abs(this.yx*this.xy))}isZero(){return 0===this.xx&&0===this.yy&&0===this.xy&&0===this.yx&&0===this.xd&&0===this.yd}isScaleAndTranslateTol(t){return this.xy*this.xy+this.yx*this.yx<=(this.xx*this.xx+this.yy*this.yy)*t}setTranslate(t,s){return this.xx=1,this.xy=0,this.xd=t,this.yx=0,this.yy=1,this.yd=s,this}setShiftCoords(t,s){return this.xx=1,this.xy=0,this.xd=t,this.yx=0,this.yy=1,this.yd=s,this}setShift(t){return this.xx=1,this.xy=0,this.xd=t.x,this.yx=0,this.yy=1,this.yd=t.y,this}setScaleCoords(t,s){return this.xx=t,this.xy=0,this.xd=0,this.yx=0,this.yy=s,this.yd=0,this}setScale(t){return this.setScaleCoords(t,t),this}setFlipX(t,s){return this.xx=-1,this.xy=0,this.xd=t+s,this.yx=0,this.yy=1,this.yd=0,this}setFlipY(t,s){return this.xx=1,this.xy=0,this.xd=0,this.yx=0,this.yy=-1,this.yd=t+s,this}setShear(t,s){return this.xx=1,this.xy=t,this.xd=0,this.yx=s,this.yy=1,this.yd=0,this}scale(t,s){return this.xx*=t,this.xy*=t,this.xd*=t,this.yx*=s,this.yy*=s,this.yd*=s,this}setRotateAngle(t){return this.setRotate(Math.cos(t),Math.sin(t))}setRotate(t,s){return this.xx=t,this.xy=-s,this.xd=0,this.yx=s,this.yy=t,this.yd=0,this}setRotateAngleAbout(t,s){return this.setRotateAbout(Math.cos(t),Math.sin(t),s)}setRotateAbout(t,s,i){return this.setTranslate(-i.x,-i.y),this.rotate(t,s),this.translate(i.x,i.y)}setSwapCoordinates(){return this.xx=0,this.xy=1,this.xd=0,this.yx=1,this.yy=0,this.yd=0,this}setRotateCw90(){return this.xx=0,this.xy=1,this.xd=0,this.yx=-1,this.yy=0,this.yd=0,this}setRotateCcw90(){return this.xx=0,this.xy=-1,this.xd=0,this.yx=1,this.yy=0,this.yd=0,this}shiftCoords(t,s){return this.xd+=t,this.yd+=s,this}shift(t){return this.xd+=t.x,this.yd+=t.y,this}translate(t,s){return this.xd+=t,this.yd+=s,this}flipX(t,s){return this.xx=-this.xx,this.xy=-this.xy,this.xd=t+s-this.xd,this}flipY(t,s){return this.yx=-this.yx,this.yy=-this.yy,this.yd=t+s-this.yd,this}shear(t,s){const i=new ei;return i.setShear(t,s),this.multiply(i)}rotateAngle(t){const s=new ei;return s.setRotateAngle(t),this.multiply(s)}rotate(t,s){const i=new ei;return i.setRotate(t,s),this.multiply(i)}rotateAbout(t,s,i){return this.translate(-i.x,-i.y),this.rotate(t,s),this.translate(i.x,i.y)}rotateAngleAbout(t,s){return this.rotateAbout(Math.cos(t),Math.sin(t),s)}setInvert(t){return this.set(t),this.invertThis()}invertThis(){let t=this.xx*this.yy-this.xy*this.yx;if(0===t)return this.setZero(),this;t=1/t;const s=(this.xy*this.yd-this.xd*this.yy)*t,i=(this.xd*this.yx-this.xx*this.yd)*t,e=this.yy*t,n=-this.xy*t,r=-this.yx*t,h=this.xx*t;return this.xd=s,this.yd=i,this.xx=e,this.yy=h,this.xy=n,this.yx=r,this}invertPrecise(t){return this.set(t),this.invertPreciseThis()}invertPreciseThis(){const t=Ws.constructDouble(this.xy),s=Ws.constructDouble(this.xx),i=s.mulDouble(this.yy).sub(t.mulDouble(this.yx));if(i.isZero())return this.setZero(),this;const e=i.clone();e.invertThis();const n=Ws.constructDouble(this.xd),r=t.mulDouble(this.yd).sub(n.mulDouble(this.yy)).mul(e).toDouble(),h=n.mulDouble(this.yx).sub(s.mulDouble(this.yd)).mul(e).toDouble(),o=e.mulDouble(this.yy).toDouble(),a=e.mulDouble(-this.xy).toDouble(),u=e.mulDouble(-this.yx).toDouble(),l=e.mulDouble(this.xx).toDouble();return this.xd=r,this.yd=h,this.xx=o,this.yy=l,this.xy=a,this.yx=u,this}extractScaleTransform(t,s){const i=Math.sqrt(this.xx*this.xx+this.xy*this.xy),e=Math.sqrt(this.yx*this.yx+this.yy*this.yy);s.setScaleCoords(1/i,1/e),s.multiply(this),t.setScaleCoords(i,e)}setFromTwoTriangles(t,s){let i=!0;for(let u=0;u<3;++u)i=i&&t[u].equals(s[u]);if(i)return this.setIdentity(),!0;const e=new Js;e.setSub(t[0],t[1]);const n=new Js;n.setSub(t[0],t[2]);const r=new Js;r.setSub(s[0],s[1]);const h=new Js;h.setSub(s[0],s[2]);const o=4*Number.EPSILON*(Math.abs(e.x*n.y)+Math.abs(n.x*e.y));let a=e.x*n.y-e.y*n.x;return Math.abs(a)>o?(a=1/a,this.xx=(r.x*n.y-e.y*h.x)*a,this.xy=(e.x*h.x-r.x*n.x)*a,this.yx=(r.y*n.y-e.y*h.y)*a,this.yy=(e.x*h.y-r.y*n.x)*a,this.xd=s[0].x-(this.xx*t[0].x+this.xy*t[0].y),this.yd=s[0].y-(this.yx*t[0].x+this.yy*t[0].y),!0):(this.setZero(),!1)}initializeFromControlPoints(t,s,i,e,n=null){return 0===s?(this.setIdentity(),void(n&&n.setIdentity())):1===s?(this.setShift(e[0].sub(i[0])),void(n&&n.setShift(i[0].sub(e[0])))):(s<3&&(t=1),void(4===t&&s>2?hi(this,s,i,e,n):oi(t,this,s,i,e,n)))}calculateErrors(t,i,e,n){s(t>0&&null!==i&&null!==e);let r=0;for(let s=0;s<t;++s){const t=this.transform(i[s]),h=Js.sqrDistance(e[s],t);r+=h,n&&(n[s]=Math.sqrt(h))}return Math.sqrt(r/t)}}const ni=[43,11,41,9,61];function ri(t,i){s(!(2!==i.rows()&&3!==i.rows()||2!==i.cols()&&3!==i.rows())),t.xx=i.atRowCol(0,0),t.xy=i.atRowCol(0,1),t.yx=i.atRowCol(1,0),t.yy=i.atRowCol(1,1),3===i.cols()?(t.xd=i.atRowCol(0,2),t.yd=i.atRowCol(1,2)):(t.xd=0,t.yd=0)}function hi(t,s,i,e,r){const h=Js.average(i,s),o=Js.average(e,s),a=new ii({NN:2,MM:2});a.setZero();const u=new ii({NN:2,MM:2});u.setZero();for(let n=0;n<s;++n)a.setRowCol(0,0,a.atRowCol(0,0)+(i[n].x-h.x)*(i[n].x-h.x)),a.setRowCol(0,1,a.atRowCol(0,1)+(i[n].x-h.x)*(i[n].y-h.y)),a.setRowCol(1,1,a.atRowCol(1,1)+(i[n].y-h.y)*(i[n].y-h.y)),u.setRowCol(0,0,u.atRowCol(0,0)+(e[n].x-o.x)*(i[n].x-h.x)),u.setRowCol(0,1,u.atRowCol(0,1)+(e[n].x-o.x)*(i[n].y-h.y)),u.setRowCol(1,0,u.atRowCol(1,0)+(e[n].y-o.y)*(i[n].x-h.x)),u.setRowCol(1,1,u.atRowCol(1,1)+(e[n].y-o.y)*(i[n].y-h.y));a.setRowCol(1,0,a.atRowCol(0,1));const l=new ii({NN:2,MM:2});a.pseudoInverse(l,!0)||n("Failed to compute pseudo inverse"),u.mul(l,u),ri(t,u);const m=h.clone();t.transformInPlace(m),t.xd=o.x-m.x,t.yd=o.y-m.y,r&&(u.pseudoInverse(l,!1)||n("Failed to compute pseudo inverse"),ri(r,l),r.transformInPlace(o),r.xd=h.x-o.x,r.yd=h.y-o.y)}function oi(t,i,e,r,h,o){s(1===t||0===t||2===t||3===t),i.setIdentity();const a=Js.average(r,e),u=Js.average(h,e);if(s(t<ni.length&&t>0),8&ni[t]){const s=new ii({NN:2,MM:2});s.setZero();for(let t=0;t<e;++t)s.setRowCol(0,0,s.atRowCol(0,0)+(h[t].x-u.x)*(r[t].x-a.x)),s.setRowCol(1,0,s.atRowCol(1,0)+(h[t].x-u.x)*(r[t].y-a.y)),s.setRowCol(0,1,s.atRowCol(0,1)+(h[t].y-u.y)*(r[t].x-a.x)),s.setRowCol(1,1,s.atRowCol(1,1)+(h[t].y-u.y)*(r[t].y-a.y));const o=new ii({NN:2,MM:2}),l=new ii({NN:2,MM:1}),m=new ii({NN:2,MM:2});s.svd(o,l,m)||n("Failed to compute svd");const c=new ii({NN:2,MM:2});o.transpose(c);const y=new ii({NN:2,MM:2});if(m.mul(c,y),!(32&ni[t])){y.determinant()<0&&(c.setRowCol(1,0,-c.atRowCol(1,0)),c.setRowCol(1,1,-c.atRowCol(1,1)),m.mul(c,y))}const x=new ei;ri(x,y),i.set(x)}if(2&ni[t]){let t=0,s=0;for(let n=0;n<e;++n){const e=r[n].sub(a);t+=e.sqrLength(),i.transformInPlace(e),s+=e.dotProduct(h[n].sub(u))}if(0===t)0===s?i.setIdentity():i.setZero();else{const e=s/t;i.scale(e,e)}}else s(!(4&ni[t]));const l=a.clone();i.transformInPlace(l),i.xd=u.x-l.x,i.yd=u.y-l.y,o&&(o.set(i),o.invertThis(),o.isZero()&&(o.xd=a.x,o.yd=a.y))}export{wt as $,Pt as A,Y as B,g as C,pt as D,_ as E,It as F,us as G,w as H,Ts as I,Cs as J,r as K,ms as L,Ws as M,Ct as N,As as O,Js as P,ns as Q,rs as R,Ot as S,ei as T,Mt as U,Es as V,Et as W,qs as X,Bt as Y,U as Z,W as _,Lt as a,gt as a0,Zs as a1,L as a2,B as a3,hs as a4,D as a5,A as a6,O as a7,G as a8,Q as a9,ws as aA,Hs as aB,F as aC,Jt as aD,zs as aa,Qt as ab,Ls as ac,Qs as ad,Os as ae,Bs as af,ft as ag,dt as ah,E as ai,I as aj,js as ak,Ys as al,$ as am,ks as an,xt as ao,Wt as ap,Ft as aq,it as ar,H as as,Vs as at,Dt as au,Ps as av,Ms as aw,Zt as ax,k as ay,Ss as az,Tt as b,S as c,Gt as d,X as e,qt as f,os as g,ps as h,Rs as i,as as j,St as k,Fs as l,zt as m,Rt as n,ls as o,Vt as p,Ut as q,yt as r,J as s,kt as t,At as u,V as v,K as w,j as x,q as y,Z as z};
5
+ import{a as t,g as s,w as i,t as e,x as n}from"./Geometry.js";class r{constructor(t){this.sum=t,this.compensation=0}assign(t){return this.compensation=t.compensation,this.sum=t.sum,this}reset(){this.sum=this.compensation=0}resetToStart(t){this.sum=t,this.compensation=0}normalize(){const t=[Number.NaN];this.sum=ct(this.sum,this.compensation,t),this.compensation=t[0]}add(t){const s=this.sum+t;let i;if(Math.abs(this.sum)>=Math.abs(t)){const e=this.sum-s+t;i=this.compensation+e}else{const e=t-s+this.sum;i=this.compensation+e}this.sum=s,this.compensation=i}sub(t){this.add(-t)}addProduct(t,s){const i=[0],e=ot(t,s,i);this.add(e),this.add(i[0])}mul(t){const s=new r(0);s.addProduct(this.sum,t),s.addProduct(this.compensation,t),this.assign(s)}getResult(){return this.sum+this.compensation}pe(t){return this.add(t),this}me(t){return this.add(-t),this}}const h=0x00000000ffffffffn,o=0x0000ffffn,a=0x000000ffn,u=0x0fn,l=0xffff0000n,m=0xff00n,c=0xf0n,y=[5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1],x=[-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3];function f(t){let s=0;return t&o||(s+=16,t>>=16n),t&a||(s+=8,t>>=8n),t&u||(s+=4,t>>=4n),s+y[Number(BigInt.asUintN(4,t))]}function d(t){let s=0;return t&l&&(s+=16,t>>=16n),t&m&&(s+=8,t>>=8n),t&c&&(s+=4,t>>=4n),s+x[Number(BigInt.asUintN(4,t))]+1}function b(t){let s=0;return t&h||(s=32,t>>=32n),s+f(BigInt.asUintN(32,t))}function v(t){let s=0;return 0xffffffff00000000n&t&&(s=32,t>>=32n),s+d(t)}class _{constructor(t,s){if(this.m_EnvelopeType=1,void 0!==t){if(t instanceof _)return this.vmin=t.vmin,void(this.vmax=t.vmax);this.vmin=t,this.vmax=s,this.normalize()}else this.setEmpty()}static construct(t,s){return new _(t,s)}static constructEmpty(){return new _}setCoords(t,s){this.vmin=t,this.vmax=s,this.normalize()}setCoordsFromEnvelope(t){this.vmin=t.vmin,this.vmax=t.vmax}setEmpty(){this.vmin=Number.NaN,this.vmax=Number.NaN}getCenter(){return.5*(this.vmin+this.vmax)}equalsRange(t,s){return ns(this.vmin,t)&&ns(this.vmax,s)}equals(t,s){return!(!this.isEmpty()||!t.isEmpty())||(void 0!==s?Math.abs(this.vmin-t.vmin)<=s&&Math.abs(this.vmax-t.vmax)<=s:this.vmin===t.vmin&&this.vmax===t.vmax)}width(){return this.vmax-this.vmin}isEmpty(){return Number.isNaN(this.vmin)||Number.isNaN(this.vmax)}isZero(){return this.vmin===this.vmax}setInfinite(){this.vmin=Number.NEGATIVE_INFINITY,this.vmax=Number.POSITIVE_INFINITY}move(t){this.isEmpty()||(this.vmin+=t,this.vmax+=t)}contains(t){return t.vmin>=this.vmin&&t.vmax<=this.vmax}containsCoordinate(t){return t>=this.vmin&&t<=this.vmax}containsRightExclusive(t){return t>=this.vmin&&t<this.vmax}containsExclusiveCoordinate(t){return t>this.vmin&&t<this.vmax}containsExclusive(t){return t.vmin>this.vmin&&t.vmax<this.vmax}isIntersecting(t){return this.vmin<=t.vmin?this.vmax>=t.vmin:t.vmax>=this.vmin}mergeCoordinate(t){if(this.isEmpty())return this.vmin=t,void(this.vmax=t);this.mergeNeCoordinate(t)}merge(t){if(t.isEmpty())return;const s=t.vmin,i=t.vmax;this.mergeCoordinate(s),this.mergeCoordinate(i)}mergeNe(t){const s=t.vmin,i=t.vmax;this.mergeNeCoordinate(s),this.mergeNeCoordinate(i)}mergeNeCoordinate(t){t<this.vmin?this.vmin=t:t>this.vmax&&(this.vmax=t)}intersect(t){this.isEmpty()||t.isEmpty()?this.setEmpty():(this.vmin<t.vmin&&(this.vmin=t.vmin),this.vmax>t.vmax&&(this.vmax=t.vmax),this.vmin>this.vmax&&this.setEmpty())}inflate(t){this.isEmpty()||(this.vmin-=t,this.vmax+=t,this.vmax<this.vmin&&this.setEmpty())}normalize(){this.vmin<=this.vmax||(this.vmin>this.vmax?this.vmax=Tt(this.vmin,this.vmin=this.vmax):this.setEmpty())}isValid(){return this.isEmpty()||this.vmin<=this.vmax}snapClip(t){return Fs(t,this.vmin,this.vmax)}calculateToleranceFromEnvelope(){if(this.isEmpty())return As();return(Math.abs(this.vmin)+Math.abs(this.vmax)+1)*As()}static unit(){return N}normalizeNoNAN(){this.vmin>this.vmax&&(this.vmax=Tt(this.vmin,this.vmin=this.vmax))}setCoordsNoNAN(t,s){this.vmin=t,this.vmax=s,this.normalizeNoNAN()}clone(){return new _(this.vmin,this.vmax)}}const N=new _(0,1);class w{static getNAN(){return new w(Number.NaN)}constructor(t,s){this.m_value=t??0,this.m_eps=s??0}[Symbol.toPrimitive](t){return this}clone(){return new w(this.m_value,this.m_eps)}assign(t){return this.m_value=t.m_value,this.m_eps=t.m_eps,this}scaleError(t){this.m_eps*=t}setError(t){this.m_eps=t}set(t,s){return this.m_value=t,this.m_eps=s??0,this}setWithEps(t,s){return void 0===s&&(s=1),this.m_value=t,this.m_eps=w.ulp(t)*s,this}setE(t){return this.m_value=t.m_value,this.m_eps=t.m_eps,this}precise(){return new w(this.m_value)}value(){return this.m_value}toDouble(){return this.m_value}eps(){return this.m_eps}resetError(){return this.m_eps=0,this}absThis(){return this.m_value=Math.abs(this.m_value),this}add(t){return this.clone().addThis(t)}addE(t){return this.clone().addThisE(t)}addThisE(t){const s=this.m_value+t.m_value,i=this.m_eps+t.m_eps+w.ulp(s);return this.m_value=s,this.m_eps=i,this}addThis(t){const s=this.m_value+t,i=this.m_eps+w.ulp(s);return this.m_value=s,this.m_eps=i,this}subE(t){return this.clone().subThisE(t)}sub(t){return this.clone().subThis(t)}subThisE(t){const s=this.m_value-t.m_value,i=this.m_eps+t.m_eps+w.ulp(s);return this.m_value=s,this.m_eps=i,this}subThis(t){const s=this.m_value-t,i=this.m_eps+w.ulp(s);return this.m_value=s,this.m_eps=i,this}setAddE(t,s){return this.m_value=t.m_value+s.m_value,this.m_eps=t.m_eps+s.m_eps+w.ulp(this.m_value),this}setAdd(t,s){return this.m_value=t+s,this.m_eps=w.ulp(this.m_value),this}setAddEN(t,s){return this.m_value=t.m_value+s,this.m_eps=t.m_eps+w.ulp(this.m_value),this}setAddNE(t,s){return this.m_value=t+s.m_value,this.m_eps=s.m_eps+w.ulp(this.m_value),this}setSubE(t,s){return this.m_value=t.m_value-s.m_value,this.m_eps=t.m_eps+s.m_eps+w.ulp(this.m_value),this}setSub(t,s){return this.m_value=t-s,this.m_eps=w.ulp(this.m_value),this}setSubEN(t,s){return this.m_value=t.m_value-s,this.m_eps=t.m_eps+w.ulp(this.m_value),this}setSubNE(t,s){return this.m_value=t-s.m_value,this.m_eps=s.m_eps+w.ulp(this.m_value),this}mulThisE(t){const s=this.m_value*t.m_value;return this.m_eps=this.m_eps*Math.abs(t.m_value)+t.m_eps*Math.abs(this.m_value)+this.m_eps*t.m_eps+w.ulp(s),this.m_value=s,this}mulThis(t){const s=this.m_value*t;return this.m_eps=this.m_eps*Math.abs(t)+w.ulp(s),this.m_value=s,this}mul(t){return this.clone().mulThis(t)}mulE(t){return this.clone().mulThisE(t)}setMulE(t,s){const i=t.m_value*s.m_value;return this.m_eps=t.m_eps*Math.abs(s.m_value)+s.m_eps*Math.abs(t.m_value)+t.m_eps*s.m_eps+w.ulp(i),this.m_value=i,this}setMul(t,s){return this.m_value=t*s,this.m_eps=w.ulp(this.m_value),this}setMulEN(t,s){return this.setE(t),this.mulThis(s)}setMulNE(t,s){return this.setE(s),this.mulThis(t)}mulThisByPower2(t){return this.m_value*=t,this.m_eps*=Math.abs(t),this}static st_mulByPower2(t,s){return new w(t.m_value,t.m_eps).mulThisByPower2(s)}divE(t){return this.clone().divThisE(t)}divThisE(t){const s=Math.abs(t.m_value),i=this.m_value/t.m_value;let e=(this.m_eps+Math.abs(i)*t.m_eps)/s;if(t.m_eps>.01*s){const i=t.m_eps/s;e*=1+(1+i)*i}return this.m_value=i,this.m_eps=e+w.ulp(i),this}divThis(t){const s=Math.abs(t);return this.m_value/=t,this.m_eps=this.m_eps/s+w.ulp(this.m_value),this}setDivE(t,s){return this.setE(t),this.divThisE(s)}setDiv(t,s){return this.m_value=t/s,this.m_eps=w.ulp(this.m_value),this}setDivEN(t,s){return this.setE(t),this.divThis(s)}setDivNE(t,s){return this.set(t),this.divThisE(s)}divThisByPower2(t){return this.m_value/=t,this.m_eps/=Math.abs(t),this}invThis(){return this.setE(E.clone().divThisE(this)),this}sqrt(){return this.clone().sqrtThis()}sqrtThis(){let t,s;return this.m_value>=0?(t=Math.sqrt(this.m_value),s=this.m_value>10*this.m_eps?.5*this.m_eps/t:this.m_value>this.m_eps?t-Math.sqrt(this.m_value-this.m_eps):Math.max(t,Math.sqrt(this.m_value+this.m_eps)-t),s+=w.ulp(t)):this.m_value<-this.m_eps?(t=Number.NaN,s=Number.NaN):(t=0,s=Math.sqrt(this.m_eps)),this.m_value=t,this.m_eps=s,this}sqr(){return this.clone().sqrThis()}sqrThis(){const t=this.m_value*this.m_value;return this.m_eps=2*this.m_eps*Math.abs(this.m_value)+this.m_eps*this.m_eps+w.ulp(t),this.m_value=t,this}setSin(t){const s=Math.sin(t.m_value),i=Math.cos(t.m_value);this.m_value=s;const e=Math.abs(s),n=Math.abs(t.value());return this.m_eps=(Math.abs(i)+.5*e*t.m_eps)*t.m_eps+w.ulp(e+n),this}static ulp(t){let s=Kt(t);const i=((0x7ff0000000000000n&s)>>52n)-1075n;return i>-1023n?(s=i+0x3ffn<<52n,ts(s)):0===t?0:Number.MIN_VALUE}setCos(t){const s=Math.sin(t.m_value),i=Math.cos(t.m_value);this.m_value=i;const e=Math.abs(i),n=Math.abs(t.value());return this.m_eps=(Math.abs(s)+.5*e*t.m_eps)*t.m_eps+w.ulp(e+n),this}static st_cosAndSin(t,s,i){const e=Math.sin(t.m_value),n=Math.cos(t.m_value);i.m_value=e,s.m_value=n;const r=Math.abs(e),h=Math.abs(n),o=Math.abs(t.value());i.m_eps=(Math.abs(n)+.5*r*t.m_eps)*t.m_eps+w.ulp(r+o),s.m_eps=(Math.abs(e)+.5*h*t.m_eps)*t.m_eps+w.ulp(h+o)}negate(){return this.clone().negateThis()}negateThis(){return this.m_value=-this.m_value,this}setAbs(){return this.m_value=Math.abs(this.m_value),this}isInInterval(t){return _.construct(this.m_value-this.m_eps,this.m_value+this.m_eps).isIntersecting(t)}eq(t){return Math.abs(this.m_value-t.m_value)<=this.m_eps+t.m_eps}ne(t){return!this.eq(t)}gt(t){return this.m_value-t.m_value>this.m_eps+t.m_eps}lt(t){return t.m_value-this.m_value>this.m_eps+t.m_eps}ge(t){return!this.lt(t)}le(t){return!this.gt(t)}tolEQ(t,s){return Math.abs(this.m_value-t.m_value)<=s||this.eq(t)}tolNE(t,s){return!this.tolEQ(t,s)}tolGT(t,s){return this.m_value-t.m_value>s&&this.gt(t)}tolLT(t,s){return t.m_value-this.m_value>s&&this.lt(t)}tolGE(t,s){return!this.tolLT(t,s)}tolLE(t,s){return!this.tolGT(t,s)}isZero(){return Math.abs(this.m_value)<=this.m_eps}isFuzzyZero(){return this.isZero()&&0!==this.m_eps}tolIsZero(t){return Math.abs(this.m_value)<=Math.max(this.m_eps,t)}setPi(){this.setE(R)}setEuler(){this.set(2.718281828459045,T())}static size(){return 1}}function M(t,s){const i=ss(t),e=ss(s),n=53-b(i),r=53-b(e);return(n>=0?n:0)+(r>=0?r:0)<=52}function p(t,s){const i=t+s;return i-t===s&&i-s===t}function C(t,s){const i=t-s;return t-i===s&&s+i===t}function T(){return zs()}w.dimensions=1;const R=new w(Math.PI,.5*T()),g=new w(0,0),E=new w(1,0),I=new w(4,0);function D(t,s,i){return t.addE(s.subE(t).mulE(i))}function A(t,s,i){return s.subE(s.subE(t).mulE(E.subE(i)))}function P(t){return Math.atanh(t)}function q(t){let s;if(0===t)s=1;else if(Math.abs(t)>.01)s=P(t)/t;else{let i;const e=-36.841361487904734;s=0;const n=t*t;for(let t=2*Math.trunc(e/Math.log(n)+2.5)-1;t>1;t-=2)i=1/t,s=(s+i)*n;s+=1}return s}function z(t){const s=Math.PI*Math.PI/6;let i;if(1===t)i=s;else if(t>1)i=s;else if(0===t)i=t;else if(t<0){const s=1+(t=Math.abs(t)),e=Math.log(s);i=e*e/-2-z(t/s)}else if(t>.5){const e=1-t,n=Math.log(t)*Math.log(e);i=s-z(e)-n}else{i=0;const s=1+Math.trunc(-16*Math.log(10)/Math.log(t)+1.5);let e=s;for(let n=s;n>0;n--,e-=1)i*=t,i+=1/(e*e);i*=t}return i}function Z(t,s){const i=s*t;if(Math.abs(s)<.1){let s=0;for(let t=60;t>=1;t--)s*=i,s+=1/t/t;return s*=t,s}return z(i)/s}function F(t,s){return t<s?Gt(t,s):Gt(s,t)}function S(t,s){const i=Math.abs(t);return s>=0?i:-i}function k(t){return Math.round(t)}function L(t,s,i,e,n){n[0]=s[0]+(i[0]-s[0])*e,n[1]=s[1]+(i[1]-s[1])*e,3===t&&(n[2]=s[2]+(i[2]-s[2])*e)}function B(t,s,i,e,n){n[0]=i[0]-(i[0]-s[0])*(1-e),n[1]=i[1]-(i[1]-s[1])*(1-e),3===t&&(n[2]=i[2]-(i[2]-s[2])*(1-e))}function O(t,s,i,e,n){e<=.5?L(t,s,i,e,n):B(t,s,i,e,n)}function G(t,s,i,e,n){n[0]=s[0].addE(i[0].subE(s[0]).mulE(e)),n[1]=s[1].addE(i[1].subE(s[1]).mulE(e))}function Q(t,s,i,e,n){n[0]=i[0].subE(i[0].subE(s[0]).mulE(E.subE(e))),n[1]=i[1].subE(i[1].subE(s[1]).mulE(E.subE(e)))}function V(t,s,i){let e;return e=i<=.5?t+(s-t)*i:s-(s-t)*(1-i),e}function U(t,s,i){return t+(s-t)*i}function W(t,s,i){return s-(s-t)*(1-i)}function Y(t,s,i,e){i<=.5?(e.x=t.x+(s.x-t.x)*i,e.y=t.y+(s.y-t.y)*i):(e.x=s.x-(s.x-t.x)*(1-i),e.y=s.y-(s.y-t.y)*(1-i))}function j(t,s,i,e){i<=.5?(e.x=t.x+(s.x-t.x)*i,e.y=t.y+(s.y-t.y)*i,e.z=t.z+(s.z-t.z)*i):(e.x=s.x-(s.x-t.x)*(1-i),e.y=s.y-(s.y-t.y)*(1-i),e.z=s.z-(s.z-t.z)*(1-i))}function X(t){return t*t}function $(t){return t*t*t}function H(t){return 1/Math.sqrt(t)}function J(t){return t<0?-1:t>0?1:0}function K(t,s,i,e){const n=[0],r=[0],h=[0];return ct(ot(t,i,n),ot(s,e,r),h)+(n[0]+r[0]+h[0])}const tt=[0],st=[0];function it(t,s,i){return mt(ot(t,s,tt),i,tt[0],st)}const et=[0],nt=[0],rt=[0],ht=[0];function ot(t,s,i){const e=t*s;return at(t,et,nt),at(s,rt,ht),i[0]=nt[0]*ht[0]-(e-et[0]*rt[0]-nt[0]*rt[0]-et[0]*ht[0]),e}function at(t,s,i){const e=134217729*t;s[0]=e-(e-t),i[0]=t-s[0]}const ut=[0],lt=[0];function mt(t,s,i,e){const n=ct(t,s,ut),r=ct(n,i,lt);return ct(r,ut[0]+lt[0],e)}function ct(t,s,i){const e=t+s;return Math.abs(t)>Math.abs(s)?i[0]=t-e+s:i[0]=s-e+t,e}function yt(t,s){return t%s}function xt(t){const s=1-t;if(0===s)return 1;let i;if(s<=.01){const t=s,e=Math.log(t);i=1+t*(.4431471805599453-.25*e+t*(.05680519270997949-.09375*e+t*(.02183137044373718-.05859375*e+t*(.011544521417308362-.042724609375*e+t*(.00714200031339596-.0336456298828125*e+t*(.004854743337164948-.027757644653320312*e+t*(.003514687963781376-.023627042770385742*e)))))))}else{if(t<.016){const s=t,i=.25,e=.046875,n=.01953125,r=.01068115234375,h=.0067291259765625,o=.004626274108886719,a=.0033752918243408203,u=.0025710230693221092;return Os()*(1-s*(i+s*(e+s*(n+s*(r+s*(h+s*(o+s*(a+s*u))))))))}i=bt(0,s,1)-t*vt(0,s,1)/3}return Fs(i,1,Os())}function ft(t,i,e=Number.NaN){if(s(i>=0&&i<=1),0===i)return t;let n=1,r=t;if(r<0&&(r=-r,n=-1),1===i){const t=Math.round(r/Ls()),s=r-t*Ls();return n*(2*t+Math.sin(s))}const h=Os(),o=Math.floor(r/h);1&o?r=(o+1)*h-r:r-=o*h;const a=Math.sin(r),u=Number.isNaN(e)?xt(i):e;let l;if(1===a)l=u+Math.sqrt(1-i)*(r-h);else{const t=r*r;if(.01424*Math.pow(t,4)<=2*zs()){l=r*(1+t*i*(-1/6+t*((4-3*i)/120-(16+(45*i-60)*i)/5040*t)))}else if(i<=.01){const t=Math.sin(2*r),s=Math.sin(4*r),e=Math.sin(6*r),n=Math.sin(8*r),h=Math.sin(10*r);l=r+i*((2*-r+t)/8+i*((-3*r+2*t-.25*s)/64+i*((-20*r+15*t-3*s+e/3)/1024+i*(5*(-140*r+112*t-28*s+16/3*e-.5*n)/65536+7*i*((-63*r+52.5*t-15*s+3.75*e-.625*n+.05*h)/65536+i*(-693*r+594*t-185.625*s+1.375*e-12.375*n+1.8*h-.125*Math.sin(12*r))/1048576)))))}else{const t=a*a,s=Math.cos(r),e=s*s,n=_t(a,s,i);l=a*(bt(e,n,1)-i*t*vt(e,n,1)/3)}}if(1&o){l=u*(o+1)-l}else l+=u*o;return n*l}function dt(t,s,i=Number.NaN){if(0===t)return 0;let e=1,n=t;t<0&&(n=-n,e=-1);const r=Number.isNaN(i)?xt(s):i,h=Math.floor(n/r);1&h?n=(h+1)*r-n:n-=h*r;let o=n<=0?0:n>=r?Os():Nt(n,s,r);return 1&h?o=Os()*(h+1)-o:o+=Os()*h,e*o}function bt(t,i,e){s((0!==t?1:0)+(0!==i?1:0)+1>1);let n=t,r=i,h=e;for(;;){const t=Math.sqrt(n*r)+Math.sqrt(r*h)+Math.sqrt(h*n);n=.25*(n+t),r=.25*(r+t),h=.25*(h+t);const s=(n+r+h)/3,i=(s-n)/s,e=(s-r)/s,o=(s-h)/s;if(Math.abs(i)<=.0024&&Math.abs(e)<=.0024&&Math.abs(o)<=.0024){const t=i*e-o*o,n=i*e*o;return(1+(1/24*t-.1-3/44*n-5*t*t/208+t*n/16)*t+(1/14+3*n/104)*n)/Math.sqrt(s)}}}function vt(t,i,e){s(0!==t||0!==i);let n=t,h=i,o=e;const a=new r(0);let u=1;for(;;){const t=.2*(n+h+3*o),s=(t-n)/t,i=(t-h)/t,e=(t-o)/t;if(Math.abs(s)<=.0015&&Math.abs(i)<=.0015&&Math.abs(e)<=.0015){const n=s*i,r=e*e,h=n-r,o=n-6*r,l=o+h+h,m=9/22,c=3/26,y=o*(.25*m*o-3/14-1.5*c*e*l),x=e*(1/6*l+e*(-m*h+e*c*n));return 3*a.getResult()+u*(1+y+x)/(t*Math.sqrt(t))}const r=Math.sqrt(n),l=Math.sqrt(h),m=Math.sqrt(o),c=r*(l+m)+l*m;a.add(u/(m*(o+c))),u*=.25,n=.25*(n+c),h=.25*(h+c),o=.25*(o+c)}}function _t(t,s,i){return t<.999?1-i*X(t):1-i+i*X(s)}function Nt(t,s,i){if(0===s)return t;if(1===s)return Math.asin(t);let e=0,n=!0;if(t<.2){const i=t*t,r=t*(1+i*s*(1/6+i*((13*s-4)/120+(16-284*s+493*s*s)/5040*i))),h=Math.abs(s*(4944*s-64-31224*s*s+37369*s*s*s)/362880*Math.pow(t,9));if(h<Math.abs(r)*zs())return r;e=r,n=h>.1*r}if(n){const n=1-s,r=1-t/i,h=Math.sqrt(r*r+n*n),o=Math.atan2(n,t+zs());e=Os()+Math.sqrt(h)*(o-Os())}let r=0;for(let h=0;h<7;h++){r=ft(e,s,i);const n=_t(Math.sin(e),Math.cos(e),s);if(e-=(r-t)/Math.sqrt(n),h>0&&Math.abs(r-t)<=4*zs()*t)break}return e}function wt(s,i,e,n,r){return 0===s?0===n?i:1===n?e:r:1===s?0===n?i:1===n?e:V(i,e,n):(2===s&&t("angular interpolation"),void t(""))}function Mt(s,i,e,n,r,h,o,a){if(0===s)for(let t=0;t<h;++t)n[t+r]=0===o?i[t]:1===o?e[t]:a;else if(1===s)if(0===o)pt(n,i,r,0,h);else if(1===o)pt(n,e,r,0,h);else for(let t=0;t<h;++t)n[t+r]=V(i[t],e[t],o);else if(2===s)if(0===o)pt(n,i,r,0,h);else if(1===o)pt(n,e,r,0,h);else{let t=0;for(let s=0,a=r;s<h;++s,++a)n[a]=V(i[s],e[s],o),t+=n[a]*n[a];if(t>0){t=Math.sqrt(t);for(let s=r;s<r+h;++s)n[s]/=t}else{for(let t=r;t<r+h;++t)n[t]=0;n[r]=1}}else t("")}function pt(t,s,i,e,n){if(0===n)return;let r=0,h=i,o=e;for(;r++<n;)t[h++]=s[o++]}function Ct(t,s,i){let e=0;for(let n=0;!e&&n<i;++n)e=t[n]-s[n];return e}function Tt(t,s){return t}function Rt(t){t.sort(((t,s)=>t<s?-1:t>s?1:0))}function gt(t,s){const i=t.slice(0,s);Rt(i),pt(t,i,0,0,s)}function Et(t,s,i,e){const n=t.slice(s,s+i);n.sort(e),pt(t,n,s,0,i)}function It(t,s){return t<s?-1:t>s?1:0}function Dt(t,s,i,e){return t<i?-1:t>i?1:s<e?-1:s>e?1:0}function At(t,s){if(t.length<2)return t.length;let i=0;for(let e=1;e<t.length;++e)s(t[e],t[i])||(i++,t[e]=Tt(t[i],t[i]=t[e]));return 1+i}function Pt(t,s){t[s]=t.at(-1),t.pop()}function qt(t,s=!1){return{[Symbol.dispose](){this.bForget||t()},bForget:s}}function zt(t,s){return Array.from({length:s},(()=>new t))}function Zt(t,s,i){for(let e=0;e<i;++e)t[e].assign(s[e]);return i}function Ft(t,s){const i=t.slice(0,s);for(let e=0;e<s;++e)i[e]=i[e].clone();return i}function St(t){return Array.from({length:t},(()=>null))}function kt(t,s){return Array.from({length:s},(()=>t()))}function Lt(t,s){return Array.from({length:t},(()=>s))}function Bt(t,s){return s in t&&1===Object.getOwnPropertyNames(t).length}class Ot{constructor(...t){this.m_elts=t}get length(){return this.m_elts.length}at(t){return this.m_elts[t]}[Symbol.dispose](){for(const t of this.m_elts)t[Symbol.dispose]()}}function Gt(t,s){return{first:t,second:s}}const Qt=Math.PI,Vt=2*Math.PI,Ut=.5*Math.PI;class Wt{constructor(t,s){this.m_cr=t,this.m_cc=s,this.m_v=Lt(t*s,0)}get(t,s){return this.m_v[t*this.m_cc+s]}set(t,s,i){this.m_v[t*this.m_cc+s]=i}inc(t,s){return++this.m_v[t*this.m_cc+s]}}const Yt=new ArrayBuffer(8),jt=new Float64Array(Yt),Xt=new BigUint64Array(Yt),$t=0x0fffffffffffffn,Ht=0x7ff0000000000000n;function Jt(){return Number.EPSILON*Ds}function Kt(t){return jt[0]=t,Xt[0]}function ts(t){return Xt[0]=t,jt[0]}function ss(t){return Kt(t)&$t}function is(t){return Number((Kt(t)&Ht)>>52n)}function es(t){if(0n===t)return-1n;if(1n===t||-1n===t)return 0n;t<0n&&(t=-t);let s=0n,i=512n,e=1n<<s+i;for(;t>=e;)s+=i,i<<=1n,e<<=i;let n=s;i>>=1n;let r=n+i;for(;i>0n;)t<1n<<r||(n=r),i>>=1n,r=n+i;return n}function ns(t,s){return t===s||Number.isNaN(t)&&Number.isNaN(s)}function rs(t,s,i){return t===s||Math.abs(t-s)<=i||Number.isNaN(t)&&Number.isNaN(s)}function hs(t,s){return t<s?-1:t>s?1:0}function os(t,s){if(t<s)return-1;if(t>s)return 1;if(t===s)return 0;{const i=Number.isNaN(t),e=Number.isNaN(s);return i<e?-1:i>e?1:0}}function as(){return 2147483647}function us(){return 32767}function ls(){return 2147483647}function ms(){return-2147483648}const cs=ls(),ys=BigInt(cs),xs=2166136261,fs=16777619;function ds(t){let s=xs,i=t;return s=(s^255&i)*fs,i>>=8,s=(s^255&i)*fs,i>>=8,s=(s^255&i)*fs,i>>=8,s=(s^255&i)*fs,s&cs}const bs=14695981039346656037n,vs=1099511628211n;function _s(t){let s=bs,i=t;return s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,i>>=8n,s=(s^0xffn&i)*vs,s&ys}function Ns(t){return 1103515245*t+12345&2147483647}function ws(t){let s=xs;for(let i=0,e=t.length;i<e;++i)s=(s^t.charCodeAt(i))*fs;return s&cs}function Ms(t,s){return s+2654435769+(t<<6)+(t>>2)&cs}function ps(t,s){return Ms(t,gs(s))}function Cs(t){return Ms(3735928559,t)}function Ts(t,s){return Ms(t,Cs(s))}function Rs(t){return ds(t)}function gs(t){return Number(_s(t))}function Es(t){return Ns(t)}const Is=100,Ds=100;function As(){return Number.EPSILON*Is}function Ps(){return.38196601125010515}function qs(){return 1.4142135623730951}function zs(){return Number.EPSILON}function Zs(t,s,i){return t===s||t===i}function Fs(t,s,i){return t>=s?t<=i?t:i:s}function Ss(t,s,i){const e=t[0];if(e>=s){if(e<=i)return!1;t[0]=i}else t[0]=s;return!0}function ks(t,s){return t>=s?s:t<-s?-s:t}function Ls(){return Qt}function Bs(){return Vt}function Os(){return Ut}const Gs=3*Os();function Qs(){return Gs}function Vs(t){return t+0}function Us(t){return{v:t}}class Ws{constructor(){this.m_rn=Us(0n),this.m_rd=Us(1n),this.m_bNaN=!1,this.m_bNormalized=!1,this.m_power=0,this.m_sign=0}static constructAssign(t,s){const i=t.clone();return void 0!==s&&i.limitPrecisionThis(s),i}static constructDouble(t){return(new Ws).setDouble(t)}static constructInt64(t){return(new Ws).setInt64(t)}static constructRational(t,s){return(new Ws).setRational(t,s)}static constructInt32(t){return this.constructInt64(BigInt(Math.trunc(t)))}[Symbol.toPrimitive](t){return this}compare(t){return this.lt(t)?-1:this.gt(t)?1:0}assignCopy(t){return this.setThis(t)}abs(){return this.clone().absThis()}absThis(){return this.isNAN()||(this.m_sign*=this.m_sign),this}clone(){return(new Ws).setThis(this)}setThis(t){return this.m_bNaN=t.m_bNaN,this.m_bNormalized=t.m_bNormalized,this.m_rn.v=t.m_rn.v,this.m_rd.v=t.m_rd.v,this.m_power=t.m_power,this.m_sign=t.m_sign,this}setZero(){return this.m_rn.v=0n,this.m_rd.v=1n,this.m_bNaN=!1,this.m_power=0,this.m_bNormalized=!0,this.m_sign=0,this}setDouble(s){if(this.setZero(),0===s)return this;if(Number.isInteger(s)&&Math.abs(s)<ls())return this.setInt32(s);const i=Kt(s),e=(i&Ws.s_em)>>52n,n=!!(i&Ws.s_sm),r=i&Ws.s_fm;if(e===Ws.s_emax)return r?(this.m_rn.v=this.m_rd.v=0n,this.m_bNaN=!0,this):(this.m_rn.v=n?-1n:1n,this.m_rd.v=0n,this);0n===e&&t("denormalized numbers not yet implemented");const h=e-1023n,o=h>=0n?h:0n,a=h<0n?-h:0n;return this.m_rn.v=(1n<<52n|r)<<o,this.m_rd.v=1n<<52n+a,this.m_sign=n?-1:1,this.m_bNormalized=!1,this.normalizeThis()}setInt64(t){return 0n===t?this.setZero():(this.m_bNaN=!1,this.m_sign=t>0n?1:-1,this.m_rn.v=t>0n?t:-t,this.m_rd.v=1n,this.m_power=0,this.m_bNormalized=!1,this.normalizeThis())}setRational(t,s){return 0n===t?0n===s?this.setNAN():this.setZero():0n===s?t>0n?this.setPositiveInf():this.setNegativeInf():(this.m_sign=(t>0n?1:-1)*(s>0n?1:-1),this.m_rn.v=t>0n?t:-t,this.m_rd.v=s>0n?s:-s,this.m_power=0,this.m_bNormalized=!1,this.normalizeThis())}setInt32(t){return this.setInt64(BigInt(Math.trunc(t)))}getDouble(){return this.convertToDouble()}toDouble(){return this.convertToDouble()}value(){return this.convertToDouble()}isNAN(){return this.m_bNaN}isPositiveInf(){return!this.isNAN()&&(0n===this.m_rd.v&&1===this.m_sign)}isNegativeInf(){return!this.isNAN()&&(0n===this.m_rd.v&&-1===this.m_sign)}isFinite(){return!this.isNAN()&&0n!==this.m_rd.v}setNAN(){return this.m_bNaN=!0,this.m_rn.v=0n,this.m_rd.v=0n,this.m_power=0,this.m_bNormalized=!0,this}setPositiveInf(){return this.m_rn.v=1n,this.m_rd.v=0n,this.m_bNaN=!1,this.m_bNormalized=!0,this.m_sign=1,this.m_power=0,this}setNegativeInf(){return this.m_rn.v=1n,this.m_rd.v=0n,this.m_bNaN=!1,this.m_bNormalized=!0,this.m_sign=-1,this.m_power=0,this}subThis(t){if(t.isNAN()&&this.setNAN(),this.isPositiveInf()&&t.isPositiveInf())this.setNAN();else{if(this.isPositiveInf()&&t.isNegativeInf())return this.setPositiveInf(),this;if(this.isNegativeInf()&&t.isNegativeInf())this.setNAN();else if(this.isNegativeInf()&&t.isPositiveInf())return this.setNegativeInf(),this}return this.isNAN()?this:this.opPlusMinus(t,!1)}thisSubAbs(t){return s(0),this}mulThis(t){return t.isNAN()&&this.setNAN(),this.isNAN()?this:(this.m_sign*=t.m_sign,0===this.m_sign?this.setZero():(this.m_rn.v*=t.m_rn.v,this.m_rd.v*=t.m_rd.v,this.m_power+=t.m_power,this.m_bNormalized=!1,this.normalizeThis(),this))}mulDoubleThis(t){return this.mulThis(Ws.constructDouble(t))}thisMulInt64(t){return s(0),this}thisMulInt32(t){return s(0),this}divThis(t){return this.mulThis(t.clone().invertThis())}divDoubleThis(t){return this.divThis(Ws.constructDouble(t))}addDoubleThis(t){return this.addThis(Ws.constructDouble(t))}subDoubleThis(t){return this.subThis(Ws.constructDouble(t))}mul(t){return this.clone().mulThis(t)}mulBigIntThis(t){return this.mulThis(Ws.constructInt64(t))}mulDouble(t){return this.clone().mulThis(Ws.constructDouble(t))}div(t){return this.clone().divThis(t)}divDouble(t){return this.clone().divDoubleThis(t)}add(t){return this.clone().addThis(t)}fmSubThis(t,s){return this.subThis(t.clone().mulThis(s))}fmAddThis(t,s){return this.addThis(t.clone().mulThis(s))}addThis(t){if(t.isNAN()&&this.setNAN(),this.isPositiveInf()&&t.isPositiveInf())return this.setPositiveInf(),this;if(this.isPositiveInf()&&t.isNegativeInf())this.setNAN();else{if(this.isNegativeInf()&&t.isNegativeInf())return this.setNegativeInf(),this;this.isNegativeInf()&&t.isPositiveInf()&&this.setNAN()}return this.isNAN()?this:this.opPlusMinus(t,!0)}addDouble(t){return this.clone().addThis(Ws.constructDouble(t))}sub(t){return this.clone().subThis(t)}subDouble(t){return this.clone().subThis(Ws.constructDouble(t))}isZero(){return 0===this.m_sign}equals(t){return this.clone().subThis(t).isZero()}lt(t){return!this.isNAN()&&!t.isNAN()&&(!(this.isPositiveInf()&&t.isPositiveInf()||this.isNegativeInf()&&t.isNegativeInf())&&(!this.isPositiveInf()&&(!!t.isPositiveInf()||this.clone().sub(t).LZ())))}absLessAbs(t){return this.abs().lt(t.abs())}gt(t){return this.clone().sub(t).GZ()}lte(t){return this.sub(t).LEZ()}gte(t){return this.sub(t).GEZ()}normalizeThis(){if(this.m_bNormalized)return this;if(0n===this.m_rn.v)return this.setZero();let t=0,s=0xffffffffn;for(;0n===(this.m_rn.v&s)&&s<=this.m_rn.v;)s<<=32n,t+=32;s&=this.m_rn.v,s>>=BigInt(t),t+=f(BigInt.asUintN(32,s))-1;let i=0;for(s=0xffffffffn;0n===(this.m_rd.v&s)&&s<=this.m_rd.v;)s<<=32n,i+=32;return s&=this.m_rd.v,s>>=BigInt(i),i+=f(BigInt.asUintN(32,s))-1,this.m_rn.v>>=BigInt(t),this.m_rd.v>>=BigInt(i),this.m_power+=t-i,this.m_rn.v>1n&&this.m_rd.v>1n&&(this.m_rn.v%this.m_rd.v===0n?(this.m_rn.v/=this.m_rd.v,this.m_rd.v=1n):this.m_rd.v%this.m_rn.v===0n&&(this.m_rd.v/=this.m_rn.v,this.m_rn.v=1n)),this.m_bNormalized=!0,this}negateThis(){return this.isNAN()||(this.m_sign*=-1),this}negate(){return this.clone().negateThis()}invertThis(){return this.isNAN()?this:this.isPositiveInf()||this.isNegativeInf()?(this.setZero(),this):0n===this.m_rn.v?(this.setPositiveInf(),this):(this.m_rd=Tt(this.m_rn,this.m_rn=this.m_rd),this.m_power=-this.m_power,this)}limitPrecisionThis(t){if(0===t)return this;if(this.isZero())return this.setZero();if(!this.isFinite())return this;this.normalizeThis();let s=Number(es(this.m_rn.v));if(s>t){const i=s-t;this.m_rn.v>>=BigInt(s-t),this.m_power+=i}if(s=Number(es(this.m_rd.v)),s>t){const i=s-t;this.m_rd.v>>=BigInt(s-t),this.m_power-=i}return this}hiBitIndex(){return Math.max(Number(es(this.m_rn.v)),Number(es(this.m_rd.v)))}ldexp(t){return this.clone().ldexpThis(t)}ldexpThis(t){return t&&(this.m_bNormalized=!1,this.m_power+=t,this.normalizeThis()),this}LZ(){return!this.isNAN()&&-1===this.m_sign}GZ(){return!this.isNAN()&&1===this.m_sign}LEZ(){return!this.isNAN()&&this.m_sign<=0}GEZ(){return!this.isNAN()&&this.m_sign>=0}toString(){return this.toDouble().toString()}sqr(){return this.clone().sqrThis()}sqrThis(){return this.mulThis(this.clone())}static sqrt(t,e){if(t.m_sign<0n&&i("MP_value: sqrt(-1)"),t.isZero())return t.clone();let n=52,r=2220446049250313e-31;for(;n<e;)2*n<=e?(r*=r,n*=2):(r*=2220446049250313e-31,n+=52);n+=52;const h=es(t.m_rn.v),o=es(t.m_rd.v);let a,u=t.m_power+Number(h-o);const l=new Ws;Math.abs(u)>200?(1&Math.abs(u)&&(u+=1),a=Ws.constructAssign(t,53).ldexpThis(-u).value(),l.setThis(t).ldexpThis(-u),s(Number.isFinite(a))):(l.setThis(t),a=l.value(),s(Number.isFinite(a)),u=0),a=Math.sqrt(a);const m=Ws.constructDouble(a),c=Ws.constructDouble(r);c.mulThis(m).ldexpThis(1);const y=r*a*2,x=m.clone(),f=new Ws;let d;for(let s=0;s<10;++s){x.mulThis(m),f.setThis(l).subThis(x).absThis();let t=f.value();if(d=1,t<.9)for(;t>y;)t*=t,++d;else d=4;if(f.lte(c))break;for(let s=0;s<d;s++)x.setThis(m).divThis(l).invertThis().addThis(m).ldexpThis(-1).limitPrecisionThis(n),m.setThis(x)}return m.ldexpThis(u/2)}static cubicRoot(t,s){if(t.isZero())return t.clone();let i=52,e=2220446049250313e-31;for(;i<s;)2*i<=s?(e*=e,i*=2):(e*=2220446049250313e-31,i+=52);i+=52;const n=Math.pow(Math.abs(t.value()),1/3),r=Ws.constructDouble(n),h=r.clone();h.sqrThis().mulDoubleThis(3).mulDoubleThis(e),h.limitPrecisionThis(32),t.LZ()&&r.negateThis();for(let o=0;o<10;++o){const s=r.clone();s.sqrThis().mulThis(r);const e=s.clone();if(e.subThis(t),e.absThis().limitPrecisionThis(32),e.lte(h))break;e.setThis(t),e.ldexpThis(1),e.addThis(s);const n=s.clone();n.ldexpThis(1),n.addThis(t),e.divThis(n),r.mulThis(e),r.limitPrecisionThis(i)}return r}isInTheRangeOfDouble(){return s(0),!1}sign(){return this.m_sign}cosAndSin(t,i){s(0)}static nan(){return s(0),new Ws}convertToDouble(){if(this.m_bNaN)return Number.NaN;if(this.isZero())return 0;if(0n===this.m_rd.v)return 1===this.m_sign?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;const t=-1===this.m_sign,s=this.m_rn.v<<(this.m_power>=0?BigInt(this.m_power):0n);let i=this.m_rd.v<<(this.m_power<0?BigInt(-this.m_power):0n);const e=s/i;let n=Number(e);if(BigInt(n)!==e)return t?-n:n;let r=s-e*i;if(r){let t=es(i)-1023n;t>0n&&(i>>=t,r<<=52n,r>>=t);let s=Number(r);Number.isFinite(s)||(r>>=52n,s=Number(r),t=0n),t>0n&&(s/=Math.pow(2,52));n+=s/Number(i)}return t?-n:n}signVal(){return 1===this.m_sign?1n:-1===this.m_sign?-1n:0n}opPlusMinus(t,s){const i=Math.min(this.m_power,t.m_power);let e,n;this.m_power>i?(e=BigInt(this.m_power-i),n=0n):(e=0n,n=BigInt(t.m_power-i));const r=this.signVal()*this.m_rn.v*t.m_rd.v<<e,h=t.signVal()*t.m_rn.v*this.m_rd.v<<n;return this.m_rn.v=s?r+h:r-h,this.m_rd.v*=t.m_rd.v,this.m_power=i,this.m_sign=1,this.m_rn.v<0n&&(this.m_sign=-1,this.m_rn.v=-this.m_rn.v),this.m_bNormalized=!1,this.normalizeThis(),this}}Ws.s_sm=0x8000000000000000n,Ws.s_em=0x7ff0000000000000n,Ws.s_fm=0x000fffffffffffffn,Ws.s_emax=0x7ffn;const Ys=Ws.constructInt32(1),js=Ws.constructInt32(0);function Xs(t,s){return v(t^s)}function $s(t,s){let i=is(t);const e=is(s);if(i===e){return i-=53-Xs(ss(t),ss(s)),i}return i>e?i:e}function Hs(t){const s=zt(Js,t.length);for(let i=0,e=t.length;i<e;++i)s[i].setCoords(t[i][0],t[i][1]);return s}class Js{static construct(t,s){return new Js(t,s)}constructor(t,s){void 0!==t?(this.x=t,this.y=s):this.x=this.y=Number.NaN}clone(){return new Js(this.x,this.y)}assign(t){this.setCoordsPoint2D(t)}setCoords(t,s){return this.x=t,this.y=s,this}setCoordsPoint2D(t){this.x=t.x,this.y=t.y}isEqualPoint2D(t,s){return void 0!==s?Math.abs(this.x-t.x)<=s&&Math.abs(this.y-t.y)<=s:this.x===t.x&&this.y===t.y}isEqual(t,s,i){return void 0!==i?Math.abs(this.x-t)<=i&&Math.abs(this.y-s)<=i:this.x===t&&this.y===s}equalsPoint2D(t,s){return this.isEqualPoint2D(t,s)}setSub(t,s){this.x=t.x-s.x,this.y=t.y-s.y}addThis(t){return this.x+=t.x,this.y+=t.y,this}setAdd(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}absoluteOther(t){}absolute(){return s(0),this}setNegate(){this.x=-this.x,this.y=-this.y}setNegateOther(t){this.x=-t.x,this.y=-t.y}interpolateThis(t,s){}interpolate(t,i,e){s(0)}scaleAddThis(t,s){this.x=this.x*t+s.x,this.y=this.y*t+s.y}setScaleAdd(t,s,i){this.x=s.x*t+i.x,this.y=s.y*t+i.y}scaleOther(t,i){s(0)}scale(t){this.x*=t,this.y*=t}compare(t){return this.y<t.y?-1:this.y>t.y?1:this.x<t.x?-1:this.x>t.x?1:0}compareX(t){return this.x<t.x?-1:this.x>t.x?1:this.y<t.y?-1:this.y>t.y?1:0}normalizeOther(t){s(0)}normalize(){const t=this.length();return t?(this.x/=t,this.y/=t):(this.x=1,this.y=0),this}getUnitVector(){return this.clone().normalize()}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}sqrLength(){return this.x*this.x+this.y*this.y}static averageFast(t,i){return s(0),{}}static average(t,s){const i=new Js;if(0===s)return i.setNAN(),i;if(1===s)return i.assign(t[0]),i;const e=new r(t[0].x),n=new r(t[0].y);for(let r=1;r<s;r++)e.add(t[r].x),n.add(t[r].y),255&r||(e.normalize(),n.normalize());return i.x=e.getResult()/s,i.y=n.getResult()/s,i}offset(t,s){const i=Js.distance(t,s),e=Js.construct(this.x,this.y);if(0===i)return Js.distance(e,t);const n=s.clone();n.subThis(t),e.subThis(t);return e.crossProduct(n)/i}side(t,s){return t.equals(s)?this.equals(t)?0:1:Js.orientationRobust(s,t,this)}static sqrDistance(t,s){const i=t.x-s.x,e=t.y-s.y;return i*i+e*e}static sqrDistanceCoords(t,s,i,e){const n=i-t,r=e-s;return n*n+r*r}static distance(t,s){return Math.sqrt(Js.sqrDistance(t,s))}dotProduct(t){return this.x*t.x+this.y*t.y}dotProductAbs(t){return Math.abs(this.x*t.x)+Math.abs(this.y*t.y)}crossProduct(t){return this.x*t.y-this.y*t.x}crossProductAbs(t){return s(0),0}rotateDirect(t,s){const i=this.x*t-this.y*s,e=this.x*s+this.y*t;this.x=i,this.y=e}rotateReverse(t,s){const i=this.x*t+this.y*s,e=-this.x*s+this.y*t;this.x=i,this.y=e}leftPerpendicularThis(){const t=this.x;this.x=-this.y,this.y=t}leftPerpendicularOther(t){const s=t.x;this.x=-t.y,this.y=s}rightPerpendicularThis(){const t=this.x;this.x=this.y,this.y=-t}rightPerpendicularOther(t){const s=t.x;this.x=t.y,this.y=-s}equals(t){return this.x===t.x&&this.y===t.y}notequals(t){return this.x!==t.x||this.y!==t.y}not(){return!this.x&&!this.y}gt(t){return this.y>t.y||this.y===t.y&&this.x>t.x}gte(t){return!this.lt(t)}lt(t){return this.y<t.y||this.y===t.y&&this.x<t.x}lte(t){return!this.gt(t)}subThis(t){return this.x-=t.x,this.y-=t.y,this}divThis(t){return this.x/=t,this.y/=t,this}add(t){return new Js(this.x+t.x,this.y+t.y)}sub(t){return new Js(this.x-t.x,this.y-t.y)}negateThis(){return this.x=-this.x,this.y=-this.y,this}negate(){return new Js(-this.x,-this.y)}mul(t){return new Js(this.x*t,this.y*t)}mulThis(t){return this.x*=t,this.y*=t,this}divide(t){return new Js(this.x/t,this.y/t)}setNAN(){this.x=this.y=Number.NaN}isNAN(){return Number.isNaN(this.x)||Number.isNaN(this.y)}static getNAN(){return new Js(Number.NaN,Number.NaN)}isFinite(){return Number.isFinite(this.x)&&Number.isFinite(this.y)}isZero(){return 0===this.x&&0===this.y}norm(t){switch(t){case 0:{const t=Math.abs(this.x),s=Math.abs(this.y),i=t-s;return i>=0?t:i<=0?s:Number.NaN}case 1:return Math.abs(this.x)+Math.abs(this.y);case 2:return Math.sqrt(this.x*this.x+this.y*this.y);default:e("norm")}}getQuarter(){return Js.getQuarterCoords(this.x,this.y)}static getQuarterCoords(t,s){return t>0?s>=0?1:4:s>0?2:0===t?4:3}static compareVectors(t,s){const i=t.getQuarter(),e=s.getQuarter();return e===i?Js.orientationRobustImpl(Js.construct(0,0),s,t,!0):i<e?-1:1}static compareVectorsOrigin(t,s,i){const e=s.sub(t),n=i.sub(t),r=e.getQuarter(),h=n.getQuarter();return h===r?Js.orientationRobustImpl(t,i,s,!0):r<h?-1:1}static orientationRobust(t,s,i){return Js.orientationRobustImpl(t,s,i,!1)}static orientationRobustEx(t,s,i,e){if(t.equals(s)||i.equals(e))return 0;const n=s.x-t.x,r=s.y-t.y,h=e.x-i.x,o=e.y-i.y;{const t=Js.getQuarterCoords(n,r)-1,s=Js.getQuarterCoords(h,o)-1,i=Js.d[t][s];if(0!==i)return i}const a=n*o,u=r*h,l=4*zs()*(Math.abs(a)+Math.abs(u)),m=a-u;if(Math.abs(m)>=l){return m<0?-1:m>0?1:0}return Js.orientationRobustExMp(t,s,i,e)}static orientationRobustExMp(t,s,i,e){const n=Ws.constructDouble(s.x),r=Ws.constructDouble(e.x);n.subThis(Ws.constructDouble(t.x)),r.subThis(Ws.constructDouble(i.x));const h=Ws.constructDouble(s.y),o=Ws.constructDouble(e.y);return h.subThis(Ws.constructDouble(t.y)),o.subThis(Ws.constructDouble(i.y)),n.mulThis(o),h.mulThis(r),n.subThis(h),n.LZ()?-1:n.GZ()?1:0}static orientationNonRobust(t,s,i){const e=s.sub(t).crossProduct(i.sub(t));return e<0?-1:e>0?1:0}static orientationRobustImpl(t,s,i,e){if(s.isEqualPoint2D(t)||i.isEqualPoint2D(t)||s.isEqualPoint2D(i))return 0;const n=s.x-t.x,r=s.y-t.y,h=i.x-t.x,o=i.y-t.y;if(!e){const t=Js.getQuarterCoords(n,r)-1,s=Js.getQuarterCoords(h,o)-1,i=Js.d[t][s];if(0!==i)return i}const a=(Math.abs(n)+Math.abs(r)+Math.abs(h)+Math.abs(o))*(Math.abs(s.x)+Math.abs(s.y)+Math.abs(i.x)+Math.abs(i.y))*8*T(),u=n*o-r*h;if(Math.abs(u)>a){return u<0?-1:1}if(C(s.x,t.x)&&C(i.y,t.y)&&C(s.y,t.y)&&C(i.x,t.x)&&M(n,o)&&M(r,h)){const t=n*o,s=r*h;if(C(t,s)){const i=t-s;return i<0?-1:i>0?1:0}}return Js.orientationRobustMp(t,s,i)}static orientationRobustMp(t,s,i){const e=Ws.constructDouble(s.x),n=Ws.constructDouble(i.x);{const s=Ws.constructDouble(t.x);e.subThis(s),n.subThis(s)}const r=Ws.constructDouble(i.y),h=Ws.constructDouble(s.y);{const s=Ws.constructDouble(t.y);r.subThis(s),h.subThis(s)}return e.mulThis(r),h.mulThis(n),e.subThis(h),e.LZ()?-1:e.GZ()?1:0}static inCircleRobust(t,s,i,e){const n=new w,r=new w;n.set(t.x),n.subThis(e.x),r.set(t.y),r.subThis(e.y);const h=new w,o=new w;h.set(s.x),h.subThis(e.x),o.set(s.y),o.subThis(e.y);const a=new w,u=new w;a.set(i.x),a.subThis(e.x),u.set(i.y),u.subThis(e.y);const l=n.mulE(o).subE(r.mulE(h)),m=h.mulE(u).subE(o.mulE(a)),c=n.mulE(u).subE(r.mulE(a)),y=n.mulE(n).addE(r.mulE(r)),x=h.mulE(h).addE(o.mulE(o)),f=a.mulE(a).addE(u.mulE(u)),d=y.mulE(m).subE(x.mulE(c)).addE(f.mulE(l));if(!d.isFuzzyZero()){const t=d.value();return t<0?-1:t>0?1:0}return Js.inCircleRobustMp(t,s,i,e)}static inCircleRobustMp(t,s,i,e){do{if(!C(t.x,e.x)||!C(t.y,e.y))break;if(!C(s.x,e.x)||!C(s.y,e.y))break;if(!C(i.x,e.x)||!C(i.y,e.y))break;const n=t.x-e.x,r=t.y-e.y,h=s.x-e.x,o=s.y-e.y,a=i.x-e.x,u=i.y-e.y;if(!M(n,o)||!M(r,h))break;if(!M(h,u)||!M(o,a))break;if(!M(n,u)||!M(r,a))break;if(!M(n,n)||!M(r,r))break;if(!M(h,h)||!M(o,o))break;if(!M(a,a)||!M(u,u))break;const l=n*o,m=r*h,c=h*u,y=o*a,x=n*u,f=r*a,d=n*n,b=r*r,v=h*h,_=o*o,N=a*a,w=u*u;if(!C(l,m))break;if(!C(c,y))break;if(!C(x,f))break;if(!p(d,b))break;if(!p(v,_))break;if(!p(N,w))break;const T=l-m,R=c-y,g=x-f,E=d+b,I=v+_,D=N+w;if(!M(E,R))break;if(!M(I,g))break;if(!M(D,T))break;const A=E*R,P=I*g,q=D*T;if(!C(A,P))break;const z=A-P;if(!p(z,q))break;const Z=z+q;return Z<0?-1:Z>0?1:0}while(0);const n=Ws.constructDouble(e.x),r=Ws.constructDouble(e.y),h=Ws.constructDouble(t.x),o=Ws.constructDouble(t.y);h.subThis(n),o.subThis(r);const a=Ws.constructDouble(s.x),u=Ws.constructDouble(s.y);a.subThis(n),u.subThis(r);const l=Ws.constructDouble(i.x),m=Ws.constructDouble(i.y);l.subThis(n),m.subThis(r);const c=h.mul(u).sub(o.mul(a)),y=a.mul(m).sub(u.mul(l)),x=h.mul(m).sub(o.mul(l)),f=h.mul(h).add(o.mul(o)),d=a.mul(a).add(u.mul(u)),b=l.mul(l).add(m.mul(m)),v=f.mul(y).sub(d.mul(x)).add(b.mul(c));return v.LZ()?-1:v.GZ()?1:0}static inCircleRobustMp3Point(t,s,i){const e=Ws.constructDouble(t.x),n=Ws.constructDouble(t.y),r=Ws.constructDouble(s.x),h=Ws.constructDouble(s.y),o=Ws.constructDouble(i.x),a=Ws.constructDouble(i.y),u=o.mul(o).add(a.mul(a)).sub(o.mul(e).add(a.mul(n)).add(o.mul(r)).add(a.mul(h))).add(e.mul(r).add(n.mul(h)));return u.LZ()?-1:u.GZ()?1:0}static inCircleRobust3Point(t,s,i){const e=new w(t.x),n=new w(t.y),r=new w(s.x),h=new w(s.y),o=new w(i.x),a=new w(i.y),u=o.mulE(o).addE(a.mulE(a)).subE(o.mulE(e).addE(a.mulE(n)).addE(o.mulE(r)).addE(a.mulE(h))).addE(e.mulE(r).addE(n.mulE(h)));if(!u.isFuzzyZero()){const t=u.value();return t<0?-1:t>0?1:0}return Js.inCircleRobustMp3Point(t,s,i)}static calculateCircleCenterFromThreePoints(t,s,i){if(t.equals(i)||t.equals(s)||i.equals(s))return Js.getNAN();const e=Ks(t,s,i);return e.isNAN()?ti(t,s,i):e}static calculateAngle(t,s){return Math.atan2(t.crossProduct(s),t.dotProduct(s))}static isBisectorRobust(t,i,e){return s(0),!1}static size(){return 2}get 0(){return this.x}get 1(){return this.y}set 0(t){this.x=t}set 1(t){this.y=t}static compareZorder(t,s){const i=Js.c_compare_zorder_xx[t.x<0?1:0]|Js.c_compare_zorder_yy[t.y<0?1:0],e=Js.c_compare_zorder_xx[s.x<0?1:0]|Js.c_compare_zorder_yy[s.y<0?1:0];if(i===e){let i=0,e=0;for(let n=0;n<2;++n){const r=$s(t[n],s[n]);r>i&&(i=r,e=n)}return t[e]<s[e]}return i<e}static lerp(t,s,i){const e=new Js;return Y(t,s,i,e),e}static getClosestCoordinate(t,s,i,e=!1){const n=Js.getNAN();n.setSub(s,t);const r=n.sqrLength();if(0===r)return.5;if(s.isEqualPoint2D(i))return 1;const h=Js.getNAN();h.setSub(i,t);let o=h.dotProduct(n)/r;return e||(o<0?o=0:o>1&&(o=1)),o}static intersectLinesAtOnePoint(t,s,i,e){if(t.equals(s)||i.equals(e))return Js.getNAN();const n=s.x-t.x,r=i.x-e.x,h=s.y-t.y,o=i.y-e.y,a=n*o-r*h;if(!a)return Js.getNAN();const u=a;if(0===u)return Js.getNAN();let l=(i.x-t.x)*o-(i.y-t.y)*r;l/=u;const m=new Js;return Y(t,s,l,m),m.isFinite()?m:Js.getNAN()}toString(){return`[${this.x},${this.y}]`}}function Ks(t,s,i){const e=new w(s.x);e.subThis(t.x);const n=new w(s.y);n.subThis(t.y);const r=new w(i.x);r.subThis(t.x);const h=new w(i.y);h.subThis(t.y);const o=e.clone();o.mulThisE(h);let a=n.clone();if(a.mulThisE(r),o.subThisE(a),0===o.value())return Js.getNAN();o.mulThis(2);const u=e.clone();u.mulThisE(e);const l=n.clone();l.mulThisE(n);const m=u.clone();m.addThisE(l);const c=r.clone();c.mulThisE(r);const y=h.clone();y.mulThisE(h);const x=c.clone();x.addThisE(y);const f=n.clone();f.mulThisE(x),a=h.clone(),a.mulThisE(m),f.subThisE(a),f.divThisE(o);const d=e.clone();d.mulThisE(x),a=r.clone(),a.mulThisE(m),d.subThisE(a),d.divThisE(o);const b=Js.construct(t.x-f.value(),t.y+d.value()),v=t.sub(b).length(),_=s.sub(b).length(),N=i.sub(b).length(),M=1e-15*(v+Math.abs(t.x)+Math.abs(s.x)+Math.abs(i.x)+Math.abs(t.y)+Math.abs(s.y)+Math.abs(i.y));return Math.abs(v-_)<=M&&Math.abs(v-N)<=M&&f.eps()<M&&d.eps()<M?b:Js.getNAN()}function ti(t,s,i){const e=Ws.constructDouble(s.x);e.subDoubleThis(t.x);const n=Ws.constructDouble(s.y);n.subDoubleThis(t.y);const r=Ws.constructDouble(i.x);r.subDoubleThis(t.x);const h=Ws.constructDouble(i.y);h.subDoubleThis(t.y);const o=e.clone();o.mulThis(h);let a=n.clone();if(a.mulThis(r),o.subThis(a),o.isZero())return Js.getNAN();o.mulDoubleThis(2);const u=e.clone();u.mulThis(e);const l=n.clone();l.mulThis(n);const m=u.clone();m.addThis(l);const c=r.clone();c.mulThis(r);const y=h.clone();y.mulThis(h);const x=c.clone();x.addThis(y);const f=n.clone();f.mulThis(x),a=h.clone(),a.mulThis(m),f.subThis(a),f.divThis(o);const d=e.clone();d.mulThis(x),a=r.clone(),a.mulThis(m),d.subThis(a),d.divThis(o);return Js.construct(t.x-f.value(),t.y+d.value())}Js.dimensions=2,Js.d=[[0,1,0,-1],[-1,0,1,0],[0,-1,0,1],[1,0,-1,0]],Js.c_compare_zorder_xx=[2,0],Js.c_compare_zorder_yy=[1,0];class si{constructor(t,s,i){if(t instanceof si)return this.data=t.data,this.N=t.N,this.M=t.M,t.data=null,t.N=0,void(t.M=0);this.data=t,this.N=s,this.M=i}assignCopy(t){return this===t||(s(this.N*this.M==t.N*t.M),this.data.set(t.data),this.N=t.N,this.M=t.M),this}setZero(){return this.data?.fill(0),this}setIdentity(){const t=0,s=1;for(let i=0;i<this.N;i++)for(let e=0;e<this.M;e++)this.setRowCol(i,e,i===e?s:t);return this}rows(){return this.N}cols(){return this.M}row(t){return s(0),{}}set(t,s){return this.data[t]=s,this}setRowCol(t,s,i){return this.data[t*this.M+s]=i,this}at(t){return this.data[t]}atRowCol(t,s){return this.data[t*this.M+s]}mulScalar(t,i){s(0)}mul(t,i){if(s(this.M===t.rows()),s(this.N===i.rows()),s(t.cols()===i.cols()),i===this){const s=new Float64Array(this.N*this.M),e=new si(s,this.N,this.M);return this.mul(t,e),void i.assignCopy(e)}if(i===t){const s=new Float64Array(t.N*t.M),e=new si(s,t.N,t.M);return this.mul(t,e),void i.assignCopy(e)}const e=t.cols();for(let s=0;s<this.N;s++)for(let n=0;n<e;n++){let e=0;for(let i=0;i<this.M;i++)e+=this.atRowCol(s,i)*t.atRowCol(i,n);i.setRowCol(s,n,e)}}mulTranspose(t,i){if(s(this.M===t.cols()),s(this.N===i.rows()),s(t.rows()===i.cols()),i===this){const s=new Float64Array(this.N*this.M),e=new si(s,this.N,this.M);return this.mulTranspose(t,e),void i.assignCopy(e)}if(i===t){const s=new Float64Array(t.N*t.M),e=new si(s,t.N,t.M);return this.mulTranspose(t,e),void i.assignCopy(e)}const e=t.rows();for(let s=0;s<this.N;s++)for(let n=0;n<e;n++){let e=0;for(let i=0;i<this.M;i++)e+=this.atRowCol(s,i)*t.atRowCol(n,i);i.setRowCol(s,n,e)}}mulLeft(t,i){s(0)}mulLeftTranspose(t,i){s(0)}mulDiag(t,i){if(s(this.M===t.N*t.M),s(this.N===i.rows()),s(this.M===i.cols()),i===this){const s=new Float64Array(this.N*this.M),e=new si(s,this.N,this.M);return this.mulDiag(t,e),void i.assignCopy(e)}const e=this.M;for(let s=0;s<this.N;s++)for(let n=0;n<e;n++)i.setRowCol(s,n,this.atRowCol(s,n)*t.at(n))}transposeInPlace(){if(this.N===this.M){for(let t=0;t<this.N;t++)for(let s=t+1;s<this.M;s++){const i=this.atRowCol(t,s);this.setRowCol(t,s,this.atRowCol(s,t)),this.setRowCol(s,t,i)}return this}const t=new Float64Array(this.N*this.M),s=new si(t,this.N,this.M);return s.assignCopy(this),this.M=Tt(this.N,this.N=this.M),s.transpose(this),this}transpose(t){if(this!==t){si.checkDims(t,this.M,this.N);for(let s=0;s<this.N;s++)for(let i=0;i<this.M;i++)t.setRowCol(i,s,this.atRowCol(s,i))}else t.transposeInPlace()}add(t,s){}svd(t,i,e,n=!1){if(si.checkDims(t,this.N,this.M),si.checkDims(i,this.M,1),si.checkDims(e,this.M,this.M),n){if(s(this.N===this.M),!this.symmetricEigen(i,e))return!1;for(let t=0;t<this.M;++t)i.at(t)<0&&i.set(t,0);return t.assignCopy(e),!0}let r,h,o,a,u,l,m,c=0,y=0,x=0,f=0,d=0;const b=this.M,v=this.N;t.assignCopy(this);const _=new Float64Array(b),N=new si(_,b,1),w=(t,s)=>s>=0?Math.abs(t):-Math.abs(t),M=(t,s)=>{if((t=Math.abs(t))>(s=Math.abs(s))){const i=s/t;return t*Math.sqrt(i*i+1)}if(s>0){const i=t/s;return s*Math.sqrt(i*i+1)}return 0};for(let s=0;s<b;s++){if(c=s+1,N.set(s,f*x),x=a=f=0,s<v){for(let i=s;i<v;i++)f+=Math.abs(t.atRowCol(i,s));if(f){for(let i=s;i<v;i++)t.setRowCol(i,s,t.atRowCol(i,s)/f),a+=t.atRowCol(i,s)*t.atRowCol(i,s);h=t.atRowCol(s,s),x=-w(Math.sqrt(a),h),o=h*x-a,t.setRowCol(s,s,h-x);for(let i=c;i<b;i++){a=0;for(let e=s;e<v;e++)a+=t.atRowCol(e,s)*t.atRowCol(e,i);h=a/o;for(let e=s;e<v;e++)t.setRowCol(e,i,t.atRowCol(e,i)+h*t.atRowCol(e,s))}for(let i=s;i<v;i++)t.setRowCol(i,s,t.atRowCol(i,s)*f)}}if(i.set(s,f*x),x=a=f=0,s<v&&s!==b-1){for(let i=c;i<b;i++)f+=Math.abs(t.atRowCol(s,i));if(f){for(let i=c;i<b;i++)t.setRowCol(s,i,t.atRowCol(s,i)/f),a+=t.atRowCol(s,i)*t.atRowCol(s,i);h=t.atRowCol(s,c),x=-w(Math.sqrt(a),h),o=h*x-a,t.setRowCol(s,c,h-x);for(let i=c;i<b;i++)N.set(i,t.atRowCol(s,i)/o);for(let i=c;i<v;i++){a=0;for(let e=c;e<b;e++)a+=t.atRowCol(i,e)*t.atRowCol(s,e);for(let s=c;s<b;s++)t.setRowCol(i,s,t.atRowCol(i,s)+a*N.at(s))}for(let i=c;i<b;i++)t.setRowCol(s,i,t.atRowCol(s,i)*f)}}const e=Math.abs(i.at(s))+Math.abs(N.at(s));d=e>d?e:d}for(let s=b-1;s>=0;s--){if(s<b-1){if(x){for(let i=c;i<b;i++)e.setRowCol(i,s,t.atRowCol(s,i)/t.atRowCol(s,c)/x);for(let i=c;i<b;i++){a=0;for(let n=c;n<b;n++)a+=t.atRowCol(s,n)*e.atRowCol(n,i);for(let t=c;t<b;t++)e.setRowCol(t,i,e.atRowCol(t,i)+a*e.atRowCol(t,s))}}for(let t=c;t<b;t++)e.setRowCol(s,t,0),e.setRowCol(t,s,0)}e.setRowCol(s,s,1),x=N.at(s),c=s}for(let s=(v<b?v:b)-1;s>=0;s--){c=s+1,x=i.at(s);for(let i=c;i<b;i++)t.setRowCol(s,i,0);if(x){x=1/x;for(let i=c;i<b;i++){a=0;for(let e=c;e<v;e++)a+=t.atRowCol(e,s)*t.atRowCol(e,i);h=a/t.atRowCol(s,s)*x;for(let e=s;e<v;e++)t.setRowCol(e,i,t.atRowCol(e,i)+h*t.atRowCol(e,s))}for(let i=s;i<v;i++)t.setRowCol(i,s,t.atRowCol(i,s)*x)}else for(let i=s;i<v;i++)t.setRowCol(i,s,0);t.setRowCol(s,s,t.atRowCol(s,s)+1)}for(let s=b-1;s>=0;s--)for(let n=1;;n++){let f=1;for(c=s;c>=0;c--){if(y=c-1,Math.abs(N.at(c))+d===d){f=0;break}if(Math.abs(i.at(y))+d===d)break}if(f){r=0,a=1;for(let e=c;e<=s&&(h=a*N.at(e),N.set(e,N.at(e)*r),Math.abs(h)+d!==d);e++){x=i.at(e),o=M(h,x),i.set(e,o),o=1/o,r=x*o,a=-h*o;for(let s=0;s<v;s++)l=t.atRowCol(s,y),m=t.atRowCol(s,e),t.setRowCol(s,y,l*r+m*a),t.setRowCol(s,e,m*r-l*a)}}if(m=i.at(s),c===s){if(m<0){i.set(s,-m);for(let t=0;t<b;t++)e.setRowCol(t,s,-e.atRowCol(t,s))}break}if(100===n)return!1;u=i.at(c),y=s-1,l=i.at(y),x=N.at(y),o=N.at(s),h=((l-m)*(l+m)+(x-o)*(x+o))/(2*o*l),x=M(h,1),h=((u-m)*(u+m)+o*(l/(h+w(x,h))-o))/u,r=a=1;for(let s=c;s<=y;s++){const n=s+1;x=N.at(n),l=i.at(n),o=a*x,x*=r,m=M(h,o),N.set(s,m),r=h/m,a=o/m,h=u*r+x*a,x=x*r-u*a,o=l*a,l*=r;for(let t=0;t<b;t++)u=e.atRowCol(t,s),m=e.atRowCol(t,n),e.setRowCol(t,s,u*r+m*a),e.setRowCol(t,n,m*r-u*a);m=M(h,o),i.set(s,m),m&&(m=1/m,r=h*m,a=o*m),h=r*x+a*l,u=r*l-a*x;for(let i=0;i<v;i++)l=t.atRowCol(i,s),m=t.atRowCol(i,n),t.setRowCol(i,s,l*r+m*a),t.setRowCol(i,n,m*r-l*a)}N.set(c,0),N.set(s,h),i.set(s,u)}const p=new Float64Array(this.N),C=new Float64Array(this.M),T=new si(p,this.N,1),R=new si(C,this.M,1);let g=1;do{g*=3,g++}while(g<=this.M);do{g/=3,g=Math.trunc(g);for(let s=g;s<this.M;s++){const n=i.at(s);for(let i=0;i<this.N;i++)T.set(i,t.atRowCol(i,s));for(let t=0;t<this.M;t++)R.set(t,e.atRowCol(t,s));let r=s;for(;i.at(r-g)<n;){i.set(r,i.at(r-g));for(let s=0;s<this.N;s++)t.setRowCol(s,r,t.atRowCol(s,r-g));for(let t=0;t<this.M;t++)e.setRowCol(t,r,e.atRowCol(t,r-g));if(r-=g,r<g)break}i.set(r,n);for(let s=0;s<this.N;s++)t.setRowCol(s,r,T.at(s));for(let t=0;t<this.M;t++)e.setRowCol(t,r,R.at(t))}}while(g>1);for(let s=0;s<this.M;s++){let i=0;for(let e=0;e<this.N;e++)t.atRowCol(e,s)<0&&i++;for(let t=0;t<this.M;t++)e.atRowCol(t,s)<0&&i++;if(i>Math.trunc((this.N+this.M)/2)){for(let i=0;i<this.N;i++)t.setRowCol(i,s,-t.atRowCol(i,s));for(let t=0;t<this.M;t++)e.setRowCol(t,s,-e.atRowCol(t,s))}}return!0}isSymmetric(){if(this.N!==this.M)return!1;for(let t=0;t<this.N;t++)for(let s=t+1;s<this.M;s++)if(this.atRowCol(t,s)!==this.atRowCol(s,t))return!1;return!0}isZero(){return s(0),!1}isIdentity(){return s(0),!1}equals(t,i){if(void 0!==i&&s(0),this.N!==t.N||this.M!==t.M)return!1;for(let s=0;s<this.N*this.M;s++)if(this.data[s]!==t.data[s])return!1;return!0}maxElement(){return s(0),0}minElement(){return s(0),0}determinant(){if(s(this.N===this.M),1===this.N)return this.data[0];if(2===this.N)return this.data[0]*this.data[3]-this.data[1]*this.data[2];if(3===this.N){const t=this;return t.atRowCol(0,0)*(t.atRowCol(1,1)*t.atRowCol(2,2)-t.atRowCol(1,2)*t.atRowCol(2,1))-t.atRowCol(0,1)*(t.atRowCol(1,0)*t.atRowCol(2,2)-t.atRowCol(2,0)*t.atRowCol(1,2))+t.atRowCol(0,2)*(t.atRowCol(1,0)*t.atRowCol(2,1)-t.atRowCol(1,1)*t.atRowCol(2,0))}const t=new Float64Array(this.N*this.N),i=new si(t,this.N,this.N),e=new Float64Array(this.N);if(!this.luDecomposition(i,e))return 0;let n=1;for(let s=0;s<this.N;s++)n*=i.atRowCol(s,s),e[s]!==s&&(n=-n);return n}submatrix(t,i,e){s(0)}inverse(t){s(0)}pseudoInverse(t,s=!1,i=2220446049250313e-31){if(t.setZero(),1===this.N&&1===this.M)return 0!==this.atRowCol(0,0)?t.setRowCol(0,0,1/this.atRowCol(0,0)):t.setRowCol(0,0,0),!0;if(2===this.N&&2===this.M){const s=this.atRowCol(0,0)*this.atRowCol(1,1)-this.atRowCol(0,1)*this.atRowCol(1,0),i=1e-5*(Math.abs(this.atRowCol(0,0)*this.atRowCol(1,1))+Math.abs(this.atRowCol(0,1)*this.atRowCol(1,0)));if(Math.abs(s)>i)return t.setRowCol(0,0,this.atRowCol(1,1)/s),t.setRowCol(0,1,-this.atRowCol(0,1)/s),t.setRowCol(1,0,-this.atRowCol(1,0)/s),t.setRowCol(1,1,this.atRowCol(0,0)/s),!0}const e=new Float64Array(this.N*this.M),n=new si(e,this.N,this.M),r=new Float64Array(this.M),h=new si(r,this.M,1),o=new Float64Array(this.M*this.M),a=new si(o,this.M,this.M);if(!this.svd(n,h,a,s))return!1;const u=Math.max(this.N,this.M),l=i*Math.abs(h.at(0))*u;for(let m=0;m<this.M;m++)h.at(m)>l?h.set(m,1/h.at(m)):h.set(m,0);return a.mulDiag(h,t),t.mulTranspose(n,t),!0}luDecomposition(t,i){return s(0),!1}symmetricEigen(t,i){s(this.rows()===this.cols()),s(this.rows()===t.rows()),s(i.rows()===i.cols()&&i.rows()===this.rows()),s(this.isSymmetric());const e=new Float64Array(this.N*this.M),n=new si(e,this.N,this.M);n.assignCopy(this);const r=100/Number.EPSILON,h=this.rows(),o=new Float64Array(h),a=new Float64Array(h),u=new si(o,h,1),l=new si(a,h,1);for(let s=0;s<h;s++)u.set(s,n.atRowCol(s,s)),t.set(s,n.atRowCol(s,s)),l.set(s,0);i.setIdentity();const m=()=>{const s=u;i.transposeInPlace();let e=1;do{e*=3,e++}while(e<=h);do{e/=3,e=Math.trunc(e);for(let n=e;n<h;n++){const r=t.at(n),h=Math.abs(r);for(let t=0;t<this.M;t++)s.set(t,i.atRowCol(t,n));let o=n;for(;Math.abs(t.at(o-e))<h;){t.set(o,t.at(o-e));for(let t=0;t<this.M;t++)i.setRowCol(t,o,i.atRowCol(t,o-e));if(o-=e,o<e)break}if(o!==n){t.set(o,r);for(let t=0;t<this.M;t++)i.setRowCol(t,o,s.at(t))}}}while(e>1)};for(let s=1;;s++){let e=0;for(let t=1;t<h;t++)for(let s=0;s<t;s++)e+=Math.abs(n.atRowCol(t,s));if(0===e)return m(),!0;const o=s<4?.2*e/(h*h):0;for(let a=0;a<h;a++)for(let e=a+1;e<h;e++){let u=r*Math.abs(n.atRowCol(e,a));if(s>4&&u<=Math.abs(t.at(a))&&u<=Math.abs(t.at(e)))n.setRowCol(e,a,0);else if(Math.abs(n.atRowCol(e,a))>o){let s,r=t.at(e)-t.at(a);if(u<Math.abs(r))s=n.atRowCol(e,a)/r;else{const t=.5*r/n.atRowCol(e,a);s=1/(Math.abs(t)+Math.sqrt(1+t*t)),t<0&&(s=-s)}const o=1/Math.sqrt(1+s*s),m=s*o,c=m/(1+o);r=s*n.atRowCol(e,a),l.set(a,l.at(a)-r),l.set(e,l.at(e)+r),t.set(a,t.at(a)-r),t.set(e,t.at(e)+r),n.setRowCol(e,a,0);let y=0;for(;y<a;y++)u=n.atRowCol(a,y),r=n.atRowCol(e,y),n.setRowCol(a,y,u-m*(r+u*c)),n.setRowCol(e,y,r+m*(u-r*c));for(y++;y<e;y++)u=n.atRowCol(y,a),r=n.atRowCol(e,y),n.setRowCol(y,a,u-m*(r+u*c)),n.setRowCol(e,y,r+m*(u-r*c));for(y++;y<h;y++)u=n.atRowCol(y,a),r=n.atRowCol(y,e),n.setRowCol(y,a,u-m*(r+u*c)),n.setRowCol(y,e,r+m*(u-r*c));for(y=0;y<h;y++)u=i.atRowCol(a,y),r=i.atRowCol(e,y),i.setRowCol(a,y,u-m*(r+u*c)),i.setRowCol(e,y,r+m*(u-r*c))}}for(let s=0;s<h;s++)u.set(s,u.at(s)+l.at(s)),t.set(s,u.at(s)),l.set(s,0)}}static checkDims(t,i,e){s(t.rows()===i&&t.cols()===e)}}class ii extends si{constructor(t){if(t.copy){const s=new Float64Array(t.copy.N*t.copy.M);return super(s,t.copy.N,t.copy.M),this.buffer=s,void this.assignCopy(t.copy)}const s=new Float64Array(t.NN*t.MM);super(s,t.NN,t.MM),this.buffer=s,t.initializerList&&pt(this.buffer,t.initializerList,0,0,t.initializerList.length)}assignCopy(t){return this===t||super.assignCopy(t),this}}class ei{constructor(t){this.m_TransformationType=1,void 0===t?this.setIdentity():t instanceof ei?this.set(t):this.setScale(t)}set(t){return this.xx=t.xx,this.xy=t.xy,this.xd=t.xd,this.yx=t.yx,this.yy=t.yy,this.yd=t.yd,this}clone(){return(new ei).set(this)}setZero(){this.xx=0,this.yy=0,this.xy=0,this.yx=0,this.xd=0,this.yd=0}isEqual(t){return this===t||this.xx===t.xx&&this.xy===t.xy&&this.xd===t.xd&&this.yx===t.yx&&this.yy===t.yy&&this.yd===t.yd}transformInPlace(t){const s=this.xx*t.x+this.xy*t.y+this.xd,i=this.yx*t.x+this.yy*t.y+this.yd;t.x=s,t.y=i}transform(t){const s=t.clone();return this.transformInPlace(s),s}queryTransform(t,s){const i=this.xx*t.x+this.xy*t.y+this.xd,e=this.yx*t.x+this.yy*t.y+this.yd;s.setCoords(i,e)}transformEnvInPlace(t){if(t.isEmpty())return;const s=zt(Js,4);t.queryCorners(s),this.transformPoints2D(s,4,s),t.setFromPoints(s,4)}queryTransformEnv(t,i){s(0)}transformPoints2D(t,s,i){for(let e=0;e<s;++e)this.queryTransform(t[e],i[e])}transformInterleavedPoints(t,s,i){s*=2;const e=Js.getNAN();for(let n=0;n<s;n+=2)e.x=t[n],e.y=t[n+1],this.transformInPlace(e),i[n]=e.x,i[n+1]=e.y}multiply(t){return ei.st_multiply(this,t,this),this}mulLeft(t){return s(0),this}static st_multiply(t,s,i){const e=t.xx*s.xx+t.yx*s.xy,n=t.xy*s.xx+t.yy*s.xy,r=t.xd*s.xx+t.yd*s.xy+s.xd,h=t.xx*s.yx+t.yx*s.yy,o=t.xy*s.yx+t.yy*s.yy,a=t.xd*s.yx+t.yd*s.yy+s.yd;i.xx=e,i.xy=n,i.xd=r,i.yx=h,i.yy=o,i.yd=a}getCoefficients(t){s(t.length>=6),t[0]=this.xx,t[1]=this.xy,t[2]=this.xd,t[3]=this.yx,t[4]=this.yy,t[5]=this.yd}setCoefficients(t){s(t.length>=6),this.xx=t[0],this.xy=t[1],this.xd=t[2],this.yx=t[3],this.yy=t[4],this.yd=t[5]}copyTo(t){s(0)}initializeFromRect(t,s){t.isEmpty()||s.isEmpty()||!t.width()||!t.height()?this.setZero():(this.xy=this.yx=0,this.xx=s.width()/t.width(),this.yy=s.height()/t.height(),this.xd=s.xmin-t.xmin*this.xx,this.yd=s.ymin-t.ymin*this.yy)}initializeFromRectIsotropic(t,s){if(t.isEmpty()||!t.width()||!t.height()||s.isEmpty())this.setZero();else{this.yx=0,this.xy=0,this.xx=s.width()/t.width(),this.yy=s.height()/t.height(),this.xx>this.yy?this.xx=this.yy:this.yy=this.xx;const i=s.getCenter(),e=t.getCenter();this.xd=i.x-e.x*this.xx,this.yd=i.y-e.y*this.yy}}initializeFromTwoPointsArray(t,s){if(t[0].equals(s[0])&&t[1].equals(s[1]))return void this.setIdentity();if(t[0].equals(t[1])){if(s[0].equals(s[1]))return void this.setShift(s[0].sub(t[0]));e("")}if(!t[0].equals(t[1])&&s[0].equals(s[1]))return this.setZero(),void this.shift(s[0]);this.setShiftCoords(-t[0].x,-t[0].y);const i=Js.distance(t[0],t[1]),n=Js.distance(s[0],s[1]),r=n/i;this.scale(r,r);const h=t[1].sub(t[0]);h.divThis(i);const o=s[1].sub(s[0]);o.divThis(n);const a=h.crossProduct(o),u=h.dotProduct(o);this.rotate(u,a),this.shiftCoords(s[0].x,s[0].y)}initializeFromTwoPoints(t,s,i,e){const n=[t,s],r=[i,e];this.initializeFromTwoPointsArray(n,r)}transformSizeInPlace(t){s(0)}transformSize(t,i){s(0)}transformTol(t){return s(0),0}transformWithoutTranslateArray(t,s,i){for(let e=0;e<s;++e)this.transformWithoutTranslate(t[e],i[e])}transformWithoutTranslateInPlace(t){const s=this.xx*t.x+this.xy*t.y,i=this.yx*t.x+this.yy*t.y;t.setCoords(s,i)}transformWithoutTranslate(t,s){const i=this.xx*t.x+this.xy*t.y,e=this.yx*t.x+this.yy*t.y;s.setCoords(i,e)}setIdentity(){this.xx=1,this.xy=0,this.xd=0,this.yx=0,this.yy=1,this.yd=0}isIdentity(){return!(1!==this.xx||1!==this.yy||this.xy||this.xd||this.yx||this.yd)}isIdentityTol(t){const s=t*t;return!(X(this.xd)+X(this.yd)>s)&&(!(X(this.xy+this.xd)+X(this.yy+this.yd-1)>s)&&!(X(this.xx+this.xd-1)+X(this.yx+this.yd)>s))}isReflective(){return this.xx*this.yy-this.yx*this.xy<0}isUniform(t){const s=this.xx*this.xx+this.yx*this.yx,i=this.xy*this.xy+this.yy*this.yy,e=(s+i)*t;return Math.abs(s-i)<=e&&Math.abs(this.xx*this.xy+this.yx*this.yy)<=e}isUniformNoRotation(){return 0!==this.xx&&Math.abs(this.xx)===Math.abs(this.yy)&&0===this.xy&&0===this.yx}isTranslate(){return 1===this.xx&&1===this.yy&&!this.xy&&!this.yx}isTranslateTol(t){const s=new Js;return s.setCoords(0,1),this.transformWithoutTranslateInPlace(s),s.y-=1,!(s.sqrLength()>t*t)&&(s.setCoords(1,0),this.transformWithoutTranslateInPlace(s),s.x-=1,s.sqrLength()<=t*t)}isOrthonormal(t){const s=new ei;return s.xx=this.xx*this.xx+this.xy*this.xy,s.xy=this.xx*this.yx+this.xy*this.yy,s.yx=this.yx*this.xx+this.yy*this.xy,s.yy=this.yx*this.yx+this.yy*this.yy,s.xd=0,s.yd=0,s.isIdentityTol(t)}isDegenerate(t){return Math.abs(this.xx*this.yy-this.yx*this.xy)<=2*t*(Math.abs(this.xx*this.yy)+Math.abs(this.yx*this.xy))}isZero(){return 0===this.xx&&0===this.yy&&0===this.xy&&0===this.yx&&0===this.xd&&0===this.yd}isScaleAndTranslateTol(t){return this.xy*this.xy+this.yx*this.yx<=(this.xx*this.xx+this.yy*this.yy)*t}setTranslate(t,s){return this.xx=1,this.xy=0,this.xd=t,this.yx=0,this.yy=1,this.yd=s,this}setShiftCoords(t,s){return this.xx=1,this.xy=0,this.xd=t,this.yx=0,this.yy=1,this.yd=s,this}setShift(t){return this.xx=1,this.xy=0,this.xd=t.x,this.yx=0,this.yy=1,this.yd=t.y,this}setScaleCoords(t,s){return this.xx=t,this.xy=0,this.xd=0,this.yx=0,this.yy=s,this.yd=0,this}setScale(t){return this.setScaleCoords(t,t),this}setFlipX(t,s){return this.xx=-1,this.xy=0,this.xd=t+s,this.yx=0,this.yy=1,this.yd=0,this}setFlipY(t,s){return this.xx=1,this.xy=0,this.xd=0,this.yx=0,this.yy=-1,this.yd=t+s,this}setShear(t,s){return this.xx=1,this.xy=t,this.xd=0,this.yx=s,this.yy=1,this.yd=0,this}scale(t,s){return this.xx*=t,this.xy*=t,this.xd*=t,this.yx*=s,this.yy*=s,this.yd*=s,this}setRotateAngle(t){return this.setRotate(Math.cos(t),Math.sin(t))}setRotate(t,s){return this.xx=t,this.xy=-s,this.xd=0,this.yx=s,this.yy=t,this.yd=0,this}setRotateAngleAbout(t,s){return this.setRotateAbout(Math.cos(t),Math.sin(t),s)}setRotateAbout(t,s,i){return this.setTranslate(-i.x,-i.y),this.rotate(t,s),this.translate(i.x,i.y)}setSwapCoordinates(){return this.xx=0,this.xy=1,this.xd=0,this.yx=1,this.yy=0,this.yd=0,this}setRotateCw90(){return this.xx=0,this.xy=1,this.xd=0,this.yx=-1,this.yy=0,this.yd=0,this}setRotateCcw90(){return this.xx=0,this.xy=-1,this.xd=0,this.yx=1,this.yy=0,this.yd=0,this}shiftCoords(t,s){return this.xd+=t,this.yd+=s,this}shift(t){return this.xd+=t.x,this.yd+=t.y,this}translate(t,s){return this.xd+=t,this.yd+=s,this}flipX(t,s){return this.xx=-this.xx,this.xy=-this.xy,this.xd=t+s-this.xd,this}flipY(t,s){return this.yx=-this.yx,this.yy=-this.yy,this.yd=t+s-this.yd,this}shear(t,s){const i=new ei;return i.setShear(t,s),this.multiply(i)}rotateAngle(t){const s=new ei;return s.setRotateAngle(t),this.multiply(s)}rotate(t,s){const i=new ei;return i.setRotate(t,s),this.multiply(i)}rotateAbout(t,s,i){return this.translate(-i.x,-i.y),this.rotate(t,s),this.translate(i.x,i.y)}rotateAngleAbout(t,s){return this.rotateAbout(Math.cos(t),Math.sin(t),s)}setInvert(t){return this.set(t),this.invertThis()}invertThis(){let t=this.xx*this.yy-this.xy*this.yx;if(0===t)return this.setZero(),this;t=1/t;const s=(this.xy*this.yd-this.xd*this.yy)*t,i=(this.xd*this.yx-this.xx*this.yd)*t,e=this.yy*t,n=-this.xy*t,r=-this.yx*t,h=this.xx*t;return this.xd=s,this.yd=i,this.xx=e,this.yy=h,this.xy=n,this.yx=r,this}invertPrecise(t){return this.set(t),this.invertPreciseThis()}invertPreciseThis(){const t=Ws.constructDouble(this.xy),s=Ws.constructDouble(this.xx),i=s.mulDouble(this.yy).sub(t.mulDouble(this.yx));if(i.isZero())return this.setZero(),this;const e=i.clone();e.invertThis();const n=Ws.constructDouble(this.xd),r=t.mulDouble(this.yd).sub(n.mulDouble(this.yy)).mul(e).toDouble(),h=n.mulDouble(this.yx).sub(s.mulDouble(this.yd)).mul(e).toDouble(),o=e.mulDouble(this.yy).toDouble(),a=e.mulDouble(-this.xy).toDouble(),u=e.mulDouble(-this.yx).toDouble(),l=e.mulDouble(this.xx).toDouble();return this.xd=r,this.yd=h,this.xx=o,this.yy=l,this.xy=a,this.yx=u,this}extractScaleTransform(t,s){const i=Math.sqrt(this.xx*this.xx+this.xy*this.xy),e=Math.sqrt(this.yx*this.yx+this.yy*this.yy);s.setScaleCoords(1/i,1/e),s.multiply(this),t.setScaleCoords(i,e)}setFromTwoTriangles(t,s){let i=!0;for(let u=0;u<3;++u)i=i&&t[u].equals(s[u]);if(i)return this.setIdentity(),!0;const e=new Js;e.setSub(t[0],t[1]);const n=new Js;n.setSub(t[0],t[2]);const r=new Js;r.setSub(s[0],s[1]);const h=new Js;h.setSub(s[0],s[2]);const o=4*Number.EPSILON*(Math.abs(e.x*n.y)+Math.abs(n.x*e.y));let a=e.x*n.y-e.y*n.x;return Math.abs(a)>o?(a=1/a,this.xx=(r.x*n.y-e.y*h.x)*a,this.xy=(e.x*h.x-r.x*n.x)*a,this.yx=(r.y*n.y-e.y*h.y)*a,this.yy=(e.x*h.y-r.y*n.x)*a,this.xd=s[0].x-(this.xx*t[0].x+this.xy*t[0].y),this.yd=s[0].y-(this.yx*t[0].x+this.yy*t[0].y),!0):(this.setZero(),!1)}initializeFromControlPoints(t,s,i,e,n=null){return 0===s?(this.setIdentity(),void(n&&n.setIdentity())):1===s?(this.setShift(e[0].sub(i[0])),void(n&&n.setShift(i[0].sub(e[0])))):(s<3&&(t=1),void(4===t&&s>2?hi(this,s,i,e,n):oi(t,this,s,i,e,n)))}calculateErrors(t,i,e,n){s(t>0&&null!==i&&null!==e);let r=0;for(let s=0;s<t;++s){const t=this.transform(i[s]),h=Js.sqrDistance(e[s],t);r+=h,n&&(n[s]=Math.sqrt(h))}return Math.sqrt(r/t)}}const ni=[43,11,41,9,61];function ri(t,i){s(!(2!==i.rows()&&3!==i.rows()||2!==i.cols()&&3!==i.rows())),t.xx=i.atRowCol(0,0),t.xy=i.atRowCol(0,1),t.yx=i.atRowCol(1,0),t.yy=i.atRowCol(1,1),3===i.cols()?(t.xd=i.atRowCol(0,2),t.yd=i.atRowCol(1,2)):(t.xd=0,t.yd=0)}function hi(t,s,i,e,r){const h=Js.average(i,s),o=Js.average(e,s),a=new ii({NN:2,MM:2});a.setZero();const u=new ii({NN:2,MM:2});u.setZero();for(let n=0;n<s;++n)a.setRowCol(0,0,a.atRowCol(0,0)+(i[n].x-h.x)*(i[n].x-h.x)),a.setRowCol(0,1,a.atRowCol(0,1)+(i[n].x-h.x)*(i[n].y-h.y)),a.setRowCol(1,1,a.atRowCol(1,1)+(i[n].y-h.y)*(i[n].y-h.y)),u.setRowCol(0,0,u.atRowCol(0,0)+(e[n].x-o.x)*(i[n].x-h.x)),u.setRowCol(0,1,u.atRowCol(0,1)+(e[n].x-o.x)*(i[n].y-h.y)),u.setRowCol(1,0,u.atRowCol(1,0)+(e[n].y-o.y)*(i[n].x-h.x)),u.setRowCol(1,1,u.atRowCol(1,1)+(e[n].y-o.y)*(i[n].y-h.y));a.setRowCol(1,0,a.atRowCol(0,1));const l=new ii({NN:2,MM:2});a.pseudoInverse(l,!0)||n("Failed to compute pseudo inverse"),u.mul(l,u),ri(t,u);const m=h.clone();t.transformInPlace(m),t.xd=o.x-m.x,t.yd=o.y-m.y,r&&(u.pseudoInverse(l,!1)||n("Failed to compute pseudo inverse"),ri(r,l),r.transformInPlace(o),r.xd=h.x-o.x,r.yd=h.y-o.y)}function oi(t,i,e,r,h,o){s(1===t||0===t||2===t||3===t),i.setIdentity();const a=Js.average(r,e),u=Js.average(h,e);if(s(t<ni.length&&t>0),8&ni[t]){const s=new ii({NN:2,MM:2});s.setZero();for(let t=0;t<e;++t)s.setRowCol(0,0,s.atRowCol(0,0)+(h[t].x-u.x)*(r[t].x-a.x)),s.setRowCol(1,0,s.atRowCol(1,0)+(h[t].x-u.x)*(r[t].y-a.y)),s.setRowCol(0,1,s.atRowCol(0,1)+(h[t].y-u.y)*(r[t].x-a.x)),s.setRowCol(1,1,s.atRowCol(1,1)+(h[t].y-u.y)*(r[t].y-a.y));const o=new ii({NN:2,MM:2}),l=new ii({NN:2,MM:1}),m=new ii({NN:2,MM:2});s.svd(o,l,m)||n("Failed to compute svd");const c=new ii({NN:2,MM:2});o.transpose(c);const y=new ii({NN:2,MM:2});if(m.mul(c,y),!(32&ni[t])){y.determinant()<0&&(c.setRowCol(1,0,-c.atRowCol(1,0)),c.setRowCol(1,1,-c.atRowCol(1,1)),m.mul(c,y))}const x=new ei;ri(x,y),i.set(x)}if(2&ni[t]){let t=0,s=0;for(let n=0;n<e;++n){const e=r[n].sub(a);t+=e.sqrLength(),i.transformInPlace(e),s+=e.dotProduct(h[n].sub(u))}if(0===t)0===s?i.setIdentity():i.setZero();else{const e=s/t;i.scale(e,e)}}else s(!(4&ni[t]));const l=a.clone();i.transformInPlace(l),i.xd=u.x-l.x,i.yd=u.y-l.y,o&&(o.set(i),o.invertThis(),o.isZero()&&(o.xd=a.x,o.yd=a.y))}export{wt as $,Pt as A,Y as B,g as C,pt as D,_ as E,It as F,us as G,w as H,Ts as I,Cs as J,r as K,ms as L,Ws as M,Ct as N,As as O,Js as P,ns as Q,rs as R,Ot as S,ei as T,Mt as U,Es as V,Et as W,qs as X,Bt as Y,U as Z,W as _,Lt as a,gt as a0,Zs as a1,L as a2,B as a3,hs as a4,D as a5,A as a6,O as a7,G as a8,Q as a9,ws as aA,Hs as aB,F as aC,Jt as aD,zs as aa,Qt as ab,Ls as ac,Qs as ad,Os as ae,Bs as af,ft as ag,dt as ah,E as ai,I as aj,js as ak,Ys as al,$ as am,ks as an,xt as ao,Wt as ap,Ft as aq,it as ar,H as as,Vs as at,Dt as au,Ps as av,Ms as aw,Zt as ax,k as ay,Ss as az,Tt as b,S as c,Gt as d,X as e,qt as f,os as g,ps as h,Rs as i,as as j,St as k,Fs as l,zt as m,Rt as n,ls as o,Vt as p,Ut as q,yt as r,J as s,kt as t,K as u,At as v,V as w,j as x,q as y,Z as z};
package/chunks/arcade.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{compileScript as e,extend as r,enableAsyncSupport as t}from"../arcade/arcadeCompiler.js";import{ArcadeModuleResolver as n}from"../arcade/ArcadeModuleResolver.js";import{executeScript as s,extend as a}from"../arcade/arcadeRuntime.js";import{ArcadeExecutionError as u,ExecutionErrorCodes as o}from"../arcade/executionError.js";import{parseScript as i}from"../arcade/parser.js";import{referencesMember as c,referencesFunction as l,findLiteralMemberAccesses as f,findExpectedFieldLiterals as p,findScriptDependencies as d,findModuleImports as m,findFunctionCalls as y}from"../arcade/treeAnalysis.js";import{setGeometryEngine as S}from"../arcade/functions/geomsync.js";import has from"../core/has.js";import{assertIsSome as b}from"../core/maybe.js";const w=new Set(["feature","angle","bearing","centroid","envelopeintersects","extent","geometry","isselfintersecting","ringisclockwise"]);let g=!1,h=!1,A=null,j=[];function x(r,t){if(!0===t.useAsync||!0===r.isAsync)return M(r,t);if(has("esri-csp-restrictions")){return function(e){return s(r,e)}}try{return e(r,t)}catch(n){if("esri.arcade.arcadeuncompilableerror"===n.declaredRootClass)return function(e){return s(r,e)};throw n}}function M(r,t){if(null===A)throw new u(null,o.AsyncNotEnabled,null);if(has("esri-csp-restrictions")){return function(e){return A.executeScript(r,e)}}try{return e(r,t,!0)}catch(n){if("esri.arcade.arcadeuncompilableerror"===n.declaredRootClass)return function(e){return A.executeScript(r,e)};throw n}}function v(e){a(e),r(e,"sync"),null===A?j.push(e):(r(e,"async"),A.extend(e))}function F(e,r=[]){return i(e,r)}function E(e,r,t=[]){return G(i(e,t),r)}function G(e,r){if(!0===r.useAsync||!0===e.isAsync){if(null===A)throw new u(null,o.AsyncNotEnabled,null);return A.executeScript(e,r)}return s(e,r)}function I(e,r){return c(e,r)}function U(e,r){return l(e,r)}function _(e,r=!1){return void 0===r&&(r=!1),f(e).map((({varId:e,memberId:r})=>`${e}.${r}`))}function C(e){return p(e)}function R(e,r=[]){return void 0===e.usesGeometry&&d(e,r),!0===e.usesGeometry}let k=null;function D(){return k||(k=P(),k)}async function P(){const e=await import("../geometry/geometryEngine.js");return h=!0,S(e),!0}let z=null;function L(){return null!==z||(z=$()),z}async function $(){await t(),A=await import("../arcade/arcadeAsyncRuntime.js");for(const e of j)A.extend(e),r(e,"async");return j=null,!0}function N(){return g}function O(){return!!A}function T(){return h}let q=null;function B(){return q||(q=V(),q)}async function V(){await L();const[e,t,n,s,a,u]=await Promise.all([import("../arcade/featureSetUtils.js"),import("../arcade/functions/featuresetbase.js"),import("../arcade/functions/featuresetgeom.js"),import("../arcade/functions/featuresetstats.js"),import("../arcade/functions/featuresetstring.js"),import("../arcade/functions/knowledgegraph.js")]);return re=e,A.extend([t,n,s,a,u]),r([t,n,s,a,u],"async"),g=!0,!0}function H(e,r=[]){return void 0===e.usesFeatureSet&&d(e,r),!0===e.usesFeatureSet}function J(e,r=[]){return void 0===e.isAsync&&d(e,r),!0===e.isAsync}function K(e,r){if(r){for(const t of r)if(I(e,t))return!0;return!1}return!1}async function Q(e,r,t=[],n=!1,s=null){return W(new Set,e,r,t,n,s)}async function W(e,r,t,n=[],s=!1,a=null){const u="string"==typeof r?F(r):r,o=[];return u&&(!1===T()&&(R(u)||s)&&o.push(D()),!1===O()&&(!0===u.isAsync||t)&&o.push(L()),!1===N()&&(H(u)||K(u,n))&&o.push(B())),o.length&&await Promise.all(o),await Y(e,u,a,t,s),!0}function X(e,r=[]){return void 0===e.usesModules&&d(e,r),!0===e.usesModules}async function Y(e,r,t=null,s=!1,a=!1){const i=m(r);null===t&&i.length>0&&(t=n.getDefault()),r.loadedModules={};for(const n of i){b(t);const i=t.normalizeModuleUri(n.source);if(e.has(i.uri))throw new u(null,o.CircularModules,null);e.add(i.uri);const c=await t.fetchModule(i);await W(e,c,s,[],a,t),e.delete(i.uri),c.isAsync&&(r.isAsync=!0),c.usesFeatureSet&&(r.usesFeatureSet=!0),c.usesGeometry&&(r.usesGeometry=!0),r.loadedModules[n.libname]={uri:i.uri,script:c}}}function Z(e){if(R(e))return!0;const r=y(e);let t=!1;for(let n=0;n<r.length;n++)if(w.has(r[n])){t=!0;break}return t}function ee(e,r){const t=null==r?null:new Set(r.map((e=>e.toLowerCase())));return f(e).some((({varId:e,memberId:r})=>"$view"===e&&(null==t||t.has(r))))}let re=null;function te(){return re}const ne=Object.freeze(Object.defineProperty({__proto__:null,_loadScriptDependenciesImpl:W,compileScript:x,enableAsyncSupport:L,enableAsyncSupportImpl:$,enableFeatureSetSupport:B,enableFeatureSetSupportImpl:V,enableGeometrySupport:D,enableGeometrySupportImpl:P,executeScript:G,extend:v,extractExpectedFieldLiterals:C,extractFieldLiterals:_,featureSetUtils:te,isAsyncEnabled:O,isFeatureSetSupportEnabled:N,isGeometryEnabled:T,loadDependentModules:Y,loadScriptDependencies:Q,parseAndExecuteScript:E,parseScript:F,referencesFunction:U,referencesMember:I,scriptIsAsync:J,scriptTouchesGeometry:Z,scriptUsesFeatureSet:H,scriptUsesGeometryEngine:R,scriptUsesModules:X,scriptUsesViewProperties:ee},Symbol.toStringTag,{value:"Module"}));export{Y as A,ee as B,W as _,C as a,D as b,x as c,B as d,G as e,te as f,R as g,ne as h,v as i,E as j,U as k,Q as l,_ as m,P as n,L as o,F as p,$ as q,I as r,Z as s,N as t,O as u,T as v,V as w,H as x,J as y,X as z};
5
+ import{compileScript as e,extend as r,enableAsyncSupport as t}from"../arcade/arcadeCompiler.js";import{ArcadeModuleResolver as n}from"../arcade/ArcadeModuleResolver.js";import{executeScript as s,extend as a}from"../arcade/arcadeRuntime.js";import{ArcadeExecutionError as u,ExecutionErrorCodes as o}from"../arcade/executionError.js";import{parseScript as i}from"../arcade/parser.js";import{referencesMember as c,referencesFunction as l,findLiteralMemberAccesses as f,findExpectedFieldLiterals as p,findScriptDependencies as d,findModuleImports as m,findFunctionCalls as y}from"../arcade/treeAnalysis.js";import{loadOperators as S}from"../arcade/functions/geomsync.js";import has from"../core/has.js";import{assertIsSome as b}from"../core/maybe.js";const w=new Set(["feature","angle","bearing","centroid","envelopeintersects","extent","geometry","isselfintersecting","ringisclockwise"]);let h=!1,A=!1,g=null,j=[];function x(r,t){if(!0===t.useAsync||!0===r.isAsync)return M(r,t);if(has("esri-csp-restrictions")){return function(e){return s(r,e)}}try{return e(r,t)}catch(n){if("esri.arcade.arcadeuncompilableerror"===n.declaredRootClass)return function(e){return s(r,e)};throw n}}function M(r,t){if(null===g)throw new u(null,o.AsyncNotEnabled,null);if(has("esri-csp-restrictions")){return function(e){return g.executeScript(r,e)}}try{return e(r,t,!0)}catch(n){if("esri.arcade.arcadeuncompilableerror"===n.declaredRootClass)return function(e){return g.executeScript(r,e)};throw n}}function v(e){a(e),r(e,"sync"),null===g?j.push(e):(r(e,"async"),g.extend(e))}function F(e,r=[]){return i(e,r)}function E(e,r,t=[]){return G(i(e,t),r)}function G(e,r){if(!0===r.useAsync||!0===e.isAsync){if(null===g)throw new u(null,o.AsyncNotEnabled,null);return g.executeScript(e,r)}return s(e,r)}function I(e,r){return c(e,r)}function U(e,r){return l(e,r)}function _(e,r=!1){return void 0===r&&(r=!1),f(e).map((({varId:e,memberId:r})=>`${e}.${r}`))}function C(e){return p(e)}function R(e,r=[]){return void 0===e.usesGeometry&&d(e,r),!0===e.usesGeometry}let k=null;function D(){return k||(k=P(),k)}async function P(){return await S(),A=!0,!0}let z=null;function L(){return null!==z||(z=$()),z}async function $(){await t(),g=await import("../arcade/arcadeAsyncRuntime.js");for(const e of j)g.extend(e),r(e,"async");return j=null,!0}function N(){return h}function O(){return!!g}function T(){return A}let q=null;function B(){return q||(q=V(),q)}async function V(){await L();const[e,t,n,s,a,u]=await Promise.all([import("../arcade/featureSetUtils.js"),import("../arcade/functions/featuresetbase.js"),import("../arcade/functions/featuresetgeom.js"),import("../arcade/functions/featuresetstats.js"),import("../arcade/functions/featuresetstring.js"),import("../arcade/functions/knowledgegraph.js")]);return re=e,g.extend([t,n,s,a,u]),r([t,n,s,a,u],"async"),h=!0,!0}function H(e,r=[]){return void 0===e.usesFeatureSet&&d(e,r),!0===e.usesFeatureSet}function J(e,r=[]){return void 0===e.isAsync&&d(e,r),!0===e.isAsync}function K(e,r){if(r){for(const t of r)if(I(e,t))return!0;return!1}return!1}async function Q(e,r,t=[],n=!1,s=null){return W(new Set,e,r,t,n,s)}async function W(e,r,t,n=[],s=!1,a=null){const u="string"==typeof r?F(r):r,o=[];return u&&(!1===T()&&(R(u)||s)&&o.push(D()),!1===O()&&(!0===u.isAsync||t)&&o.push(L()),!1===N()&&(H(u)||K(u,n))&&o.push(B())),o.length&&await Promise.all(o),await Y(e,u,a,t,s),!0}function X(e,r=[]){return void 0===e.usesModules&&d(e,r),!0===e.usesModules}async function Y(e,r,t=null,s=!1,a=!1){const i=m(r);null===t&&i.length>0&&(t=n.getDefault()),r.loadedModules={};for(const n of i){b(t);const i=t.normalizeModuleUri(n.source);if(e.has(i.uri))throw new u(null,o.CircularModules,null);e.add(i.uri);const c=await t.fetchModule(i);await W(e,c,s,[],a,t),e.delete(i.uri),c.isAsync&&(r.isAsync=!0),c.usesFeatureSet&&(r.usesFeatureSet=!0),c.usesGeometry&&(r.usesGeometry=!0),r.loadedModules[n.libname]={uri:i.uri,script:c}}}function Z(e){if(R(e))return!0;const r=y(e);let t=!1;for(let n=0;n<r.length;n++)if(w.has(r[n])){t=!0;break}return t}function ee(e,r){const t=null==r?null:new Set(r.map((e=>e.toLowerCase())));return f(e).some((({varId:e,memberId:r})=>"$view"===e&&(null==t||t.has(r))))}let re=null;function te(){return re}const ne=Object.freeze(Object.defineProperty({__proto__:null,_loadScriptDependenciesImpl:W,compileScript:x,enableAsyncSupport:L,enableAsyncSupportImpl:$,enableFeatureSetSupport:B,enableFeatureSetSupportImpl:V,enableGeometrySupport:D,enableGeometrySupportImpl:P,executeScript:G,extend:v,extractExpectedFieldLiterals:C,extractFieldLiterals:_,featureSetUtils:te,isAsyncEnabled:O,isFeatureSetSupportEnabled:N,isGeometryEnabled:T,loadDependentModules:Y,loadScriptDependencies:Q,parseAndExecuteScript:E,parseScript:F,referencesFunction:U,referencesMember:I,scriptIsAsync:J,scriptTouchesGeometry:Z,scriptUsesFeatureSet:H,scriptUsesGeometryEngine:R,scriptUsesModules:X,scriptUsesViewProperties:ee},Symbol.toStringTag,{value:"Module"}));export{Y as A,ee as B,W as _,C as a,D as b,x as c,B as d,G as e,te as f,R as g,ne as h,v as i,E as j,U as k,Q as l,_ as m,P as n,L as o,F as p,$ as q,I as r,Z as s,N as t,O as u,T as v,V as w,H as x,J as y,X as z};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import{areaUnitFromSpatialReference as e,convertUnit as r,getMetersPerUnitForSR as t}from"../core/unitUtils.js";import{fromGeometry as o,getSpatialReference as a}from"../geometry/operators/support/apiConverter.js";function n(n,s={}){const{unit:i}=s;let u=o(n).calculateArea2D();if(u&&i){const o=a(n);if(o.isGeographic)throw new Error("Unable to convert from an angular area unit to a linear area unit.");const s=e(o);s!==i&&(s?u=r(u,s,i):(u=Math.sqrt(u),u*=t(o),u**=2,u=r(u,"square-meters",i)))}return u}const s=!0,i=Object.freeze(Object.defineProperty({__proto__:null,execute:n,supportsCurves:s},Symbol.toStringTag,{value:"Module"}));export{i as a,n as e,s};
package/chunks/array.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{deepClone as n}from"../arcade/deepClone.js";import{ArcadeExecutionError as t,ExecutionErrorCodes as r}from"../arcade/executionError.js";import e from"../arcade/ImmutableArray.js";import{B as o,E as i,m as u,d as a,v as c,z as s,i as l,J as f,f as d}from"./languageUtils.js";import{isPromiseLike as h}from"../core/promiseUtils.js";import{isArray as w,isBoolean as g,isInteger as m}from"../support/guards.js";function F(F){function p(n,o,i){if(n instanceof e)return n.toArray();if(w(n))return n;throw new t(o,r.InvalidParameter,i)}function y(n,t){const r=n.length,e=Math.floor(r/2);return 0===r?[]:1===r?[n[0]]:v(y(n.slice(0,e),t),y(n.slice(e,r),t),t)}function v(n,t,r){const e=[];for(;n.length>0||t.length>0;)if(n.length>0&&t.length>0){let o=r(n[0],t[0]);isNaN(o)&&(o=0),o<=0?(e.push(n[0]),n=n.slice(1)):(e.push(t[0]),t=t.slice(1))}else n.length>0?(e.push(n[0]),n=n.slice(1)):t.length>0&&(e.push(t[0]),t=t.slice(1));return e}async function P(n,t){const r=n.length,e=Math.floor(r/2);if(0===r)return[];if(1===r)return[n[0]];const o=[await P(n.slice(0,e),t),await P(n.slice(e,r),t)];return I(o[0],o[1],t,[])}async function I(n,t,r,e){const o=e;if(n.length>0||t.length>0){if(n.length>0&&t.length>0){let i=await r(n[0],t[0]);return isNaN(i)&&(i=1),i<=0?(o.push(n[0]),n=n.slice(1)):(o.push(t[0]),t=t.slice(1)),I(n,t,r,e)}return n.length>0?(o.push(n[0]),I(n=n.slice(1),t,r,e)):(o.push(t[0]),I(n,t=t.slice(1),r,e))}return e}function N(n,e,i,a){o(i,1,2,n,e);let s=i[0];if(u(s)&&(s=s.toArray()),!1===w(s))throw new t(n,r.InvalidParameter,e);if(i.length>1){if(!1===l(i[1]))throw new t(n,r.InvalidParameter,e);let o=s;const u=i[1].createFunction(n);return a?P(o,u):(o=y(o,((n,t)=>u(n,t))),o)}let h=s;if(0===h.length)return[];const g={};for(let t=0;t<h.length;t++){const n=f(h[t]);""!==n&&(g[n]=!0)}if(!0===g.Array||!0===g.Dictionary||!0===g.Feature||!0===g.Point||!0===g.Polygon||!0===g.Polyline||!0===g.Multipoint||!0===g.Extent||!0===g.Function)return h.slice();let m=0,F="";for(const t in g)m++,F=t;return h=m>1||"String"===F?y(h,((n,t)=>{if(null==n||n===c)return null==t||t===c?0:1;if(null==t||t===c)return-1;const r=d(n),e=d(t);return r<e?-1:r===e?0:1})):"Number"===F?y(h,((n,t)=>n-t)):"Boolean"===F?y(h,((n,t)=>n===t?0:t?-1:1)):"Date"===F?y(h,((n,t)=>n.toNumber()-t.toNumber())):h.slice(),h}F.functions.array=function(e,c){return F.standardFunction(e,c,((s,l,f)=>{if(o(f,0,2,e,c),0===f.length)return[];if(1===f.length&&null===f[0])return[];if(w(f[0])){if(2===f.length&&!1===g(f[1]))throw new t(e,r.InvalidParameter,c);return!0===i(f[1],!1)?n(f[0]):f[0].slice()}if(u(f[0])){if(2===f.length&&!1===g(f[1]))throw new t(e,r.InvalidParameter,c);return!0===i(f[1],!1)?n(f[0]):f[0].toArray().slice()}const d=a(f[0]);if(isNaN(d)||!1===m(d))throw new t(e,r.InvalidParameter,c);const h=i(f[1],null),F=new Array(d);return F.fill(h),F}))},F.functions.front=function(n,e){return F.standardFunction(n,e,((i,a,c)=>{if(o(c,1,1,n,e),u(c[0])){if(c[0].length()<=0)throw new t(n,r.OutOfBounds,e);return c[0].get(0)}if(w(c[0])){if(c[0].length<=0)throw new t(n,r.OutOfBounds,e);return c[0][0]}throw new t(n,r.InvalidParameter,e)}))},F.functions.back=function(n,e){return F.standardFunction(n,e,((i,a,c)=>{if(o(c,1,1,n,e),u(c[0])){if(c[0].length()<=0)throw new t(n,r.OutOfBounds,e);return c[0].get(c[0].length()-1)}if(w(c[0])){if(c[0].length<=0)throw new t(n,r.OutOfBounds,e);return c[0][c[0].length-1]}throw new t(n,r.InvalidParameter,e)}))},F.functions.push=function(n,e){return F.standardFunction(n,e,((i,u,a)=>{if(o(a,1,2,n,e),w(a[0]))return a[0][a[0].length]=a[1],a[0].length;throw new t(n,r.InvalidParameter,e)}))},F.functions.pop=function(n,e){return F.standardFunction(n,e,((i,u,a)=>{if(o(a,1,1,n,e),w(a[0])){if(a[0].length<=0)throw new t(n,r.OutOfBounds,e);const o=a[0][a[0].length-1];return a[0].length=a[0].length-1,o}throw new t(n,r.InvalidParameter,e)}))},F.functions.erase=function(n,e){return F.standardFunction(n,e,((i,u,s)=>{if(o(s,2,2,n,e),w(s[0])){let o=a(s[1]);if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);const i=s[0];if(i.length<=0)throw new t(n,r.OutOfBounds,e);if(o<0&&(o=i.length+o),o<0)throw new t(n,r.OutOfBounds,e);if(o>=i.length)throw new t(n,r.OutOfBounds,e);return i.splice(o,1),c}throw new t(n,r.InvalidParameter,e)}))},F.functions.insert=function(n,e){return F.standardFunction(n,e,((i,u,s)=>{if(o(s,3,3,n,e),w(s[0])){const o=a(s[1]);if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);const i=s[2],u=s[0];if(o>u.length)throw new t(n,r.OutOfBounds,e);if(o<0&&o<-1*u.length)throw new t(n,r.OutOfBounds,e);return o===u.length?(u[o]=i,c):(u.splice(o,0,i),c)}throw new t(n,r.InvalidParameter,e)}))},F.functions.resize=function(n,e){return F.standardFunction(n,e,((u,s,l)=>{if(o(l,2,3,n,e),w(l[0])){const o=a(l[1]);if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);if(o<0)throw new t(n,r.InvalidParameter,e);const u=i(l[2],null),s=l[0];if(s.length>=o)return s.length=o,c;const f=s.length;s.length=o;for(let n=f;n<s.length;n++)s[n]=u;return c}throw new t(n,r.InvalidParameter,e)}))},F.functions.includes=function(n,e){return F.standardFunction(n,e,((i,a,c)=>{if(o(c,2,2,n,e),w(c[0])){const n=c[1];return!!c[0].some((t=>s(t,n)))}if(u(c[0])){const n=c[1];return!!c[0].toArray().some((t=>s(t,n)))}throw new t(n,r.InvalidParameter,e)}))},F.functions.slice=function(n,e){return F.standardFunction(n,e,((c,s,l)=>{if(o(l,1,3,n,e),w(l[0])){const o=a(i(l[1],0)),u=a(i(l[2],l[0].length));if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);if(isNaN(u)||!1===m(u))throw new t(n,r.InvalidParameter,e);return l[0].slice(o,u)}if(u(l[0])){const o=l[0],u=a(i(l[1],0)),c=a(i(l[2],o.length()));if(isNaN(u)||!1===m(u))throw new t(n,r.InvalidParameter,e);if(isNaN(c)||!1===m(c))throw new t(n,r.InvalidParameter,e);return o.toArray().slice(u,c)}throw new t(n,r.InvalidParameter,e)}))},F.functions.splice=function(n,t){return F.standardFunction(n,t,((n,t,r)=>{const e=[];for(let o=0;o<r.length;o++)w(r[o])?e.push(...r[o]):u(r[o])?e.push(...r[o].toArray()):e.push(r[o]);return e}))},F.functions.top=function(n,e){return F.standardFunction(n,e,((i,c,s)=>{if(o(s,2,2,n,e),w(s[0]))return a(s[1])>=s[0].length?s[0].slice():s[0].slice(0,a(s[1]));if(u(s[0]))return a(s[1])>=s[0].length()?s[0].slice():s[0].slice(0,a(s[1]));throw new t(n,r.InvalidParameter,e)}))},F.functions.first=function(n,t){return F.standardFunction(n,t,((r,e,i)=>(o(i,1,1,n,t),w(i[0])?0===i[0].length?null:i[0][0]:u(i[0])?0===i[0].length()?null:i[0].get(0):null)))},"sync"===F.mode&&(F.functions.sort=function(n,t){return F.standardFunction(n,t,((t,r,e)=>N(n,r,e,!1)))},F.functions.any=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=i(n);if(g(t)&&!0===t)return!0}return!1}))},F.functions.all=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){if(!0!==i(n))return!1}return!0}))},F.functions.none=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){if(!0===i(n))return!1}return!0}))},F.functions.reduce=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,3,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);return 2===e.length?0===u.length?null:u.reduce(((n,t)=>{const r=i(n,t);return n=void 0!==r&&r!==c?r:null})):u.reduce(((n,t)=>{const r=i(n,t);return n=void 0!==r&&r!==c?r:null}),e[2])}))},F.functions.map=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){const t=i(n);void 0!==t&&t!==c?a.push(t):a.push(null)}return a}))},F.functions.filter=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){!0===i(n)&&a.push(n)}return a}))}),"async"===F.mode&&(F.functions.sort=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>N(n,r,e,!0)))},F.functions.any=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=await i(n);let r=null;if(r=h(r)?await t:t,g(r)&&!0===r)return!0}return!1}))},F.functions.all=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=await i(n);let r=null;if(r=h(r)?await t:t,!0!==r)return!1}return!0}))},F.functions.none=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=await i(n);let r=null;if(r=h(r)?await t:t,!0===r)return!1}return!0}))},F.functions.filter=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){const t=await i(n);let r=null;r=h(r)?await t:t,!0===r&&a.push(n)}return a}))},F.functions.reduce=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,3,n,r);const u=e[1].createFunction(n),a=p(e[0],n,r);let s;if(e.length>2){const n=i(e[2],null);s=a.reduce((async(n,t)=>{let r=await n;return void 0!==r&&r!==c||(r=null),u(r,t)}),Promise.resolve(n))}else{if(0===a.length)return null;s=a.reduce((async(n,t,r)=>{if(r<=1)return u(n,t);let e=await n;return void 0!==e&&e!==c||(e=null),u(e,t)}))}return s.then((n=>void 0!==n&&n!==c?n:null))}))},F.functions.map=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){const t=await i(n);let r=null;r=h(r)?await t:t,void 0!==r&&r!==c?a.push(r):a.push(null)}return a}))})}const p=Object.freeze(Object.defineProperty({__proto__:null,registerFunctions:F},Symbol.toStringTag,{value:"Module"}));export{p as A,F as r};
5
+ import{deepClone as n}from"../arcade/deepClone.js";import{ArcadeExecutionError as t,ExecutionErrorCodes as r}from"../arcade/executionError.js";import e from"../arcade/ImmutableArray.js";import{B as o,G as i,m as u,d as a,v as c,z as s,i as l,J as f,f as d}from"./languageUtils.js";import{isPromiseLike as h}from"../core/promiseUtils.js";import{isArray as w,isBoolean as g,isInteger as m}from"../support/guards.js";function F(F){function p(n,o,i){if(n instanceof e)return n.toArray();if(w(n))return n;throw new t(o,r.InvalidParameter,i)}function y(n,t){const r=n.length,e=Math.floor(r/2);return 0===r?[]:1===r?[n[0]]:v(y(n.slice(0,e),t),y(n.slice(e,r),t),t)}function v(n,t,r){const e=[];for(;n.length>0||t.length>0;)if(n.length>0&&t.length>0){let o=r(n[0],t[0]);isNaN(o)&&(o=0),o<=0?(e.push(n[0]),n=n.slice(1)):(e.push(t[0]),t=t.slice(1))}else n.length>0?(e.push(n[0]),n=n.slice(1)):t.length>0&&(e.push(t[0]),t=t.slice(1));return e}async function P(n,t){const r=n.length,e=Math.floor(r/2);if(0===r)return[];if(1===r)return[n[0]];const o=[await P(n.slice(0,e),t),await P(n.slice(e,r),t)];return I(o[0],o[1],t,[])}async function I(n,t,r,e){const o=e;if(n.length>0||t.length>0){if(n.length>0&&t.length>0){let i=await r(n[0],t[0]);return isNaN(i)&&(i=1),i<=0?(o.push(n[0]),n=n.slice(1)):(o.push(t[0]),t=t.slice(1)),I(n,t,r,e)}return n.length>0?(o.push(n[0]),I(n=n.slice(1),t,r,e)):(o.push(t[0]),I(n,t=t.slice(1),r,e))}return e}function N(n,e,i,a){o(i,1,2,n,e);let s=i[0];if(u(s)&&(s=s.toArray()),!1===w(s))throw new t(n,r.InvalidParameter,e);if(i.length>1){if(!1===l(i[1]))throw new t(n,r.InvalidParameter,e);let o=s;const u=i[1].createFunction(n);return a?P(o,u):(o=y(o,((n,t)=>u(n,t))),o)}let h=s;if(0===h.length)return[];const g={};for(let t=0;t<h.length;t++){const n=f(h[t]);""!==n&&(g[n]=!0)}if(!0===g.Array||!0===g.Dictionary||!0===g.Feature||!0===g.Point||!0===g.Polygon||!0===g.Polyline||!0===g.Multipoint||!0===g.Extent||!0===g.Function)return h.slice();let m=0,F="";for(const t in g)m++,F=t;return h=m>1||"String"===F?y(h,((n,t)=>{if(null==n||n===c)return null==t||t===c?0:1;if(null==t||t===c)return-1;const r=d(n),e=d(t);return r<e?-1:r===e?0:1})):"Number"===F?y(h,((n,t)=>n-t)):"Boolean"===F?y(h,((n,t)=>n===t?0:t?-1:1)):"Date"===F?y(h,((n,t)=>n.toNumber()-t.toNumber())):h.slice(),h}F.functions.array=function(e,c){return F.standardFunction(e,c,((s,l,f)=>{if(o(f,0,2,e,c),0===f.length)return[];if(1===f.length&&null===f[0])return[];if(w(f[0])){if(2===f.length&&!1===g(f[1]))throw new t(e,r.InvalidParameter,c);return!0===i(f[1],!1)?n(f[0]):f[0].slice()}if(u(f[0])){if(2===f.length&&!1===g(f[1]))throw new t(e,r.InvalidParameter,c);return!0===i(f[1],!1)?n(f[0]):f[0].toArray().slice()}const d=a(f[0]);if(isNaN(d)||!1===m(d))throw new t(e,r.InvalidParameter,c);const h=i(f[1],null),F=new Array(d);return F.fill(h),F}))},F.functions.front=function(n,e){return F.standardFunction(n,e,((i,a,c)=>{if(o(c,1,1,n,e),u(c[0])){if(c[0].length()<=0)throw new t(n,r.OutOfBounds,e);return c[0].get(0)}if(w(c[0])){if(c[0].length<=0)throw new t(n,r.OutOfBounds,e);return c[0][0]}throw new t(n,r.InvalidParameter,e)}))},F.functions.back=function(n,e){return F.standardFunction(n,e,((i,a,c)=>{if(o(c,1,1,n,e),u(c[0])){if(c[0].length()<=0)throw new t(n,r.OutOfBounds,e);return c[0].get(c[0].length()-1)}if(w(c[0])){if(c[0].length<=0)throw new t(n,r.OutOfBounds,e);return c[0][c[0].length-1]}throw new t(n,r.InvalidParameter,e)}))},F.functions.push=function(n,e){return F.standardFunction(n,e,((i,u,a)=>{if(o(a,1,2,n,e),w(a[0]))return a[0][a[0].length]=a[1],a[0].length;throw new t(n,r.InvalidParameter,e)}))},F.functions.pop=function(n,e){return F.standardFunction(n,e,((i,u,a)=>{if(o(a,1,1,n,e),w(a[0])){if(a[0].length<=0)throw new t(n,r.OutOfBounds,e);const o=a[0][a[0].length-1];return a[0].length=a[0].length-1,o}throw new t(n,r.InvalidParameter,e)}))},F.functions.erase=function(n,e){return F.standardFunction(n,e,((i,u,s)=>{if(o(s,2,2,n,e),w(s[0])){let o=a(s[1]);if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);const i=s[0];if(i.length<=0)throw new t(n,r.OutOfBounds,e);if(o<0&&(o=i.length+o),o<0)throw new t(n,r.OutOfBounds,e);if(o>=i.length)throw new t(n,r.OutOfBounds,e);return i.splice(o,1),c}throw new t(n,r.InvalidParameter,e)}))},F.functions.insert=function(n,e){return F.standardFunction(n,e,((i,u,s)=>{if(o(s,3,3,n,e),w(s[0])){const o=a(s[1]);if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);const i=s[2],u=s[0];if(o>u.length)throw new t(n,r.OutOfBounds,e);if(o<0&&o<-1*u.length)throw new t(n,r.OutOfBounds,e);return o===u.length?(u[o]=i,c):(u.splice(o,0,i),c)}throw new t(n,r.InvalidParameter,e)}))},F.functions.resize=function(n,e){return F.standardFunction(n,e,((u,s,l)=>{if(o(l,2,3,n,e),w(l[0])){const o=a(l[1]);if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);if(o<0)throw new t(n,r.InvalidParameter,e);const u=i(l[2],null),s=l[0];if(s.length>=o)return s.length=o,c;const f=s.length;s.length=o;for(let n=f;n<s.length;n++)s[n]=u;return c}throw new t(n,r.InvalidParameter,e)}))},F.functions.includes=function(n,e){return F.standardFunction(n,e,((i,a,c)=>{if(o(c,2,2,n,e),w(c[0])){const n=c[1];return!!c[0].some((t=>s(t,n)))}if(u(c[0])){const n=c[1];return!!c[0].toArray().some((t=>s(t,n)))}throw new t(n,r.InvalidParameter,e)}))},F.functions.slice=function(n,e){return F.standardFunction(n,e,((c,s,l)=>{if(o(l,1,3,n,e),w(l[0])){const o=a(i(l[1],0)),u=a(i(l[2],l[0].length));if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);if(isNaN(u)||!1===m(u))throw new t(n,r.InvalidParameter,e);return l[0].slice(o,u)}if(u(l[0])){const o=l[0],u=a(i(l[1],0)),c=a(i(l[2],o.length()));if(isNaN(u)||!1===m(u))throw new t(n,r.InvalidParameter,e);if(isNaN(c)||!1===m(c))throw new t(n,r.InvalidParameter,e);return o.toArray().slice(u,c)}throw new t(n,r.InvalidParameter,e)}))},F.functions.splice=function(n,t){return F.standardFunction(n,t,((n,t,r)=>{const e=[];for(let o=0;o<r.length;o++)w(r[o])?e.push(...r[o]):u(r[o])?e.push(...r[o].toArray()):e.push(r[o]);return e}))},F.functions.top=function(n,e){return F.standardFunction(n,e,((i,c,s)=>{if(o(s,2,2,n,e),w(s[0]))return a(s[1])>=s[0].length?s[0].slice():s[0].slice(0,a(s[1]));if(u(s[0]))return a(s[1])>=s[0].length()?s[0].slice():s[0].slice(0,a(s[1]));throw new t(n,r.InvalidParameter,e)}))},F.functions.first=function(n,t){return F.standardFunction(n,t,((r,e,i)=>(o(i,1,1,n,t),w(i[0])?0===i[0].length?null:i[0][0]:u(i[0])?0===i[0].length()?null:i[0].get(0):null)))},"sync"===F.mode&&(F.functions.sort=function(n,t){return F.standardFunction(n,t,((t,r,e)=>N(n,r,e,!1)))},F.functions.any=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=i(n);if(g(t)&&!0===t)return!0}return!1}))},F.functions.all=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){if(!0!==i(n))return!1}return!0}))},F.functions.none=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){if(!0===i(n))return!1}return!0}))},F.functions.reduce=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,3,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);return 2===e.length?0===u.length?null:u.reduce(((n,t)=>{const r=i(n,t);return n=void 0!==r&&r!==c?r:null})):u.reduce(((n,t)=>{const r=i(n,t);return n=void 0!==r&&r!==c?r:null}),e[2])}))},F.functions.map=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){const t=i(n);void 0!==t&&t!==c?a.push(t):a.push(null)}return a}))},F.functions.filter=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){!0===i(n)&&a.push(n)}return a}))}),"async"===F.mode&&(F.functions.sort=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>N(n,r,e,!0)))},F.functions.any=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=await i(n);let r=null;if(r=h(r)?await t:t,g(r)&&!0===r)return!0}return!1}))},F.functions.all=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=await i(n);let r=null;if(r=h(r)?await t:t,!0!==r)return!1}return!0}))},F.functions.none=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=await i(n);let r=null;if(r=h(r)?await t:t,!0===r)return!1}return!0}))},F.functions.filter=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){const t=await i(n);let r=null;r=h(r)?await t:t,!0===r&&a.push(n)}return a}))},F.functions.reduce=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,3,n,r);const u=e[1].createFunction(n),a=p(e[0],n,r);let s;if(e.length>2){const n=i(e[2],null);s=a.reduce((async(n,t)=>{let r=await n;return void 0!==r&&r!==c||(r=null),u(r,t)}),Promise.resolve(n))}else{if(0===a.length)return null;s=a.reduce((async(n,t,r)=>{if(r<=1)return u(n,t);let e=await n;return void 0!==e&&e!==c||(e=null),u(e,t)}))}return s.then((n=>void 0!==n&&n!==c?n:null))}))},F.functions.map=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){const t=await i(n);let r=null;r=h(r)?await t:t,void 0!==r&&r!==c?a.push(r):a.push(null)}return a}))})}const p=Object.freeze(Object.defineProperty({__proto__:null,registerFunctions:F},Symbol.toStringTag,{value:"Module"}));export{p as A,F as r};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import{isSome as e}from"../core/arrayUtils.js";import{convertToSpatialReferenceUnit as r}from"../core/unitUtils.js";import{supportsCurves as t,execute as o,executeManyEx as s}from"../geometry/operators/gx/operatorBuffer.js";import{getSpatialReference as a,toGeometry as n,fromSpatialReference as u,fromGeometry as i}from"../geometry/operators/support/apiConverter.js";function p(e,t,s={}){const{unit:p}=s,m=a(e);return p&&(t=r(t,p,m)),n(o(i(e),u(m),t),m)}function m(t,o,p={}){let{maxDeviation:m=NaN,maxVerticesInFullCircle:c=96,union:l=!1,unit:f}=p;const x=a(t);f&&(o=o.map((e=>r(e,f,x))),m&&(m=r(m,f,x)));const j=t.map(i);return s(j,u(x),o,m,c,l).map((e=>n(e,x))).filter(e)}const c=t(),l=Object.freeze(Object.defineProperty({__proto__:null,execute:p,executeMany:m,supportsCurves:c},Symbol.toStringTag,{value:"Module"}));export{m as a,l as b,p as e,c as s};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import{c as e}from"./Centroid-DZi-eb9F.js";import{fromGeometry as r,toPoint as t,getSpatialReference as o}from"../geometry/operators/support/apiConverter.js";class s{getOperatorType(){return 10205}accelerateGeometry(e,r,t){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(r,t){return e(r)}}const u=new s;function n(e){const s=u.execute(r(e),null);return t(s,o(e))}const c=u.supportsCurves(),p=Object.freeze(Object.defineProperty({__proto__:null,execute:n,supportsCurves:c},Symbol.toStringTag,{value:"Module"}));export{p as c,n as e,c as s};