@arcgis/core 4.32.0-next.20241021 → 4.32.0-next.20241023

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 (257) hide show
  1. package/applications/MapViewer/templateUtils.d.ts +4 -0
  2. package/applications/MapViewer/templateUtils.js +5 -0
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/0b7ee57bec7ffac312f2.js +1 -0
  5. package/assets/esri/core/workers/chunks/{1ba1d9c867ec6a492af9.js → 0f3912bca9fe25eea75c.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{842ebde78db9bfcaf07b.js → 1678d1d0ecb9b2af69a8.js} +1 -1
  7. package/assets/esri/core/workers/chunks/1d16ca7791f64dd7c7fb.js +1 -0
  8. package/assets/esri/core/workers/chunks/1d4be734ff961e313257.js +1 -0
  9. package/assets/esri/core/workers/chunks/{b292758308dfac4ba8ee.js → 2d8aa31dc96bbd014036.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{53f648321c5fde26bfe4.js → 319e06888467f9f460ab.js} +1 -1
  11. package/assets/esri/core/workers/chunks/33cae7ece52a77394b05.js +1 -0
  12. package/assets/esri/core/workers/chunks/{210a954f5299fe105e0b.js → 539060ffb7f230fb1bd0.js} +1 -1
  13. package/assets/esri/core/workers/chunks/545441dcc8e915e63ff1.js +1 -0
  14. package/assets/esri/core/workers/chunks/{303f39b9b7bd33109df8.js → 587df97288a83721d251.js} +1 -1
  15. package/assets/esri/core/workers/chunks/5caa02a7a85d05e253b4.js +1 -0
  16. package/assets/esri/core/workers/chunks/5cfecb320e1dcd258b2e.js +1 -0
  17. package/assets/esri/core/workers/chunks/67018ef25736f0722f6e.js +1 -0
  18. package/assets/esri/core/workers/chunks/89f74819ac1b5884c149.js +1 -0
  19. package/assets/esri/core/workers/chunks/92b2d81ef16877341f97.js +1 -0
  20. package/assets/esri/core/workers/chunks/{e6e77cbdeb99d90caad1.js → 97f62fad6d416a666319.js} +1 -1
  21. package/assets/esri/core/workers/chunks/98c1956b2e27058c8a51.js +1 -0
  22. package/assets/esri/core/workers/chunks/9c8a910b6261a4d5da77.js +1 -0
  23. package/assets/esri/core/workers/chunks/ab6eaa3ae2e233f91a5e.js +1 -0
  24. package/assets/esri/core/workers/chunks/{63719f892a7d1025c7d3.js → b42c1ab7579a3c464f72.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{03eba36affe6ed1f5a11.js → bc4ef18d0a02354186e3.js} +7 -7
  26. package/assets/esri/core/workers/chunks/{c71304c88fce556340ef.js → c859f73b57a764e99b02.js} +1 -1
  27. package/assets/esri/core/workers/chunks/cb3038ec3ef0d86bf2a0.js +1 -0
  28. package/assets/esri/core/workers/chunks/{ae20ca2008a2ea6a46b2.js → d8f4bd2b4366388f8a28.js} +1 -1
  29. package/assets/esri/core/workers/chunks/e71fa25ed45bae5a1adb.js +320 -0
  30. package/assets/esri/core/workers/chunks/{9c9a8a529494c6d1dfa3.js → ec9d5af8887854e821c8.js} +1 -1
  31. package/assets/esri/libs/parquet/pkg/arcgis_parquet_bg.wasm +0 -0
  32. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +14 -0
  33. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +1 -1
  34. package/assets/esri/themes/dark/main.css +1 -1
  35. package/assets/esri/themes/light/main.css +1 -1
  36. package/assets/esri/themes/light/view.css +1 -1
  37. package/chunks/Bufferer-BhkgvSV4.js +5 -0
  38. package/chunks/{Distance2DCalculator-DM4OojiI.js → Distance2DCalculator-BX0Ep7eP.js} +1 -1
  39. package/chunks/{GeodeticDistanceCalculator-DzvUOSaR.js → GeodeticDistanceCalculator-B5uO-Y_z.js} +1 -1
  40. package/chunks/OperatorCrosses.js +5 -0
  41. package/chunks/OperatorCut.js +1 -1
  42. package/chunks/OperatorGeodesicBuffer.js +1 -1
  43. package/chunks/OperatorGeodeticArea.js +1 -1
  44. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  45. package/chunks/OperatorGeodeticDistance.js +1 -1
  46. package/chunks/OperatorGeodeticLength.js +1 -1
  47. package/chunks/OperatorIntersects.js +5 -0
  48. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  49. package/chunks/OperatorOverlaps.js +5 -0
  50. package/chunks/OperatorProximity.js +1 -1
  51. package/chunks/OperatorProximityGeodesic.js +1 -1
  52. package/chunks/OperatorShapePreservingLength.js +1 -1
  53. package/chunks/OperatorTouches.js +5 -0
  54. package/chunks/OperatorWithin.js +5 -0
  55. package/chunks/QuadraticBezier.js +1 -1
  56. package/chunks/SSAOBlur.glsl.js +5 -5
  57. package/chunks/SideCalculator2D-CoWc8Oe3.js +1 -1
  58. package/chunks/Transformation2D.js +1 -1
  59. package/core/MemCache.js +1 -1
  60. package/core/MemCachePool.js +1 -1
  61. package/core/unitUtils.js +1 -1
  62. package/geometry/Mesh.js +1 -1
  63. package/geometry/operators/affineTransformOperator.js +1 -1
  64. package/geometry/operators/alphaShapeOperator.js +1 -1
  65. package/geometry/operators/areaOperator.js +1 -1
  66. package/geometry/operators/autoCompleteOperator.js +1 -1
  67. package/geometry/operators/boundaryOperator.js +1 -1
  68. package/geometry/operators/bufferOperator.js +1 -1
  69. package/geometry/operators/centroidOperator.js +1 -1
  70. package/geometry/operators/clipOperator.js +1 -1
  71. package/geometry/operators/containsOperator.js +1 -1
  72. package/geometry/operators/convexHullOperator.js +1 -1
  73. package/geometry/operators/crossesOperator.js +1 -1
  74. package/geometry/operators/cutOperator.js +1 -1
  75. package/geometry/operators/densifyOperator.js +1 -1
  76. package/geometry/operators/differenceOperator.js +1 -1
  77. package/geometry/operators/disjointOperator.js +1 -1
  78. package/geometry/operators/distanceOperator.js +1 -1
  79. package/geometry/operators/equalsOperator.js +1 -1
  80. package/geometry/operators/extendOperator.js +1 -1
  81. package/geometry/operators/generalizeOperator.js +1 -1
  82. package/geometry/operators/geodesicBufferOperator.js +1 -1
  83. package/geometry/operators/geodesicProximityOperator.js +1 -1
  84. package/geometry/operators/geodeticAreaOperator.js +1 -1
  85. package/geometry/operators/geodeticDensifyOperator.js +1 -1
  86. package/geometry/operators/geodeticDistanceOperator.js +1 -1
  87. package/geometry/operators/geodeticLengthOperator.js +1 -1
  88. package/geometry/operators/graphicBufferOperator.js +1 -1
  89. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  90. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  91. package/geometry/operators/gx/operatorBoundary.js +1 -1
  92. package/geometry/operators/gx/operatorBuffer.js +1 -1
  93. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  94. package/geometry/operators/gx/operatorDifference.js +1 -1
  95. package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
  96. package/geometry/operators/gx/operatorGeodeticArea.js +1 -1
  97. package/geometry/operators/gx/operatorGeodeticDensify.js +1 -1
  98. package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
  99. package/geometry/operators/gx/operatorGeodeticLength.js +1 -1
  100. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  101. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  102. package/geometry/operators/gx/operatorIntersection.js +1 -1
  103. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  104. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  105. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  106. package/geometry/operators/gx/operatorOffset.js +1 -1
  107. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  108. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  109. package/geometry/operators/gx/operatorProject.js +1 -1
  110. package/geometry/operators/gx/operatorProximityGeodesic.js +1 -1
  111. package/geometry/operators/gx/operatorSimplify.js +1 -1
  112. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  113. package/geometry/operators/gx/operatorUnion.js +1 -1
  114. package/geometry/operators/integrateOperator.js +1 -1
  115. package/geometry/operators/intersectionOperator.js +1 -1
  116. package/geometry/operators/intersectsOperator.js +1 -1
  117. package/geometry/operators/isNearOperator.js +1 -1
  118. package/geometry/operators/json/containsOperator.js +5 -0
  119. package/geometry/operators/json/crossesOperator.js +5 -0
  120. package/geometry/operators/json/disjointOperator.js +5 -0
  121. package/geometry/operators/json/intersectsOperator.js +5 -0
  122. package/geometry/operators/json/offsetOperator.js +5 -0
  123. package/geometry/operators/json/overlapsOperator.js +5 -0
  124. package/geometry/operators/json/touchesOperator.js +5 -0
  125. package/geometry/operators/json/withinOperator.js +5 -0
  126. package/geometry/operators/labelPointOperator.js +1 -1
  127. package/geometry/operators/lengthOperator.js +1 -1
  128. package/geometry/operators/linesToPolygonsOperator.js +1 -1
  129. package/geometry/operators/locateBetweenOperator.js +1 -1
  130. package/geometry/operators/minimumBoundingCircleOperator.js +1 -1
  131. package/geometry/operators/multiPartToSinglePartOperator.js +1 -1
  132. package/geometry/operators/offsetOperator.js +1 -1
  133. package/geometry/operators/overlapsOperator.js +1 -1
  134. package/geometry/operators/polygonOverlayOperator.js +1 -1
  135. package/geometry/operators/polygonSlicerOperator.js +1 -1
  136. package/geometry/operators/projectOperator.js +1 -1
  137. package/geometry/operators/proximityOperator.js +1 -1
  138. package/geometry/operators/relateOperator.js +1 -1
  139. package/geometry/operators/reshapeOperator.js +1 -1
  140. package/geometry/operators/simplifyOperator.js +1 -1
  141. package/geometry/operators/singlePartToMultiPartOperator.js +1 -1
  142. package/geometry/operators/support/apiConverter.js +5 -0
  143. package/geometry/operators/support/initNoPeFactory.js +5 -0
  144. package/geometry/operators/support/jsonConverter.js +5 -0
  145. package/geometry/operators/support/proximityResult.js +1 -1
  146. package/geometry/operators/symmetricDifferenceOperator.js +1 -1
  147. package/geometry/operators/touchesOperator.js +1 -1
  148. package/geometry/operators/unionOperator.js +1 -1
  149. package/geometry/operators/withinOperator.js +1 -1
  150. package/geometry/support/MeshVertexAttributes.js +1 -1
  151. package/interfaces.d.ts +134 -0
  152. package/layers/LinkChartLayer.js +1 -1
  153. package/layers/SceneLayer.js +1 -1
  154. package/layers/graphics/OptimizedGeometry.js +1 -1
  155. package/layers/graphics/sources/ParquetSource.js +1 -1
  156. package/layers/knowledgeGraph/supportUtils.js +1 -1
  157. package/layers/support/ElevationQueryTileCache.js +1 -1
  158. package/layers/support/ElevationTileData.js +1 -1
  159. package/layers/support/mediaUtils.js +1 -1
  160. package/layers/support/parquetLayerUtils.js +1 -1
  161. package/layers/support/rasterFunctions/ClipFunction.js +1 -1
  162. package/layers/support/rasterFunctions/clipUtils.js +1 -1
  163. package/layers/support/rasterFunctions/localUtils.js +1 -1
  164. package/libs/parquet/parquet.js +1 -1
  165. package/linkChart/LinkChartProperties.js +1 -1
  166. package/package.json +1 -1
  167. package/smartMapping/raster/renderers/classBreaks.js +1 -1
  168. package/smartMapping/raster/renderers/rgb.js +1 -1
  169. package/smartMapping/raster/renderers/stretch.js +1 -1
  170. package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
  171. package/smartMapping/raster/support/adapters/RasterLayerAdapter.js +1 -1
  172. package/smartMapping/renderers/support/rendererUtils.d.ts +4 -0
  173. package/support/revision.js +1 -1
  174. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  175. package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
  176. package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
  177. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  178. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  179. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
  180. package/views/2d/grid/GridView2D.js +1 -1
  181. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  182. package/views/2d/layers/MediaLayerView2D.js +1 -1
  183. package/views/2d/layers/TileLayerView2D.js +1 -1
  184. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  185. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  186. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  187. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  188. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  189. package/views/3d/glTF/loader.js +1 -1
  190. package/views/3d/layers/I3SMeshView3D.js +1 -1
  191. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  192. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  193. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  194. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  195. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  196. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  197. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  198. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  199. package/views/3d/layers/i3s/CachedMeshData.js +5 -0
  200. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  201. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  202. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  203. package/views/3d/layers/support/FeatureTile.js +1 -1
  204. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  205. package/views/3d/state/ViewStateManager.js +1 -1
  206. package/views/3d/state/controllers/FovController.js +1 -1
  207. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  208. package/views/3d/terrain/Tile.js +1 -1
  209. package/views/3d/terrain/TileTexture.js +1 -1
  210. package/views/3d/webgl/ManagedFBO.js +1 -1
  211. package/views/3d/webgl/ManagedFBOAttachment.js +1 -1
  212. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  213. package/views/3d/webgl-engine/core/FBOPool.js +1 -1
  214. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
  215. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  216. package/views/3d/webgl-engine/materials/ProceduralTextureRepository.js +1 -1
  217. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  218. package/views/3d/webgl-engine/shaders/SSAOBlur.glsl.js +1 -1
  219. package/views/input/BrowserEventSource.js +1 -1
  220. package/views/webgl/Texture.js +1 -1
  221. package/views/webgl/VertexArrayObject.js +1 -1
  222. package/webdoc/support/webdocSaveUtils.js +1 -1
  223. package/widgets/Attribution/AttributionViewModel.js +1 -1
  224. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  225. package/widgets/BatchAttributeForm/css.js +1 -1
  226. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  227. package/widgets/BatchAttributeForm.js +1 -1
  228. package/widgets/ElevationProfile/support/ElevationProfileView2D.js +1 -1
  229. package/widgets/ElevationProfile/support/ProfileLine2D.js +5 -0
  230. package/widgets/ElevationProfile/support/ProfileLines3D.js +1 -1
  231. package/widgets/ElevationProfile/support/constants.js +1 -1
  232. package/widgets/ElevationProfile/support/visualizationUtils.js +5 -0
  233. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  234. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  235. package/widgets/FeatureTable/support/columnUtils.js +1 -1
  236. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  237. package/widgets/FeatureTable/support/templateUtils.js +5 -0
  238. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  239. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  240. package/widgets/support/GridControls.js +1 -1
  241. package/assets/esri/core/workers/chunks/03d0394fff1463c224f9.js +0 -1
  242. package/assets/esri/core/workers/chunks/0c40cac18711f79f0a7d.js +0 -1
  243. package/assets/esri/core/workers/chunks/1a97f98facfc62a9fc69.js +0 -1
  244. package/assets/esri/core/workers/chunks/1e3ed3ee48c2977cff6f.js +0 -1
  245. package/assets/esri/core/workers/chunks/1fc064e37d030e449d5e.js +0 -1
  246. package/assets/esri/core/workers/chunks/4daab36de5efa03a8cbb.js +0 -1
  247. package/assets/esri/core/workers/chunks/77d129134c2a66cd86d8.js +0 -1
  248. package/assets/esri/core/workers/chunks/88bd9e023764da377aa7.js +0 -1
  249. package/assets/esri/core/workers/chunks/92ce57cb12d9a7a3699e.js +0 -1
  250. package/assets/esri/core/workers/chunks/a5675c989d00b7400f98.js +0 -1
  251. package/assets/esri/core/workers/chunks/c06c5c815b5e37717fa1.js +0 -1
  252. package/assets/esri/core/workers/chunks/ca1385e165aae8a32ca2.js +0 -1
  253. package/assets/esri/core/workers/chunks/ce8c1208916f54af7e68.js +0 -320
  254. package/assets/esri/core/workers/chunks/df51c93b2dbcc89efc23.js +0 -1
  255. package/assets/esri/core/workers/chunks/efa3c919261672871f2f.js +0 -1
  256. package/chunks/Bufferer-fr1_Nc47.js +0 -5
  257. package/geometry/operators/support/converterAPI.js +0 -5
@@ -2,27 +2,27 @@
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{j as e}from"./vec32.js";import{ScreenSpacePass as r}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepth as o}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{Float2DrawUniform as t}from"../views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js";import{FloatPassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as l}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as n}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DDrawUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as d}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";const i=4;function f(){const f=new n,u=f.fragment;f.include(r);const c=(i+1)/2,p=1/(2*c*c);return u.include(o),u.uniforms.add(new d("depthMap",(e=>e.depthTexture)),new s("tex",(e=>e.colorTexture)),new t("blurSize",(e=>e.blurSize)),new a("projScale",((r,o)=>{const t=e(o.camera.eye,o.camera.center);return t>5e4?Math.max(0,r.projScale-(t-5e4)):r.projScale}))),u.code.add(l`
5
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepth as r}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{Float2DrawUniform as o}from"../views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js";import{FloatPassUniform as t}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as a}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as l}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DDrawUniform as n}from"../views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js";import{Texture2DPassUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";const d=4;function i(){const i=new l,f=i.fragment;i.include(e);const u=(d+1)/2,c=1/(2*u*u);return f.include(r),f.uniforms.add(new s("depthMap",(e=>e.depthTexture)),new n("tex",(e=>e.colorTexture)),new o("blurSize",(e=>e.blurSize)),new t("projScale",((e,r)=>{const o=r.camera.distance;return o>5e4?Math.max(0,e.projScale-(o-5e4)):e.projScale}))),f.code.add(a`
6
6
  void blurFunction(vec2 uv, float r, float center_d, float sharpness, inout float wTotal, inout float bTotal) {
7
7
  float c = texture(tex, uv).r;
8
8
  float d = linearDepthFromTexture(depthMap, uv);
9
9
 
10
10
  float ddiff = d - center_d;
11
11
 
12
- float w = exp(-r * r * ${l.float(p)} - ddiff * ddiff * sharpness);
12
+ float w = exp(-r * r * ${a.float(c)} - ddiff * ddiff * sharpness);
13
13
  wTotal += w;
14
14
  bTotal += w * c;
15
15
  }
16
- `),f.outputs.add("fragBlur","float"),u.main.add(l`
16
+ `),i.outputs.add("fragBlur","float"),f.main.add(a`
17
17
  float b = 0.0;
18
18
  float w_total = 0.0;
19
19
 
20
20
  float center_d = linearDepthFromTexture(depthMap, uv);
21
21
 
22
22
  float sharpness = -0.05 * projScale / center_d;
23
- for (int r = -${l.int(i)}; r <= ${l.int(i)}; ++r) {
23
+ for (int r = -${a.int(d)}; r <= ${a.int(d)}; ++r) {
24
24
  float rf = float(r);
25
25
  vec2 uvOffset = uv + rf * blurSize;
26
26
  blurFunction(uvOffset, rf, center_d, sharpness, w_total, b);
27
27
  }
28
- fragBlur = b / w_total;`),f}const u=Object.freeze(Object.defineProperty({__proto__:null,build:f},Symbol.toStringTag,{value:"Module"}));export{u as S,f as b};
28
+ fragBlur = b / w_total;`),i}const f=Object.freeze(Object.defineProperty({__proto__:null,build:i},Symbol.toStringTag,{value:"Module"}));export{f as S,i as b};
@@ -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{P as e}from"./Transformation2D.js";import{c as t,G as n,t as r,g as o}from"./Geometry.js";import{t as i,q as s}from"./QuadraticBezier.js";const u=a(new e,-1,Number.NaN);function a(e,t,n){return{m_coordinate:e.clone(),m_vertexIndex:t,m_geometryIndex:0,m_distance:n,m_bRightSide:!1,isEmpty:c}}function c(){return Number.isNaN(this.m_distance)}function g(e,r,o=-1,s=-1){if(e.isEmpty())return 3;const u=e.getGeometryType();if(t(u))return m(e,r,o,s);if(u===n.enumPolygon)return f(e,r,o,s);if(u===n.enumPolyline)return x(e,r,o,s);if(u===n.enumEnvelope){const t=new i;return e.queryEnvelope(t),t.contains(r)?t.containsExclusive(r)?1:2:0}return 3}function m(t,n,o,i){if(o>=0||i>=0)return r("");if(t.isDegenerate(0))return t.getStartXY().equals(n)?2:3;if(!t.isCurve()){const r=e.orientationRobust(n,t.getStartXY(),t.getEndXY());return r<0?1:r>0?0:2}const s=t.getClosestCoordinate(n,!1),u=t.getTangent(s),a=t.getCoord2D(s),c=e.orientationRobust(n,a,a.add(u));return c<0?1:c>0?0:2}function f(e,t,n,o){(n>=0||o>=0)&&r("");const u=new i;e.queryEnvelope(u);const a=s(e,t,0);return 0===a?0:1===a?1:2}function x(t,n,o,i){(o<0&&i>=0||o>=0&&i<0)&&r("");const s=t.querySegmentIterator();if(o<0){let t=Number.MAX_VALUE,r=0;for(;s.nextPath();)for(;s.hasNextSegment();){const u=s.nextSegment(),a=u.getClosestCoordinate(n,!1),c=u.getCoord2D(a),g=e.sqrDistance(c,n);g<t?(r=1,o=s.getStartPointIndex(),i=s.getPathIndex(),t=g):g===t&&r++}if(0===r)return 3;if(1===r){s.resetToVertex(o,i);return g(s.nextSegment(),n)}}const u=d();if(-1!==u.i1&&-1===u.i2)return u.bRight1?1:0;if(-1!==u.i1&&-1!==u.i2){if(u.bRight1===u.bRight2)return u.bRight1?1:0;{s.resetToVertex(u.i1,-1);const e=s.nextSegment().getTangent(1);s.resetToVertex(u.i2,-1);const t=s.nextSegment().getTangent(0);return e.crossProduct(t)>=0?1:0}}s.resetToVertex(o,i);return g(s.nextSegment(),n)}function d(e,t,n,r){return o(0),{}}export{g as c,u as e,a as m};
5
+ import{P as e}from"./Transformation2D.js";import{c as t,G as n,t as r,g as o}from"./Geometry.js";import{v as i,t as s}from"./QuadraticBezier.js";const u=a(new e,-1,Number.NaN);function a(e,t,n){return{m_coordinate:e.clone(),m_vertexIndex:t,m_geometryIndex:0,m_distance:n,m_bRightSide:!1,isEmpty:c}}function c(){return Number.isNaN(this.m_distance)}function g(e,r,o=-1,s=-1){if(e.isEmpty())return 3;const u=e.getGeometryType();if(t(u))return m(e,r,o,s);if(u===n.enumPolygon)return f(e,r,o,s);if(u===n.enumPolyline)return x(e,r,o,s);if(u===n.enumEnvelope){const t=new i;return e.queryEnvelope(t),t.contains(r)?t.containsExclusive(r)?1:2:0}return 3}function m(t,n,o,i){if(o>=0||i>=0)return r("");if(t.isDegenerate(0))return t.getStartXY().equals(n)?2:3;if(!t.isCurve()){const r=e.orientationRobust(n,t.getStartXY(),t.getEndXY());return r<0?1:r>0?0:2}const s=t.getClosestCoordinate(n,!1),u=t.getTangent(s),a=t.getCoord2D(s),c=e.orientationRobust(n,a,a.add(u));return c<0?1:c>0?0:2}function f(e,t,n,o){(n>=0||o>=0)&&r("");const u=new i;e.queryEnvelope(u);const a=s(e,t,0);return 0===a?0:1===a?1:2}function x(t,n,o,i){(o<0&&i>=0||o>=0&&i<0)&&r("");const s=t.querySegmentIterator();if(o<0){let t=Number.MAX_VALUE,r=0;for(;s.nextPath();)for(;s.hasNextSegment();){const u=s.nextSegment(),a=u.getClosestCoordinate(n,!1),c=u.getCoord2D(a),g=e.sqrDistance(c,n);g<t?(r=1,o=s.getStartPointIndex(),i=s.getPathIndex(),t=g):g===t&&r++}if(0===r)return 3;if(1===r){s.resetToVertex(o,i);return g(s.nextSegment(),n)}}const u=d();if(-1!==u.i1&&-1===u.i2)return u.bRight1?1:0;if(-1!==u.i1&&-1!==u.i2){if(u.bRight1===u.bRight2)return u.bRight1?1:0;{s.resetToVertex(u.i1,-1);const e=s.nextSegment().getTangent(1);s.resetToVertex(u.i2,-1);const t=s.nextSegment().getTangent(0);return e.crossProduct(t)>=0?1:0}}s.resetToVertex(o,i);return g(s.nextSegment(),n)}function d(e,t,n,r){return o(0),{}}export{g as c,u as e,a as m};
@@ -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{g as t,d as s,p as i,t as e,q as r}from"./Geometry.js";class n{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(){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])}addKahan(s){t(0)}subKahan(s){t(0)}mulKahan(s){t(0)}mul(t){const s=new n(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}meKahan(t){return this.subKahan(t),this}peKahan(t){return this.addKahan(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(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 es(this.vmin,t)&&es(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 t(0),!0}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(s){return t(0),!0}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(s){t(0)}normalize(){this.vmin<=this.vmax||(this.vmin>this.vmax?this.vmax=Ct(this.vmin,this.vmin=this.vmax):this.setEmpty())}isValid(){return this.isEmpty()||this.vmin<=this.vmax}snapClip(t){return zs(t,this.vmin,this.vmax)}calculateToleranceFromEnvelope(){if(this.isEmpty())return Is();return(Math.abs(this.vmin)+Math.abs(this.vmax)+1)*Is()}static unit(){return w}normalizeNoNAN(){this.vmin>this.vmax&&(this.vmax=Ct(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 w=new _(0,1);class N{static getNAN(){return new N(Number.NaN)}constructor(t,s){this.m_value=t??0,this.m_eps=s??0}[Symbol.toPrimitive](t){return this}clone(){return new N(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=N.ulp(t)*s,this}setE(t){return this.m_value=t.m_value,this.m_eps=t.m_eps,this}precise(){return new N(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+N.ulp(s);return this.m_value=s,this.m_eps=i,this}addThis(t){const s=this.m_value+t,i=this.m_eps+N.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+N.ulp(s);return this.m_value=s,this.m_eps=i,this}subThis(t){const s=this.m_value-t,i=this.m_eps+N.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+N.ulp(this.m_value),this}setAdd(t,s){return this.m_value=t+s,this.m_eps=N.ulp(this.m_value),this}setAddEN(t,s){return this.m_value=t.m_value+s,this.m_eps=t.m_eps+N.ulp(this.m_value),this}setAddNE(t,s){return this.m_value=t+s.m_value,this.m_eps=s.m_eps+N.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+N.ulp(this.m_value),this}setSub(t,s){return this.m_value=t-s,this.m_eps=N.ulp(this.m_value),this}setSubEN(t,s){return this.m_value=t.m_value-s,this.m_eps=t.m_eps+N.ulp(this.m_value),this}setSubNE(t,s){return this.m_value=t-s.m_value,this.m_eps=s.m_eps+N.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+N.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)+N.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+N.ulp(i),this.m_value=i,this}setMul(t,s){return this.m_value=t*s,this.m_eps=N.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 N(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+N.ulp(i),this}divThis(t){const s=Math.abs(t);return this.m_value/=t,this.m_eps=this.m_eps/s+N.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=N.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+=N.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+N.ulp(t),this.m_value=t,this}cubeThis(){return t(0),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),r=Math.abs(t.value());return this.m_eps=(Math.abs(i)+.5*e*t.m_eps)*t.m_eps+N.ulp(e+r),this}static ulp(t){let s=Ht(t);const i=((0x7ff0000000000000n&s)>>52n)-1075n;return i>-1023n?(s=i+0x3ffn<<52n,Jt(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),r=Math.abs(t.value());return this.m_eps=(Math.abs(s)+.5*e*t.m_eps)*t.m_eps+N.ulp(e+r),this}static st_cosAndSin(t,s,i){const e=Math.sin(t.m_value),r=Math.cos(t.m_value);i.m_value=e,s.m_value=r;const n=Math.abs(e),h=Math.abs(r),o=Math.abs(t.value());i.m_eps=(Math.abs(r)+.5*n*t.m_eps)*t.m_eps+N.ulp(n+o),s.m_eps=(Math.abs(e)+.5*h*t.m_eps)*t.m_eps+N.ulp(h+o)}setLog(s){return t(0),this}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}static atan2(s,i){return t(0),new N}acosThis(){return t(0),this}asinThis(){return t(0),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())}cubicRootThis(){return t(0),this}powerThis(s){return t(0),this}setPower(t,s){return this.setE(t),this.powerThis(s)}static size(){return 1}}function M(t,s){const i=ts(t),e=ts(s),r=53-b(i),n=53-b(e);return(r>=0?r:0)+(n>=0?n: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 Ps()}N.dimensions=1;const R=new N(Math.PI,.5*T()),g=new N(0,0),E=new N(1,0),I=new N(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 r=t*t;for(let t=2*Math.trunc(e/Math.log(r)+2.5)-1;t>1;t-=2)i=1/t,s=(s+i)*r;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,r=Math.log(t)*Math.log(e);i=s-z(e)-r}else{i=0;const s=1+Math.trunc(-16*Math.log(10)/Math.log(t)+1.5);let e=s;for(let r=s;r>0;r--,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?Ot(t,s):Ot(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,r){r[0]=s[0]+(i[0]-s[0])*e,r[1]=s[1]+(i[1]-s[1])*e,3===t&&(r[2]=s[2]+(i[2]-s[2])*e)}function B(t,s,i,e,r){r[0]=i[0]-(i[0]-s[0])*(1-e),r[1]=i[1]-(i[1]-s[1])*(1-e),3===t&&(r[2]=i[2]-(i[2]-s[2])*(1-e))}function O(t,s,i,e,r){e<=.5?L(t,s,i,e,r):B(t,s,i,e,r)}function G(t,s,i,e,r){r[0]=s[0].addE(i[0].subE(s[0]).mulE(e)),r[1]=s[1].addE(i[1].subE(s[1]).mulE(e))}function Q(t,s,i,e,r){r[0]=i[0].subE(i[0].subE(s[0]).mulE(E.subE(e))),r[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 K(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 W(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 j(t){return t*t}function X(t){return t*t*t}function $(t){return 1/Math.sqrt(t)}function H(t){return t<0?-1:t>0?1:0}function J(t,s,i,e){const r=[0],n=[0],h=[0];return ct(ot(t,i,r),ot(s,e,n),h)+(r[0]+n[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],rt=[0],nt=[0],ht=[0];function ot(t,s,i){const e=t*s;return at(t,et,rt),at(s,nt,ht),i[0]=rt[0]*ht[0]-(e-et[0]*nt[0]-rt[0]*nt[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 r=ct(t,s,ut),n=ct(r,i,lt);return ct(n,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,r=.01953125,n=.01068115234375,h=.0067291259765625,o=.004626274108886719,a=.0033752918243408203,u=.0025710230693221092;return Ls()*(1-s*(i+s*(e+s*(r+s*(n+s*(h+s*(o+s*(a+s*u))))))))}i=bt(0,s,1)-t*vt(0,s,1)/3}return zs(i,1,Ls())}function ft(s,i,e=Number.NaN){if(t(i>=0&&i<=1),0===i)return s;let r=1,n=s;if(n<0&&(n=-n,r=-1),1===i){const t=Math.round(n/Ss()),s=n-t*Ss();return r*(2*t+Math.sin(s))}const h=Ls(),o=Math.floor(n/h);1&o?n=(o+1)*h-n:n-=o*h;const a=Math.sin(n),u=Number.isNaN(e)?xt(i):e;let l;if(1===a)l=u+Math.sqrt(1-i)*(n-h);else{const t=n*n;if(.01424*Math.pow(t,4)<=2*Ps()){l=n*(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*n),s=Math.sin(4*n),e=Math.sin(6*n),r=Math.sin(8*n),h=Math.sin(10*n);l=n+i*((2*-n+t)/8+i*((-3*n+2*t-.25*s)/64+i*((-20*n+15*t-3*s+e/3)/1024+i*(5*(-140*n+112*t-28*s+16/3*e-.5*r)/65536+7*i*((-63*n+52.5*t-15*s+3.75*e-.625*r+.05*h)/65536+i*(-693*n+594*t-185.625*s+1.375*e-12.375*r+1.8*h-.125*Math.sin(12*n))/1048576)))))}else{const t=a*a,s=Math.cos(n),e=s*s,r=_t(a,s,i);l=a*(bt(e,r,1)-i*t*vt(e,r,1)/3)}}if(1&o){l=u*(o+1)-l}else l+=u*o;return r*l}function dt(t,s,i=Number.NaN){if(0===t)return 0;let e=1,r=t;t<0&&(r=-r,e=-1);const n=Number.isNaN(i)?xt(s):i,h=Math.floor(r/n);1&h?r=(h+1)*n-r:r-=h*n;let o=r<=0?0:r>=n?Ls():wt(r,s,n);return 1&h?o=Ls()*(h+1)-o:o+=Ls()*h,e*o}function bt(s,i,e){t((0!==s?1:0)+(0!==i?1:0)+1>1);let r=s,n=i,h=e;for(;;){const t=Math.sqrt(r*n)+Math.sqrt(n*h)+Math.sqrt(h*r);r=.25*(r+t),n=.25*(n+t),h=.25*(h+t);const s=(r+n+h)/3,i=(s-r)/s,e=(s-n)/s,o=(s-h)/s;if(Math.abs(i)<=.0024&&Math.abs(e)<=.0024&&Math.abs(o)<=.0024){const t=i*e-o*o,r=i*e*o;return(1+(1/24*t-.1-3/44*r-5*t*t/208+t*r/16)*t+(1/14+3*r/104)*r)/Math.sqrt(s)}}}function vt(s,i,e){t(0!==s||0!==i);let r=s,h=i,o=e;const a=new n(0);let u=1;for(;;){const t=.2*(r+h+3*o),s=(t-r)/t,i=(t-h)/t,e=(t-o)/t;if(Math.abs(s)<=.0015&&Math.abs(i)<=.0015&&Math.abs(e)<=.0015){const r=s*i,n=e*e,h=r-n,o=r-6*n,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*r));return 3*a.getResult()+u*(1+y+x)/(t*Math.sqrt(t))}const n=Math.sqrt(r),l=Math.sqrt(h),m=Math.sqrt(o),c=n*(l+m)+l*m;a.add(u/(m*(o+c))),u*=.25,r=.25*(r+c),h=.25*(h+c),o=.25*(o+c)}}function _t(t,s,i){return t<.999?1-i*j(t):1-i+i*j(s)}function wt(t,s,i){if(0===s)return t;if(1===s)return Math.asin(t);let e=0,r=!0;if(t<.2){const i=t*t,n=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(n)*Ps())return n;e=n,r=h>.1*n}if(r){const r=1-s,n=1-t/i,h=Math.sqrt(n*n+r*r),o=Math.atan2(r,t+Ps());e=Ls()+Math.sqrt(h)*(o-Ls())}let n=0;for(let h=0;h<7;h++){n=ft(e,s,i);const r=_t(Math.sin(e),Math.cos(e),s);if(e-=(n-t)/Math.sqrt(r),h>0&&Math.abs(n-t)<=4*Ps()*t)break}return e}function Nt(t,i,e,r,n){return 0===t?0===r?i:1===r?e:n:1===t?0===r?i:1===r?e:V(i,e,r):(2===t&&s("angular interpolation"),void s(""))}function Mt(t,i,e,r,n,h,o,a){if(0===t)for(let s=0;s<h;++s)r[s+n]=0===o?i[s]:1===o?e[s]:a;else if(1===t)if(0===o)pt(r,i,n,0,h);else if(1===o)pt(r,e,n,0,h);else for(let s=0;s<h;++s)r[s+n]=V(i[s],e[s],o);else if(2===t)if(0===o)pt(r,i,n,0,h);else if(1===o)pt(r,e,n,0,h);else{let t=0;for(let s=0,a=n;s<h;++s,++a)r[a]=V(i[s],e[s],o),t+=r[a]*r[a];if(t>0){t=Math.sqrt(t);for(let s=n;s<n+h;++s)r[s]/=t}else{for(let t=n;t<n+h;++t)r[t]=0;r[n]=1}}else s("")}function pt(t,s,i,e,r){if(0===r)return;let n=0,h=i,o=e;for(;n++<r;)t[h++]=s[o++]}function Ct(t,s){return t}function Tt(t){t.sort(((t,s)=>t<s?-1:t>s?1:0))}function Rt(t,s){const i=t.slice(0,s);Tt(i),pt(t,i,0,0,s)}function gt(t,s,i,e){const r=t.slice(s,s+i);r.sort(e),pt(t,r,s,0,i)}function Et(t,s){return t<s?-1:t>s?1:0}function It(t,s,i,e){return t<i?-1:t>i?1:s<e?-1:s>e?1:0}function Dt(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]=Ct(t[i],t[i]=t[e]));return 1+i}function At(t,s){t[s]=t.at(-1),t.pop()}function Pt(t,s=!1){return{[Symbol.dispose](){this.bForget||t()},bForget:s}}function qt(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 Zt(t,s){const i=t.slice(0,s);for(let e=0;e<s;++e)i[e]=i[e].clone();return i}function Ft(t){return Array.from({length:t},(()=>null))}function St(t,s){return Array.from({length:s},(()=>t()))}function kt(t,s){return Array.from({length:t},(()=>s))}function Lt(t,s){return s in t&&1===Object.getOwnPropertyNames(t).length}class Bt{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 Ot(t,s){return{first:t,second:s}}const Gt=Math.PI,Qt=2*Math.PI,Vt=.5*Math.PI;class Ut{constructor(t,s){this.m_cr=t,this.m_cc=s,this.m_v=kt(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 Kt=new ArrayBuffer(8),Yt=new Float64Array(Kt),Wt=new BigUint64Array(Kt),jt=0x0fffffffffffffn,Xt=0x7ff0000000000000n;function $t(){return Number.EPSILON*Es}function Ht(t){return Yt[0]=t,Wt[0]}function Jt(t){return Wt[0]=t,Yt[0]}function ts(t){return Ht(t)&jt}function ss(t){return Number((Ht(t)&Xt)>>52n)}function is(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 r=s;i>>=1n;let n=r+i;for(;i>0n;)t<1n<<n||(r=n),i>>=1n,n=r+i;return r}function es(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 ns(t,s){return t<s?-1:t>s?1:0}function hs(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 os(){return 2147483647}function as(){return 32767}function us(){return 2147483647}const ls=us(),ms=BigInt(ls),cs=2166136261,ys=16777619;function xs(t){let s=cs,i=t;return s=(s^255&i)*ys,i>>=8,s=(s^255&i)*ys,i>>=8,s=(s^255&i)*ys,i>>=8,s=(s^255&i)*ys,s&ls}const fs=14695981039346656037n,ds=1099511628211n;function bs(t){let s=fs,i=t;return s=(s^0xffn&i)*ds,i>>=8n,s=(s^0xffn&i)*ds,i>>=8n,s=(s^0xffn&i)*ds,i>>=8n,s=(s^0xffn&i)*ds,i>>=8n,s=(s^0xffn&i)*ds,i>>=8n,s=(s^0xffn&i)*ds,i>>=8n,s=(s^0xffn&i)*ds,s&ms}function vs(t){return 1103515245*t+12345&2147483647}function _s(t){let s=cs;for(let i=0,e=t.length;i<e;++i)s=(s^t.charCodeAt(i))*ys;return s&ls}function ws(t,s){return s+2654435769+(t<<6)+(t>>2)&ls}function Ns(t,s){return ws(t,Ts(s))}function Ms(t){return ws(3735928559,t)}function ps(t,s){return ws(t,Ms(s))}function Cs(t){return xs(t)}function Ts(t){return Number(bs(t))}function Rs(t){return vs(t)}const gs=100,Es=100;function Is(){return Number.EPSILON*gs}function Ds(){return.38196601125010515}function As(){return 1.4142135623730951}function Ps(){return Number.EPSILON}function qs(t,s,i){return t===s||t===i}function zs(t,s,i){return t>=s?t<=i?t:i:s}function Zs(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 Fs(t,s){return t>=s?s:t<-s?-s:t}function Ss(){return Gt}function ks(){return Qt}function Ls(){return Vt}const Bs=3*Ls();function Os(){return Bs}function Gs(t){return t+0}function Qs(t){return{v:t}}class Vs{constructor(){this.m_rn=Qs(0n),this.m_rd=Qs(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 Vs).setDouble(t)}static constructInt64(t){return(new Vs).setInt64(t)}static constructRational(t,s){return(new Vs).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 Vs).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(t){if(this.setZero(),0===t)return this;if(Number.isInteger(t)&&Math.abs(t)<us())return this.setInt32(t);const i=Ht(t),e=(i&Vs.s_em)>>52n,r=!!(i&Vs.s_sm),n=i&Vs.s_fm;if(e===Vs.s_emax)return n?(this.m_rn.v=this.m_rd.v=0n,this.m_bNaN=!0,this):(this.m_rn.v=r?-1n:1n,this.m_rd.v=0n,this);0n===e&&s("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|n)<<o,this.m_rd.v=1n<<52n+a,this.m_sign=r?-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(s){return t(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(Vs.constructDouble(t))}thisMulInt64(s){return t(0),this}thisMulInt32(s){return t(0),this}divThis(t){return this.mulThis(t.clone().invertThis())}divDoubleThis(t){return this.divThis(Vs.constructDouble(t))}addDoubleThis(t){return this.addThis(Vs.constructDouble(t))}subDoubleThis(t){return this.subThis(Vs.constructDouble(t))}mul(t){return this.clone().mulThis(t)}mulBigIntThis(t){return this.mulThis(Vs.constructInt64(t))}mulDouble(t){return this.clone().mulThis(Vs.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(Vs.constructDouble(t))}sub(t){return this.clone().subThis(t)}subDouble(t){return this.clone().subThis(Vs.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=Ct(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(is(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(is(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(is(this.m_rn.v)),Number(is(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(s,e){if(s.m_sign<0n&&i("MP_value: sqrt(-1)"),s.isZero())return s.clone();let r=52,n=2220446049250313e-31;for(;r<e;)2*r<=e?(n*=n,r*=2):(n*=2220446049250313e-31,r+=52);r+=52;const h=is(s.m_rn.v),o=is(s.m_rd.v);let a,u=s.m_power+Number(h-o);const l=new Vs;Math.abs(u)>200?(1&Math.abs(u)&&(u+=1),a=Vs.constructAssign(s,53).ldexpThis(-u).value(),l.setThis(s).ldexpThis(-u),t(Number.isFinite(a))):(l.setThis(s),a=l.value(),t(Number.isFinite(a)),u=0),a=Math.sqrt(a);const m=Vs.constructDouble(a),c=Vs.constructDouble(n);c.mulThis(m).ldexpThis(1);const y=n*a*2,x=m.clone(),f=new Vs;let d;for(let t=0;t<10;++t){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(r),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 r=Math.pow(Math.abs(t.value()),1/3),n=Vs.constructDouble(r),h=n.clone();h.sqrThis().mulDoubleThis(3).mulDoubleThis(e),h.limitPrecisionThis(32),t.LZ()&&n.negateThis();for(let o=0;o<10;++o){const s=n.clone();s.sqrThis().mulThis(n);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 r=s.clone();r.ldexpThis(1),r.addThis(t),e.divThis(r),n.mulThis(e),n.limitPrecisionThis(i)}return n}isInTheRangeOfDouble(){return t(0),!1}sign(){return this.m_sign}cosAndSin(s,i){t(0)}static nan(){return t(0),new Vs}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 r=Number(e);if(BigInt(r)!==e)return t?-r:r;let n=s-e*i;if(n){let t=is(i)-1023n;t>0n&&(i>>=t,n<<=52n,n>>=t);let s=Number(n);Number.isFinite(s)||(n>>=52n,s=Number(n),t=0n),t>0n&&(s/=Math.pow(2,52));r+=s/Number(i)}return t?-r:r}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,r;this.m_power>i?(e=BigInt(this.m_power-i),r=0n):(e=0n,r=BigInt(t.m_power-i));const n=this.signVal()*this.m_rn.v*t.m_rd.v<<e,h=t.signVal()*t.m_rn.v*this.m_rd.v<<r;return this.m_rn.v=s?n+h:n-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}}Vs.s_sm=0x8000000000000000n,Vs.s_em=0x7ff0000000000000n,Vs.s_fm=0x000fffffffffffffn,Vs.s_emax=0x7ffn;const Us=Vs.constructInt32(1),Ks=Vs.constructInt32(0);function Ys(t,s){return v(t^s)}function Ws(t,s){let i=ss(t);const e=ss(s);if(i===e){return i-=53-Ys(ts(t),ts(s)),i}return i>e?i:e}function js(t){const s=qt(Xs,t.length);for(let i=0,e=t.length;i<e;++i)s[i].setCoords(t[i][0],t[i][1]);return s}class Xs{static construct(t,s){return new Xs(t,s)}constructor(t,s){void 0!==t?(this.x=t,this.y=s):this.x=this.y=Number.NaN}clone(){return new Xs(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 t(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(s,i,e){t(0)}scaleAddThis(t,s){this.x=this.x*t+s.x,this.y=this.y*t+s.y}scaleAddOther(s,i,e){t(0)}scaleOther(s,i){t(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(s){t(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(s,i){return t(0),{}}static average(t,s){const i=new Xs;if(0===s)return i.setNAN(),i;if(1===s)return i.assign(t[0]),i;const e=new n(t[0].x),r=new n(t[0].y);for(let n=1;n<s;n++)e.add(t[n].x),r.add(t[n].y),255&n||(e.normalize(),r.normalize());return i.x=e.getResult()/s,i.y=r.getResult()/s,i}offset(t,s){const i=Xs.distance(t,s),e=Xs.construct(this.x,this.y);if(0===i)return Xs.distance(e,t);const r=s.clone();r.subThis(t),e.subThis(t);return e.crossProduct(r)/i}side(s,i){return t(0),0}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 r=i-t,n=e-s;return r*r+n*n}static distance(t,s){return Math.sqrt(Xs.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(s){return t(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 Xs(this.x+t.x,this.y+t.y)}sub(t){return new Xs(this.x-t.x,this.y-t.y)}negateThis(){return this.x=-this.x,this.y=-this.y,this}negate(){return new Xs(-this.x,-this.y)}mul(t){return new Xs(this.x*t,this.y*t)}mulThis(t){return this.x*=t,this.y*=t,this}divide(t){return new Xs(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 Xs(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 Xs.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?Xs.orientationRobustImpl(Xs.construct(0,0),s,t,!0):i<e?-1:1}static compareVectorsOrigin(t,s,i){const e=s.sub(t),r=i.sub(t),n=e.getQuarter(),h=r.getQuarter();return h===n?Xs.orientationRobustImpl(t,i,s,!0):n<h?-1:1}static orientationRobust(t,s,i){return Xs.orientationRobustImpl(t,s,i,!1)}static orientationRobustEx(t,s,i,e){if(t.equals(s)||i.equals(e))return 0;const r=s.x-t.x,n=s.y-t.y,h=e.x-i.x,o=e.y-i.y;{const t=Xs.getQuarterCoords(r,n)-1,s=Xs.getQuarterCoords(h,o)-1,i=Xs.d[t][s];if(0!==i)return i}const a=r*o,u=n*h,l=4*Ps()*(Math.abs(a)+Math.abs(u)),m=a-u;if(Math.abs(m)>=l){return m<0?-1:m>0?1:0}return Xs.orientationRobustExMp(t,s,i,e)}static orientationRobustExMp(t,s,i,e){const r=Vs.constructDouble(s.x),n=Vs.constructDouble(e.x);r.subThis(Vs.constructDouble(t.x)),n.subThis(Vs.constructDouble(i.x));const h=Vs.constructDouble(s.y),o=Vs.constructDouble(e.y);return h.subThis(Vs.constructDouble(t.y)),o.subThis(Vs.constructDouble(i.y)),r.mulThis(o),h.mulThis(n),r.subThis(h),r.LZ()?-1:r.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 r=s.x-t.x,n=s.y-t.y,h=i.x-t.x,o=i.y-t.y;if(!e){const t=Xs.getQuarterCoords(r,n)-1,s=Xs.getQuarterCoords(h,o)-1,i=Xs.d[t][s];if(0!==i)return i}const a=(Math.abs(r)+Math.abs(n)+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=r*o-n*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(r,o)&&M(n,h)){const t=r*o,s=n*h;if(C(t,s)){const i=t-s;return i<0?-1:i>0?1:0}}return Xs.orientationRobustMp(t,s,i)}static orientationRobustMp(t,s,i){const e=Vs.constructDouble(s.x),r=Vs.constructDouble(i.x);{const s=Vs.constructDouble(t.x);e.subThis(s),r.subThis(s)}const n=Vs.constructDouble(i.y),h=Vs.constructDouble(s.y);{const s=Vs.constructDouble(t.y);n.subThis(s),h.subThis(s)}return e.mulThis(n),h.mulThis(r),e.subThis(h),e.LZ()?-1:e.GZ()?1:0}static inCircleRobust(t,s,i,e){const r=new N,n=new N;r.set(t.x),r.subThis(e.x),n.set(t.y),n.subThis(e.y);const h=new N,o=new N;h.set(s.x),h.subThis(e.x),o.set(s.y),o.subThis(e.y);const a=new N,u=new N;a.set(i.x),a.subThis(e.x),u.set(i.y),u.subThis(e.y);const l=r.mulE(o).subE(n.mulE(h)),m=h.mulE(u).subE(o.mulE(a)),c=r.mulE(u).subE(n.mulE(a)),y=r.mulE(r).addE(n.mulE(n)),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 Xs.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 r=t.x-e.x,n=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(r,o)||!M(n,h))break;if(!M(h,u)||!M(o,a))break;if(!M(r,u)||!M(n,a))break;if(!M(r,r)||!M(n,n))break;if(!M(h,h)||!M(o,o))break;if(!M(a,a)||!M(u,u))break;const l=r*o,m=n*h,c=h*u,y=o*a,x=r*u,f=n*a,d=r*r,b=n*n,v=h*h,_=o*o,w=a*a,N=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(w,N))break;const T=l-m,R=c-y,g=x-f,E=d+b,I=v+_,D=w+N;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 r=Vs.constructDouble(e.x),n=Vs.constructDouble(e.y),h=Vs.constructDouble(t.x),o=Vs.constructDouble(t.y);h.subThis(r),o.subThis(n);const a=Vs.constructDouble(s.x),u=Vs.constructDouble(s.y);a.subThis(r),u.subThis(n);const l=Vs.constructDouble(i.x),m=Vs.constructDouble(i.y);l.subThis(r),m.subThis(n);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=Vs.constructDouble(t.x),r=Vs.constructDouble(t.y),n=Vs.constructDouble(s.x),h=Vs.constructDouble(s.y),o=Vs.constructDouble(i.x),a=Vs.constructDouble(i.y),u=o.mul(o).add(a.mul(a)).sub(o.mul(e).add(a.mul(r)).add(o.mul(n)).add(a.mul(h))).add(e.mul(n).add(r.mul(h)));return u.LZ()?-1:u.GZ()?1:0}static inCircleRobust3Point(t,s,i){const e=new N(t.x),r=new N(t.y),n=new N(s.x),h=new N(s.y),o=new N(i.x),a=new N(i.y),u=o.mulE(o).addE(a.mulE(a)).subE(o.mulE(e).addE(a.mulE(r)).addE(o.mulE(n)).addE(a.mulE(h))).addE(e.mulE(n).addE(r.mulE(h)));if(!u.isFuzzyZero()){const t=u.value();return t<0?-1:t>0?1:0}return Xs.inCircleRobustMp3Point(t,s,i)}static calculateCircleCenterFromThreePoints(t,s,i){if(t.equals(i)||t.equals(s)||i.equals(s))return Xs.getNAN();const e=$s(t,s,i);return e.isNAN()?Hs(t,s,i):e}static calculateAngle(t,s){return Math.atan2(t.crossProduct(s),t.dotProduct(s))}static isBisectorRobust(s,i,e){return t(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=Xs.c_compare_zorder_xx[t.x<0?1:0]|Xs.c_compare_zorder_yy[t.y<0?1:0],e=Xs.c_compare_zorder_xx[s.x<0?1:0]|Xs.c_compare_zorder_yy[s.y<0?1:0];if(i===e){let i=0,e=0;for(let r=0;r<2;++r){const n=Ws(t[r],s[r]);n>i&&(i=n,e=r)}return t[e]<s[e]}return i<e}static lerp(t,s,i){const e=new Xs;return Y(t,s,i,e),e}static getClosestCoordinate(t,s,i,e=!1){const r=Xs.getNAN();r.setSub(s,t);const n=r.sqrLength();if(0===n)return.5;if(s.isEqualPoint2D(i))return 1;const h=Xs.getNAN();h.setSub(i,t);let o=h.dotProduct(r)/n;return e||(o<0?o=0:o>1&&(o=1)),o}static intersectLinesAtOnePoint(s,i,e,r){return t(0),new Xs(0,0)}toString(){return`[${this.x},${this.y}]`}}function $s(t,s,i){const e=new N(s.x);e.subThis(t.x);const r=new N(s.y);r.subThis(t.y);const n=new N(i.x);n.subThis(t.x);const h=new N(i.y);h.subThis(t.y);const o=e.clone();o.mulThisE(h);let a=r.clone();if(a.mulThisE(n),o.subThisE(a),0===o.value())return Xs.getNAN();o.mulThis(2);const u=e.clone();u.mulThisE(e);const l=r.clone();l.mulThisE(r);const m=u.clone();m.addThisE(l);const c=n.clone();c.mulThisE(n);const y=h.clone();y.mulThisE(h);const x=c.clone();x.addThisE(y);const f=r.clone();f.mulThisE(x),a=h.clone(),a.mulThisE(m),f.subThisE(a),f.divThisE(o);const d=e.clone();d.mulThisE(x),a=n.clone(),a.mulThisE(m),d.subThisE(a),d.divThisE(o);const b=Xs.construct(t.x-f.value(),t.y+d.value()),v=t.sub(b).length(),_=s.sub(b).length(),w=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-w)<=M&&f.eps()<M&&d.eps()<M?b:Xs.getNAN()}function Hs(t,s,i){const e=Vs.constructDouble(s.x);e.subDoubleThis(t.x);const r=Vs.constructDouble(s.y);r.subDoubleThis(t.y);const n=Vs.constructDouble(i.x);n.subDoubleThis(t.x);const h=Vs.constructDouble(i.y);h.subDoubleThis(t.y);const o=e.clone();o.mulThis(h);let a=r.clone();if(a.mulThis(n),o.subThis(a),o.isZero())return Xs.getNAN();o.mulDouble(2);const u=e.clone();u.mulThis(e);const l=r.clone();l.mulThis(r);const m=u.clone();m.addThis(l);const c=n.clone();c.mulThis(n);const y=h.clone();y.mulThis(h);const x=c.clone();x.addThis(y);const f=r.clone();f.mulThis(x),a=h.clone(),a.mulThis(m),f.subThis(a),f.divThis(o);const d=e.clone();d.mulThis(x),a=n.clone(),a.mulThis(m),d.subThis(a),d.divThis(o);return Xs.construct(t.x-f.value(),t.y+d.value())}Xs.dimensions=2,Xs.d=[[0,1,0,-1],[-1,0,1,0],[0,-1,0,1],[1,0,-1,0]],Xs.c_compare_zorder_xx=[2,0],Xs.c_compare_zorder_yy=[1,0];class Js{constructor(t,s,i){if(t instanceof Js)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}assignMove(s){return t(0),this}assignCopy(s){return this===s||(t(this.N*this.M==s.N*s.M),this.data.set(s.data),this.N=s.N,this.M=s.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(s){return t(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(s,i){t(0)}mul(s,i){if(t(this.M===s.rows()),t(this.N===i.rows()),t(s.cols()===i.cols()),i===this){const t=new Float64Array(this.N*this.M),e=new Js(t,this.N,this.M);return this.mul(s,e),void i.assignCopy(e)}if(i===s){const t=new Float64Array(s.N*s.M),e=new Js(t,s.N,s.M);return this.mul(s,e),void i.assignCopy(e)}const e=s.cols();for(let t=0;t<this.N;t++)for(let r=0;r<e;r++){let e=0;for(let i=0;i<this.M;i++)e+=this.atRowCol(t,i)*s.atRowCol(i,r);i.setRowCol(t,r,e)}}mulTranspose(s,i){if(t(this.M===s.cols()),t(this.N===i.rows()),t(s.rows()===i.cols()),i===this){const t=new Float64Array(this.N*this.M),e=new Js(t,this.N,this.M);return this.mulTranspose(s,e),void i.assignCopy(e)}if(i===s){const t=new Float64Array(s.N*s.M),e=new Js(t,s.N,s.M);return this.mulTranspose(s,e),void i.assignCopy(e)}const e=s.rows();for(let t=0;t<this.N;t++)for(let r=0;r<e;r++){let e=0;for(let i=0;i<this.M;i++)e+=this.atRowCol(t,i)*s.atRowCol(r,i);i.setRowCol(t,r,e)}}mulLeft(s,i){t(0)}mulLeftTranspose(s,i){t(0)}mulDiag(s,i){if(t(this.M===s.N*s.M),t(this.N===i.rows()),t(this.M===i.cols()),i===this){const t=new Float64Array(this.N*this.M),e=new Js(t,this.N,this.M);return this.mulDiag(s,e),void i.assignCopy(e)}const e=this.M;for(let t=0;t<this.N;t++)for(let r=0;r<e;r++)i.setRowCol(t,r,this.atRowCol(t,r)*s.at(r))}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 Js(t,this.N,this.M);return s.assignCopy(this),this.M=Ct(this.N,this.N=this.M),s.transpose(this),this}transpose(t){if(this!==t){Js.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(s,i,e,r=!1){if(Js.checkDims(s,this.N,this.M),Js.checkDims(i,this.M,1),Js.checkDims(e,this.M,this.M),r){if(t(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 s.assignCopy(e),!0}let n,h,o,a,u,l,m,c=0,y=0,x=0,f=0,d=0;const b=this.M,v=this.N;s.assignCopy(this);const _=new Float64Array(b),w=new Js(_,b,1),N=(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 t=0;t<b;t++){if(c=t+1,w.set(t,f*x),x=a=f=0,t<v){for(let i=t;i<v;i++)f+=Math.abs(s.atRowCol(i,t));if(f){for(let i=t;i<v;i++)s.setRowCol(i,t,s.atRowCol(i,t)/f),a+=s.atRowCol(i,t)*s.atRowCol(i,t);h=s.atRowCol(t,t),x=-N(Math.sqrt(a),h),o=h*x-a,s.setRowCol(t,t,h-x);for(let i=c;i<b;i++){a=0;for(let e=t;e<v;e++)a+=s.atRowCol(e,t)*s.atRowCol(e,i);h=a/o;for(let e=t;e<v;e++)s.setRowCol(e,i,s.atRowCol(e,i)+h*s.atRowCol(e,t))}for(let i=t;i<v;i++)s.setRowCol(i,t,s.atRowCol(i,t)*f)}}if(i.set(t,f*x),x=a=f=0,t<v&&t!==b-1){for(let i=c;i<b;i++)f+=Math.abs(s.atRowCol(t,i));if(f){for(let i=c;i<b;i++)s.setRowCol(t,i,s.atRowCol(t,i)/f),a+=s.atRowCol(t,i)*s.atRowCol(t,i);h=s.atRowCol(t,c),x=-N(Math.sqrt(a),h),o=h*x-a,s.setRowCol(t,c,h-x);for(let i=c;i<b;i++)w.set(i,s.atRowCol(t,i)/o);for(let i=c;i<v;i++){a=0;for(let e=c;e<b;e++)a+=s.atRowCol(i,e)*s.atRowCol(t,e);for(let t=c;t<b;t++)s.setRowCol(i,t,s.atRowCol(i,t)+a*w.at(t))}for(let i=c;i<b;i++)s.setRowCol(t,i,s.atRowCol(t,i)*f)}}const e=Math.abs(i.at(t))+Math.abs(w.at(t));d=e>d?e:d}for(let t=b-1;t>=0;t--){if(t<b-1){if(x){for(let i=c;i<b;i++)e.setRowCol(i,t,s.atRowCol(t,i)/s.atRowCol(t,c)/x);for(let i=c;i<b;i++){a=0;for(let r=c;r<b;r++)a+=s.atRowCol(t,r)*e.atRowCol(r,i);for(let s=c;s<b;s++)e.setRowCol(s,i,e.atRowCol(s,i)+a*e.atRowCol(s,t))}}for(let s=c;s<b;s++)e.setRowCol(t,s,0),e.setRowCol(s,t,0)}e.setRowCol(t,t,1),x=w.at(t),c=t}for(let t=(v<b?v:b)-1;t>=0;t--){c=t+1,x=i.at(t);for(let i=c;i<b;i++)s.setRowCol(t,i,0);if(x){x=1/x;for(let i=c;i<b;i++){a=0;for(let e=c;e<v;e++)a+=s.atRowCol(e,t)*s.atRowCol(e,i);h=a/s.atRowCol(t,t)*x;for(let e=t;e<v;e++)s.setRowCol(e,i,s.atRowCol(e,i)+h*s.atRowCol(e,t))}for(let i=t;i<v;i++)s.setRowCol(i,t,s.atRowCol(i,t)*x)}else for(let i=t;i<v;i++)s.setRowCol(i,t,0);s.setRowCol(t,t,s.atRowCol(t,t)+1)}for(let t=b-1;t>=0;t--)for(let r=1;;r++){let f=1;for(c=t;c>=0;c--){if(y=c-1,Math.abs(w.at(c))+d===d){f=0;break}if(Math.abs(i.at(y))+d===d)break}if(f){n=0,a=1;for(let e=c;e<=t&&(h=a*w.at(e),w.set(e,w.at(e)*n),Math.abs(h)+d!==d);e++){x=i.at(e),o=M(h,x),i.set(e,o),o=1/o,n=x*o,a=-h*o;for(let t=0;t<v;t++)l=s.atRowCol(t,y),m=s.atRowCol(t,e),s.setRowCol(t,y,l*n+m*a),s.setRowCol(t,e,m*n-l*a)}}if(m=i.at(t),c===t){if(m<0){i.set(t,-m);for(let s=0;s<b;s++)e.setRowCol(s,t,-e.atRowCol(s,t))}break}if(100===r)return!1;u=i.at(c),y=t-1,l=i.at(y),x=w.at(y),o=w.at(t),h=((l-m)*(l+m)+(x-o)*(x+o))/(2*o*l),x=M(h,1),h=((u-m)*(u+m)+o*(l/(h+N(x,h))-o))/u,n=a=1;for(let t=c;t<=y;t++){const r=t+1;x=w.at(r),l=i.at(r),o=a*x,x*=n,m=M(h,o),w.set(t,m),n=h/m,a=o/m,h=u*n+x*a,x=x*n-u*a,o=l*a,l*=n;for(let s=0;s<b;s++)u=e.atRowCol(s,t),m=e.atRowCol(s,r),e.setRowCol(s,t,u*n+m*a),e.setRowCol(s,r,m*n-u*a);m=M(h,o),i.set(t,m),m&&(m=1/m,n=h*m,a=o*m),h=n*x+a*l,u=n*l-a*x;for(let i=0;i<v;i++)l=s.atRowCol(i,t),m=s.atRowCol(i,r),s.setRowCol(i,t,l*n+m*a),s.setRowCol(i,r,m*n-l*a)}w.set(c,0),w.set(t,h),i.set(t,u)}const p=new Float64Array(this.N),C=new Float64Array(this.M),T=new Js(p,this.N,1),R=new Js(C,this.M,1);let g=1;do{g*=3,g++}while(g<=this.M);do{g/=3,g=Math.trunc(g);for(let t=g;t<this.M;t++){const r=i.at(t);for(let i=0;i<this.N;i++)T.set(i,s.atRowCol(i,t));for(let s=0;s<this.M;s++)R.set(s,e.atRowCol(s,t));let n=t;for(;i.at(n-g)<r;){i.set(n,i.at(n-g));for(let t=0;t<this.N;t++)s.setRowCol(t,n,s.atRowCol(t,n-g));for(let t=0;t<this.M;t++)e.setRowCol(t,n,e.atRowCol(t,n-g));if(n-=g,n<g)break}i.set(n,r);for(let t=0;t<this.N;t++)s.setRowCol(t,n,T.at(t));for(let t=0;t<this.M;t++)e.setRowCol(t,n,R.at(t))}}while(g>1);for(let t=0;t<this.M;t++){let i=0;for(let e=0;e<this.N;e++)s.atRowCol(e,t)<0&&i++;for(let s=0;s<this.M;s++)e.atRowCol(s,t)<0&&i++;if(i>Math.trunc((this.N+this.M)/2)){for(let i=0;i<this.N;i++)s.setRowCol(i,t,-s.atRowCol(i,t));for(let s=0;s<this.M;s++)e.setRowCol(s,t,-e.atRowCol(s,t))}}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 t(0),!1}isIdentity(){return t(0),!1}equals(s,i){if(void 0!==i&&t(0),this.N!==s.N||this.M!==s.M)return!1;for(let t=0;t<this.N*this.M;t++)if(this.data[t]!==s.data[t])return!1;return!0}maxElement(){return t(0),0}min_element(){return t(0),0}determinant(){if(t(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 s=new Float64Array(this.N*this.N),i=new Js(s,this.N,this.N),e=new Float64Array(this.N);if(!this.luDecomposition(i,e))return 0;let r=1;for(let t=0;t<this.N;t++)r*=i.atRowCol(t,t),e[t]!==t&&(r=-r);return r}submatrix(s,i,e){t(0)}inverse(s){t(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),r=new Js(e,this.N,this.M),n=new Float64Array(this.M),h=new Js(n,this.M,1),o=new Float64Array(this.M*this.M),a=new Js(o,this.M,this.M);if(!this.svd(r,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(r,t),!0}luDecomposition(s,i){return t(0),!1}symmetricEigen(s,i){t(this.rows()===this.cols()),t(this.rows()===s.rows()),t(i.rows()===i.cols()&&i.rows()===this.rows()),t(this.isSymmetric());const e=new Float64Array(this.N*this.M),r=new Js(e,this.N,this.M);r.assignCopy(this);const n=100/Number.EPSILON,h=this.rows(),o=new Float64Array(h),a=new Float64Array(h),u=new Js(o,h,1),l=new Js(a,h,1);for(let t=0;t<h;t++)u.set(t,r.atRowCol(t,t)),s.set(t,r.atRowCol(t,t)),l.set(t,0);i.setIdentity();const m=()=>{const t=u;i.transposeInPlace();let e=1;do{e*=3,e++}while(e<=h);do{e/=3,e=Math.trunc(e);for(let r=e;r<h;r++){const n=s.at(r),h=Math.abs(n);for(let s=0;s<this.M;s++)t.set(s,i.atRowCol(s,r));let o=r;for(;Math.abs(s.at(o-e))<h;){s.set(o,s.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!==r){s.set(o,n);for(let s=0;s<this.M;s++)i.setRowCol(s,o,t.at(s))}}}while(e>1)};for(let t=1;;t++){let e=0;for(let t=1;t<h;t++)for(let s=0;s<t;s++)e+=Math.abs(r.atRowCol(t,s));if(0===e)return m(),!0;const o=t<4?.2*e/(h*h):0;for(let a=0;a<h;a++)for(let e=a+1;e<h;e++){let u=n*Math.abs(r.atRowCol(e,a));if(t>4&&u<=Math.abs(s.at(a))&&u<=Math.abs(s.at(e)))r.setRowCol(e,a,0);else if(Math.abs(r.atRowCol(e,a))>o){let t,n=s.at(e)-s.at(a);if(u<Math.abs(n))t=r.atRowCol(e,a)/n;else{const s=.5*n/r.atRowCol(e,a);t=1/(Math.abs(s)+Math.sqrt(1+s*s)),s<0&&(t=-t)}const o=1/Math.sqrt(1+t*t),m=t*o,c=m/(1+o);n=t*r.atRowCol(e,a),l.set(a,l.at(a)-n),l.set(e,l.at(e)+n),s.set(a,s.at(a)-n),s.set(e,s.at(e)+n),r.setRowCol(e,a,0);let y=0;for(;y<a;y++)u=r.atRowCol(a,y),n=r.atRowCol(e,y),r.setRowCol(a,y,u-m*(n+u*c)),r.setRowCol(e,y,n+m*(u-n*c));for(y++;y<e;y++)u=r.atRowCol(y,a),n=r.atRowCol(e,y),r.setRowCol(y,a,u-m*(n+u*c)),r.setRowCol(e,y,n+m*(u-n*c));for(y++;y<h;y++)u=r.atRowCol(y,a),n=r.atRowCol(y,e),r.setRowCol(y,a,u-m*(n+u*c)),r.setRowCol(y,e,n+m*(u-n*c));for(y=0;y<h;y++)u=i.atRowCol(a,y),n=i.atRowCol(e,y),i.setRowCol(a,y,u-m*(n+u*c)),i.setRowCol(e,y,n+m*(u-n*c))}}for(let t=0;t<h;t++)u.set(t,u.at(t)+l.at(t)),s.set(t,u.at(t)),l.set(t,0)}}static checkDims(s,i,e){t(s.rows()===i&&s.cols()===e)}}class ti extends Js{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 si{constructor(t){void 0===t?this.setIdentity():t instanceof si?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 si).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=qt(Xs,4);t.queryCorners(s),this.transformPoints2D(s,4,s),t.setFromPoints(s,4)}queryTransformEnv(s,i){t(0)}transformInterleaved(s,i,e){t(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=Xs.getNAN();for(let r=0;r<s;r+=2)e.x=t[r],e.y=t[r+1],this.transformInPlace(e),i[r]=e.x,i[r+1]=e.y}multiply(t){return si.st_multiply(this,t,this),this}mulLeft(s){return t(0),this}static st_multiply(t,s,i){const e=t.xx*s.xx+t.yx*s.xy,r=t.xy*s.xx+t.yy*s.xy,n=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=r,i.xd=n,i.yx=h,i.yy=o,i.yd=a}getCoefficients(s){t(0)}setCoefficients(t){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(s){t(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}}initializeFromCurveParameters(s,i,e){t(0)}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=Xs.distance(t[0],t[1]),r=Xs.distance(s[0],s[1]),n=r/i;this.scale(n,n);const h=t[1].sub(t[0]);h.divThis(i);const o=s[1].sub(s[0]);o.divThis(r);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 r=[t,s],n=[i,e];this.initializeFromTwoPointsArray(r,n)}transformSizeInPlace(s){t(0)}transformSize(s,i){t(0)}transformTol(s){return t(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!(j(this.xd)+j(this.yd)>s)&&(!(j(this.xy+this.xd)+j(this.yy+this.yd-1)>s)&&!(j(this.xx+this.xd-1)+j(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 t(0),!1}isTranslateTol(s){return t(0),!1}isOrthonormal(s){return t(0),!1}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}isScaleAndTranslate(s){return t(0),!1}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(s,i){return t(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(s,i){return t(0),this}rotateAngle(t){const s=new si;return s.setRotateAngle(t),this.multiply(s)}rotate(t,s){const i=new si;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,r=-this.xy*t,n=-this.yx*t,h=this.xx*t;return this.xd=s,this.yd=i,this.xx=e,this.yy=h,this.xy=r,this.yx=n,this}invertPrecise(t){return this.set(t),this.invertPreciseThis()}invertPreciseThis(){const t=Vs.constructDouble(this.xy),s=Vs.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 r=Vs.constructDouble(this.xd),n=t.mulDouble(this.yd).sub(r.mulDouble(this.yy)).mul(e).toDouble(),h=r.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=n,this.yd=h,this.xx=o,this.yy=l,this.xy=a,this.yx=u,this}extractScaleTransform(s,i){t(0)}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 Xs;e.setSub(t[0],t[1]);const r=new Xs;r.setSub(t[0],t[2]);const n=new Xs;n.setSub(s[0],s[1]);const h=new Xs;h.setSub(s[0],s[2]);const o=4*Number.EPSILON*(Math.abs(e.x*r.y)+Math.abs(r.x*e.y));let a=e.x*r.y-e.y*r.x;return Math.abs(a)>o?(a=1/a,this.xx=(n.x*r.y-e.y*h.x)*a,this.xy=(e.x*h.x-n.x*r.x)*a,this.yx=(n.y*r.y-e.y*h.y)*a,this.yy=(e.x*h.y-n.y*r.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,r=null){return 0===s?(this.setIdentity(),void(r&&r.setIdentity())):1===s?(this.setShift(e[0].sub(i[0])),void(r&&r.setShift(i[0].sub(e[0])))):(s<3&&(t=1),void(4===t&&s>2?ri(this,s,i,e,r):ni(t,this,s,i,e,r)))}calculateErrors(s,i,e,r){t(s>0&&null!==i&&null!==e);let n=0;for(let t=0;t<s;++t){const s=this.transform(i[t]),h=Xs.sqrDistance(e[t],s);n+=h,r&&(r[t]=Math.sqrt(h))}return Math.sqrt(n/s)}}const ii=[43,11,41,9,61];function ei(s,i){t(!(2!==i.rows()&&3!==i.rows()||2!==i.cols()&&3!==i.rows())),s.xx=i.atRowCol(0,0),s.xy=i.atRowCol(0,1),s.yx=i.atRowCol(1,0),s.yy=i.atRowCol(1,1),3===i.cols()?(s.xd=i.atRowCol(0,2),s.yd=i.atRowCol(1,2)):(s.xd=0,s.yd=0)}function ri(t,s,i,e,n){const h=Xs.average(i,s),o=Xs.average(e,s),a=new ti({NN:2,MM:2});a.setZero();const u=new ti({NN:2,MM:2});u.setZero();for(let r=0;r<s;++r)a.setRowCol(0,0,a.atRowCol(0,0)+(i[r].x-h.x)*(i[r].x-h.x)),a.setRowCol(0,1,a.atRowCol(0,1)+(i[r].x-h.x)*(i[r].y-h.y)),a.setRowCol(1,1,a.atRowCol(1,1)+(i[r].y-h.y)*(i[r].y-h.y)),u.setRowCol(0,0,u.atRowCol(0,0)+(e[r].x-o.x)*(i[r].x-h.x)),u.setRowCol(0,1,u.atRowCol(0,1)+(e[r].x-o.x)*(i[r].y-h.y)),u.setRowCol(1,0,u.atRowCol(1,0)+(e[r].y-o.y)*(i[r].x-h.x)),u.setRowCol(1,1,u.atRowCol(1,1)+(e[r].y-o.y)*(i[r].y-h.y));a.setRowCol(1,0,a.atRowCol(0,1));const l=new ti({NN:2,MM:2});a.pseudoInverse(l,!0)||r("Failed to compute pseudo inverse"),u.mul(l,u),ei(t,u);const m=h.clone();t.transformInPlace(m),t.xd=o.x-m.x,t.yd=o.y-m.y,n&&(u.pseudoInverse(l,!1)||r("Failed to compute pseudo inverse"),ei(n,l),n.transformInPlace(o),n.xd=h.x-o.x,n.yd=h.y-o.y)}function ni(s,i,e,n,h,o){t(1===s||0===s||2===s||3===s),i.setIdentity();const a=Xs.average(n,e),u=Xs.average(h,e);if(t(s<ii.length&&s>0),8&ii[s]){const t=new ti({NN:2,MM:2});t.setZero();for(let s=0;s<e;++s)t.setRowCol(0,0,t.atRowCol(0,0)+(h[s].x-u.x)*(n[s].x-a.x)),t.setRowCol(1,0,t.atRowCol(1,0)+(h[s].x-u.x)*(n[s].y-a.y)),t.setRowCol(0,1,t.atRowCol(0,1)+(h[s].y-u.y)*(n[s].x-a.x)),t.setRowCol(1,1,t.atRowCol(1,1)+(h[s].y-u.y)*(n[s].y-a.y));const o=new ti({NN:2,MM:2}),l=new ti({NN:2,MM:1}),m=new ti({NN:2,MM:2});t.svd(o,l,m)||r("Failed to compute svd");const c=new ti({NN:2,MM:2});o.transpose(c);const y=new ti({NN:2,MM:2});if(m.mul(c,y),!(32&ii[s])){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 si;ei(x,y),i.set(x)}if(2&ii[s]){let t=0,s=0;for(let r=0;r<e;++r){const e=n[r].sub(a);t+=e.sqrLength(),i.transformInPlace(e),s+=e.dotProduct(h[r].sub(u))}if(0===t)0===s?i.setIdentity():i.setZero();else{const e=s/t;i.scale(e,e)}}else t(!(4&ii[s]));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{Nt as $,pt as A,Rs as B,Mt as C,gt as D,_ as E,As as F,ws as G,Cs as H,Ft as I,zt as J,n as K,k as L,Ps as M,Lt as N,O,Xs as P,N as Q,U as R,Bt as S,si as T,K as U,Rt as V,qs as W,ns as X,Y,L as Z,B as _,zs as a,Gt as a0,Ss as a1,Os as a2,Ls as a3,ks as a4,ft as a5,dt as a6,E as a7,g as a8,G as a9,ps as aA,Ms as aB,Q as aa,I as ab,Vs as ac,Ks as ad,Et as ae,D as af,A as ag,X as ah,Fs as ai,Ds as aj,At as ak,Zs as al,_s as am,js as an,xt as ao,Ut as ap,Zt as aq,Us as ar,it as as,F as at,Ns as au,Gs as av,It as aw,$ as ax,as as ay,$t as az,os as b,kt as c,qt as d,Vt as e,Ot as f,Qt as g,yt as h,us as i,St as j,j as k,V as l,Pt as m,Tt as n,hs as o,J as p,H as q,S as r,Ct as s,W as t,Dt as u,q as v,Z as w,Is as x,es as y,rs as z};
5
+ import{g as t,d as s,p as i,t as e,q as r}from"./Geometry.js";class n{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(){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])}addKahan(s){t(0)}subKahan(s){t(0)}mulKahan(s){t(0)}mul(t){const s=new n(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}meKahan(t){return this.subKahan(t),this}peKahan(t){return this.addKahan(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],f=[-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3];function x(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+f[Number(BigInt.asUintN(4,t))]+1}function b(t){let s=0;return t&h||(s=32,t>>=32n),s+x(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(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 rs(this.vmin,t)&&rs(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 t(0),!0}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(s){return t(0),!0}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(s){t(0)}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 w}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 w=new _(0,1);class N{static getNAN(){return new N(Number.NaN)}constructor(t,s){this.m_value=t??0,this.m_eps=s??0}[Symbol.toPrimitive](t){return this}clone(){return new N(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=N.ulp(t)*s,this}setE(t){return this.m_value=t.m_value,this.m_eps=t.m_eps,this}precise(){return new N(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+N.ulp(s);return this.m_value=s,this.m_eps=i,this}addThis(t){const s=this.m_value+t,i=this.m_eps+N.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+N.ulp(s);return this.m_value=s,this.m_eps=i,this}subThis(t){const s=this.m_value-t,i=this.m_eps+N.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+N.ulp(this.m_value),this}setAdd(t,s){return this.m_value=t+s,this.m_eps=N.ulp(this.m_value),this}setAddEN(t,s){return this.m_value=t.m_value+s,this.m_eps=t.m_eps+N.ulp(this.m_value),this}setAddNE(t,s){return this.m_value=t+s.m_value,this.m_eps=s.m_eps+N.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+N.ulp(this.m_value),this}setSub(t,s){return this.m_value=t-s,this.m_eps=N.ulp(this.m_value),this}setSubEN(t,s){return this.m_value=t.m_value-s,this.m_eps=t.m_eps+N.ulp(this.m_value),this}setSubNE(t,s){return this.m_value=t-s.m_value,this.m_eps=s.m_eps+N.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+N.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)+N.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+N.ulp(i),this.m_value=i,this}setMul(t,s){return this.m_value=t*s,this.m_eps=N.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 N(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+N.ulp(i),this}divThis(t){const s=Math.abs(t);return this.m_value/=t,this.m_eps=this.m_eps/s+N.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=N.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+=N.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+N.ulp(t),this.m_value=t,this}cubeThis(){return t(0),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),r=Math.abs(t.value());return this.m_eps=(Math.abs(i)+.5*e*t.m_eps)*t.m_eps+N.ulp(e+r),this}static ulp(t){let s=Jt(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),r=Math.abs(t.value());return this.m_eps=(Math.abs(s)+.5*e*t.m_eps)*t.m_eps+N.ulp(e+r),this}static st_cosAndSin(t,s,i){const e=Math.sin(t.m_value),r=Math.cos(t.m_value);i.m_value=e,s.m_value=r;const n=Math.abs(e),h=Math.abs(r),o=Math.abs(t.value());i.m_eps=(Math.abs(r)+.5*n*t.m_eps)*t.m_eps+N.ulp(n+o),s.m_eps=(Math.abs(e)+.5*h*t.m_eps)*t.m_eps+N.ulp(h+o)}setLog(s){return t(0),this}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}static atan2(s,i){return t(0),new N}acosThis(){return t(0),this}asinThis(){return t(0),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())}cubicRootThis(){return t(0),this}powerThis(s){return t(0),this}setPower(t,s){return this.setE(t),this.powerThis(s)}static size(){return 1}}function M(t,s){const i=ss(t),e=ss(s),r=53-b(i),n=53-b(e);return(r>=0?r:0)+(n>=0?n: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()}N.dimensions=1;const R=new N(Math.PI,.5*T()),g=new N(0,0),E=new N(1,0),I=new N(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 r=t*t;for(let t=2*Math.trunc(e/Math.log(r)+2.5)-1;t>1;t-=2)i=1/t,s=(s+i)*r;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,r=Math.log(t)*Math.log(e);i=s-z(e)-r}else{i=0;const s=1+Math.trunc(-16*Math.log(10)/Math.log(t)+1.5);let e=s;for(let r=s;r>0;r--,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,r){r[0]=s[0]+(i[0]-s[0])*e,r[1]=s[1]+(i[1]-s[1])*e,3===t&&(r[2]=s[2]+(i[2]-s[2])*e)}function B(t,s,i,e,r){r[0]=i[0]-(i[0]-s[0])*(1-e),r[1]=i[1]-(i[1]-s[1])*(1-e),3===t&&(r[2]=i[2]-(i[2]-s[2])*(1-e))}function O(t,s,i,e,r){e<=.5?L(t,s,i,e,r):B(t,s,i,e,r)}function G(t,s,i,e,r){r[0]=s[0].addE(i[0].subE(s[0]).mulE(e)),r[1]=s[1].addE(i[1].subE(s[1]).mulE(e))}function Q(t,s,i,e,r){r[0]=i[0].subE(i[0].subE(s[0]).mulE(E.subE(e))),r[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 K(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 W(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 j(t){return t*t}function X(t){return t*t*t}function $(t){return 1/Math.sqrt(t)}function H(t){return t<0?-1:t>0?1:0}function J(t,s,i,e){const r=[0],n=[0],h=[0];return ct(ot(t,i,r),ot(s,e,n),h)+(r[0]+n[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],rt=[0],nt=[0],ht=[0];function ot(t,s,i){const e=t*s;return at(t,et,rt),at(s,nt,ht),i[0]=rt[0]*ht[0]-(e-et[0]*nt[0]-rt[0]*nt[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 r=ct(t,s,ut),n=ct(r,i,lt);return ct(n,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 ft(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,r=.01953125,n=.01068115234375,h=.0067291259765625,o=.004626274108886719,a=.0033752918243408203,u=.0025710230693221092;return Os()*(1-s*(i+s*(e+s*(r+s*(n+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 xt(s,i,e=Number.NaN){if(t(i>=0&&i<=1),0===i)return s;let r=1,n=s;if(n<0&&(n=-n,r=-1),1===i){const t=Math.round(n/Ls()),s=n-t*Ls();return r*(2*t+Math.sin(s))}const h=Os(),o=Math.floor(n/h);1&o?n=(o+1)*h-n:n-=o*h;const a=Math.sin(n),u=Number.isNaN(e)?ft(i):e;let l;if(1===a)l=u+Math.sqrt(1-i)*(n-h);else{const t=n*n;if(.01424*Math.pow(t,4)<=2*zs()){l=n*(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*n),s=Math.sin(4*n),e=Math.sin(6*n),r=Math.sin(8*n),h=Math.sin(10*n);l=n+i*((2*-n+t)/8+i*((-3*n+2*t-.25*s)/64+i*((-20*n+15*t-3*s+e/3)/1024+i*(5*(-140*n+112*t-28*s+16/3*e-.5*r)/65536+7*i*((-63*n+52.5*t-15*s+3.75*e-.625*r+.05*h)/65536+i*(-693*n+594*t-185.625*s+1.375*e-12.375*r+1.8*h-.125*Math.sin(12*n))/1048576)))))}else{const t=a*a,s=Math.cos(n),e=s*s,r=_t(a,s,i);l=a*(bt(e,r,1)-i*t*vt(e,r,1)/3)}}if(1&o){l=u*(o+1)-l}else l+=u*o;return r*l}function dt(t,s,i=Number.NaN){if(0===t)return 0;let e=1,r=t;t<0&&(r=-r,e=-1);const n=Number.isNaN(i)?ft(s):i,h=Math.floor(r/n);1&h?r=(h+1)*n-r:r-=h*n;let o=r<=0?0:r>=n?Os():wt(r,s,n);return 1&h?o=Os()*(h+1)-o:o+=Os()*h,e*o}function bt(s,i,e){t((0!==s?1:0)+(0!==i?1:0)+1>1);let r=s,n=i,h=e;for(;;){const t=Math.sqrt(r*n)+Math.sqrt(n*h)+Math.sqrt(h*r);r=.25*(r+t),n=.25*(n+t),h=.25*(h+t);const s=(r+n+h)/3,i=(s-r)/s,e=(s-n)/s,o=(s-h)/s;if(Math.abs(i)<=.0024&&Math.abs(e)<=.0024&&Math.abs(o)<=.0024){const t=i*e-o*o,r=i*e*o;return(1+(1/24*t-.1-3/44*r-5*t*t/208+t*r/16)*t+(1/14+3*r/104)*r)/Math.sqrt(s)}}}function vt(s,i,e){t(0!==s||0!==i);let r=s,h=i,o=e;const a=new n(0);let u=1;for(;;){const t=.2*(r+h+3*o),s=(t-r)/t,i=(t-h)/t,e=(t-o)/t;if(Math.abs(s)<=.0015&&Math.abs(i)<=.0015&&Math.abs(e)<=.0015){const r=s*i,n=e*e,h=r-n,o=r-6*n,l=o+h+h,m=9/22,c=3/26,y=o*(.25*m*o-3/14-1.5*c*e*l),f=e*(1/6*l+e*(-m*h+e*c*r));return 3*a.getResult()+u*(1+y+f)/(t*Math.sqrt(t))}const n=Math.sqrt(r),l=Math.sqrt(h),m=Math.sqrt(o),c=n*(l+m)+l*m;a.add(u/(m*(o+c))),u*=.25,r=.25*(r+c),h=.25*(h+c),o=.25*(o+c)}}function _t(t,s,i){return t<.999?1-i*j(t):1-i+i*j(s)}function wt(t,s,i){if(0===s)return t;if(1===s)return Math.asin(t);let e=0,r=!0;if(t<.2){const i=t*t,n=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(n)*zs())return n;e=n,r=h>.1*n}if(r){const r=1-s,n=1-t/i,h=Math.sqrt(n*n+r*r),o=Math.atan2(r,t+zs());e=Os()+Math.sqrt(h)*(o-Os())}let n=0;for(let h=0;h<7;h++){n=xt(e,s,i);const r=_t(Math.sin(e),Math.cos(e),s);if(e-=(n-t)/Math.sqrt(r),h>0&&Math.abs(n-t)<=4*zs()*t)break}return e}function Nt(t,i,e,r,n){return 0===t?0===r?i:1===r?e:n:1===t?0===r?i:1===r?e:V(i,e,r):(2===t&&s("angular interpolation"),void s(""))}function Mt(t,i,e,r,n,h,o,a){if(0===t)for(let s=0;s<h;++s)r[s+n]=0===o?i[s]:1===o?e[s]:a;else if(1===t)if(0===o)pt(r,i,n,0,h);else if(1===o)pt(r,e,n,0,h);else for(let s=0;s<h;++s)r[s+n]=V(i[s],e[s],o);else if(2===t)if(0===o)pt(r,i,n,0,h);else if(1===o)pt(r,e,n,0,h);else{let t=0;for(let s=0,a=n;s<h;++s,++a)r[a]=V(i[s],e[s],o),t+=r[a]*r[a];if(t>0){t=Math.sqrt(t);for(let s=n;s<n+h;++s)r[s]/=t}else{for(let t=n;t<n+h;++t)r[t]=0;r[n]=1}}else s("")}function pt(t,s,i,e,r){if(0===r)return;let n=0,h=i,o=e;for(;n++<r;)t[h++]=s[o++]}function Ct(t,s,i){let e=0;for(let r=0;!e&&r<i;++r)e=t[r]-s[r];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 r=t.slice(s,s+i);r.sort(e),pt(t,r,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 Kt{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),Wt=new Float64Array(Yt),jt=new BigUint64Array(Yt),Xt=0x0fffffffffffffn,$t=0x7ff0000000000000n;function Ht(){return Number.EPSILON*Ds}function Jt(t){return Wt[0]=t,jt[0]}function ts(t){return jt[0]=t,Wt[0]}function ss(t){return Jt(t)&Xt}function is(t){return Number((Jt(t)&$t)>>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 r=s;i>>=1n;let n=r+i;for(;i>0n;)t<1n<<n||(r=n),i>>=1n,n=r+i;return r}function rs(t,s){return t===s||Number.isNaN(t)&&Number.isNaN(s)}function ns(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),fs=2166136261,xs=16777619;function ds(t){let s=fs,i=t;return s=(s^255&i)*xs,i>>=8,s=(s^255&i)*xs,i>>=8,s=(s^255&i)*xs,i>>=8,s=(s^255&i)*xs,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 ws(t){return 1103515245*t+12345&2147483647}function Ns(t){let s=fs;for(let i=0,e=t.length;i<e;++i)s=(s^t.charCodeAt(i))*xs;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 ws(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 Ks{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 Ks).setDouble(t)}static constructInt64(t){return(new Ks).setInt64(t)}static constructRational(t,s){return(new Ks).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 Ks).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(t){if(this.setZero(),0===t)return this;if(Number.isInteger(t)&&Math.abs(t)<ls())return this.setInt32(t);const i=Jt(t),e=(i&Ks.s_em)>>52n,r=!!(i&Ks.s_sm),n=i&Ks.s_fm;if(e===Ks.s_emax)return n?(this.m_rn.v=this.m_rd.v=0n,this.m_bNaN=!0,this):(this.m_rn.v=r?-1n:1n,this.m_rd.v=0n,this);0n===e&&s("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|n)<<o,this.m_rd.v=1n<<52n+a,this.m_sign=r?-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(s){return t(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(Ks.constructDouble(t))}thisMulInt64(s){return t(0),this}thisMulInt32(s){return t(0),this}divThis(t){return this.mulThis(t.clone().invertThis())}divDoubleThis(t){return this.divThis(Ks.constructDouble(t))}addDoubleThis(t){return this.addThis(Ks.constructDouble(t))}subDoubleThis(t){return this.subThis(Ks.constructDouble(t))}mul(t){return this.clone().mulThis(t)}mulBigIntThis(t){return this.mulThis(Ks.constructInt64(t))}mulDouble(t){return this.clone().mulThis(Ks.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(Ks.constructDouble(t))}sub(t){return this.clone().subThis(t)}subDouble(t){return this.clone().subThis(Ks.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+=x(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+=x(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(s,e){if(s.m_sign<0n&&i("MP_value: sqrt(-1)"),s.isZero())return s.clone();let r=52,n=2220446049250313e-31;for(;r<e;)2*r<=e?(n*=n,r*=2):(n*=2220446049250313e-31,r+=52);r+=52;const h=es(s.m_rn.v),o=es(s.m_rd.v);let a,u=s.m_power+Number(h-o);const l=new Ks;Math.abs(u)>200?(1&Math.abs(u)&&(u+=1),a=Ks.constructAssign(s,53).ldexpThis(-u).value(),l.setThis(s).ldexpThis(-u),t(Number.isFinite(a))):(l.setThis(s),a=l.value(),t(Number.isFinite(a)),u=0),a=Math.sqrt(a);const m=Ks.constructDouble(a),c=Ks.constructDouble(n);c.mulThis(m).ldexpThis(1);const y=n*a*2,f=m.clone(),x=new Ks;let d;for(let t=0;t<10;++t){f.mulThis(m),x.setThis(l).subThis(f).absThis();let t=x.value();if(d=1,t<.9)for(;t>y;)t*=t,++d;else d=4;if(x.lte(c))break;for(let s=0;s<d;s++)f.setThis(m).divThis(l).invertThis().addThis(m).ldexpThis(-1).limitPrecisionThis(r),m.setThis(f)}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 r=Math.pow(Math.abs(t.value()),1/3),n=Ks.constructDouble(r),h=n.clone();h.sqrThis().mulDoubleThis(3).mulDoubleThis(e),h.limitPrecisionThis(32),t.LZ()&&n.negateThis();for(let o=0;o<10;++o){const s=n.clone();s.sqrThis().mulThis(n);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 r=s.clone();r.ldexpThis(1),r.addThis(t),e.divThis(r),n.mulThis(e),n.limitPrecisionThis(i)}return n}isInTheRangeOfDouble(){return t(0),!1}sign(){return this.m_sign}cosAndSin(s,i){t(0)}static nan(){return t(0),new Ks}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 r=Number(e);if(BigInt(r)!==e)return t?-r:r;let n=s-e*i;if(n){let t=es(i)-1023n;t>0n&&(i>>=t,n<<=52n,n>>=t);let s=Number(n);Number.isFinite(s)||(n>>=52n,s=Number(n),t=0n),t>0n&&(s/=Math.pow(2,52));r+=s/Number(i)}return t?-r:r}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,r;this.m_power>i?(e=BigInt(this.m_power-i),r=0n):(e=0n,r=BigInt(t.m_power-i));const n=this.signVal()*this.m_rn.v*t.m_rd.v<<e,h=t.signVal()*t.m_rn.v*this.m_rd.v<<r;return this.m_rn.v=s?n+h:n-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}}Ks.s_sm=0x8000000000000000n,Ks.s_em=0x7ff0000000000000n,Ks.s_fm=0x000fffffffffffffn,Ks.s_emax=0x7ffn;const Ys=Ks.constructInt32(1),Ws=Ks.constructInt32(0);function js(t,s){return v(t^s)}function Xs(t,s){let i=is(t);const e=is(s);if(i===e){return i-=53-js(ss(t),ss(s)),i}return i>e?i:e}function $s(t){const s=zt(Hs,t.length);for(let i=0,e=t.length;i<e;++i)s[i].setCoords(t[i][0],t[i][1]);return s}class Hs{static construct(t,s){return new Hs(t,s)}constructor(t,s){void 0!==t?(this.x=t,this.y=s):this.x=this.y=Number.NaN}clone(){return new Hs(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 t(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(s,i,e){t(0)}scaleAddThis(t,s){this.x=this.x*t+s.x,this.y=this.y*t+s.y}scaleAddOther(s,i,e){t(0)}scaleOther(s,i){t(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(s){t(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(s,i){return t(0),{}}static average(t,s){const i=new Hs;if(0===s)return i.setNAN(),i;if(1===s)return i.assign(t[0]),i;const e=new n(t[0].x),r=new n(t[0].y);for(let n=1;n<s;n++)e.add(t[n].x),r.add(t[n].y),255&n||(e.normalize(),r.normalize());return i.x=e.getResult()/s,i.y=r.getResult()/s,i}offset(t,s){const i=Hs.distance(t,s),e=Hs.construct(this.x,this.y);if(0===i)return Hs.distance(e,t);const r=s.clone();r.subThis(t),e.subThis(t);return e.crossProduct(r)/i}side(s,i){return t(0),0}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 r=i-t,n=e-s;return r*r+n*n}static distance(t,s){return Math.sqrt(Hs.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(s){return t(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 Hs(this.x+t.x,this.y+t.y)}sub(t){return new Hs(this.x-t.x,this.y-t.y)}negateThis(){return this.x=-this.x,this.y=-this.y,this}negate(){return new Hs(-this.x,-this.y)}mul(t){return new Hs(this.x*t,this.y*t)}mulThis(t){return this.x*=t,this.y*=t,this}divide(t){return new Hs(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 Hs(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 Hs.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?Hs.orientationRobustImpl(Hs.construct(0,0),s,t,!0):i<e?-1:1}static compareVectorsOrigin(t,s,i){const e=s.sub(t),r=i.sub(t),n=e.getQuarter(),h=r.getQuarter();return h===n?Hs.orientationRobustImpl(t,i,s,!0):n<h?-1:1}static orientationRobust(t,s,i){return Hs.orientationRobustImpl(t,s,i,!1)}static orientationRobustEx(t,s,i,e){if(t.equals(s)||i.equals(e))return 0;const r=s.x-t.x,n=s.y-t.y,h=e.x-i.x,o=e.y-i.y;{const t=Hs.getQuarterCoords(r,n)-1,s=Hs.getQuarterCoords(h,o)-1,i=Hs.d[t][s];if(0!==i)return i}const a=r*o,u=n*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 Hs.orientationRobustExMp(t,s,i,e)}static orientationRobustExMp(t,s,i,e){const r=Ks.constructDouble(s.x),n=Ks.constructDouble(e.x);r.subThis(Ks.constructDouble(t.x)),n.subThis(Ks.constructDouble(i.x));const h=Ks.constructDouble(s.y),o=Ks.constructDouble(e.y);return h.subThis(Ks.constructDouble(t.y)),o.subThis(Ks.constructDouble(i.y)),r.mulThis(o),h.mulThis(n),r.subThis(h),r.LZ()?-1:r.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 r=s.x-t.x,n=s.y-t.y,h=i.x-t.x,o=i.y-t.y;if(!e){const t=Hs.getQuarterCoords(r,n)-1,s=Hs.getQuarterCoords(h,o)-1,i=Hs.d[t][s];if(0!==i)return i}const a=(Math.abs(r)+Math.abs(n)+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=r*o-n*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(r,o)&&M(n,h)){const t=r*o,s=n*h;if(C(t,s)){const i=t-s;return i<0?-1:i>0?1:0}}return Hs.orientationRobustMp(t,s,i)}static orientationRobustMp(t,s,i){const e=Ks.constructDouble(s.x),r=Ks.constructDouble(i.x);{const s=Ks.constructDouble(t.x);e.subThis(s),r.subThis(s)}const n=Ks.constructDouble(i.y),h=Ks.constructDouble(s.y);{const s=Ks.constructDouble(t.y);n.subThis(s),h.subThis(s)}return e.mulThis(n),h.mulThis(r),e.subThis(h),e.LZ()?-1:e.GZ()?1:0}static inCircleRobust(t,s,i,e){const r=new N,n=new N;r.set(t.x),r.subThis(e.x),n.set(t.y),n.subThis(e.y);const h=new N,o=new N;h.set(s.x),h.subThis(e.x),o.set(s.y),o.subThis(e.y);const a=new N,u=new N;a.set(i.x),a.subThis(e.x),u.set(i.y),u.subThis(e.y);const l=r.mulE(o).subE(n.mulE(h)),m=h.mulE(u).subE(o.mulE(a)),c=r.mulE(u).subE(n.mulE(a)),y=r.mulE(r).addE(n.mulE(n)),f=h.mulE(h).addE(o.mulE(o)),x=a.mulE(a).addE(u.mulE(u)),d=y.mulE(m).subE(f.mulE(c)).addE(x.mulE(l));if(!d.isFuzzyZero()){const t=d.value();return t<0?-1:t>0?1:0}return Hs.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 r=t.x-e.x,n=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(r,o)||!M(n,h))break;if(!M(h,u)||!M(o,a))break;if(!M(r,u)||!M(n,a))break;if(!M(r,r)||!M(n,n))break;if(!M(h,h)||!M(o,o))break;if(!M(a,a)||!M(u,u))break;const l=r*o,m=n*h,c=h*u,y=o*a,f=r*u,x=n*a,d=r*r,b=n*n,v=h*h,_=o*o,w=a*a,N=u*u;if(!C(l,m))break;if(!C(c,y))break;if(!C(f,x))break;if(!p(d,b))break;if(!p(v,_))break;if(!p(w,N))break;const T=l-m,R=c-y,g=f-x,E=d+b,I=v+_,D=w+N;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 r=Ks.constructDouble(e.x),n=Ks.constructDouble(e.y),h=Ks.constructDouble(t.x),o=Ks.constructDouble(t.y);h.subThis(r),o.subThis(n);const a=Ks.constructDouble(s.x),u=Ks.constructDouble(s.y);a.subThis(r),u.subThis(n);const l=Ks.constructDouble(i.x),m=Ks.constructDouble(i.y);l.subThis(r),m.subThis(n);const c=h.mul(u).sub(o.mul(a)),y=a.mul(m).sub(u.mul(l)),f=h.mul(m).sub(o.mul(l)),x=h.mul(h).add(o.mul(o)),d=a.mul(a).add(u.mul(u)),b=l.mul(l).add(m.mul(m)),v=x.mul(y).sub(d.mul(f)).add(b.mul(c));return v.LZ()?-1:v.GZ()?1:0}static inCircleRobustMp3Point(t,s,i){const e=Ks.constructDouble(t.x),r=Ks.constructDouble(t.y),n=Ks.constructDouble(s.x),h=Ks.constructDouble(s.y),o=Ks.constructDouble(i.x),a=Ks.constructDouble(i.y),u=o.mul(o).add(a.mul(a)).sub(o.mul(e).add(a.mul(r)).add(o.mul(n)).add(a.mul(h))).add(e.mul(n).add(r.mul(h)));return u.LZ()?-1:u.GZ()?1:0}static inCircleRobust3Point(t,s,i){const e=new N(t.x),r=new N(t.y),n=new N(s.x),h=new N(s.y),o=new N(i.x),a=new N(i.y),u=o.mulE(o).addE(a.mulE(a)).subE(o.mulE(e).addE(a.mulE(r)).addE(o.mulE(n)).addE(a.mulE(h))).addE(e.mulE(n).addE(r.mulE(h)));if(!u.isFuzzyZero()){const t=u.value();return t<0?-1:t>0?1:0}return Hs.inCircleRobustMp3Point(t,s,i)}static calculateCircleCenterFromThreePoints(t,s,i){if(t.equals(i)||t.equals(s)||i.equals(s))return Hs.getNAN();const e=Js(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(s,i,e){return t(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=Hs.c_compare_zorder_xx[t.x<0?1:0]|Hs.c_compare_zorder_yy[t.y<0?1:0],e=Hs.c_compare_zorder_xx[s.x<0?1:0]|Hs.c_compare_zorder_yy[s.y<0?1:0];if(i===e){let i=0,e=0;for(let r=0;r<2;++r){const n=Xs(t[r],s[r]);n>i&&(i=n,e=r)}return t[e]<s[e]}return i<e}static lerp(t,s,i){const e=new Hs;return Y(t,s,i,e),e}static getClosestCoordinate(t,s,i,e=!1){const r=Hs.getNAN();r.setSub(s,t);const n=r.sqrLength();if(0===n)return.5;if(s.isEqualPoint2D(i))return 1;const h=Hs.getNAN();h.setSub(i,t);let o=h.dotProduct(r)/n;return e||(o<0?o=0:o>1&&(o=1)),o}static intersectLinesAtOnePoint(s,i,e,r){return t(0),new Hs(0,0)}toString(){return`[${this.x},${this.y}]`}}function Js(t,s,i){const e=new N(s.x);e.subThis(t.x);const r=new N(s.y);r.subThis(t.y);const n=new N(i.x);n.subThis(t.x);const h=new N(i.y);h.subThis(t.y);const o=e.clone();o.mulThisE(h);let a=r.clone();if(a.mulThisE(n),o.subThisE(a),0===o.value())return Hs.getNAN();o.mulThis(2);const u=e.clone();u.mulThisE(e);const l=r.clone();l.mulThisE(r);const m=u.clone();m.addThisE(l);const c=n.clone();c.mulThisE(n);const y=h.clone();y.mulThisE(h);const f=c.clone();f.addThisE(y);const x=r.clone();x.mulThisE(f),a=h.clone(),a.mulThisE(m),x.subThisE(a),x.divThisE(o);const d=e.clone();d.mulThisE(f),a=n.clone(),a.mulThisE(m),d.subThisE(a),d.divThisE(o);const b=Hs.construct(t.x-x.value(),t.y+d.value()),v=t.sub(b).length(),_=s.sub(b).length(),w=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-w)<=M&&x.eps()<M&&d.eps()<M?b:Hs.getNAN()}function ti(t,s,i){const e=Ks.constructDouble(s.x);e.subDoubleThis(t.x);const r=Ks.constructDouble(s.y);r.subDoubleThis(t.y);const n=Ks.constructDouble(i.x);n.subDoubleThis(t.x);const h=Ks.constructDouble(i.y);h.subDoubleThis(t.y);const o=e.clone();o.mulThis(h);let a=r.clone();if(a.mulThis(n),o.subThis(a),o.isZero())return Hs.getNAN();o.mulDouble(2);const u=e.clone();u.mulThis(e);const l=r.clone();l.mulThis(r);const m=u.clone();m.addThis(l);const c=n.clone();c.mulThis(n);const y=h.clone();y.mulThis(h);const f=c.clone();f.addThis(y);const x=r.clone();x.mulThis(f),a=h.clone(),a.mulThis(m),x.subThis(a),x.divThis(o);const d=e.clone();d.mulThis(f),a=n.clone(),a.mulThis(m),d.subThis(a),d.divThis(o);return Hs.construct(t.x-x.value(),t.y+d.value())}Hs.dimensions=2,Hs.d=[[0,1,0,-1],[-1,0,1,0],[0,-1,0,1],[1,0,-1,0]],Hs.c_compare_zorder_xx=[2,0],Hs.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}assignMove(s){return t(0),this}assignCopy(s){return this===s||(t(this.N*this.M==s.N*s.M),this.data.set(s.data),this.N=s.N,this.M=s.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(s){return t(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(s,i){t(0)}mul(s,i){if(t(this.M===s.rows()),t(this.N===i.rows()),t(s.cols()===i.cols()),i===this){const t=new Float64Array(this.N*this.M),e=new si(t,this.N,this.M);return this.mul(s,e),void i.assignCopy(e)}if(i===s){const t=new Float64Array(s.N*s.M),e=new si(t,s.N,s.M);return this.mul(s,e),void i.assignCopy(e)}const e=s.cols();for(let t=0;t<this.N;t++)for(let r=0;r<e;r++){let e=0;for(let i=0;i<this.M;i++)e+=this.atRowCol(t,i)*s.atRowCol(i,r);i.setRowCol(t,r,e)}}mulTranspose(s,i){if(t(this.M===s.cols()),t(this.N===i.rows()),t(s.rows()===i.cols()),i===this){const t=new Float64Array(this.N*this.M),e=new si(t,this.N,this.M);return this.mulTranspose(s,e),void i.assignCopy(e)}if(i===s){const t=new Float64Array(s.N*s.M),e=new si(t,s.N,s.M);return this.mulTranspose(s,e),void i.assignCopy(e)}const e=s.rows();for(let t=0;t<this.N;t++)for(let r=0;r<e;r++){let e=0;for(let i=0;i<this.M;i++)e+=this.atRowCol(t,i)*s.atRowCol(r,i);i.setRowCol(t,r,e)}}mulLeft(s,i){t(0)}mulLeftTranspose(s,i){t(0)}mulDiag(s,i){if(t(this.M===s.N*s.M),t(this.N===i.rows()),t(this.M===i.cols()),i===this){const t=new Float64Array(this.N*this.M),e=new si(t,this.N,this.M);return this.mulDiag(s,e),void i.assignCopy(e)}const e=this.M;for(let t=0;t<this.N;t++)for(let r=0;r<e;r++)i.setRowCol(t,r,this.atRowCol(t,r)*s.at(r))}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(s,i,e,r=!1){if(si.checkDims(s,this.N,this.M),si.checkDims(i,this.M,1),si.checkDims(e,this.M,this.M),r){if(t(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 s.assignCopy(e),!0}let n,h,o,a,u,l,m,c=0,y=0,f=0,x=0,d=0;const b=this.M,v=this.N;s.assignCopy(this);const _=new Float64Array(b),w=new si(_,b,1),N=(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 t=0;t<b;t++){if(c=t+1,w.set(t,x*f),f=a=x=0,t<v){for(let i=t;i<v;i++)x+=Math.abs(s.atRowCol(i,t));if(x){for(let i=t;i<v;i++)s.setRowCol(i,t,s.atRowCol(i,t)/x),a+=s.atRowCol(i,t)*s.atRowCol(i,t);h=s.atRowCol(t,t),f=-N(Math.sqrt(a),h),o=h*f-a,s.setRowCol(t,t,h-f);for(let i=c;i<b;i++){a=0;for(let e=t;e<v;e++)a+=s.atRowCol(e,t)*s.atRowCol(e,i);h=a/o;for(let e=t;e<v;e++)s.setRowCol(e,i,s.atRowCol(e,i)+h*s.atRowCol(e,t))}for(let i=t;i<v;i++)s.setRowCol(i,t,s.atRowCol(i,t)*x)}}if(i.set(t,x*f),f=a=x=0,t<v&&t!==b-1){for(let i=c;i<b;i++)x+=Math.abs(s.atRowCol(t,i));if(x){for(let i=c;i<b;i++)s.setRowCol(t,i,s.atRowCol(t,i)/x),a+=s.atRowCol(t,i)*s.atRowCol(t,i);h=s.atRowCol(t,c),f=-N(Math.sqrt(a),h),o=h*f-a,s.setRowCol(t,c,h-f);for(let i=c;i<b;i++)w.set(i,s.atRowCol(t,i)/o);for(let i=c;i<v;i++){a=0;for(let e=c;e<b;e++)a+=s.atRowCol(i,e)*s.atRowCol(t,e);for(let t=c;t<b;t++)s.setRowCol(i,t,s.atRowCol(i,t)+a*w.at(t))}for(let i=c;i<b;i++)s.setRowCol(t,i,s.atRowCol(t,i)*x)}}const e=Math.abs(i.at(t))+Math.abs(w.at(t));d=e>d?e:d}for(let t=b-1;t>=0;t--){if(t<b-1){if(f){for(let i=c;i<b;i++)e.setRowCol(i,t,s.atRowCol(t,i)/s.atRowCol(t,c)/f);for(let i=c;i<b;i++){a=0;for(let r=c;r<b;r++)a+=s.atRowCol(t,r)*e.atRowCol(r,i);for(let s=c;s<b;s++)e.setRowCol(s,i,e.atRowCol(s,i)+a*e.atRowCol(s,t))}}for(let s=c;s<b;s++)e.setRowCol(t,s,0),e.setRowCol(s,t,0)}e.setRowCol(t,t,1),f=w.at(t),c=t}for(let t=(v<b?v:b)-1;t>=0;t--){c=t+1,f=i.at(t);for(let i=c;i<b;i++)s.setRowCol(t,i,0);if(f){f=1/f;for(let i=c;i<b;i++){a=0;for(let e=c;e<v;e++)a+=s.atRowCol(e,t)*s.atRowCol(e,i);h=a/s.atRowCol(t,t)*f;for(let e=t;e<v;e++)s.setRowCol(e,i,s.atRowCol(e,i)+h*s.atRowCol(e,t))}for(let i=t;i<v;i++)s.setRowCol(i,t,s.atRowCol(i,t)*f)}else for(let i=t;i<v;i++)s.setRowCol(i,t,0);s.setRowCol(t,t,s.atRowCol(t,t)+1)}for(let t=b-1;t>=0;t--)for(let r=1;;r++){let x=1;for(c=t;c>=0;c--){if(y=c-1,Math.abs(w.at(c))+d===d){x=0;break}if(Math.abs(i.at(y))+d===d)break}if(x){n=0,a=1;for(let e=c;e<=t&&(h=a*w.at(e),w.set(e,w.at(e)*n),Math.abs(h)+d!==d);e++){f=i.at(e),o=M(h,f),i.set(e,o),o=1/o,n=f*o,a=-h*o;for(let t=0;t<v;t++)l=s.atRowCol(t,y),m=s.atRowCol(t,e),s.setRowCol(t,y,l*n+m*a),s.setRowCol(t,e,m*n-l*a)}}if(m=i.at(t),c===t){if(m<0){i.set(t,-m);for(let s=0;s<b;s++)e.setRowCol(s,t,-e.atRowCol(s,t))}break}if(100===r)return!1;u=i.at(c),y=t-1,l=i.at(y),f=w.at(y),o=w.at(t),h=((l-m)*(l+m)+(f-o)*(f+o))/(2*o*l),f=M(h,1),h=((u-m)*(u+m)+o*(l/(h+N(f,h))-o))/u,n=a=1;for(let t=c;t<=y;t++){const r=t+1;f=w.at(r),l=i.at(r),o=a*f,f*=n,m=M(h,o),w.set(t,m),n=h/m,a=o/m,h=u*n+f*a,f=f*n-u*a,o=l*a,l*=n;for(let s=0;s<b;s++)u=e.atRowCol(s,t),m=e.atRowCol(s,r),e.setRowCol(s,t,u*n+m*a),e.setRowCol(s,r,m*n-u*a);m=M(h,o),i.set(t,m),m&&(m=1/m,n=h*m,a=o*m),h=n*f+a*l,u=n*l-a*f;for(let i=0;i<v;i++)l=s.atRowCol(i,t),m=s.atRowCol(i,r),s.setRowCol(i,t,l*n+m*a),s.setRowCol(i,r,m*n-l*a)}w.set(c,0),w.set(t,h),i.set(t,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 t=g;t<this.M;t++){const r=i.at(t);for(let i=0;i<this.N;i++)T.set(i,s.atRowCol(i,t));for(let s=0;s<this.M;s++)R.set(s,e.atRowCol(s,t));let n=t;for(;i.at(n-g)<r;){i.set(n,i.at(n-g));for(let t=0;t<this.N;t++)s.setRowCol(t,n,s.atRowCol(t,n-g));for(let t=0;t<this.M;t++)e.setRowCol(t,n,e.atRowCol(t,n-g));if(n-=g,n<g)break}i.set(n,r);for(let t=0;t<this.N;t++)s.setRowCol(t,n,T.at(t));for(let t=0;t<this.M;t++)e.setRowCol(t,n,R.at(t))}}while(g>1);for(let t=0;t<this.M;t++){let i=0;for(let e=0;e<this.N;e++)s.atRowCol(e,t)<0&&i++;for(let s=0;s<this.M;s++)e.atRowCol(s,t)<0&&i++;if(i>Math.trunc((this.N+this.M)/2)){for(let i=0;i<this.N;i++)s.setRowCol(i,t,-s.atRowCol(i,t));for(let s=0;s<this.M;s++)e.setRowCol(s,t,-e.atRowCol(s,t))}}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 t(0),!1}isIdentity(){return t(0),!1}equals(s,i){if(void 0!==i&&t(0),this.N!==s.N||this.M!==s.M)return!1;for(let t=0;t<this.N*this.M;t++)if(this.data[t]!==s.data[t])return!1;return!0}maxElement(){return t(0),0}min_element(){return t(0),0}determinant(){if(t(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 s=new Float64Array(this.N*this.N),i=new si(s,this.N,this.N),e=new Float64Array(this.N);if(!this.luDecomposition(i,e))return 0;let r=1;for(let t=0;t<this.N;t++)r*=i.atRowCol(t,t),e[t]!==t&&(r=-r);return r}submatrix(s,i,e){t(0)}inverse(s){t(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),r=new si(e,this.N,this.M),n=new Float64Array(this.M),h=new si(n,this.M,1),o=new Float64Array(this.M*this.M),a=new si(o,this.M,this.M);if(!this.svd(r,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(r,t),!0}luDecomposition(s,i){return t(0),!1}symmetricEigen(s,i){t(this.rows()===this.cols()),t(this.rows()===s.rows()),t(i.rows()===i.cols()&&i.rows()===this.rows()),t(this.isSymmetric());const e=new Float64Array(this.N*this.M),r=new si(e,this.N,this.M);r.assignCopy(this);const n=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 t=0;t<h;t++)u.set(t,r.atRowCol(t,t)),s.set(t,r.atRowCol(t,t)),l.set(t,0);i.setIdentity();const m=()=>{const t=u;i.transposeInPlace();let e=1;do{e*=3,e++}while(e<=h);do{e/=3,e=Math.trunc(e);for(let r=e;r<h;r++){const n=s.at(r),h=Math.abs(n);for(let s=0;s<this.M;s++)t.set(s,i.atRowCol(s,r));let o=r;for(;Math.abs(s.at(o-e))<h;){s.set(o,s.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!==r){s.set(o,n);for(let s=0;s<this.M;s++)i.setRowCol(s,o,t.at(s))}}}while(e>1)};for(let t=1;;t++){let e=0;for(let t=1;t<h;t++)for(let s=0;s<t;s++)e+=Math.abs(r.atRowCol(t,s));if(0===e)return m(),!0;const o=t<4?.2*e/(h*h):0;for(let a=0;a<h;a++)for(let e=a+1;e<h;e++){let u=n*Math.abs(r.atRowCol(e,a));if(t>4&&u<=Math.abs(s.at(a))&&u<=Math.abs(s.at(e)))r.setRowCol(e,a,0);else if(Math.abs(r.atRowCol(e,a))>o){let t,n=s.at(e)-s.at(a);if(u<Math.abs(n))t=r.atRowCol(e,a)/n;else{const s=.5*n/r.atRowCol(e,a);t=1/(Math.abs(s)+Math.sqrt(1+s*s)),s<0&&(t=-t)}const o=1/Math.sqrt(1+t*t),m=t*o,c=m/(1+o);n=t*r.atRowCol(e,a),l.set(a,l.at(a)-n),l.set(e,l.at(e)+n),s.set(a,s.at(a)-n),s.set(e,s.at(e)+n),r.setRowCol(e,a,0);let y=0;for(;y<a;y++)u=r.atRowCol(a,y),n=r.atRowCol(e,y),r.setRowCol(a,y,u-m*(n+u*c)),r.setRowCol(e,y,n+m*(u-n*c));for(y++;y<e;y++)u=r.atRowCol(y,a),n=r.atRowCol(e,y),r.setRowCol(y,a,u-m*(n+u*c)),r.setRowCol(e,y,n+m*(u-n*c));for(y++;y<h;y++)u=r.atRowCol(y,a),n=r.atRowCol(y,e),r.setRowCol(y,a,u-m*(n+u*c)),r.setRowCol(y,e,n+m*(u-n*c));for(y=0;y<h;y++)u=i.atRowCol(a,y),n=i.atRowCol(e,y),i.setRowCol(a,y,u-m*(n+u*c)),i.setRowCol(e,y,n+m*(u-n*c))}}for(let t=0;t<h;t++)u.set(t,u.at(t)+l.at(t)),s.set(t,u.at(t)),l.set(t,0)}}static checkDims(s,i,e){t(s.rows()===i&&s.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){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(Hs,4);t.queryCorners(s),this.transformPoints2D(s,4,s),t.setFromPoints(s,4)}queryTransformEnv(s,i){t(0)}transformInterleaved(s,i,e){t(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=Hs.getNAN();for(let r=0;r<s;r+=2)e.x=t[r],e.y=t[r+1],this.transformInPlace(e),i[r]=e.x,i[r+1]=e.y}multiply(t){return ei.st_multiply(this,t,this),this}mulLeft(s){return t(0),this}static st_multiply(t,s,i){const e=t.xx*s.xx+t.yx*s.xy,r=t.xy*s.xx+t.yy*s.xy,n=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=r,i.xd=n,i.yx=h,i.yy=o,i.yd=a}getCoefficients(s){t(0)}setCoefficients(t){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(s){t(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}}initializeFromCurveParameters(s,i,e){t(0)}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=Hs.distance(t[0],t[1]),r=Hs.distance(s[0],s[1]),n=r/i;this.scale(n,n);const h=t[1].sub(t[0]);h.divThis(i);const o=s[1].sub(s[0]);o.divThis(r);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 r=[t,s],n=[i,e];this.initializeFromTwoPointsArray(r,n)}transformSizeInPlace(s){t(0)}transformSize(s,i){t(0)}transformTol(s){return t(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!(j(this.xd)+j(this.yd)>s)&&(!(j(this.xy+this.xd)+j(this.yy+this.yd-1)>s)&&!(j(this.xx+this.xd-1)+j(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 t(0),!1}isTranslateTol(s){return t(0),!1}isOrthonormal(s){return t(0),!1}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}isScaleAndTranslate(s){return t(0),!1}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(s,i){return t(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(s,i){return t(0),this}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,r=-this.xy*t,n=-this.yx*t,h=this.xx*t;return this.xd=s,this.yd=i,this.xx=e,this.yy=h,this.xy=r,this.yx=n,this}invertPrecise(t){return this.set(t),this.invertPreciseThis()}invertPreciseThis(){const t=Ks.constructDouble(this.xy),s=Ks.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 r=Ks.constructDouble(this.xd),n=t.mulDouble(this.yd).sub(r.mulDouble(this.yy)).mul(e).toDouble(),h=r.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=n,this.yd=h,this.xx=o,this.yy=l,this.xy=a,this.yx=u,this}extractScaleTransform(s,i){t(0)}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 Hs;e.setSub(t[0],t[1]);const r=new Hs;r.setSub(t[0],t[2]);const n=new Hs;n.setSub(s[0],s[1]);const h=new Hs;h.setSub(s[0],s[2]);const o=4*Number.EPSILON*(Math.abs(e.x*r.y)+Math.abs(r.x*e.y));let a=e.x*r.y-e.y*r.x;return Math.abs(a)>o?(a=1/a,this.xx=(n.x*r.y-e.y*h.x)*a,this.xy=(e.x*h.x-n.x*r.x)*a,this.yx=(n.y*r.y-e.y*h.y)*a,this.yy=(e.x*h.y-n.y*r.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,r=null){return 0===s?(this.setIdentity(),void(r&&r.setIdentity())):1===s?(this.setShift(e[0].sub(i[0])),void(r&&r.setShift(i[0].sub(e[0])))):(s<3&&(t=1),void(4===t&&s>2?hi(this,s,i,e,r):oi(t,this,s,i,e,r)))}calculateErrors(s,i,e,r){t(s>0&&null!==i&&null!==e);let n=0;for(let t=0;t<s;++t){const s=this.transform(i[t]),h=Hs.sqrDistance(e[t],s);n+=h,r&&(r[t]=Math.sqrt(h))}return Math.sqrt(n/s)}}const ri=[43,11,41,9,61];function ni(s,i){t(!(2!==i.rows()&&3!==i.rows()||2!==i.cols()&&3!==i.rows())),s.xx=i.atRowCol(0,0),s.xy=i.atRowCol(0,1),s.yx=i.atRowCol(1,0),s.yy=i.atRowCol(1,1),3===i.cols()?(s.xd=i.atRowCol(0,2),s.yd=i.atRowCol(1,2)):(s.xd=0,s.yd=0)}function hi(t,s,i,e,n){const h=Hs.average(i,s),o=Hs.average(e,s),a=new ii({NN:2,MM:2});a.setZero();const u=new ii({NN:2,MM:2});u.setZero();for(let r=0;r<s;++r)a.setRowCol(0,0,a.atRowCol(0,0)+(i[r].x-h.x)*(i[r].x-h.x)),a.setRowCol(0,1,a.atRowCol(0,1)+(i[r].x-h.x)*(i[r].y-h.y)),a.setRowCol(1,1,a.atRowCol(1,1)+(i[r].y-h.y)*(i[r].y-h.y)),u.setRowCol(0,0,u.atRowCol(0,0)+(e[r].x-o.x)*(i[r].x-h.x)),u.setRowCol(0,1,u.atRowCol(0,1)+(e[r].x-o.x)*(i[r].y-h.y)),u.setRowCol(1,0,u.atRowCol(1,0)+(e[r].y-o.y)*(i[r].x-h.x)),u.setRowCol(1,1,u.atRowCol(1,1)+(e[r].y-o.y)*(i[r].y-h.y));a.setRowCol(1,0,a.atRowCol(0,1));const l=new ii({NN:2,MM:2});a.pseudoInverse(l,!0)||r("Failed to compute pseudo inverse"),u.mul(l,u),ni(t,u);const m=h.clone();t.transformInPlace(m),t.xd=o.x-m.x,t.yd=o.y-m.y,n&&(u.pseudoInverse(l,!1)||r("Failed to compute pseudo inverse"),ni(n,l),n.transformInPlace(o),n.xd=h.x-o.x,n.yd=h.y-o.y)}function oi(s,i,e,n,h,o){t(1===s||0===s||2===s||3===s),i.setIdentity();const a=Hs.average(n,e),u=Hs.average(h,e);if(t(s<ri.length&&s>0),8&ri[s]){const t=new ii({NN:2,MM:2});t.setZero();for(let s=0;s<e;++s)t.setRowCol(0,0,t.atRowCol(0,0)+(h[s].x-u.x)*(n[s].x-a.x)),t.setRowCol(1,0,t.atRowCol(1,0)+(h[s].x-u.x)*(n[s].y-a.y)),t.setRowCol(0,1,t.atRowCol(0,1)+(h[s].y-u.y)*(n[s].x-a.x)),t.setRowCol(1,1,t.atRowCol(1,1)+(h[s].y-u.y)*(n[s].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});t.svd(o,l,m)||r("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&ri[s])){y.determinant()<0&&(c.setRowCol(1,0,-c.atRowCol(1,0)),c.setRowCol(1,1,-c.atRowCol(1,1)),m.mul(c,y))}const f=new ei;ni(f,y),i.set(f)}if(2&ri[s]){let t=0,s=0;for(let r=0;r<e;++r){const e=n[r].sub(a);t+=e.sqrLength(),i.transformInPlace(e),s+=e.dotProduct(h[r].sub(u))}if(0===t)0===s?i.setIdentity():i.setZero();else{const e=s/t;i.scale(e,e)}}else t(!(4&ri[s]));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{O as $,ns as A,pt as B,Es as C,Mt as D,_ as E,Et as F,qs as G,Ms as H,Rs as I,St as J,n as K,Zt as L,k as M,zs as N,Bt as O,Hs as P,U as Q,K as R,Ot as S,ei as T,N as U,gt as V,Zs as W,hs as X,Y,L as Z,B as _,Fs as a,Nt as a0,Qt as a1,Ls as a2,Qs as a3,Os as a4,Bs as a5,xt as a6,dt as a7,E as a8,g as a9,us as aA,Ht as aB,Ts as aC,Cs as aD,G as aa,Q as ab,I as ac,Ks as ad,Ws as ae,It as af,D as ag,A as ah,X as ai,ks as aj,Ps as ak,Pt as al,Ss as am,Ns as an,$s as ao,Ct as ap,ft as aq,Kt as ar,Ft as as,Ys as at,it as au,F as av,ps as aw,Vs as ax,Dt as ay,$ as az,as as b,Lt as c,zt as d,Ut as e,Gt as f,Vt as g,yt as h,ls as i,kt as j,j as k,V as l,qt as m,Rt as n,os as o,J as p,H as q,S as r,Tt as s,W as t,At as u,q as v,Z as w,ms as x,As as y,rs as z};
package/core/MemCache.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 t from"./PooledArray.js";const e=-3,s=e-1;var i;!function(t){t[t.ALL=0]="ALL",t[t.SOME=1]="SOME"}(i||(i={}));class r{constructor(t,e,s){this.name=t,this._storage=e,this.id=o+++":",this.size=0,this.maxSize=-1,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),s&&(this._storage.registerRemoveFunc(this.id,s),this._removeFunc=!0)}destroy(){this._storage.clear(this),this._removeFunc&&this._storage.deregisterRemoveFunc(this.id),this._storage.deregister(this),this._storage=null}get hitRate(){return this._hit/(this._hit+this._miss)}get storageSize(){return this._storage.size}getSize(t){return this._storage.getSize(this,t)}resetHitRate(){this._hit=this._miss=0}put(t,e,s,i=0){this._storage.put(this,t,e,s,i)}pop(t){const e=this._storage.pop(this,t);return void 0===e?++this._miss:++this._hit,e}get(t){const e=this._storage.get(this,t);return void 0===e?++this._miss:++this._hit,e}peek(t){return this._storage.peek(this,t)}updateSize(t,e,s){this._storage.updateSize(this,t,e,s)}clear(){this._storage.clear(this)}clearAll(){this._storage.clearAll()}get performanceInfo(){return this._storage.performanceInfo}resetStats(){this._storage.resetStats()}}class h{get size(){return this._size}constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new t,this._users=new t}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(t){this._users.push(t)}deregister(t){this._users.removeUnordered(t)}registerRemoveFunc(t,e){this._removeFuncs.push([t,e])}deregisterRemoveFunc(t){this._removeFuncs.filterInPlace((e=>e[0]!==t))}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=Math.max(t,-1),this._checkSize()}getSize(t,e){const s=this._db.get(t.id+e);return s?.size??0}put(t,r,h,o,_){r=t.id+r;const a=this._db.get(r);if(a&&(this._size-=a.size,t.size-=a.size,this._db.delete(r),a.entry!==h&&this._notifyRemove(r,a.entry,a.size,i.ALL)),o>this._maxSize)return void this._notifyRemove(r,h,o,i.ALL);if(void 0===h)return void console.warn("Refusing to cache undefined entry ");if(!o||o<0)return console.warn(`Refusing to cache entry with size ${o} for key ${r}`),void this._notifyRemove(r,h,0,i.ALL);const c=1+Math.max(_,s)-e;this._db.set(r,new n(h,o,c)),this._size+=o,t.size+=o,this._checkSize()}updateSize(t,e,s,r){e=t.id+e;const h=this._db.get(e);if(h&&h.entry===s){for(this._size-=h.size,t.size-=h.size;r>this._maxSize;){const t=this._notifyRemove(e,s,r,i.SOME);if(!(null!=t&&t>0))return void this._db.delete(e);r=t}h.size=r,this._size+=r,t.size+=r,this._checkSize()}}pop(t,e){e=t.id+e;const s=this._db.get(e);if(s)return this._size-=s.size,t.size-=s.size,this._db.delete(e),++this._hit,s.entry;++this._miss}get(t,e){e=t.id+e;const s=this._db.get(e);if(void 0!==s)return this._db.delete(e),s.lives=s.lifetime,this._db.set(e,s),++this._hit,s.entry;++this._miss}peek(t,e){const s=this._db.get(t.id+e);return s?++this._hit:++this._miss,s?.entry}get performanceInfo(){const t={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},s={},i=new Array;this._db.forEach(((t,e)=>{const r=t.lifetime;i[r]=(i[r]||0)+t.size,this._users.forAll((i=>{const{id:r,name:h}=i;if(e.startsWith(r)){const e=s[h]||0;s[h]=e+t.size}}))}));const r={};this._users.forAll((t=>{const e=t.name;if("hitRate"in t&&"number"==typeof t.hitRate&&!isNaN(t.hitRate)&&t.hitRate>0){const i=s[e]||0;s[e]=i,r[e]=Math.round(100*t.hitRate)+"%"}else r[e]="0%"}));const h=Object.keys(s);h.sort(((t,e)=>s[e]-s[t])),h.forEach((e=>t[e]=Math.round(s[e]/2**20)+"MB / "+r[e]));for(let o=i.length-1;o>=0;--o){const s=i[o];s&&(t["Priority "+(o+e-1)]=Math.round(s/this._size*100)+"%")}return t}resetStats(){this._hit=this._miss=0,this._users.forAll((t=>t.resetHitRate()))}clear(t){const e=t.id;this._db.forEach(((t,s)=>{s.startsWith(e)&&(this._size-=t.size,this._db.delete(s),this._notifyRemove(s,t.entry,t.size,i.ALL))})),t.size=0}clearAll(){this._db.forEach(((t,e)=>this._notifyRemove(e,t.entry,t.size,i.ALL))),this._users.forAll((t=>t.size=0)),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(t,e,s,i){let r;return this._removeFuncs.some((h=>{if(t.startsWith(h[0])){const t=h[1](e,i,s);return"number"==typeof t&&(r=t),!0}return!1})),r}_checkSize(){this._users.forAll((t=>this._checkSizeLimits(t))),this._checkSizeLimits()}_checkSizeLimits(t){const e=t??this;if(e.maxSize<0||e.size<=e.maxSize)return;const s=t?.id;let i=!0;for(;i;){i=!1;for(const[r,h]of this._db)if(0===h.lifetime&&(!s||r.startsWith(s))){if(this._purgeItem(r,h,t),e.size<=.9*e.maxSize)return;i||=this._db.has(r)}}for(const[r,h]of this._db)if((!s||r.startsWith(s))&&(this._purgeItem(r,h,t),e.size<=.9*e.maxSize))return}_purgeItem(t,e,s=this._users.find((e=>t.startsWith(e.id)))){if(this._db.delete(t),e.lives<=1){this._size-=e.size,s&&(s.size-=e.size);const r=this._notifyRemove(t,e.entry,e.size,i.SOME);null!=r&&r>0&&(this._size+=r,s&&(s.size+=r),e.lives=e.lifetime,e.size=r,this._db.set(t,e))}else--e.lives,this._db.set(t,e)}}let o=0;class n{constructor(t,e,s){this.entry=t,this.size=e,this.lifetime=s,this.lives=s}}export{r as MemCache,h as MemCacheStorage,e as MinPriority,s as NoPriority,i as RemoveMode};
5
+ import t from"./PooledArray.js";const e=-3,s=e-1;var i;!function(t){t[t.ALL=0]="ALL",t[t.SOME=1]="SOME"}(i||(i={}));class r{constructor(t,e,s){this.name=t,this._storage=e,this.id=o+++":",this.size=0,this.maxSize=-1,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),s&&(this._storage.registerRemoveFunc(this.id,s),this._removeFunc=!0)}destroy(){this._storage.clear(this),this._removeFunc&&this._storage.deregisterRemoveFunc(this.id),this._storage.deregister(this),this._storage=null}get hitRate(){return this._hit/(this._hit+this._miss)}get storageSize(){return this._storage.size}getSize(t){return this._storage.getSize(this,t)}resetHitRate(){this._hit=this._miss=0}put(t,e,s=0){this._storage.put(this,t,e,e.cachedMemory,s)}pop(t){const e=this._storage.pop(this,t);return void 0===e?++this._miss:++this._hit,e}get(t){const e=this._storage.get(this,t);return void 0===e?++this._miss:++this._hit,e}peek(t){return this._storage.peek(this,t)}updateSize(t,e){this._storage.updateSize(this,t,e,e.cachedMemory)}clear(){this._storage.clear(this)}clearAll(){this._storage.clearAll()}get performanceInfo(){return this._storage.performanceInfo}resetStats(){this._storage.resetStats()}}class h{get size(){return this._size}constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new t,this._users=new t}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(t){this._users.push(t)}deregister(t){this._users.removeUnordered(t)}registerRemoveFunc(t,e){this._removeFuncs.push([t,e])}deregisterRemoveFunc(t){this._removeFuncs.filterInPlace((e=>e[0]!==t))}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=Math.max(t,-1),this._checkSize()}getSize(t,e){const s=this._db.get(t.id+e);return s?.size??0}put(t,r,h,o,_){r=t.id+r;const a=this._db.get(r);if(a&&(this._size-=a.size,t.size-=a.size,this._db.delete(r),a.entry!==h&&this._notifyRemove(r,a.entry,a.size,i.ALL)),o>this._maxSize)return void this._notifyRemove(r,h,o,i.ALL);if(void 0===h)return void console.warn("Refusing to cache undefined entry ");if(!o||o<0)return console.warn(`Refusing to cache entry with size ${o} for key ${r}`),void this._notifyRemove(r,h,0,i.ALL);const c=1+Math.max(_,s)-e;this._db.set(r,new n(h,o,c)),this._size+=o,t.size+=o,this._checkSize()}updateSize(t,e,s,r){e=t.id+e;const h=this._db.get(e);if(h&&h.entry===s){for(this._size-=h.size,t.size-=h.size;r>this._maxSize;){const t=this._notifyRemove(e,s,r,i.SOME);if(!(null!=t&&t>0))return void this._db.delete(e);r=t}h.size=r,this._size+=r,t.size+=r,this._checkSize()}}pop(t,e){e=t.id+e;const s=this._db.get(e);if(s)return this._size-=s.size,t.size-=s.size,this._db.delete(e),++this._hit,s.entry;++this._miss}get(t,e){e=t.id+e;const s=this._db.get(e);if(void 0!==s)return this._db.delete(e),s.lives=s.lifetime,this._db.set(e,s),++this._hit,s.entry;++this._miss}peek(t,e){const s=this._db.get(t.id+e);return s?++this._hit:++this._miss,s?.entry}get performanceInfo(){const t={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},s={},i=new Array;this._db.forEach(((t,e)=>{const r=t.lifetime;i[r]=(i[r]||0)+t.size,this._users.forAll((i=>{const{id:r,name:h}=i;if(e.startsWith(r)){const e=s[h]||0;s[h]=e+t.size}}))}));const r={};this._users.forAll((t=>{const e=t.name;if("hitRate"in t&&"number"==typeof t.hitRate&&!isNaN(t.hitRate)&&t.hitRate>0){const i=s[e]||0;s[e]=i,r[e]=Math.round(100*t.hitRate)+"%"}else r[e]="0%"}));const h=Object.keys(s);h.sort(((t,e)=>s[e]-s[t])),h.forEach((e=>t[e]=Math.round(s[e]/2**20)+"MB / "+r[e]));for(let o=i.length-1;o>=0;--o){const s=i[o];s&&(t["Priority "+(o+e-1)]=Math.round(s/this._size*100)+"%")}return t}resetStats(){this._hit=this._miss=0,this._users.forAll((t=>t.resetHitRate()))}clear(t){const e=t.id;this._db.forEach(((t,s)=>{s.startsWith(e)&&(this._size-=t.size,this._db.delete(s),this._notifyRemove(s,t.entry,t.size,i.ALL))})),t.size=0}clearAll(){this._db.forEach(((t,e)=>this._notifyRemove(e,t.entry,t.size,i.ALL))),this._users.forAll((t=>t.size=0)),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(t,e,s,i){let r;return this._removeFuncs.some((h=>{if(t.startsWith(h[0])){const t=h[1](e,i,s);return"number"==typeof t&&(r=t),!0}return!1})),r}_checkSize(){this._users.forAll((t=>this._checkSizeLimits(t))),this._checkSizeLimits()}_checkSizeLimits(t){const e=t??this;if(e.maxSize<0||e.size<=e.maxSize)return;const s=t?.id;let i=!0;for(;i;){i=!1;for(const[r,h]of this._db)if(0===h.lifetime&&(!s||r.startsWith(s))){if(this._purgeItem(r,h,t),e.size<=.9*e.maxSize)return;i||=this._db.has(r)}}for(const[r,h]of this._db)if((!s||r.startsWith(s))&&(this._purgeItem(r,h,t),e.size<=.9*e.maxSize))return}_purgeItem(t,e,s=this._users.find((e=>t.startsWith(e.id)))){if(this._db.delete(t),e.lives<=1){this._size-=e.size,s&&(s.size-=e.size);const r=this._notifyRemove(t,e.entry,e.size,i.SOME);null!=r&&r>0&&(this._size+=r,s&&(s.size+=r),e.lives=e.lifetime,e.size=r,this._db.set(t,e))}else--e.lives,this._db.set(t,e)}}let o=0;class n{constructor(t,e,s){this.entry=t,this.size=e,this.lifetime=s,this.lives=s}}export{r as MemCache,h as MemCacheStorage,e as MinPriority,s as NoPriority,i as RemoveMode};
@@ -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{RemoveMode as e,NoPriority as t}from"./MemCache.js";class c{constructor(t,c){this._cache=t(c,((t,c,s)=>{switch(c){case e.ALL:return t.forEach((e=>e.dispose())),0;case e.SOME:{const e=t.shift();return e&&(s-=Math.round(e.usedMemory),e.dispose()),s}}}))}hitrate(){return this._cache.hitRate}destroy(){this._cache.destroy()}clear(){this._cache.clear()}getSize(e){return this._cache.getSize(e)}pop(e){const t=this._cache.peek(e);if(!t)return;const c=t.pop();if(t.length>0){if(c){const s=this._cache.getSize(e)-Math.round(c.usedMemory);this._cache.updateSize(e,t,s)}}else this._cache.pop(e);return c}put(e,c,s=t){const h=this._cache.peek(e);if(!h)return void this._cache.put(e,[c],c.usedMemory,s);h.push(c);const r=this._cache.getSize(e)+Math.round(c.usedMemory);this._cache.updateSize(e,h,r)}}export{c as MemCachePool};
5
+ import{RemoveMode as e,NoPriority as c}from"./MemCache.js";class t{constructor(c,t){this._cache=c(t,((c,t,h)=>{switch(t){case e.ALL:return c.forEach((e=>e.dispose())),0;case e.SOME:{const e=c.shift();return e&&(h-=Math.round(e.cachedMemory),e.dispose()),h}}}))}hitrate(){return this._cache.hitRate}destroy(){this._cache.destroy()}clear(){this._cache.clear()}getSize(e){return this._cache.getSize(e)}pop(e){const c=this._cache.peek(e);if(!c)return;const t=c.pop();return c.length>0?t&&(c.cachedMemory=this._cache.getSize(e)-Math.round(t.cachedMemory),this._cache.updateSize(e,c)):this._cache.pop(e),t}put(e,t,s=c){const r=this._cache.peek(e);if(r)r.push(t),r.cachedMemory=this._cache.getSize(e)+Math.round(t.cachedMemory),this._cache.updateSize(e,r);else{const c=new h(t);this._cache.put(e,c,s)}}}class h extends Array{constructor(e){super(),this.item=e,this.cachedMemory=e.cachedMemory,this.push(e)}}export{t as MemCachePool};
package/core/unitUtils.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"./has.js";import{strict as e}from"./jsonMap.js";import{getReferenceEllipsoid as s}from"../geometry/ellipsoidUtils.js";import{earth as t,mars as r,moon as n}from"../geometry/support/Ellipsoid.js";import{isEarth as i,isWKIDFromMars as a,isWKIDFromMoon as u,isGeographic as c}from"../geometry/support/spatialReferenceUtils.js";import l from"../geometry/support/WKIDUnitConversion.js";const o=39.37,m=t.radius*Math.PI/200,f=/(?:LENGTH)?UNIT\[([^\]]+)]]$/i,U=l,d=/UNIT\[([^\]]+)]/i,h=new Set([4305,4807,4810,4811,4812,4816,4819,4821,4901,4902,37225,104025,104026,104139,104140]),B=e()({meter:"meters",foot:"feet",foot_us:"us-feet",foot_clarke:"clarke-feet",yard_clarke:"clarke-yards",link_clarke:"clarke-links",yard_sears:"sears-yards",foot_sears:"sears-feet",chain_sears:"sears-chains",chain_benoit_1895_b:"benoit-1895-b-chains",yard_indian:"indian-yards",yard_indian_1937:"indian-1937-yards",foot_gold_coast:"gold-coast-feet",chain:"chains",chain_sears_1922_truncated:"sears-1922-truncated-chains","50_kilometers":"50-kilometers","150_kilometers":"150-kilometers"}),q=e=>e*e,k=e=>e*e*e,b={length:{baseUnit:"meters",units:{millimeters:{inBaseUnits:.001},centimeters:{inBaseUnits:.01},decimeters:{inBaseUnits:.1},meters:{inBaseUnits:1},kilometers:{inBaseUnits:1e3},inches:{inBaseUnits:.0254},feet:{inBaseUnits:.3048},yards:{inBaseUnits:.9144},miles:{inBaseUnits:1609.344},"nautical-miles":{inBaseUnits:1852},"us-feet":{inBaseUnits:1200/3937},"clarke-feet":{inBaseUnits:.3047972654},"clarke-yards":{inBaseUnits:.9143917962},"clarke-links":{inBaseUnits:.201166195164},"sears-yards":{inBaseUnits:.9143984146160287},"sears-feet":{inBaseUnits:.3047994715386762},"sears-chains":{inBaseUnits:20.11676512155263},"benoit-1895-b-chains":{inBaseUnits:20.11678249437587},"indian-yards":{inBaseUnits:.9143985307444408},"indian-1937-yards":{inBaseUnits:.91439523},"gold-coast-feet":{inBaseUnits:.3047997101815088},chains:{inBaseUnits:20.1168},"sears-1922-truncated-chains":{inBaseUnits:20.116756},"50-kilometers":{inBaseUnits:5e4},"150-kilometers":{inBaseUnits:15e4}}},area:{baseUnit:"square-meters",units:{"square-millimeters":{inBaseUnits:q(.001)},"square-centimeters":{inBaseUnits:q(.01)},"square-decimeters":{inBaseUnits:q(.1)},"square-meters":{inBaseUnits:1},"square-kilometers":{inBaseUnits:q(1e3)},"square-inches":{inBaseUnits:q(.0254)},"square-feet":{inBaseUnits:q(.3048)},"square-yards":{inBaseUnits:q(.9144)},"square-miles":{inBaseUnits:q(1609.344)},"square-us-feet":{inBaseUnits:q(1200/3937)},acres:{inBaseUnits:.0015625*q(1609.344)},ares:{inBaseUnits:100},hectares:{inBaseUnits:1e4}}},volume:{baseUnit:"liters",units:{liters:{inBaseUnits:1},"cubic-millimeters":{inBaseUnits:1e3*k(.001)},"cubic-centimeters":{inBaseUnits:1e3*k(.01)},"cubic-decimeters":{inBaseUnits:1e3*k(.1)},"cubic-meters":{inBaseUnits:1e3},"cubic-kilometers":{inBaseUnits:1e3*k(1e3)},"cubic-inches":{inBaseUnits:1e3*k(.0254)},"cubic-feet":{inBaseUnits:1e3*k(.3048)},"cubic-yards":{inBaseUnits:1e3*k(.9144)},"cubic-miles":{inBaseUnits:1e3*k(1609.344)}}},angle:{baseUnit:"radians",units:{radians:{inBaseUnits:1},degrees:{inBaseUnits:Math.PI/180}}}},p=(()=>{const e={};for(const s in b)for(const t in b[s].units)e[t]=s;return e})();function y(e,s,t){return e*b[t].units[s].inBaseUnits}function g(e,s,t){return e/b[t].units[s].inBaseUnits}const w=["metric","imperial","square-inches","square-feet","square-yards","square-miles","square-us-feet","square-meters","square-kilometers","acres","ares","hectares"],_=["metric","imperial","inches","feet","yards","miles","nautical-miles","us-feet","meters","kilometers"],M=new Map([["meters","square-meters"],["feet","square-feet"],["us-feet","square-us-feet"]]);function S(e){return"imperial"===e||"metric"===e}function D(e){const s=p[e];if(!s)throw new Error("unknown type");return s}function C(e){return b[e].baseUnit}function P(e){return C(D(e))}function E(e,s=null){return s=s||D(e),b[s].baseUnit===e}function I(e,s,t){if(s===t)return e;const r=D(s);if(r!==D(t))throw new Error("incompatible units");const n=E(s,r)?e:y(e,s,r);return E(t,r)?n:g(n,t,r)}function j(e,s,t,r=!1){if(!r&&s.isGeographic)throw new Error("Unable to convert from an angular unit to a linear unit.");const n=ee(s);return n!==t&&(e=n?I(e,n,t):I(e*=z(s),"meters",t)),e}function R(e,s,t,r=!1){if(!r&&t.isGeographic)throw new Error("Unable to convert from a linear unit to an angular unit.");const n=ee(t);return s!==n&&(e=n?I(e,s,n):I(e,s,"meters")/z(t)),e}function v(e){switch(e){case"metric":return"meters";case"imperial":return"feet";default:return e}}function x(e){return v(e)}function N(e){switch(e){case"metric":return"square-meters";case"imperial":return"square-feet";default:return e}}function O(e,s,t){switch(t){case"metric":return G(e,s);case"imperial":return T(e,s);default:return t}}function F(e,s,t){switch(t){case"metric":return J(e,s);case"imperial":return K(e,s);default:return t}}function G(e,s){const t=I(e,s,"meters");return Math.abs(t)<3e3?"meters":"kilometers"}function J(e,s){const t=I(e,s,"meters");return Math.abs(t)<1e5?"meters":"kilometers"}function T(e,s){const t=I(e,s,"feet");return Math.abs(t)<1e3?"feet":"miles"}function K(e,s){const t=I(e,s,"feet");return Math.abs(t)<1e5?"feet":"miles"}function A(e,s){const t=I(e,s,"square-meters");return Math.abs(t)<3e6?"square-meters":"square-kilometers"}function H(e,s){const t=I(e,s,"square-feet");return Math.abs(t)<1e6?"square-feet":"square-miles"}function L(e,s,t){return I(e,s,"meters")/(t*Math.PI/180)}function Y(e){return B.fromJSON(e.toLowerCase())||null}function W(e){if(null!=e&&!i(e))return 1;const s=z(e);return s>1e5?1:s}function $(e){return z(e)>=s(e).metersPerDegree?"meters":ee(e)}function z(e,s=t.metersPerDegree){return Q(e,!0)??s}function Q(e,s=!1){const t=e?.wkid??null,i=e?.wkt2??e?.wkt??null;let c=null;if(t){if(a(t))return r.metersPerDegree;if(u(t))return n.metersPerDegree;c=U.values[U[t]],!c&&s&&h.has(t)&&(c=m)}else i&&(ie(i)?c=X(f.exec(i),c):ne(i)&&(c=X(d.exec(i),c)));return c}function V(e){return c(e)?1:z(e)}function X(e,s){return e?.[1]?Z(e[1]):s}function Z(e){return parseFloat(e.split(",")[1])}function ee(e){const s=e?.wkid??null,t=e?.wkt2??e?.wkt??null;let r=null;if(s)r=U.units[U[s]];else if(t){const e=ie(t)?f:ne(t)?d:null;if(e){const s=e.exec(t);s?.[1]&&(r=ue(s[1]))}}return null!=r?Y(r):null}function se(e){const s=ee(e);return null!=s&&_.includes(s)?s:null}function te(e){const s=$(e);return null!=s&&_.includes(s)?s:null}function re(e){const s=ee(e);return null==s?null:M.get(s)}function ne(e){return/^GEOCCS/i.test(e)}function ie(e){return/^\s*(?:PROJCS|PROJCRS|PROJECTEDCRS)/i.test(e)}const ae=1e-7;function ue(e){const s=/[\\"']{1}([^\\"']+)/.exec(e);let t=s?.[1];if(!t||!U.units.includes(t)){const s=Z(e);t=null;const r=U.values;for(let e=0;e<r.length;++e)if(Math.abs(s-r[e])<ae){t=U.units[e];break}}return t}function ce(e){const s=ee(e);if(null==s)return null;switch(s){case"feet":case"us-feet":case"clarke-feet":case"clarke-yards":case"clarke-links":case"sears-yards":case"sears-feet":case"sears-chains":case"benoit-1895-b-chains":case"indian-yards":case"indian-1937-yards":case"gold-coast-feet":case"chains":case"sears-1922-truncated-chains":return"imperial";case"50-kilometers":case"150-kilometers":case"meters":return"metric"}return null}const le={esriAcres:"acres",esriAres:"ares",esriHectares:"hectares",esriSquareCentimeters:"square-centimeters",esriSquareDecimeters:"square-decimeters",esriSquareFeet:"square-feet",esriSquareInches:"square-inches",esriSquareKilometers:"square-kilometers",esriSquareMeters:"square-meters",esriSquareMiles:"square-miles",esriSquareMillimeters:"square-millimeters",esriSquareUsFeet:"square-us-feet",esriSquareYards:"square-yards"},oe={esriCentimeters:"centimeters",esriDecimeters:"decimeters",esriFeet:"feet",esriInches:"inches",esriKilometers:"kilometers",esriMeters:"meters",esriMiles:"miles",esriMillimeters:"millimeters",esriNauticalMiles:"nautical-miles",esriYards:"yards"},me={esriDUDecimalDegrees:"degrees",esriDURadians:"radians"},fe=e()(le),Ue=e()(oe),de=e()(me);export{H as adaptiveImperialAreaUnit,T as adaptiveImperialLengthUnit,K as adaptiveImperialVerticalLengthUnit,O as adaptiveLengthUnit,A as adaptiveMetricAreaUnit,G as adaptiveMetricLengthUnit,J as adaptiveMetricVerticalLengthUnit,F as adaptiveVerticalLengthUnit,de as angleUnitsJSONMap,re as areaUnitFromSpatialReference,fe as areaUnitsJSONMap,P as baseUnitForUnit,C as baseUnitForUnitType,j as convertFromSpatialReferenceUnit,R as convertToSpatialReferenceUnit,I as convertUnit,N as defaultAreaUnit,v as defaultLengthUnit,x as defaultVerticalLengthUnit,ce as getDefaultUnitSystem,V as getMetersPerCartesianUnitForSR,Q as getMetersPerUnit,z as getMetersPerUnitForSR,W as getMetersPerVerticalUnitForSR,ee as getUnitString,$ as getVerticalUnitStringForSR,h as gradGcsIds,o as inchesPerMeter,E as isBaseUnit,S as isMeasurementSystem,ie as isProjectedWKT,L as lengthToDegrees,se as lengthUnitFromSpatialReference,Ue as lengthUnitsJSONMap,w as measurementAreaUnits,_ as measurementLengthUnits,Y as unitFromRESTJSON,D as unitType,te as verticalLengthUnitFromSpatialReference};
5
+ import"./has.js";import{strict as e}from"./jsonMap.js";import{getReferenceEllipsoid as s}from"../geometry/ellipsoidUtils.js";import{earth as t,mars as r,moon as n}from"../geometry/support/Ellipsoid.js";import{isGeographic as i,isEarth as a,isWKIDFromMars as u,isWKIDFromMoon as c}from"../geometry/support/spatialReferenceUtils.js";import l from"../geometry/support/WKIDUnitConversion.js";const o=39.37,m=t.radius*Math.PI/200,f=/(?:LENGTH)?UNIT\[([^\]]+)]]$/i,U=l,d=/UNIT\[([^\]]+)]/i,B=new Set([4305,4807,4810,4811,4812,4816,4819,4821,4901,4902,37225,104025,104026,104139,104140]),h=e()({meter:"meters",foot:"feet",foot_us:"us-feet",foot_clarke:"clarke-feet",yard_clarke:"clarke-yards",link_clarke:"clarke-links",yard_sears:"sears-yards",foot_sears:"sears-feet",chain_sears:"sears-chains",chain_benoit_1895_b:"benoit-1895-b-chains",yard_indian:"indian-yards",yard_indian_1937:"indian-1937-yards",foot_gold_coast:"gold-coast-feet",chain:"chains",chain_sears_1922_truncated:"sears-1922-truncated-chains","50_kilometers":"50-kilometers","150_kilometers":"150-kilometers"}),q=e=>e*e,k=e=>e*e*e,b={length:{baseUnit:"meters",units:{millimeters:{inBaseUnits:.001},centimeters:{inBaseUnits:.01},decimeters:{inBaseUnits:.1},meters:{inBaseUnits:1},kilometers:{inBaseUnits:1e3},inches:{inBaseUnits:.0254},feet:{inBaseUnits:.3048},yards:{inBaseUnits:.9144},miles:{inBaseUnits:1609.344},"nautical-miles":{inBaseUnits:1852},"us-feet":{inBaseUnits:1200/3937},"clarke-feet":{inBaseUnits:.3047972654},"clarke-yards":{inBaseUnits:.9143917962},"clarke-links":{inBaseUnits:.201166195164},"sears-yards":{inBaseUnits:.9143984146160287},"sears-feet":{inBaseUnits:.3047994715386762},"sears-chains":{inBaseUnits:20.11676512155263},"benoit-1895-b-chains":{inBaseUnits:20.11678249437587},"indian-yards":{inBaseUnits:.9143985307444408},"indian-1937-yards":{inBaseUnits:.91439523},"gold-coast-feet":{inBaseUnits:.3047997101815088},chains:{inBaseUnits:20.1168},"sears-1922-truncated-chains":{inBaseUnits:20.116756},"50-kilometers":{inBaseUnits:5e4},"150-kilometers":{inBaseUnits:15e4}}},area:{baseUnit:"square-meters",units:{"square-millimeters":{inBaseUnits:q(.001)},"square-centimeters":{inBaseUnits:q(.01)},"square-decimeters":{inBaseUnits:q(.1)},"square-meters":{inBaseUnits:1},"square-kilometers":{inBaseUnits:q(1e3)},"square-inches":{inBaseUnits:q(.0254)},"square-feet":{inBaseUnits:q(.3048)},"square-yards":{inBaseUnits:q(.9144)},"square-miles":{inBaseUnits:q(1609.344)},"square-us-feet":{inBaseUnits:q(1200/3937)},acres:{inBaseUnits:.0015625*q(1609.344)},ares:{inBaseUnits:100},hectares:{inBaseUnits:1e4}}},volume:{baseUnit:"liters",units:{liters:{inBaseUnits:1},"cubic-millimeters":{inBaseUnits:1e3*k(.001)},"cubic-centimeters":{inBaseUnits:1e3*k(.01)},"cubic-decimeters":{inBaseUnits:1e3*k(.1)},"cubic-meters":{inBaseUnits:1e3},"cubic-kilometers":{inBaseUnits:1e3*k(1e3)},"cubic-inches":{inBaseUnits:1e3*k(.0254)},"cubic-feet":{inBaseUnits:1e3*k(.3048)},"cubic-yards":{inBaseUnits:1e3*k(.9144)},"cubic-miles":{inBaseUnits:1e3*k(1609.344)}}},angle:{baseUnit:"radians",units:{radians:{inBaseUnits:1},degrees:{inBaseUnits:Math.PI/180}}}},p=(()=>{const e={};for(const s in b)for(const t in b[s].units)e[t]=s;return e})();function y(e,s,t){return e*b[t].units[s].inBaseUnits}function w(e,s,t){return e/b[t].units[s].inBaseUnits}const g=["metric","imperial","square-inches","square-feet","square-yards","square-miles","square-us-feet","square-meters","square-kilometers","acres","ares","hectares"],_=["metric","imperial","inches","feet","yards","miles","nautical-miles","us-feet","meters","kilometers"],M=new Map([["meters","square-meters"],["feet","square-feet"],["us-feet","square-us-feet"]]);function S(e){return"imperial"===e||"metric"===e}function D(e){const s=p[e];if(!s)throw new Error("unknown type");return s}function C(e){return b[e].baseUnit}function P(e){return C(D(e))}function E(e,s=null){return s=s||D(e),b[s].baseUnit===e}function I(e,s,t){if(s===t)return e;const r=D(s);if(r!==D(t))throw new Error("incompatible units");const n=E(s,r)?e:y(e,s,r);return E(t,r)?n:w(n,t,r)}function j(e,s,t,r=!1){if(!r&&i(s))throw new Error("Unable to convert from an angular unit to a linear unit.");const n=ee(s);return n!==t&&(e=n?I(e,n,t):I(e*=z(s),"meters",t)),e}function R(e,s,t,r=!1){if(!r&&i(t))throw new Error("Unable to convert from a linear unit to an angular unit.");const n=ee(t);return s!==n&&(e=n?I(e,s,n):I(e,s,"meters")/z(t)),e}function v(e){switch(e){case"metric":return"meters";case"imperial":return"feet";default:return e}}function x(e){return v(e)}function N(e){switch(e){case"metric":return"square-meters";case"imperial":return"square-feet";default:return e}}function O(e,s,t){switch(t){case"metric":return J(e,s);case"imperial":return K(e,s);default:return t}}function F(e,s,t){switch(t){case"metric":return T(e,s);case"imperial":return A(e,s);default:return t}}function J(e,s){const t=I(e,s,"meters");return Math.abs(t)<3e3?"meters":"kilometers"}function T(e,s){const t=I(e,s,"meters");return Math.abs(t)<1e5?"meters":"kilometers"}function K(e,s){const t=I(e,s,"feet");return Math.abs(t)<1e3?"feet":"miles"}function A(e,s){const t=I(e,s,"feet");return Math.abs(t)<1e5?"feet":"miles"}function G(e,s){const t=I(e,s,"square-meters");return Math.abs(t)<3e6?"square-meters":"square-kilometers"}function H(e,s){const t=I(e,s,"square-feet");return Math.abs(t)<1e6?"square-feet":"square-miles"}function L(e,s,t){return I(e,s,"meters")/(t*Math.PI/180)}function Y(e){return h.fromJSON(e.toLowerCase())||null}function W(e){if(null!=e&&!a(e))return 1;const s=z(e);return s>1e5?1:s}function $(e){return z(e)>=s(e).metersPerDegree?"meters":ee(e)}function z(e,s=t.metersPerDegree){return Q(e,!0)??s}function Q(e,s=!1){const t=e?.wkid??null,i=e?.wkt2??e?.wkt??null;let a=null;if(t){if(u(t))return r.metersPerDegree;if(c(t))return n.metersPerDegree;a=U.values[U[t]],!a&&s&&B.has(t)&&(a=m)}else i&&(ie(i)?a=X(f.exec(i),a):ne(i)&&(a=X(d.exec(i),a)));return a}function V(e){return i(e)?1:z(e)}function X(e,s){return e?.[1]?Z(e[1]):s}function Z(e){return parseFloat(e.split(",")[1])}function ee(e){const s=e?.wkid??null,t=e?.wkt2??e?.wkt??null;let r=null;if(s)r=U.units[U[s]];else if(t){const e=ie(t)?f:ne(t)?d:null;if(e){const s=e.exec(t);s?.[1]&&(r=ue(s[1]))}}return null!=r?Y(r):null}function se(e){const s=ee(e);return null!=s&&_.includes(s)?s:null}function te(e){const s=$(e);return null!=s&&_.includes(s)?s:null}function re(e){const s=ee(e);return null==s?null:M.get(s)}function ne(e){return/^GEOCCS/i.test(e)}function ie(e){return/^\s*(?:PROJCS|PROJCRS|PROJECTEDCRS)/i.test(e)}const ae=1e-7;function ue(e){const s=/[\\"']{1}([^\\"']+)/.exec(e);let t=s?.[1];if(!t||!U.units.includes(t)){const s=Z(e);t=null;const r=U.values;for(let e=0;e<r.length;++e)if(Math.abs(s-r[e])<ae){t=U.units[e];break}}return t}function ce(e){const s=ee(e);if(null==s)return null;switch(s){case"feet":case"us-feet":case"clarke-feet":case"clarke-yards":case"clarke-links":case"sears-yards":case"sears-feet":case"sears-chains":case"benoit-1895-b-chains":case"indian-yards":case"indian-1937-yards":case"gold-coast-feet":case"chains":case"sears-1922-truncated-chains":return"imperial";case"50-kilometers":case"150-kilometers":case"meters":return"metric"}return null}const le={esriAcres:"acres",esriAres:"ares",esriHectares:"hectares",esriSquareCentimeters:"square-centimeters",esriSquareDecimeters:"square-decimeters",esriSquareFeet:"square-feet",esriSquareInches:"square-inches",esriSquareKilometers:"square-kilometers",esriSquareMeters:"square-meters",esriSquareMiles:"square-miles",esriSquareMillimeters:"square-millimeters",esriSquareUsFeet:"square-us-feet",esriSquareYards:"square-yards"},oe={esriCentimeters:"centimeters",esriDecimeters:"decimeters",esriFeet:"feet",esriInches:"inches",esriKilometers:"kilometers",esriMeters:"meters",esriMiles:"miles",esriMillimeters:"millimeters",esriNauticalMiles:"nautical-miles",esriYards:"yards"},me={esriDUDecimalDegrees:"degrees",esriDURadians:"radians"},fe=e()(le),Ue=e()(oe),de=e()(me);export{H as adaptiveImperialAreaUnit,K as adaptiveImperialLengthUnit,A as adaptiveImperialVerticalLengthUnit,O as adaptiveLengthUnit,G as adaptiveMetricAreaUnit,J as adaptiveMetricLengthUnit,T as adaptiveMetricVerticalLengthUnit,F as adaptiveVerticalLengthUnit,de as angleUnitsJSONMap,re as areaUnitFromSpatialReference,fe as areaUnitsJSONMap,P as baseUnitForUnit,C as baseUnitForUnitType,j as convertFromSpatialReferenceUnit,R as convertToSpatialReferenceUnit,I as convertUnit,N as defaultAreaUnit,v as defaultLengthUnit,x as defaultVerticalLengthUnit,ce as getDefaultUnitSystem,V as getMetersPerCartesianUnitForSR,Q as getMetersPerUnit,z as getMetersPerUnitForSR,W as getMetersPerVerticalUnitForSR,ee as getUnitString,$ as getVerticalUnitStringForSR,B as gradGcsIds,o as inchesPerMeter,E as isBaseUnit,S as isMeasurementSystem,ie as isProjectedWKT,L as lengthToDegrees,se as lengthUnitFromSpatialReference,Ue as lengthUnitsJSONMap,g as measurementAreaUnits,_ as measurementLengthUnits,Y as unitFromRESTJSON,D as unitType,te as verticalLengthUnitFromSpatialReference};
package/geometry/Mesh.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{_ as e}from"../chunks/tslib.es6.js";import{deprecatedFunction as t}from"../core/deprecate.js";import r from"../core/Error.js";import o from"../core/Loadable.js";import s from"../core/Logger.js";import{EsriPromiseMixin as n}from"../core/Promise.js";import{throwIfAborted as i,whenOrAbort as a}from"../core/promiseUtils.js";import{watch as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{fromValues as m}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"./Geometry.js";import u from"./Point.js";import f from"./Polygon.js";import{create as d,fromBuffer as x,zero as y}from"./support/aaBoundingBox.js";import{composeAxes as v,create as g}from"./support/axisAngleDegrees.js";import j from"./support/MeshComponent.js";import{componentNotFoundMessage as w,meshNotLoadedMessage as S,invalidLocationMessage as b,invalidPolygonMessage as A,InvalidLocationError as M}from"./support/meshErrors.js";import L from"./support/MeshGeoreferencedVertexSpace.js";import F from"./support/MeshLocalVertexSpace.js";import R from"./support/MeshTransform.js";import{MeshVertexAttributes as U}from"./support/MeshVertexAttributes.js";import{vertexSpaceOriginToPoint as _,isRelativeVertexSpace as C,selectVertexSpace as P}from"./support/meshVertexSpaceUtils.js";import{triangulate as E}from"./support/triangulationUtils.js";import{centerAt as B}from"./support/meshUtils/centerAt.js";import{computeMeshExtent as G}from"./support/meshUtils/extent.js";import{loadExternal as k}from"./support/meshUtils/loadExternal.js";import{Metadata as I}from"./support/meshUtils/Metadata.js";import{convertUnitGeometry as T,createUnitSizeBox as V,extractSingleFaceOfBox as O,createUnitSizeSphere as z,createUnitSizeCylinder as D,convertPlaneSizeParameter as N,createUnitSizePlane as W}from"./support/meshUtils/primitives.js";import{rotate as Z}from"./support/meshUtils/rotate.js";import{scale as q}from"./support/meshUtils/scale.js";var H;const K="esri.geometry.Mesh";function J(){return s.getLogger(K)}const Q={base:null,key:"type",defaultKeyValue:"georeferenced",typeMap:{georeferenced:L,local:F}};let X=H=class extends(o.LoadableMixin(n(h))){constructor(e){super(e),this.components=null,this.vertexSpace=new L,this.transform=null,this.metadata=new I,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new U,this.type="mesh"}initialize(){(0===this.metadata.externalSources.length||this.vertexAttributes.position.length)&&(this.loadStatus="loaded"),this.when((()=>{this.addHandles(c((()=>({vertexAttributes:this.vertexAttributes,components:this.components?.map((e=>e.clone()))})),(()=>this._clearSources()),{once:!0,sync:!0}))}))}get hasExtent(){return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):null!=this.metadata.displaySource?.extent}get _transformedExtent(){const{spatialReference:e,vertexSpace:t}=this,r=this;return G({get transform(){return r.transform},vertexSpace:t,spatialReference:e,untransformedBounds:this._untransformedBounds})}get _untransformedBounds(){const{vertexAttributes:{position:e},components:t}=this;return 0===e.length||0===t?.length?d(y):x(e)}get origin(){const e=_(this.vertexSpace,this.spatialReference);if(null!=e)return e;const{center:t,zmin:r}=this._transformedExtent;return new u({x:t.x,y:t.y,z:r,spatialReference:this.spatialReference})}get extent(){return this.loaded||null==this.metadata?.displaySource?.extent?this._transformedExtent:this.metadata.displaySource.extent.clone()}addComponent(e){this._checkIfLoaded("addComponent()")&&(this.components||(this.components=[]),this.components.push(j.from(e)),this.notifyChange("components"))}removeComponent(e){if(this._checkIfLoaded("removeComponent()")){if(this.components){const t=this.components.indexOf(e);if(-1!==t)return this.components.splice(t,1),void this.notifyChange("components")}J().error("removeComponent()",w)}}rotate(e,t,r,o){return v(e,t,r,Y),Z(this,Y,o),this}offset(e,t,r){if(!this._checkIfLoaded("offset()"))return this;const{vertexSpace:o,vertexAttributes:s}=this,n=s?.position;if(!n)return this;if(C(o)){const[s,n,i]=o.origin;o.origin=m(s+e,n+t,i+r)}else{for(let o=0;o<n.length;o+=3)n[o]+=e,n[o+1]+=t,n[o+2]+=r;this.vertexAttributesChanged()}return this}scale(e,t){return this._checkIfLoaded("scale()")?(q(this,e,t),this):this}centerAt(e,t){return this._checkIfLoaded("centerAt()")?(B(this,e,t),this):this}load(e){const{metadata:{displaySource:t}}=this;return t&&this.addResolvingPromise(k(this,t,e)),Promise.resolve(this)}addExternalSources(e){this.metadata.externalSources.addMany(e)}updateDisplaySource(e){this.metadata.displaySource=e}clone(){return this.cloneAndModifyVertexAttributes(this.vertexAttributes.clone(),this.vertexSpace.clone(),{preserveMetadata:!0})}cloneAndModifyVertexAttributes(e,t,r){let o=null;if(this.components){const e=new Map,t=new Map;o=this.components.map((r=>r.cloneWithDeduplication(e,t)))}const s={components:o,spatialReference:this.spatialReference,vertexAttributes:e,vertexSpace:t,transform:this.transform?.clone()??null,metadata:r?.preserveMetadata?this.metadata.clone():new I};return new H(s)}cloneShallow(){return new H({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange("vertexAttributes")}async toBinaryGLTF(e){const[{toBinaryGLTF:t}]=await Promise.all([import("./support/meshUtils/exporters/gltf/gltfexport.js"),this.load(e)]);return i(e),await t(this,e)}get memoryUsage(){let e=0;if(e+=this.vertexAttributes.memoryUsage,null!=this.components)for(const t of this.components)e+=t.memoryUsage;return e}_clearSources(){this.metadata.clearSources()}_checkIfLoaded(e){return!!this.loaded||(J().error(e,S),!1)}static createBox(e,t){if(!(e instanceof u))return J().error(".createBox()",b),null;const r=new H(T(V(),e,t));return t?.imageFace&&"all"!==t.imageFace?O(r,t.imageFace):r}static createSphere(e,t){return e instanceof u?new H(T(z(t?.densificationFactor||0),e,t)):(J().error(".createSphere()",b),null)}static createCylinder(e,t){return e instanceof u?new H(T(D(t?.densificationFactor||0),e,t)):(J().error(".createCylinder()",b),null)}static createPlane(e,t){if(!(e instanceof u))return J().error(".createPlane()",b),null;const r=t?.facing??"up",o=N(r,t?.size);return new H(T(W(r),e,{...t,size:o}))}static createFromPolygon(e,t){if(!(e instanceof f))return J().error(".createFromPolygon()",A),null;const r=E(e);return new H({vertexAttributes:new U({position:r.position}),components:[new j({faces:r.faces,shading:"flat",material:t?.material??null})],spatialReference:e.spatialReference,vertexSpace:new L})}static async createFromGLTF(e,t,r){if(!(e instanceof u)){const e=new M;throw J().error(".createfromGLTF()",e.message),e}const{loadGLTFMesh:o}=await a(import("./support/meshUtils/loadGLTFMesh.js"),r);return new H(await o(e,t,r))}static async createFromFiles(e,o,s){t(J(),"`Mesh.createFromFiles` is deprecated in favor of 'SceneLayer.convertMesh'",{replacement:"SceneLayer.convertMesh",version:"4.29"});const n=e=>J().error(".createFromFiles()",e.message);if(!(e instanceof u)){const e=new M;throw n(e),e}if(!s?.layer)throw new r("invalid:no-layer","SceneLayer required for file to mesh conversion.");return s.layer.convertMesh(o,{location:e,...s})}static createWithExternalSource(e,t,r){const o=r?.extent??null,{spatialReference:s}=e,n=r?.transform?.clone()??new R,i=P(e,r),a={source:t,extent:o},c=new I;return c.externalSources.push(a),new H({metadata:c,transform:n,vertexSpace:i,spatialReference:s})}static createIncomplete(e,t){const{spatialReference:o}=e,s=t?.transform?.clone()??new R,n=P(e,t),i=new H({transform:s,vertexSpace:n,spatialReference:o});return i.addResolvingPromise(Promise.reject(new r("mesh-incomplete","Mesh resources are not complete"))),i}};e([p({type:[j],json:{write:!0}})],X.prototype,"components",void 0),e([p({nonNullable:!0,types:Q,constructOnly:!0,json:{write:!0}})],X.prototype,"vertexSpace",void 0),e([p({type:R,json:{write:!0}})],X.prototype,"transform",void 0),e([p({constructOnly:!0})],X.prototype,"metadata",void 0),e([p()],X.prototype,"hasExtent",null),e([p()],X.prototype,"_transformedExtent",null),e([p()],X.prototype,"_untransformedBounds",null),e([p()],X.prototype,"origin",null),e([p({readOnly:!0,json:{read:!1}})],X.prototype,"extent",null),e([p({readOnly:!0,json:{read:!1,write:!0,default:!0}})],X.prototype,"hasZ",void 0),e([p({readOnly:!0,json:{read:!1,write:!0,default:!1}})],X.prototype,"hasM",void 0),e([p({type:U,nonNullable:!0,json:{write:!0}})],X.prototype,"vertexAttributes",void 0),X=H=e([l(K)],X);const Y=g(),$=X;export{$ as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{deprecatedFunction as t}from"../core/deprecate.js";import r from"../core/Error.js";import o from"../core/Loadable.js";import s from"../core/Logger.js";import{EsriPromiseMixin as n}from"../core/Promise.js";import{throwIfAborted as i,whenOrAbort as a}from"../core/promiseUtils.js";import{watch as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{fromValues as m}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"./Geometry.js";import u from"./Point.js";import f from"./Polygon.js";import{create as d,fromBuffer as x,zero as y}from"./support/aaBoundingBox.js";import{composeAxes as v,create as g}from"./support/axisAngleDegrees.js";import j from"./support/MeshComponent.js";import{componentNotFoundMessage as w,meshNotLoadedMessage as S,invalidLocationMessage as b,invalidPolygonMessage as M,InvalidLocationError as A}from"./support/meshErrors.js";import L from"./support/MeshGeoreferencedVertexSpace.js";import F from"./support/MeshLocalVertexSpace.js";import R from"./support/MeshTransform.js";import{MeshVertexAttributes as _}from"./support/MeshVertexAttributes.js";import{vertexSpaceOriginToPoint as C,isRelativeVertexSpace as U,selectVertexSpace as P}from"./support/meshVertexSpaceUtils.js";import{triangulate as E}from"./support/triangulationUtils.js";import{centerAt as B}from"./support/meshUtils/centerAt.js";import{computeMeshExtent as G}from"./support/meshUtils/extent.js";import{loadExternal as k}from"./support/meshUtils/loadExternal.js";import{Metadata as I}from"./support/meshUtils/Metadata.js";import{convertUnitGeometry as T,createUnitSizeBox as V,extractSingleFaceOfBox as O,createUnitSizeSphere as z,createUnitSizeCylinder as D,convertPlaneSizeParameter as N,createUnitSizePlane as W}from"./support/meshUtils/primitives.js";import{rotate as Z}from"./support/meshUtils/rotate.js";import{scale as q}from"./support/meshUtils/scale.js";var H;const K="esri.geometry.Mesh";function J(){return s.getLogger(K)}const Q={base:null,key:"type",defaultKeyValue:"georeferenced",typeMap:{georeferenced:L,local:F}};let X=H=class extends(o.LoadableMixin(n(h))){constructor(e){super(e),this.components=null,this.vertexSpace=new L,this.transform=null,this.metadata=new I,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new _,this.type="mesh"}initialize(){(0===this.metadata.externalSources.length||this.vertexAttributes.position.length)&&(this.loadStatus="loaded"),this.when((()=>{this.addHandles(c((()=>({vertexAttributes:this.vertexAttributes,components:this.components?.map((e=>e.clone()))})),(()=>this._clearSources()),{once:!0,sync:!0}))}))}get hasExtent(){return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):null!=this.metadata.displaySource?.extent}get _transformedExtent(){const{spatialReference:e,vertexSpace:t}=this,r=this;return G({get transform(){return r.transform},vertexSpace:t,spatialReference:e,untransformedBounds:this._untransformedBounds})}get _untransformedBounds(){const{vertexAttributes:{position:e},components:t}=this;return 0===e.length||0===t?.length?d(y):x(e)}get origin(){const e=C(this.vertexSpace,this.spatialReference);if(null!=e)return e;const{center:t,zmin:r}=this._transformedExtent;return new u({x:t.x,y:t.y,z:r,spatialReference:this.spatialReference})}get extent(){return this.loaded||null==this.metadata?.displaySource?.extent?this._transformedExtent:this.metadata.displaySource.extent.clone()}addComponent(e){this._checkIfLoaded("addComponent()")&&(this.components||(this.components=[]),this.components.push(j.from(e)),this.notifyChange("components"))}removeComponent(e){if(this._checkIfLoaded("removeComponent()")){if(this.components){const t=this.components.indexOf(e);if(-1!==t)return this.components.splice(t,1),void this.notifyChange("components")}J().error("removeComponent()",w)}}rotate(e,t,r,o){return v(e,t,r,Y),Z(this,Y,o),this}offset(e,t,r){if(!this._checkIfLoaded("offset()"))return this;const{vertexSpace:o,vertexAttributes:s}=this,n=s?.position;if(!n)return this;if(U(o)){const[s,n,i]=o.origin;o.origin=m(s+e,n+t,i+r)}else{for(let o=0;o<n.length;o+=3)n[o]+=e,n[o+1]+=t,n[o+2]+=r;this.vertexAttributesChanged()}return this}scale(e,t){return this._checkIfLoaded("scale()")?(q(this,e,t),this):this}centerAt(e,t){return this._checkIfLoaded("centerAt()")?(B(this,e,t),this):this}load(e){const{metadata:{displaySource:t}}=this;return t&&this.addResolvingPromise(k(this,t,e)),Promise.resolve(this)}addExternalSources(e){this.metadata.externalSources.addMany(e)}updateDisplaySource(e){this.metadata.displaySource=e}clone(){return this.cloneAndModifyVertexAttributes(this.vertexAttributes.clone(),this.vertexSpace.clone(),{preserveMetadata:!0})}cloneAndModifyVertexAttributes(e,t,r){let o=null;if(this.components){const e=new Map,t=new Map;o=this.components.map((r=>r.cloneWithDeduplication(e,t)))}const s={components:o,spatialReference:this.spatialReference,vertexAttributes:e,vertexSpace:t,transform:this.transform?.clone()??null,metadata:r?.preserveMetadata?this.metadata.clone():new I};return new H(s)}cloneShallow(){return new H({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange("vertexAttributes")}async toBinaryGLTF(e){const[{toBinaryGLTF:t}]=await Promise.all([import("./support/meshUtils/exporters/gltf/gltfexport.js"),this.load(e)]);return i(e),await t(this,e)}get usedMemory(){return this.components?this.components.reduce(((e,t)=>e+t.memoryUsage),this.vertexAttributes.usedMemory):this.vertexAttributes.usedMemory}_clearSources(){this.metadata.clearSources()}_checkIfLoaded(e){return!!this.loaded||(J().error(e,S),!1)}static createBox(e,t){if(!(e instanceof u))return J().error(".createBox()",b),null;const r=new H(T(V(),e,t));return t?.imageFace&&"all"!==t.imageFace?O(r,t.imageFace):r}static createSphere(e,t){return e instanceof u?new H(T(z(t?.densificationFactor||0),e,t)):(J().error(".createSphere()",b),null)}static createCylinder(e,t){return e instanceof u?new H(T(D(t?.densificationFactor||0),e,t)):(J().error(".createCylinder()",b),null)}static createPlane(e,t){if(!(e instanceof u))return J().error(".createPlane()",b),null;const r=t?.facing??"up",o=N(r,t?.size);return new H(T(W(r),e,{...t,size:o}))}static createFromPolygon(e,t){if(!(e instanceof f))return J().error(".createFromPolygon()",M),null;const r=E(e);return new H({vertexAttributes:new _({position:r.position}),components:[new j({faces:r.faces,shading:"flat",material:t?.material??null})],spatialReference:e.spatialReference,vertexSpace:new L})}static async createFromGLTF(e,t,r){if(!(e instanceof u)){const e=new A;throw J().error(".createfromGLTF()",e.message),e}const{loadGLTFMesh:o}=await a(import("./support/meshUtils/loadGLTFMesh.js"),r);return new H(await o(e,t,r))}static async createFromFiles(e,o,s){t(J(),"`Mesh.createFromFiles` is deprecated in favor of 'SceneLayer.convertMesh'",{replacement:"SceneLayer.convertMesh",version:"4.29"});const n=e=>J().error(".createFromFiles()",e.message);if(!(e instanceof u)){const e=new A;throw n(e),e}if(!s?.layer)throw new r("invalid:no-layer","SceneLayer required for file to mesh conversion.");return s.layer.convertMesh(o,{location:e,...s})}static createWithExternalSource(e,t,r){const o=r?.extent??null,{spatialReference:s}=e,n=r?.transform?.clone()??new R,i=P(e,r),a={source:t,extent:o},c=new I;return c.externalSources.push(a),new H({metadata:c,transform:n,vertexSpace:i,spatialReference:s})}static createIncomplete(e,t){const{spatialReference:o}=e,s=t?.transform?.clone()??new R,n=P(e,t),i=new H({transform:s,vertexSpace:n,spatialReference:o});return i.addResolvingPromise(Promise.reject(new r("mesh-incomplete","Mesh resources are not complete"))),i}};e([p({type:[j],json:{write:!0}})],X.prototype,"components",void 0),e([p({nonNullable:!0,types:Q,constructOnly:!0,json:{write:!0}})],X.prototype,"vertexSpace",void 0),e([p({type:R,json:{write:!0}})],X.prototype,"transform",void 0),e([p({constructOnly:!0})],X.prototype,"metadata",void 0),e([p()],X.prototype,"hasExtent",null),e([p()],X.prototype,"_transformedExtent",null),e([p()],X.prototype,"_untransformedBounds",null),e([p()],X.prototype,"origin",null),e([p({readOnly:!0,json:{read:!1}})],X.prototype,"extent",null),e([p({readOnly:!0,json:{read:!1,write:!0,default:!0}})],X.prototype,"hasZ",void 0),e([p({readOnly:!0,json:{read:!1,write:!0,default:!1}})],X.prototype,"hasM",void 0),e([p({type:_,nonNullable:!0,json:{write:!0}})],X.prototype,"vertexAttributes",void 0),X=H=e([l(K)],X);const Y=g(),$=X;export{$ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as r}from"../../core/arrayUtils.js";import{execute as t,executeMany as o}from"./gx/operatorAffineTransform.js";import{getSpatialReference as n,toGeometry as e,fromGeometry as f}from"./support/converterAPI.js";function s(r,o){const s=n(r);return e(t(f(r),o.transform),s)}function a(t,s){const a=t.map(f),m=n(t);return o(a,s.transform).map((r=>e(r,m))).filter(r)}function m(){return!0}export{s as execute,a as executeMany,m as supportsCurves};
5
+ import{isSome as r}from"../../core/arrayUtils.js";import{execute as t,executeMany as o}from"./gx/operatorAffineTransform.js";import{getSpatialReference as n,toGeometry as e,fromGeometry as a}from"./support/apiConverter.js";function f(r,o){const f=n(r);return e(t(a(r),o.transform),f)}function s(t,f){const s=t.map(a),m=n(t);return o(s,f.transform).map((r=>e(r,m))).filter(r)}function m(){return!0}export{f as execute,s as executeMany,m as supportsCurves};
@@ -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{execute as e,executeMany as r,supportsCurves as t}from"./gx/operatorAlphaShape.js";import{getSpatialReference as a,toPolygon as o,fromGeometry as p}from"./support/converterAPI.js";function n(r,t){const n=a(r),u=[0];return{alphaShape:o(e(p(r),t,u),n),calculatedAlpha:u[0]}}function u(e,t,n={}){const{merge:u=!1}=n,s=e.map(p),c=a(e);return r(s,t,u).map((e=>o(e,c)))}function s(){return t()}export{n as execute,u as executeMany,s as supportsCurves};
5
+ import{execute as e,executeMany as r,supportsCurves as t}from"./gx/operatorAlphaShape.js";import{getSpatialReference as a,toPolygon as p,fromGeometry as o}from"./support/apiConverter.js";function n(r,t){const n=a(r),u=[0];return{alphaShape:p(e(o(r),t,u),n),calculatedAlpha:u[0]}}function u(e,t,n={}){const{merge:u=!1}=n,s=e.map(o),c=a(e);return r(s,t,u).map((e=>p(e,c)))}function s(){return t()}export{n as execute,u as executeMany,s as supportsCurves};
@@ -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{areaUnitFromSpatialReference as r,convertUnit as t,getMetersPerUnitForSR as n}from"../../core/unitUtils.js";import{fromGeometry as o,getSpatialReference as e}from"./support/converterAPI.js";function a(a,i={}){const{unit:u}=i;let c=o(a).calculateArea2D();if(c&&u){const o=e(a);if(o.isGeographic)throw new Error("Unable to convert from an angular area unit to a linear area unit.");const i=r(o);i!==u&&(i?c=t(c,i,u):(c=Math.sqrt(c),c*=n(o),c**=2,c=t(c,"square-meters",u)))}return c}function i(){return!0}export{a as execute,i as supportsCurves};
5
+ import{areaUnitFromSpatialReference as r,convertUnit as t,getMetersPerUnitForSR as n}from"../../core/unitUtils.js";import{fromGeometry as o,getSpatialReference as e}from"./support/apiConverter.js";function a(a,i={}){const{unit:u}=i;let s=o(a).calculateArea2D();if(s&&u){const o=e(a);if(o.isGeographic)throw new Error("Unable to convert from an angular area unit to a linear area unit.");const i=r(o);i!==u&&(i?s=t(s,i,u):(s=Math.sqrt(s),s*=n(o),s**=2,s=t(s,"square-meters",u)))}return s}function i(){return!0}export{a as execute,i as supportsCurves};
@@ -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{isSome as r}from"../../core/arrayUtils.js";import{execute as o,supportsCurves as t}from"./gx/operatorAutoComplete.js";import{getSpatialReference as e,fromSpatialReference as p,fromPolyline as s,fromPolygon as m,toPolygon as u}from"./support/converterAPI.js";function a(t,a){const n=e(t);return o(t.map(m),a.map(s),p(n)).map((r=>u(r,n))).filter(r)}function n(){return t()}export{a as execute,n as supportsCurves};
5
+ import{isSome as r}from"../../core/arrayUtils.js";import{execute as o,supportsCurves as t}from"./gx/operatorAutoComplete.js";import{getSpatialReference as e,fromSpatialReference as p,fromPolyline as s,fromPolygon as m,toPolygon as a}from"./support/apiConverter.js";function u(t,u){const i=e(t);return o(t.map(m),u.map(s),p(i)).map((r=>a(r,i))).filter(r)}function i(){return t()}export{u as execute,i as supportsCurves};
@@ -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{execute as r,executeMany as t,supportsCurves as o}from"./gx/operatorBoundary.js";import{getSpatialReference as e,toGeometry as n,fromGeometry as u}from"./support/converterAPI.js";function s(t){const o=e(t);return n(r(u(t)),o)}function p(r){const o=r.map(u),s=e(r);return t(o).map((r=>n(r,s)))}function a(){return o()}export{s as execute,p as executeMany,a as supportsCurves};
5
+ import{execute as r,executeMany as t,supportsCurves as o}from"./gx/operatorBoundary.js";import{getSpatialReference as e,toGeometry as n,fromGeometry as u}from"./support/apiConverter.js";function p(t){const o=e(t);return n(r(u(t)),o)}function s(r){const o=r.map(u),p=e(r);return t(o).map((r=>n(r,p)))}function a(){return o()}export{p as execute,s as executeMany,a as supportsCurves};
@@ -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{isSome as r}from"../../core/arrayUtils.js";import{convertToSpatialReferenceUnit as t}from"../../core/unitUtils.js";import{execute as o,executeManyEx as e,supportsCurves as n}from"./gx/operatorBuffer.js";import{getSpatialReference as i,toGeometry as u,fromSpatialReference as s,fromGeometry as m}from"./support/converterAPI.js";function p(r,e,n={}){const{unit:p}=n,a=i(r);return p&&(e=t(e,p,a)),u(o(m(r),s(a),e),a)}function a(o,n,p={}){let{maxDeviation:a=NaN,maxVerticesInFullCircle:c=96,union:f=!1,unit:l}=p;const x=o.map(m),j=i(o);return l&&(n=n.map((r=>t(r,l,j))),a&&(a=t(a,l,j))),e(x,s(j),n,a,c,f).map((r=>u(r,j))).filter(r)}function c(){return n()}export{p as execute,a as executeMany,c as supportsCurves};
5
+ import{isSome as r}from"../../core/arrayUtils.js";import{convertToSpatialReferenceUnit as t}from"../../core/unitUtils.js";import{execute as o,executeManyEx as e,supportsCurves as i}from"./gx/operatorBuffer.js";import{getSpatialReference as n,toGeometry as u,fromSpatialReference as s,fromGeometry as p}from"./support/apiConverter.js";function a(r,e,i={}){const{unit:a}=i,m=n(r);return a&&(e=t(e,a,m)),u(o(p(r),s(m),e),m)}function m(o,i,a={}){let{maxDeviation:m=NaN,maxVerticesInFullCircle:c=96,union:f=!1,unit:l}=a;const x=o.map(p),j=n(o);return l&&(i=i.map((r=>t(r,l,j))),m&&(m=t(m,l,j))),e(x,s(j),i,m,c,f).map((r=>u(r,j))).filter(r)}function c(){return i()}export{a as execute,m as executeMany,c as supportsCurves};