@arcgis/core 4.32.0-next.20250106 → 4.32.0-next.20250108

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 (228) hide show
  1. package/AttributeBinsGraphic.js +5 -0
  2. package/README.md +1 -1
  3. package/WebLinkChart.js +1 -1
  4. package/applications/MapViewer/templateUtils.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/000771f8eefcd6af0fda.js +1 -0
  7. package/assets/esri/core/workers/chunks/{9372d08ba8bf3342c48f.js → 011ccfd3acee83e7dc68.js} +1 -1
  8. package/assets/esri/core/workers/chunks/03af4a51043677ffcd0f.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d07da8b63d83af179a2c.js → 05943caacfd28c383810.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{9f495ad57cdbfa90c5b8.js → 095aeb19e2207c8361ca.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{67c7bdc0c91a8f803ea8.js → 11cb25dfab7c8467897a.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{07304287ed5244fa4e12.js → 12b2c8251ec2d0e2ca46.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js → 1abeba63bf623a746d5c.js} +2 -2
  14. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js.LICENSE.txt → 1abeba63bf623a746d5c.js.LICENSE.txt} +1 -1
  15. package/assets/esri/core/workers/chunks/{a57cead317eb2fc9afd8.js → 206194cf069ad4bcc3ad.js} +1 -1
  16. package/assets/esri/core/workers/chunks/24a597ae32a2083a50a5.js +1 -0
  17. package/assets/esri/core/workers/chunks/{0673d811c496143fc3d4.js → 2779cf112299b612a73a.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{bd37c9cc720587665fd3.js → 304b88ade7551130ad3a.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{aedff36d3fec86abb9fb.js → 30a84ddf0384bb52fdbe.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{367af4aa7e170c8553e3.js → 33a13544b9e5f4f20bce.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{dce55e7f76adecc055c3.js → 35d9457109d0631a1ca8.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{3a90163b76b0bc7f21d2.js → 3767defbd9c4b2e86886.js} +1 -1
  23. package/assets/esri/core/workers/chunks/3a3e9701e5d7b05f41b7.js +1 -0
  24. package/assets/esri/core/workers/chunks/{9a498f2c007f4d78d4dd.js → 4234539a9721104acafb.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{76fa5c7c87831ad25cde.js → 435c037ccba71f1e22d3.js} +1 -1
  26. package/assets/esri/core/workers/chunks/4387c47ae1b36d770f1d.js +1 -0
  27. package/assets/esri/core/workers/chunks/44ec3c77339b9765aaa4.js +1 -0
  28. package/assets/esri/core/workers/chunks/4b77c8d994498899631a.js +1 -0
  29. package/assets/esri/core/workers/chunks/510cb8647841fec436c8.js +1 -0
  30. package/assets/esri/core/workers/chunks/{f9af0473878d960a02f2.js → 58485909e1cfeb52c01e.js} +1 -1
  31. package/assets/esri/core/workers/chunks/5b61a1e7ac60a02a906d.js +1 -0
  32. package/assets/esri/core/workers/chunks/62f8949a2d9076f3c1ea.js +2 -0
  33. package/assets/esri/core/workers/chunks/{c8cd6ba5600d8ff8db0b.js.LICENSE.txt → 62f8949a2d9076f3c1ea.js.LICENSE.txt} +1 -1
  34. package/assets/esri/core/workers/chunks/{664aa401887b59abd7b7.js → 6400f39a965900f66ce7.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{ddce265c46e4dfeb6c6d.js → 66d40a486aa3caa76106.js} +1 -1
  36. package/assets/esri/core/workers/chunks/6b3ee691646fbc39445c.js +1 -0
  37. package/assets/esri/core/workers/chunks/{533a7fd64b17bb294545.js → 6c58f792e2ae3736f662.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js → 6efb36bc2205203ff44d.js} +2 -2
  39. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js.LICENSE.txt → 6efb36bc2205203ff44d.js.LICENSE.txt} +1 -1
  40. package/assets/esri/core/workers/chunks/76a7114a69264f5c07b0.js +2 -0
  41. package/assets/esri/core/workers/chunks/{005727711cca0614c2ab.js.LICENSE.txt → 76a7114a69264f5c07b0.js.LICENSE.txt} +1 -1
  42. package/assets/esri/core/workers/chunks/{a90611cdc86190799560.js → 7a43fda8984549a084b8.js} +1 -1
  43. package/assets/esri/core/workers/chunks/7b753da3b8a6d75abf20.js +1 -0
  44. package/assets/esri/core/workers/chunks/{ca1e186f136abb23ae4b.js → 7d0fc25ce1f74adcfeb6.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{9b020c47ca9ff5de9bb8.js → 7db356976198c4df76c1.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{9ad7d095e614e7e8d7f5.js → 7df076d15b7b7a66dcee.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{955421ee2247965244f0.js → 7fe92f072d3641ec4662.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{4c56698cf1c669371865.js → 81816410cb1453938593.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{4ffaa2c5ab47a599ee9f.js → 82266ca8002554198208.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{88c68881cbdf4e911832.js → 89286d8f59844724cd16.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{f19d3c855f6e93544918.js → 8be0151a24c9af76a976.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{d9e396adf3354ee68339.js → 8f2b2d2dc9935b0d2039.js} +1 -1
  53. package/assets/esri/core/workers/chunks/907a91266e25cc4b9d42.js +1 -0
  54. package/assets/esri/core/workers/chunks/{a77aa86896bbb0e088df.js → 9857491cafa0278d9ae6.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{993db7646a8fc60179eb.js → 98da074899c82f0ded0b.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{3bb94da29dac3367ecc6.js → a1edd3f68e691ea39594.js} +1 -1
  57. package/assets/esri/core/workers/chunks/a8ec4189ec3b37d5ff74.js +1 -0
  58. package/assets/esri/core/workers/chunks/{6a4305eb1e52b80ecb5c.js → b8ea84adff5619040494.js} +3 -3
  59. package/assets/esri/core/workers/chunks/c4374b6bc5c8dc6435c7.js +1 -0
  60. package/assets/esri/core/workers/chunks/c5a928dcff7dc8a8cc9f.js +2 -0
  61. package/assets/esri/core/workers/chunks/{f4e3db71d1adae717535.js.LICENSE.txt → c5a928dcff7dc8a8cc9f.js.LICENSE.txt} +1 -1
  62. package/assets/esri/core/workers/chunks/cac79b64a7dade8bf486.js +2 -0
  63. package/assets/esri/core/workers/chunks/{bf0a0ca7fdac98f06a89.js.LICENSE.txt → cac79b64a7dade8bf486.js.LICENSE.txt} +1 -1
  64. package/assets/esri/core/workers/chunks/cd92b80de7e9f982f9a9.js +1 -0
  65. package/assets/esri/core/workers/chunks/{2cccaf50134c65944e0a.js → d0876eed5249b029f9f0.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{178f606c8896ae5f39de.js → d1dbbab4a4c6072c182f.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{8e42fb623f56942958d8.js → d74b5dc60f02892d03e7.js} +1 -1
  68. package/assets/esri/core/workers/chunks/e27b8674a3492db51f2e.js +1 -0
  69. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js → e2d987c39a6ef318511c.js} +2 -2
  70. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js.LICENSE.txt → e2d987c39a6ef318511c.js.LICENSE.txt} +1 -1
  71. package/assets/esri/core/workers/chunks/{943428cf643e87ccfaad.js → e7e26b71f9eb28421936.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{f0adabf6d71a27f3183b.js → e80b0646a7e0e466ea65.js} +1 -1
  73. package/assets/esri/core/workers/chunks/e9c21907fabcedbd32ae.js +1 -0
  74. package/assets/esri/core/workers/chunks/{3ed7c8138231de3a3b96.js → f8c960df1dabab120c70.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{fdd8a5eb07466541f1f9.js → fd95b19f02d8dfef2baf.js} +1 -1
  76. package/assets/esri/widgets/support/GridControls/t9n/GridControls_ja.json +1 -1
  77. package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
  78. package/chunks/LineSeries.js +1 -1
  79. package/chunks/OperatorProject.js +1 -1
  80. package/chunks/Pattern.glsl.js +1 -1
  81. package/chunks/QuadraticBezier.js +1 -1
  82. package/chunks/Transformation2D.js +1 -1
  83. package/chunks/bufferOperator.js +1 -1
  84. package/chunks/chartUtilsAm5.js +1 -1
  85. package/chunks/geodesicBufferOperator.js +1 -1
  86. package/chunks/lyr3DWorker.js +1 -1
  87. package/chunks/terrainUtilsPlanar.js +1 -1
  88. package/chunks/terrainUtilsSpherical.js +1 -1
  89. package/chunks/vxlLayer.js +1 -1
  90. package/geometry/operators/graphicBufferOperator.js +1 -1
  91. package/geometry/support/meshUtils/primitives.js +1 -1
  92. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  93. package/geometry/support/triangle.js +1 -1
  94. package/interfaces.d.ts +186 -96
  95. package/layers/LinkChartLayer.js +1 -1
  96. package/layers/MapNotesLayer.js +1 -1
  97. package/layers/MediaLayer.js +1 -1
  98. package/layers/graphics/data/QueryEngineResult.js +1 -1
  99. package/layers/graphics/data/queryUtils.js +1 -1
  100. package/layers/graphics/data/queryValidationUtils.js +1 -1
  101. package/layers/graphics/sources/WFSSource.js +1 -1
  102. package/layers/support/ImageElement.js +1 -1
  103. package/layers/support/VideoElement.js +1 -1
  104. package/layers/support/capabilities.js +1 -1
  105. package/layers/support/featureLayerUtils.js +1 -1
  106. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  107. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  108. package/layers/video/VideoController.js +1 -1
  109. package/linkChart/OrganicLayoutSettings.js +1 -1
  110. package/package.json +4 -4
  111. package/renderers/RasterStretchRenderer.js +1 -1
  112. package/rest/query/executeAttributeBinsQuery.js +1 -1
  113. package/rest/support/AttributeBinsFeatureSet.js +5 -0
  114. package/rest/support/AttributeBinsQuery.js +1 -1
  115. package/rest/support/BinParametersAttributes.js +1 -1
  116. package/rest/support/BinParametersBase.js +1 -1
  117. package/rest/support/DateBinParameters.js +1 -1
  118. package/rest/support/FeatureSet.js +1 -1
  119. package/rest/support/NormalizationBinParametersMixin.js +1 -1
  120. package/rest/support/Query.js +1 -1
  121. package/rest/support/TopFeaturesQuery.js +1 -1
  122. package/smartMapping/renderers/color.js +1 -1
  123. package/smartMapping/renderers/dotDensity.js +1 -1
  124. package/smartMapping/renderers/pieChart.js +1 -1
  125. package/smartMapping/renderers/size.js +1 -1
  126. package/smartMapping/renderers/univariateColorSize.js +1 -1
  127. package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
  128. package/support/mediaLayerUtils.js +5 -0
  129. package/support/revision.js +1 -1
  130. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  131. package/symbols/cim/cimAnalyzer.js +1 -1
  132. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  133. package/views/2d/AnimationManager.js +1 -1
  134. package/views/2d/engine/Bitmap.js +1 -1
  135. package/views/2d/engine/BitmapContainer.js +1 -1
  136. package/views/2d/engine/BitmapTileContainer.js +1 -1
  137. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  138. package/views/2d/engine/webgl/Overlay.js +1 -1
  139. package/views/2d/engine/webgl/SDFConverter.js +1 -1
  140. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  141. package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  143. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  144. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  145. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  146. package/views/2d/navigation/MapViewNavigation.js +1 -1
  147. package/views/2d/support/HighlightGroup.js +1 -1
  148. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  149. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  150. package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
  151. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  152. package/views/3d/analysis/support/measurementUtils.js +1 -1
  153. package/views/3d/environment/CloudsParameters.js +1 -1
  154. package/views/3d/environment/MarsAtmosphere.js +1 -1
  155. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  156. package/views/3d/layers/MediaLayerView3D.js +1 -1
  157. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  158. package/views/3d/layers/graphics/placementUtils.js +1 -1
  159. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  160. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  161. package/views/3d/state/NearFarHeuristic.js +1 -1
  162. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  163. package/views/3d/support/HighlightGroup.js +1 -1
  164. package/views/3d/terrain/SphericalPatch.js +1 -1
  165. package/views/3d/terrain/TerrainRenderer.js +1 -1
  166. package/views/3d/terrain/TerrainSurface.js +1 -1
  167. package/views/3d/terrain/TilePerLayerInfo.js +1 -1
  168. package/views/3d/terrain/TileRenderer.js +1 -1
  169. package/views/3d/terrain/TileTexture.js +1 -1
  170. package/views/3d/terrain/terrainUtilsPlanar.js +1 -1
  171. package/views/3d/terrain/terrainUtilsSpherical.js +1 -1
  172. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  173. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  174. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  175. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  176. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  177. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  178. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +4 -4
  179. package/views/SceneView.js +1 -1
  180. package/views/View.js +1 -1
  181. package/views/draw/support/HighlightHelper.js +1 -1
  182. package/views/input/BrowserEventSource.js +1 -1
  183. package/views/layers/DimensionLayerView.js +1 -1
  184. package/views/layers/MediaLayerView.js +1 -1
  185. package/views/support/HighlightGroup.d.ts +4 -0
  186. package/views/support/HighlightGroup.js +5 -0
  187. package/views/webgl/Texture.js +1 -1
  188. package/views/webgl/textureUtils.js +5 -0
  189. package/webscene/Slide.js +1 -1
  190. package/widgets/BasemapLayerList.js +1 -1
  191. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  192. package/widgets/CatalogLayerList.js +1 -1
  193. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  194. package/widgets/Editor/UpdateWorkflow.js +1 -1
  195. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  196. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  197. package/widgets/FeatureTable/support/exportUtils.js +1 -1
  198. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  199. package/widgets/LayerList/support/layerListUtils.js +1 -1
  200. package/widgets/LayerList.js +1 -1
  201. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  202. package/widgets/PanoramicViewer/utils.js +1 -1
  203. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  204. package/widgets/Sketch/SketchViewModel.js +1 -1
  205. package/widgets/TableList.js +1 -1
  206. package/widgets/support/ColorPicker.js +1 -1
  207. package/assets/esri/core/workers/chunks/005727711cca0614c2ab.js +0 -2
  208. package/assets/esri/core/workers/chunks/0a3bf1b74cce1b6b7ed8.js +0 -1
  209. package/assets/esri/core/workers/chunks/0d2411a941c42acb8cc2.js +0 -1
  210. package/assets/esri/core/workers/chunks/127c82cdb229434883b6.js +0 -1
  211. package/assets/esri/core/workers/chunks/13720b1d97fb7d80e972.js +0 -1
  212. package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +0 -1
  213. package/assets/esri/core/workers/chunks/16530347bd78dc6c2fcd.js +0 -1
  214. package/assets/esri/core/workers/chunks/1a713cc601c6fcd97d2f.js +0 -1
  215. package/assets/esri/core/workers/chunks/3029354194f1a3030c5c.js +0 -1
  216. package/assets/esri/core/workers/chunks/318a39b56851e707edad.js +0 -1
  217. package/assets/esri/core/workers/chunks/53cd990b2c988518de6d.js +0 -1
  218. package/assets/esri/core/workers/chunks/5a0eb9dfe668cf290462.js +0 -1
  219. package/assets/esri/core/workers/chunks/66b411119b8ffb99b9dc.js +0 -1
  220. package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +0 -1
  221. package/assets/esri/core/workers/chunks/9f0ebeae8a3ba360284b.js +0 -1
  222. package/assets/esri/core/workers/chunks/a3cef3837f4df9ab022e.js +0 -1
  223. package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js +0 -2
  224. package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +0 -2
  225. package/assets/esri/core/workers/chunks/ea250d66089967976c05.js +0 -1
  226. package/assets/esri/core/workers/chunks/ecf317c6c790b3cc83bf.js +0 -1
  227. package/assets/esri/core/workers/chunks/f4e3db71d1adae717535.js +0 -2
  228. package/views/2d/support/HighlightGroup.d.ts +0 -4
@@ -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 t}from"../../chunks/tslib.es6.js";import"../../geometry.js";import i from"../../Viewpoint.js";import e from"../../core/Accessor.js";import has from"../../core/has.js";import{removeMaybe as n}from"../../core/maybe.js";import{addFrameTask as o}from"../../core/scheduling.js";import{createScreenPoint as s}from"../../core/screenUtils.js";import{Milliseconds as a}from"../../core/time.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import p from"../ViewAnimation.js";import u from"./PaddedViewState.js";import{easingFunctions as c,parse as d}from"./unitBezier.js";import{copy as l}from"./viewpointUtils.js";import{Camera as w}from"./pointToPoint/Camera.js";import{Animation as _}from"../animation/pointToPoint/Animation.js";import{defaultSettings2D as g}from"../animation/pointToPoint/Settings.js";import f from"../../geometry/Point.js";const v=2e3,j=64;class y{constructor(t){this._view=t,this._animation=new _((()=>new w(this._view))),this._current=new w(this._view)}get _source(){return this._animation.definition.source}get _target(){return this._animation.definition.target}get duration(){return this._animation.time}get animation(){return this._animation}update(t,i,e={}){l(this._current.viewpoint,t),l(this._source.viewpoint,t),l(this._target.viewpoint,i),this._animation.update(this._source,this._target,e)}applyRatio(t,i){this._animation.cameraAt(i,this._current),l(t,this._current.viewpoint)}}let T=class extends e{constructor(t){super(t),this._animation=null,this._destinationViewState=new u,this.updateFunction=null,this.easing=c.ease,this.viewpoint=new i({targetGeometry:new f,scale:0,rotation:0}),this._updateTask=o({postRender:this._postRender.bind(this)}),this._updateTask.pause(),this._transition=new y(t.view)}destroy(){this._updateTask=n(this._updateTask)}get animation(){return this._animation}set animation(t){this._animation=t,this.view.animation=t}animate(t,i,e){this.stop();const n=this.viewpoint;l(n,i);const o=("string"==typeof e?.easing?d(e.easing):e?.easing)||this.easing,s=t.target;this._transition.update(this.viewpoint,s,{apex:{maximumDistance:Math.min(Math.min(i.scale,s.scale)*j,this.view.constraints.effectiveMinScale),desiredSlope:5e-8},duration:e?.duration,maxDuration:"auto"===e?.animationMode?a(1/0):e?.maxDuration??g.maxDuration,speedFactor:e?.speedFactor,easing:"function"==typeof o?t=>o(t):void 0}),"auto"===e?.animationMode&&(this._destinationViewState.copy(this.view.state),this._destinationViewState.viewpoint=s,x(this._transition.animation,e,this.view.state,this._destinationViewState)||this._transition.update(this.viewpoint,s,{duration:a(0)}));const r=()=>{this.animation===t&&this._updateTask&&("finished"===t.state&&(this._transition.applyRatio(this.viewpoint,1),this.view.state&&(this.view.state.viewpoint=this.viewpoint.clone())),this.animation=null,this.updateFunction=null)};return t.when(r,r),this._startTime=performance.now(),this._updateTask.resume(),this.animation=t,t}animateContinuous(t,i){this.stop(),this.updateFunction=i,this.viewpoint=t;const e=new p({target:t.clone()}),n=()=>{this.animation===e&&this._updateTask&&(this.animation=null,this.updateFunction=null)};return e.when(n,n),this._startTime=performance.now(),this._updateTask.resume(),this.animation=e,e}stop(){this.animation&&(this.animation.stop(),this.animation=null,this.updateFunction=null)}_postRender(t){const i=this.animation;if(i&&i.state!==p.State.STOPPED){if(this.updateFunction)this.updateFunction(this.viewpoint,t.deltaTime),this.animation?.update(this.viewpoint);else{const t=performance.now()-this._startTime,i=this._transition.duration,e=i>0?t/i:1,n=e>=1;this._transition.applyRatio(this.viewpoint,e),n&&this.animation?.finish()}this.view.state&&(this.view.state.viewpoint=this.viewpoint.clone())}else this._updateTask.pause()}};function x(t,i,e,n){if(null!=i?.duration)return!0;const{time:o,isLinear:a}=t,r=i?.speedFactor||1,h=i?.maxDuration??g.maxDuration/r;if(has("esri-goto-debug")&&(console.log("speed factor:",r),console.log("adjusted duration:\t\t",o),console.log("adjusted max duration:\t",h),console.log("is linear:",a)),o>h)return has("esri-goto-debug")&&console.warn(`failed "auto" heuristic: animations must be shorter than ${h/1e3}s`),!1;if(a){const t=1.5,i=m(),a=s(...n.toScreen(i,...e.center)),p=s(...e.toScreen(i,...n.center)),u=null!=p&&p.x>-(t-.5)*e.size[0]&&p.x<(t+.5)*e.size[0]&&p.y>-(t-.5)*e.size[1]&&p.y<(t+.5)*e.size[1],c=null!=a&&a.x>-(t-.5)*n.size[0]&&a.x<(t+.5)*n.size[0]&&a.y>-(t-.5)*n.size[1]&&a.y<(t+.5)*n.size[1];if(has("esri-goto-debug")&&(console.log(`dest is within ${t} screens at start view:`,u),console.log(`start is within ${t} screens at dest view:`,c)),o>v/r&&!u&&!c)return has("esri-goto-debug")&&console.warn(`failed "auto" heuristic: linear animations must be...\n - shorter than ${v/1e3/r}s, or\n - shorter than ${h/1e3}s and the destination is close enough to the starting screen, or\n - shorter than ${h/1e3}s and the start point is close enough to the destination screen`),!1}return!0}t([r()],T.prototype,"easing",void 0),t([r()],T.prototype,"view",void 0),t([r()],T.prototype,"viewpoint",void 0),T=t([h("esri.views.2d.AnimationManager")],T);const S=T;export{S as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import"../../geometry.js";import i from"../../Viewpoint.js";import e from"../../core/Accessor.js";import has from"../../core/has.js";import{removeMaybe as n}from"../../core/maybe.js";import{addFrameTask as o}from"../../core/scheduling.js";import{createScreenPoint as s}from"../../core/screenUtils.js";import{Milliseconds as a}from"../../core/time.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import p from"../ViewAnimation.js";import u from"./PaddedViewState.js";import{easingFunctions as c,parse as d}from"./unitBezier.js";import{copy as l}from"./viewpointUtils.js";import{Camera as w}from"./pointToPoint/Camera.js";import{Animation as _}from"../animation/pointToPoint/Animation.js";import{defaultSettings2D as g}from"../animation/pointToPoint/Settings.js";import f from"../../geometry/Point.js";const v=2e3,j=64;class y{constructor(t){this._view=t,this._animation=new _((()=>new w(this._view))),this._current=new w(this._view)}get _source(){return this._animation.definition.source}get _target(){return this._animation.definition.target}get duration(){return this._animation.time}get animation(){return this._animation}update(t,i,e={}){l(this._current.viewpoint,t),l(this._source.viewpoint,t),l(this._target.viewpoint,i),this._animation.update(this._source,this._target,e)}applyRatio(t,i){this._animation.cameraAt(i,this._current),l(t,this._current.viewpoint)}}let T=class extends e{constructor(t){super(t),this._animation=null,this._destinationViewState=new u,this.updateFunction=null,this.easing=c.ease,this.viewpoint=new i({targetGeometry:new f,scale:0,rotation:0}),this._updateTask=o({postRender:this._postRender.bind(this)}),this._updateTask.pause(),this._transition=new y(t.view)}destroy(){this._updateTask=n(this._updateTask)}get animation(){return this._animation}set animation(t){this._animation=t,this.view.animation=t}animate(t,i,e){this.stop();const n=this.viewpoint;l(n,i);const o=("string"==typeof e?.easing?d(e.easing):e?.easing)||this.easing,s=t.target;this._transition.update(this.viewpoint,s,{apex:{maximumDistance:Math.min(Math.min(i.scale,s.scale)*j,this.view.constraints.effectiveMinScale),desiredSlope:5e-8},duration:e?.duration,maxDuration:"auto"===e?.animationMode?a(1/0):e?.maxDuration??g.maxDuration,speedFactor:e?.speedFactor,easing:"function"==typeof o?t=>o(t):void 0}),"auto"===e?.animationMode&&(this._destinationViewState.copy(this.view.state),this._destinationViewState.viewpoint=s,x(this._transition.animation,e,this.view.state,this._destinationViewState)||this._transition.update(this.viewpoint,s,{duration:a(0)}));const r=()=>{this.animation===t&&this._updateTask&&("finished"===t.state&&(this._transition.applyRatio(this.viewpoint,1),this.view.state&&(this.view.state.viewpoint=this.viewpoint.clone())),this.animation=null,this.updateFunction=null)};return t.when(r,r),this._startTime=performance.now(),this._updateTask.resume(),this.animation=t,t}animateContinuous(t,i){this.stop(),this.updateFunction=i,this.viewpoint=t;const e=new p({target:t.clone()}),n=()=>{this.animation===e&&this._updateTask&&(this.animation=null,this.updateFunction=null)};return e.when(n,n),this._startTime=performance.now(),this._updateTask.resume(),this.animation=e,e}stop(){this.animation&&(this.animation.stop(),this.animation=null,this.updateFunction=null)}_postRender(t){const i=this.animation;if(i&&i.state!==p.State.STOPPED){if(this.updateFunction)this.updateFunction(this.viewpoint,t.deltaTime),this.animation?.update(this.viewpoint);else{const t=performance.now()-this._startTime,i=this._transition.duration,e=i>0?t/i:1,n=e>=1;this._transition.applyRatio(this.viewpoint,e),n&&this.animation?.finish()}this.view.state&&(this.view.state.viewpoint=this.viewpoint.clone())}else this._updateTask.pause()}};function x(t,i,e,n){if(null!=i?.duration)return!0;const{time:o,isLinear:a}=t,r=i?.speedFactor||1,h=i?.maxDuration??g.maxDuration/r;if(has("esri-goto-debug")&&(console.log("speed factor:",r),console.log("adjusted duration:\t\t",o),console.log("adjusted max duration:\t",h),console.log("is linear:",a)),o>h)return has("esri-goto-debug")&&console.warn(`failed "auto" heuristic: animations must be shorter than ${h/1e3}s`),!1;if(a){const t=1.5,i=m(),a=s(...n.toScreen(i,...e.center)),p=s(...e.toScreen(i,...n.center)),u=null!=p&&p.x>-1*e.size[0]&&p.x<(t+.5)*e.size[0]&&p.y>-1*e.size[1]&&p.y<(t+.5)*e.size[1],c=null!=a&&a.x>-1*n.size[0]&&a.x<(t+.5)*n.size[0]&&a.y>-1*n.size[1]&&a.y<(t+.5)*n.size[1];if(has("esri-goto-debug")&&(console.log(`dest is within ${t} screens at start view:`,u),console.log(`start is within ${t} screens at dest view:`,c)),o>v/r&&!u&&!c)return has("esri-goto-debug")&&console.warn(`failed "auto" heuristic: linear animations must be...\n - shorter than ${v/1e3/r}s, or\n - shorter than ${h/1e3}s and the destination is close enough to the starting screen, or\n - shorter than ${h/1e3}s and the start point is close enough to the destination screen`),!1}return!0}t([r()],T.prototype,"easing",void 0),t([r()],T.prototype,"view",void 0),t([r()],T.prototype,"viewpoint",void 0),T=t([h("esri.views.2d.AnimationManager")],T);const S=T;export{S 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{createResolver as t,onAbortOrThrow as e,throwIfNotAbortError as i}from"../../../core/promiseUtils.js";import{identity as s,translate as r,rotate as h,scaleByVec2 as u,multiply as o}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as a}from"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{DisplayObject as l}from"./DisplayObject.js";import d from"./ImageryBitmapSource.js";import{SizedPixelFormat as c,PixelFormat as _,TextureWrapMode as x}from"../../webgl/enums.js";import{Texture as m}from"../../webgl/Texture.js";import{TextureDescriptor as p}from"../../webgl/TextureDescriptor.js";function g(t){return t&&"render"in t}function f(t){const e=document.createElement("canvas");return e.width=t.width,e.height=t.height,t.render(e.getContext("2d")),e}function w(t){return g(t)?t instanceof d?t.getRenderedRasterPixels()?.renderedRasterPixels:f(t):t}class S extends l{constructor(t=null,e=!1){super(),this.blendFunction="standard",this._sourceWidth=0,this._sourceHeight=0,this._texture=null,this.stencilRef=0,this.coordScale=[1,1],this._height=void 0,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this._width=void 0,this.x=0,this.y=0,this.immutable=e,this.source=t,this.requestRender=this.requestRender.bind(this)}destroy(){this._texture&&(this._texture.texture.dispose(),this._texture=null),null!=this._uploadStatus&&(this._uploadStatus.controller.abort(),this._uploadStatus=null)}get isSourceScaled(){return this.width!==this._sourceWidth||this.height!==this._sourceHeight}get height(){return void 0!==this._height?this._height:this._sourceHeight}set height(t){this._height=t}get source(){return this._source}set source(t){null==t&&null==this._source||(this._source=t,this.invalidateTexture(),this.requestRender())}get width(){return void 0!==this._width?this._width:this._sourceWidth}set width(t){this._width=t}beforeRender(t){super.beforeRender(t),this.getTexture(t)}async setSourceAsync(i,s){null!=this._uploadStatus&&this._uploadStatus.controller.abort();const r=new AbortController,h=t();return e(s,(()=>r.abort())),e(r,(t=>h.reject(t))),this._uploadStatus={controller:r,resolver:h},this.source=i,h.promise}invalidateTexture(){this._texture&&this._texture.invalidated||this._texture&&(this._texture.invalidated=!0),this._source instanceof HTMLImageElement?(this._sourceHeight=this._source.naturalHeight,this._sourceWidth=this._source.naturalWidth):this._source&&(this._sourceHeight=this._source.height,this._sourceWidth=this._source.width)}transitionStep(t,e){t>=64&&(this.fadeTransitionEnabled=!1),super.transitionStep(t,e)}setTransform(t){const e=s(this.transforms.displayViewScreenMat3),[i,n]=t.toScreenNoRotation([0,0],[this.x,this.y]),l=this.resolution/this.pixelRatio/t.resolution,d=l*this.width,c=l*this.height,_=Math.PI*this.rotation/180;r(e,e,a(i,n)),r(e,e,a(d/2,c/2)),h(e,e,-_),r(e,e,a(-d/2,-c/2)),u(e,e,a(d,c)),o(this.transforms.displayViewScreenMat3,t.displayViewMat3,e)}setSamplingProfile(t){this._texture&&(t.mips&&!this._texture.texture.descriptor.hasMipmap&&this._texture.texture.generateMipmap(),this._texture.texture.setSamplingMode(t.samplingMode))}bind(t,e){this._texture&&t.bindTexture(this._texture.texture,e)}getTexture({context:t,painter:e}){if(this._texture&&!this._texture.invalidated)return this._texture.texture;if(this._texture||(this._texture={texture:this._createTexture(t),invalidated:!1}),!this.source)return this._texture.texture.setData(null),this._texture.texture;this._texture.texture.resize(this._sourceWidth,this._sourceHeight);const s=w(this.source);try{if(null!=this._uploadStatus){const{controller:t,resolver:i}=this._uploadStatus,r={signal:t.signal},{width:h,height:u}=this,{texture:o}=this._texture;e.textureUploadManager.enqueueTextureUpdate({data:s,texture:o,width:h,height:u},r),i.resolve(),this._uploadStatus=null}else this._texture?.texture.setData(s);this.ready()}catch(r){i(r)}return this._texture.texture}onDetach(){this.destroy()}_createTransforms(){return{displayViewScreenMat3:n()}}_createTexture(t){const e=this.immutable,i=new p;return i.internalFormat=e?c.RGBA8:_.RGBA,i.wrapMode=x.CLAMP_TO_EDGE,i.isImmutable=e,i.width=this._sourceWidth,i.height=this._sourceHeight,new m(t,i)}}export{S as Bitmap,g as isImageSource,f as rasterize};
5
+ import{createResolver as t,onAbortOrThrow as e,throwIfNotAbortError as i}from"../../../core/promiseUtils.js";import{identity as s,translate as r,rotate as h,scaleByVec2 as o,multiply as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as n}from"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{DisplayObject as l}from"./DisplayObject.js";import d from"./ImageryBitmapSource.js";import{SizedPixelFormat as c,PixelFormat as _,TextureWrapMode as p}from"../../webgl/enums.js";import{Texture as m}from"../../webgl/Texture.js";import{TextureDescriptor as x}from"../../webgl/TextureDescriptor.js";function g(t){return t&&"render"in t}function f(t){const e=document.createElement("canvas");return e.width=t.width,e.height=t.height,t.render(e.getContext("2d")),e}function w(t){return g(t)?t instanceof d?t.getRenderedRasterPixels()?.renderedRasterPixels:f(t):t}class S extends l{constructor(t=null,e=!1){super(),this.blendFunction="standard",this._sourceWidth=0,this._sourceHeight=0,this._textureInvalidated=!1,this.stencilRef=0,this.coordScale=[1,1],this._height=void 0,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this._texture=null,this._width=void 0,this.x=0,this.y=0,this.immutable=e,this.source=t,this.requestRender=this.requestRender.bind(this)}destroy(){this._texture&&(this._texture.dispose(),this._texture=null),null!=this._uploadStatus&&(this._uploadStatus.controller.abort(),this._uploadStatus=null)}get isSourceScaled(){return this.width!==this._sourceWidth||this.height!==this._sourceHeight}get height(){return void 0!==this._height?this._height:this._sourceHeight}set height(t){this._height=t}get source(){return this._source}set source(t){null==t&&null==this._source||(this._source=t,this.invalidateTexture(),this.requestRender())}get texture(){return this._texture}get width(){return void 0!==this._width?this._width:this._sourceWidth}set width(t){this._width=t}beforeRender(t){super.beforeRender(t),this.updateTexture(t)}async setSourceAsync(i,s){null!=this._uploadStatus&&this._uploadStatus.controller.abort();const r=new AbortController,h=t();return e(s,(()=>r.abort())),e(r,(t=>h.reject(t))),this._uploadStatus={controller:r,resolver:h},this.source=i,h.promise}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this._source instanceof HTMLImageElement?(this._sourceHeight=this._source.naturalHeight,this._sourceWidth=this._source.naturalWidth):this._source&&(this._sourceHeight=this._source.height,this._sourceWidth=this._source.width))}transitionStep(t,e){t>=64&&(this.fadeTransitionEnabled=!1),super.transitionStep(t,e)}setTransform(t){const e=s(this.transforms.displayViewScreenMat3),[i,a]=t.toScreenNoRotation([0,0],[this.x,this.y]),l=this.resolution/this.pixelRatio/t.resolution,d=l*this.width,c=l*this.height,_=Math.PI*this.rotation/180;r(e,e,n(i,a)),r(e,e,n(d/2,c/2)),h(e,e,-_),r(e,e,n(-d/2,-c/2)),o(e,e,n(d,c)),u(this.transforms.displayViewScreenMat3,t.displayViewMat3,e)}setSamplingProfile(t){this._texture&&(t.mips&&!this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._texture.setSamplingMode(t.samplingMode))}bind(t,e){this._texture&&t.bindTexture(this._texture,e)}async updateTexture({context:t,painter:e}){if(!this._textureInvalidated)return;if(this._textureInvalidated=!1,this._texture||(this._texture=this._createTexture(t)),!this.source)return void this._texture.setData(null);this._texture.resize(this._sourceWidth,this._sourceHeight);const s=w(this.source);try{if(null!=this._uploadStatus){const{controller:t,resolver:i}=this._uploadStatus,r={signal:t.signal},{width:h,height:o}=this,u=this._texture,a=e.textureUploadManager;await a.enqueueTextureUpdate({data:s,texture:u,width:h,height:o},r),i.resolve(),this._uploadStatus=null}else this._texture.setData(s);this.ready()}catch(r){i(r)}}onDetach(){this.destroy()}_createTransforms(){return{displayViewScreenMat3:a()}}_createTexture(t){const e=this.immutable,i=new x;return i.internalFormat=e?c.RGBA8:_.RGBA,i.wrapMode=p.CLAMP_TO_EDGE,i.isImmutable=e,i.width=this._sourceWidth,i.height=this._sourceHeight,new m(t,i)}}export{S as Bitmap,g as isImageSource,f as rasterize};
@@ -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{WGLDrawPhase as e}from"./webgl/enums.js";import i from"./webgl/WGLContainer.js";import{BitmapTechnique as s}from"./webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js";class t extends i{constructor(){super(...arguments),this._hasCrossfade=!1,this._bitmapTechnique=null}get requiresDedicatedFBO(){return super.requiresDedicatedFBO||this._hasCrossfade}beforeRender(e){super.beforeRender(e),this._manageFade()}onAttach(){super.onAttach(),this._bitmapTechnique=new s}onDetach(){super.onDetach(),this._bitmapTechnique?.shutdown(),this._bitmapTechnique=null}doRender(i){if(!this.visible||i.drawPhase!==e.MAP)return;if(!this._bitmapTechnique)return;super.doRender(i);const s=this.children;this._bitmapTechnique.render(i,{bitmaps:s})}_manageFade(){this.children.reduce(((e,i)=>e+(i.inFadeTransition?1:0)),0)>=2?(this.children.forEach((e=>e.blendFunction="additive")),this._hasCrossfade=!0):(this.children.forEach((e=>e.blendFunction="standard")),this._hasCrossfade=!1)}}export{t as BitmapContainer};
5
+ import{WGLDrawPhase as e}from"./webgl/enums.js";import i from"./webgl/WGLContainer.js";import{BitmapTechnique as s}from"./webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js";class r extends i{constructor(){super(...arguments),this._hasCrossfade=!1,this._bitmapTechnique=null}get requiresDedicatedFBO(){return super.requiresDedicatedFBO||this._hasCrossfade}beforeRender(e){super.beforeRender(e),this._manageFade()}onAttach(){super.onAttach(),this._bitmapTechnique=new s}onDetach(){super.onDetach(),this._bitmapTechnique?.shutdown(),this._bitmapTechnique=null}renderChildren(i){super.renderChildren(i),this.visible&&i.drawPhase===e.MAP&&null!=this._bitmapTechnique&&this._bitmapTechnique.render(i,{bitmaps:this.children})}_manageFade(){this.children.reduce(((e,i)=>e+(i.inFadeTransition?1:0)),0)>=2?(this.children.forEach((e=>e.blendFunction="additive")),this._hasCrossfade=!0):(this.children.forEach((e=>e.blendFunction="standard")),this._hasCrossfade=!1)}}export{r as BitmapContainer};
@@ -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{create as e}from"../../../geometry/support/aaBoundingRect.js";import{BitmapTile as i}from"./BitmapTile.js";import{WGLDrawPhase as t}from"./webgl/enums.js";import n from"./webgl/TileContainer.js";import{BitmapTechnique as r}from"./webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js";class s extends n{constructor(){super(...arguments),this._bitmapTechnique=null}get requiresDedicatedFBO(){return this.children.some((e=>"additive"===e.bitmap.blendFunction))}createTile(t){const n=this.tileInfoView.getTileBounds(e(),t),r=this.tileInfoView.getTileResolution(t.level),[s,o]=this.tileInfoView.tileInfo.size;return new i(t,r,n[0],n[3],s,o)}onAttach(){super.onAttach(),this._bitmapTechnique=new r}onDetach(){super.onDetach(),this._bitmapTechnique?.shutdown(),this._bitmapTechnique=null}doRender(e){if(!this.visible||e.drawPhase!==t.MAP)return;if(!this._bitmapTechnique)return;super.doRender(e);const i=this.children.map((e=>e.bitmap));this._bitmapTechnique.render(e,{bitmaps:i})}}export{s as BitmapTileContainer};
5
+ import{create as e}from"../../../geometry/support/aaBoundingRect.js";import{BitmapTile as i}from"./BitmapTile.js";import{WGLDrawPhase as t}from"./webgl/enums.js";import n from"./webgl/TileContainer.js";import{BitmapTechnique as r}from"./webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js";class s extends n{constructor(){super(...arguments),this._bitmapTechnique=null}get requiresDedicatedFBO(){return this.children.some((e=>"additive"===e.bitmap.blendFunction))}createTile(t){const n=this.tileInfoView.getTileBounds(e(),t),r=this.tileInfoView.getTileResolution(t.level),[s,o]=this.tileInfoView.tileInfo.size;return new i(t,r,n[0],n[3],s,o)}onAttach(){super.onAttach(),this._bitmapTechnique=new r}onDetach(){super.onDetach(),this._bitmapTechnique?.shutdown(),this._bitmapTechnique=null}renderChildren(e){if(super.renderChildren(e),!this.visible||e.drawPhase!==t.MAP||null==this._bitmapTechnique)return;const i=this.children.map((e=>e.bitmap));this._bitmapTechnique.render(e,{bitmaps:i})}}export{s as BitmapTileContainer};
@@ -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"../../../../../core/ArrayPool.js";import{e}from"../../../../../chunks/earcut.js";import{triangulate as i}from"../../../../../geometry/libtess.js";import{Point as r}from"../../../../../geometry/support/TileClipper.js";import{BucketType as l}from"../enums.js";import n from"./BaseBucket.js";class s extends n{constructor(t,e,i,r,n,s,o){super(t,e,i),this.type=l.FILL,this._patternMap=new Map,this._fillVertexBuffer=r,this._fillIndexBuffer=n,this._outlineVertexBuffer=s,this._outlineIndexBuffer=o}get fillIndexStart(){return this._fillIndexStart}get fillIndexCount(){return this._fillIndexCount}get outlineIndexStart(){return this._outlineIndexStart}get outlineIndexCount(){return this._outlineIndexCount}getResources(t,e,i){const r=this.layer,l=this.zoom,n=r.getPaintProperty("fill-pattern");if(n)if(n.isDataDriven)for(const s of this._features)e(n.getValue(l,s),!0);else e(n.getValue(l),!0)}processFeatures(t){this._fillIndexStart=3*this._fillIndexBuffer.index,this._fillIndexCount=0,this._outlineIndexStart=3*this._outlineIndexBuffer.index,this._outlineIndexCount=0;const e=this.layer,i=this.zoom,{fillMaterial:r,outlineMaterial:l,hasDataDrivenFill:n,hasDataDrivenOutline:s}=e;t&&t.setExtent(this.layerExtent);const o=e.getPaintProperty("fill-pattern"),a=o?.isDataDriven;let f=!o&&e.getPaintValue("fill-antialias",i);if(e.outlineUsesFillColor){if(f&&!e.hasDataDrivenOpacity){const t=e.getPaintValue("fill-opacity",i),r=e.getPaintValue("fill-opacity",i+1);t<1&&r<1&&(f=!1)}if(f&&!e.hasDataDrivenColor){const t=e.getPaintValue("fill-color",i),r=e.getPaintValue("fill-color",i+1);t[3]<1&&r[3]<1&&(f=!1)}}const u=this._features,d=t?.validateTessellation;if(a){const n=[];for(const a of u){const u=o.getValue(i,a),h=this._spriteInfo[u];if(!h?.rect)continue;const x=r.encodeAttributes(a,i,e,h),c=f&&s?l.encodeAttributes(a,i,e):[],_=a.getGeometry(t);n.push({ddFillAttributes:x,ddOutlineAttributes:c,page:h.page,geometry:_}),n.sort(((t,e)=>t.page-e.page));for(const{ddFillAttributes:t,ddOutlineAttributes:i,page:r,geometry:l}of n)this._processFeature(l,f,e.outlineUsesFillColor,t,i,d,r)}}else for(const h of u){const o=n?r.encodeAttributes(h,i,e):null,a=f&&s?l.encodeAttributes(h,i,e):null,u=h.getGeometry(t);this._processFeature(u,f,e.outlineUsesFillColor,o,a,d)}}serialize(){let t=10;t+=this.layerUIDs.length,t+=this._fillVertexBuffer.array.length,t+=this._fillIndexBuffer.array.length,t+=this._outlineVertexBuffer.array.length,t+=this._outlineIndexBuffer.array.length,t+=3*this._patternMap.size+1;const e=new Uint32Array(t),i=new Int32Array(e.buffer);let r=0;e[r++]=this.type,e[r++]=this.layerUIDs.length;for(let s=0;s<this.layerUIDs.length;s++)e[r++]=this.layerUIDs[s];e[r++]=this._fillIndexStart,e[r++]=this._fillIndexCount,e[r++]=this._outlineIndexStart,e[r++]=this._outlineIndexCount;const l=this._patternMap,n=l.size;if(e[r++]=n,n>0)for(const[s,[o,a]]of l)e[r++]=s,e[r++]=o,e[r++]=a;e[r++]=this._fillVertexBuffer.array.length;for(let s=0;s<this._fillVertexBuffer.array.length;s++)i[r++]=this._fillVertexBuffer.array[s];e[r++]=this._fillIndexBuffer.array.length;for(let s=0;s<this._fillIndexBuffer.array.length;s++)e[r++]=this._fillIndexBuffer.array[s];e[r++]=this._outlineVertexBuffer.array.length;for(let s=0;s<this._outlineVertexBuffer.array.length;s++)i[r++]=this._outlineVertexBuffer.array[s];e[r++]=this._outlineIndexBuffer.array.length;for(let s=0;s<this._outlineIndexBuffer.array.length;s++)e[r++]=this._outlineIndexBuffer.array[s];return e.buffer}_processFeature(t,e,i,r,l,n,o){if(!t)return;const a=t.length,f=!l||0===l.length;if(e&&(!i||f))for(let s=0;s<a;s++)this._processOutline(t[s],l);const u=32;let d;for(let h=0;h<a;h++){const e=s._area(t[h]);e>u?(void 0!==d&&this._processFill(t,d,r,n,o),d=[h]):e<-u&&void 0!==d&&d.push(h)}void 0!==d&&this._processFill(t,d,r,n,o)}_processOutline(t,e){const i=this._outlineVertexBuffer,l=this._outlineIndexBuffer,n=l.index;let s,o,a;const f=new r(0,0),u=new r(0,0),d=new r(0,0);let h=-1,x=-1,c=-1,_=-1,y=-1,g=!1;const p=0;let I=t.length;if(I<2)return;const B=t[p];let m=t[I-1];for(;I&&m.isEqual(B);)--I,m=t[I-1];if(!(I-p<2)){for(let r=p;r<I;++r){r===p?(s=t[I-1],o=t[p],a=t[p+1],f.assignSub(o,s),f.normalize(),f.rightPerpendicular()):(s=o,o=a,a=r!==I-1?t[r+1]:t[p],f.assign(u));const n=this._isClipEdge(s,o);-1===_&&(g=n),u.assignSub(a,o),u.normalize(),u.rightPerpendicular();const B=f.x*u.y-f.y*u.x;d.assignAdd(f,u),d.normalize();const m=-d.x*-f.x+-d.y*-f.y;let V=Math.abs(0!==m?1/m:1);V>8&&(V=8),B>=0?(c=i.add(o.x,o.y,f.x,f.y,0,1,e),-1===_&&(_=c),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,V*-d.x,V*-d.y,0,-1,e),-1===y&&(y=x),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=x,x=c,c=i.add(o.x,o.y,d.x,d.y,0,1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,u.x,u.y,0,1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c)):(c=i.add(o.x,o.y,V*d.x,V*d.y,0,1,e),-1===_&&(_=c),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,-f.x,-f.y,0,-1,e),-1===y&&(y=x),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=x,x=c,c=i.add(o.x,o.y,-d.x,-d.y,0,-1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=i.add(o.x,o.y,-u.x,-u.y,0,-1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c))}h>=0&&x>=0&&_>=0&&!g&&l.add(h,x,_),h>=0&&_>=0&&y>=0&&!g&&l.add(h,y,_),this._outlineIndexCount+=3*(l.index-n)}}_processFill(r,l,n,s,o){s=!0;let a;l.length>1&&(a=[]);let f=0;for(const t of l)0!==f&&a.push(f),f+=r[t].length;const u=2*f,d=t.acquire();for(const t of l){const e=r[t],i=e.length;for(let t=0;t<i;++t)d.push(e[t].x,e[t].y)}const h=e(d,a,2);if(s&&e.deviation(d,a,2,h)>0){const t=l.map((t=>r[t].length)),{buffer:e,vertexCount:s}=i(d,t);if(s>0){const t=this._fillVertexBuffer.index;for(let i=0;i<s;i++)this._fillVertexBuffer.add(e[2*i],e[2*i+1],n);for(let e=0;e<s;e+=3){const i=t+e;this._fillIndexBuffer.add(i,i+1,i+2)}if(void 0!==o){const t=this._patternMap,e=t.get(o);e?e[1]+=s:t.set(o,[this._fillIndexStart+this._fillIndexCount,s])}this._fillIndexCount+=s}}else{const t=h.length;if(t>0){const e=this._fillVertexBuffer.index;let i=0;for(;i<u;)this._fillVertexBuffer.add(d[i++],d[i++],n);let r=0;for(;r<t;)this._fillIndexBuffer.add(e+h[r++],e+h[r++],e+h[r++]);if(void 0!==o){const e=this._patternMap,i=e.get(o);i?i[1]+=t:e.set(o,[this._fillIndexStart+this._fillIndexCount,t])}this._fillIndexCount+=t}}t.release(d)}_isClipEdge(t,e){return t.x===e.x?t.x<=-64||t.x>=4160:t.y===e.y&&(t.y<=-64||t.y>=4160)}static _area(t){let e=0;const i=t.length-1;for(let r=0;r<i;r++)e+=(t[r].x-t[r+1].x)*(t[r].y+t[r+1].y);return e+=(t[i].x-t[0].x)*(t[i].y+t[0].y),.5*e}}export{s as default};
5
+ import t from"../../../../../core/ArrayPool.js";import{e}from"../../../../../chunks/earcut.js";import{triangulate as i}from"../../../../../geometry/libtess.js";import{Point as r}from"../../../../../geometry/support/TileClipper.js";import{BucketType as l}from"../enums.js";import n from"./BaseBucket.js";class s extends n{constructor(t,e,i,r,n,s,o){super(t,e,i),this.type=l.FILL,this._patternMap=new Map,this._fillVertexBuffer=r,this._fillIndexBuffer=n,this._outlineVertexBuffer=s,this._outlineIndexBuffer=o}get fillIndexStart(){return this._fillIndexStart}get fillIndexCount(){return this._fillIndexCount}get outlineIndexStart(){return this._outlineIndexStart}get outlineIndexCount(){return this._outlineIndexCount}getResources(t,e,i){const r=this.layer,l=this.zoom,n=r.getPaintProperty("fill-pattern");if(n)if(n.isDataDriven)for(const s of this._features)e(n.getValue(l,s),!0);else e(n.getValue(l),!0)}processFeatures(t){this._fillIndexStart=3*this._fillIndexBuffer.index,this._fillIndexCount=0,this._outlineIndexStart=3*this._outlineIndexBuffer.index,this._outlineIndexCount=0;const e=this.layer,i=this.zoom,{fillMaterial:r,outlineMaterial:l,hasDataDrivenFill:n,hasDataDrivenOutline:s}=e;t&&t.setExtent(this.layerExtent);const o=e.getPaintProperty("fill-pattern"),a=o?.isDataDriven;let f=!o&&e.getPaintValue("fill-antialias",i);if(e.outlineUsesFillColor){if(f&&!e.hasDataDrivenOpacity){const t=e.getPaintValue("fill-opacity",i),r=e.getPaintValue("fill-opacity",i+1);t<1&&r<1&&(f=!1)}if(f&&!e.hasDataDrivenColor){const t=e.getPaintValue("fill-color",i),r=e.getPaintValue("fill-color",i+1);t[3]<1&&r[3]<1&&(f=!1)}}const u=this._features,d=t?.validateTessellation;if(a){const n=[];for(const a of u){const u=o.getValue(i,a),h=this._spriteInfo[u];if(!h?.rect)continue;const x=r.encodeAttributes(a,i,e,h),c=f&&s?l.encodeAttributes(a,i,e):[],_=a.getGeometry(t);n.push({ddFillAttributes:x,ddOutlineAttributes:c,page:h.page,geometry:_}),n.sort(((t,e)=>t.page-e.page));for(const{ddFillAttributes:t,ddOutlineAttributes:i,page:r,geometry:l}of n)this._processFeature(l,f,e.outlineUsesFillColor,t,i,d,r)}}else for(const h of u){const o=n?r.encodeAttributes(h,i,e):null,a=f&&s?l.encodeAttributes(h,i,e):null,u=h.getGeometry(t);this._processFeature(u,f,e.outlineUsesFillColor,o,a,d)}}serialize(){let t=10;t+=this.layerUIDs.length,t+=this._fillVertexBuffer.array.length,t+=this._fillIndexBuffer.array.length,t+=this._outlineVertexBuffer.array.length,t+=this._outlineIndexBuffer.array.length,t+=3*this._patternMap.size+1;const e=new Uint32Array(t),i=new Int32Array(e.buffer);let r=0;e[r++]=this.type,e[r++]=this.layerUIDs.length;for(let s=0;s<this.layerUIDs.length;s++)e[r++]=this.layerUIDs[s];e[r++]=this._fillIndexStart,e[r++]=this._fillIndexCount,e[r++]=this._outlineIndexStart,e[r++]=this._outlineIndexCount;const l=this._patternMap,n=l.size;if(e[r++]=n,n>0)for(const[s,[o,a]]of l)e[r++]=s,e[r++]=o,e[r++]=a;e[r++]=this._fillVertexBuffer.array.length;for(let s=0;s<this._fillVertexBuffer.array.length;s++)i[r++]=this._fillVertexBuffer.array[s];e[r++]=this._fillIndexBuffer.array.length;for(let s=0;s<this._fillIndexBuffer.array.length;s++)e[r++]=this._fillIndexBuffer.array[s];e[r++]=this._outlineVertexBuffer.array.length;for(let s=0;s<this._outlineVertexBuffer.array.length;s++)i[r++]=this._outlineVertexBuffer.array[s];e[r++]=this._outlineIndexBuffer.array.length;for(let s=0;s<this._outlineIndexBuffer.array.length;s++)e[r++]=this._outlineIndexBuffer.array[s];return e.buffer}_processFeature(t,e,i,r,l,n,o){if(!t)return;const a=t.length,f=!l||0===l.length;if(e&&(!i||f))for(let s=0;s<a;s++)this._processOutline(t[s],l);const u=32;let d;for(let h=0;h<a;h++){const e=s._area(t[h]);e>u?(void 0!==d&&this._processFill(t,d,r,n,o),d=[h]):e<-32&&void 0!==d&&d.push(h)}void 0!==d&&this._processFill(t,d,r,n,o)}_processOutline(t,e){const i=this._outlineVertexBuffer,l=this._outlineIndexBuffer,n=l.index;let s,o,a;const f=new r(0,0),u=new r(0,0),d=new r(0,0);let h=-1,x=-1,c=-1,_=-1,y=-1,g=!1;const p=0;let I=t.length;if(I<2)return;const B=t[p];let m=t[I-1];for(;I&&m.isEqual(B);)--I,m=t[I-1];if(!(I-p<2)){for(let r=p;r<I;++r){r===p?(s=t[I-1],o=t[p],a=t[p+1],f.assignSub(o,s),f.normalize(),f.rightPerpendicular()):(s=o,o=a,a=r!==I-1?t[r+1]:t[p],f.assign(u));const n=this._isClipEdge(s,o);-1===_&&(g=n),u.assignSub(a,o),u.normalize(),u.rightPerpendicular();const B=f.x*u.y-f.y*u.x;d.assignAdd(f,u),d.normalize();const m=-d.x*-f.x+-d.y*-f.y;let V=Math.abs(0!==m?1/m:1);V>8&&(V=8),B>=0?(c=i.add(o.x,o.y,f.x,f.y,0,1,e),-1===_&&(_=c),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,V*-d.x,V*-d.y,0,-1,e),-1===y&&(y=x),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=x,x=c,c=i.add(o.x,o.y,d.x,d.y,0,1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,u.x,u.y,0,1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c)):(c=i.add(o.x,o.y,V*d.x,V*d.y,0,1,e),-1===_&&(_=c),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),x=i.add(o.x,o.y,-f.x,-f.y,0,-1,e),-1===y&&(y=x),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=x,x=c,c=i.add(o.x,o.y,-d.x,-d.y,0,-1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c),h=i.add(o.x,o.y,-u.x,-u.y,0,-1,e),h>=0&&x>=0&&c>=0&&!n&&l.add(h,x,c))}h>=0&&x>=0&&_>=0&&!g&&l.add(h,x,_),h>=0&&_>=0&&y>=0&&!g&&l.add(h,y,_),this._outlineIndexCount+=3*(l.index-n)}}_processFill(r,l,n,s,o){s=!0;let a;l.length>1&&(a=[]);let f=0;for(const t of l)0!==f&&a.push(f),f+=r[t].length;const u=2*f,d=t.acquire();for(const t of l){const e=r[t],i=e.length;for(let t=0;t<i;++t)d.push(e[t].x,e[t].y)}const h=e(d,a,2);if(s&&e.deviation(d,a,2,h)>0){const t=l.map((t=>r[t].length)),{buffer:e,vertexCount:s}=i(d,t);if(s>0){const t=this._fillVertexBuffer.index;for(let i=0;i<s;i++)this._fillVertexBuffer.add(e[2*i],e[2*i+1],n);for(let e=0;e<s;e+=3){const i=t+e;this._fillIndexBuffer.add(i,i+1,i+2)}if(void 0!==o){const t=this._patternMap,e=t.get(o);e?e[1]+=s:t.set(o,[this._fillIndexStart+this._fillIndexCount,s])}this._fillIndexCount+=s}}else{const t=h.length;if(t>0){const e=this._fillVertexBuffer.index;let i=0;for(;i<u;)this._fillVertexBuffer.add(d[i++],d[i++],n);let r=0;for(;r<t;)this._fillIndexBuffer.add(e+h[r++],e+h[r++],e+h[r++]);if(void 0!==o){const e=this._patternMap,i=e.get(o);i?i[1]+=t:e.set(o,[this._fillIndexStart+this._fillIndexCount,t])}this._fillIndexCount+=t}}t.release(d)}_isClipEdge(t,e){return t.x===e.x?t.x<=-64||t.x>=4160:t.y===e.y&&(t.y<=-64||t.y>=4160)}static _area(t){let e=0;const i=t.length-1;for(let r=0;r<i;r++)e+=(t[r].x-t[r+1].x)*(t[r].y+t[r+1].y);return e+=(t[i].x-t[0].x)*(t[i].y+t[0].y),.5*e}}export{s 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 e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import i from"../../../../core/Logger.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,when as a,initial as l}from"../../../../core/reactiveUtils.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{AnimatedSymbolRepeatType as p}from"../../../../symbols/cim/enums.js";import{DisplayObject as u}from"../DisplayObject.js";import{play as c}from"./animatedFormats/utils.js";import{TextureWrapMode as f}from"../../../webgl/enums.js";import{Texture as w}from"../../../webgl/Texture.js";import{TextureDescriptor as y}from"../../../webgl/TextureDescriptor.js";const x=[1,1],g=d(),v={none:p.None,loop:p.Loop,oscillate:p.Oscillate};function b(e){return e?{type:"CIMAnimatedSymbolProperties",...e,playAnimation:e.playing,repeatType:e.repeatType?v[e.repeatType]:void 0}:{type:"CIMAnimatedSymbolProperties"}}class q extends u{constructor(n){super(),this.elementView=n,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=h(),this._handles=new r,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._handles.add([o((()=>this.elementView.element.opacity),(e=>this.opacity=e),l),o((()=>[this.elementView.coords]),(()=>{this.requestRender()}),l),o((()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions]),(()=>{this._handles.remove("play"),this.texture=s(this.texture),this.requestRender()}),l),a((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),"video"===e.type&&null!=e.content&&(this._handles.add([t(e.content,"play",(()=>this.requestRender())),t(e.content,"loadeddata",(()=>this.requestRender())),t(e.content,"loaded",(()=>this.requestRender()))]),"requestVideoFrameCallback"in e.content?e.content.requestVideoFrameCallback((()=>this.requestRender())):this._handles.add([t(e.content,"seeked",(()=>this.requestRender()))]),this.requestRender())}),l)]),n.element.load().catch((t=>{i.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:n,error:t}))}))}getMesh(e){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=s(this.texture)}get textureSize(){return x}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,i=r instanceof HTMLVideoElement,s=e?r.naturalWidth:i?r.videoWidth:r.width,n=e?r.naturalHeight:i?r.videoHeight:r.height;if(this._updatePerspectiveTransform(s,n),this.texture)i&&(this.texture.setData(r),this.texture.generateMipmap(),"requestVideoFrameCallback"in r?r.requestVideoFrameCallback((()=>this.requestRender())):r.paused||this.requestRender());else{const e=new y;if(e.wrapMode=f.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,e.width=s,e.height=n,"getFrame"in r){const i=r=>{this.texture?this.texture.setData(r):this.texture=new w(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&this._handles.add(c(r,b(this.elementView.element.animationOptions),null,i),"play")}else this.texture=new w(t,e,r);this.texture.generateMipmap(),i&&("requestVideoFrameCallback"in r?r.requestVideoFrameCallback((()=>this.requestRender())):r.paused||this.requestRender())}}super.beforeRender(e)}_createTransforms(){return null}draw(e,t){this.isReady&&null!=this.texture?t.render(e,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:x,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._indices}):this.requestRender()}updateDrawCoords(e,t,r,i){const{coords:s,bounds:n}=this.elementView;if(null==s||null==n)return;const[o,a,l,d]=s.rings[0],m=this._vertices,{x:h,y:p}=e;m.set([a[0]-h,a[1]-p,o[0]-h,o[1]-p,l[0]-h,l[1]-p,d[0]-h,d[1]-p]);let u=t;if(i){const[e,,t]=n,{worldWidth:r,xBounds:s}=i,[o,a]=s;e<o&&t>o?u=r:t>a&&e<a&&(u=-r)}this.wrapAroundShift=u,this.isWrapAround=0!==u}_updatePerspectiveTransform(e,t){const r=this._vertices;n(g,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,g[6]/g[8]*e,g[7]/g[8]*t)}}export{q as default};
5
+ import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import i from"../../../../core/Logger.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,when as a,initial as l}from"../../../../core/reactiveUtils.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isVideoElement as p}from"../../../../support/mediaLayerUtils.js";import{AnimatedSymbolRepeatType as u}from"../../../../symbols/cim/enums.js";import{DisplayObject as c}from"../DisplayObject.js";import{play as f}from"./animatedFormats/utils.js";import{TextureWrapMode as w}from"../../../webgl/enums.js";import{Texture as y}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const g=[1,1],v=d(),b={none:u.None,loop:u.Loop,oscillate:u.Oscillate};function q(e){return e?{type:"CIMAnimatedSymbolProperties",...e,playAnimation:e.playing,repeatType:e.repeatType?b[e.repeatType]:void 0}:{type:"CIMAnimatedSymbolProperties"}}class V extends c{constructor(n){super(),this.elementView=n,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=h(),this._handles=new r,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._handles.add([o((()=>this.elementView.element.opacity),(e=>this.opacity=e),l),o((()=>[this.elementView.coords]),(()=>{this.requestRender()}),l),o((()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions]),(()=>{this._handles.remove("play"),this.texture=s(this.texture),this.requestRender()}),l),a((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),p(e)&&null!=e.content&&(this._handles.add([t(e.content,"play",(()=>this.requestRender())),t(e.content,"loadeddata",(()=>this.requestRender())),t(e.content,"loaded",(()=>this.requestRender()))]),"requestVideoFrameCallback"in e.content?e.content.requestVideoFrameCallback((()=>this.requestRender())):this._handles.add([t(e.content,"seeked",(()=>this.requestRender()))]),this.requestRender())}),l)]),n.element.load().catch((t=>{i.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:n,error:t}))}))}getMesh(e){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=s(this.texture)}get textureSize(){return g}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,i=r instanceof HTMLVideoElement,s=e?r.naturalWidth:i?r.videoWidth:r.width,n=e?r.naturalHeight:i?r.videoHeight:r.height;if(this._updatePerspectiveTransform(s,n),this.texture)i&&(this.texture.setData(r),this.texture.generateMipmap(),"requestVideoFrameCallback"in r?r.requestVideoFrameCallback((()=>this.requestRender())):r.paused||this.requestRender());else{const e=new x;if(e.wrapMode=w.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,e.width=s,e.height=n,"getFrame"in r){const i=r=>{this.texture?this.texture.setData(r):this.texture=new y(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&this._handles.add(f(r,q(this.elementView.element.animationOptions),null,i),"play")}else this.texture=new y(t,e,r);this.texture.generateMipmap(),i&&("requestVideoFrameCallback"in r?r.requestVideoFrameCallback((()=>this.requestRender())):r.paused||this.requestRender())}}super.beforeRender(e)}_createTransforms(){return null}draw(e,t){this.isReady&&null!=this.texture?t.render(e,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:g,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._indices}):this.requestRender()}updateDrawCoords(e,t,r,i){const{coords:s,bounds:n}=this.elementView;if(null==s||null==n)return;const[o,a,l,d]=s.rings[0],m=this._vertices,{x:h,y:p}=e;m.set([a[0]-h,a[1]-p,o[0]-h,o[1]-p,l[0]-h,l[1]-p,d[0]-h,d[1]-p]);let u=t;if(i){const[e,,t]=n,{worldWidth:r,xBounds:s}=i,[o,a]=s;e<o&&t>o?u=r:t>a&&e<a&&(u=-r)}this.wrapAroundShift=u,this.isWrapAround=0!==u}_updatePerspectiveTransform(e,t){const r=this._vertices;n(v,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,v[6]/v[8]*e,v[7]/v[8]*t)}}export{V 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{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{onAbort as e,createAbortError as s}from"../../../../core/promiseUtils.js";import{destroyHiddenSvg as i,createHiddenSvg as r,createSvgElement as n}from"../svgUtils.js";const o=1e20;class a{constructor(t,e=2){this._textureSize=t,this._rasterizationScale=e,this._canvasSize=this._textureSize*this._rasterizationScale,this._svg=null;const{_canvasSize:s}=this,i=document.createElement("canvas");i.width=i.height=s,this._context=i.getContext("2d",{willReadFrequently:!1}),this._gridOuter=new Float64Array(s*s),this._gridInner=new Float64Array(s*s),this._f=new Float64Array(s),this._d=new Float64Array(s),this._z=new Float64Array(s+1),this._v=new Int16Array(s)}dispose(){this._context=this._gridOuter=this._gridInner=this._f=this._d=this._z=this._v=null,this._svg=i(this._svg)}draw(i,r,n){const{_canvasSize:a,_textureSize:h,_rasterizationScale:_}=this,l=h/4;this._initSVG();const c=this.createSVGString(i,r);return new Promise(((i,r)=>{const d=new Image;d.src="data:image/svg+xml; charset=utf8, "+encodeURIComponent(c),d.onload=()=>{d.onload=null,this._context.clearRect(0,0,a,a),this._context.drawImage(d,0,0,a,a);const e=this._context.getImageData(0,0,a,a),s=new Uint8Array(h*h*4);for(let t=0;t<a*a;t++){const s=e.data[4*t+3]/255;this._gridOuter[t]=1===s?0:0===s?o:Math.max(0,.5-s)**2,this._gridInner[t]=1===s?o:0===s?0:Math.max(0,s-.5)**2}this._edt(this._gridOuter,a,a),this._edt(this._gridInner,a,a);for(let i=0;i<h*h;i++){let e=0;for(let t=0;t<_;t++){const s=Math.floor(i/h)*_+t;for(let t=0;t<_;t++){const r=s*a+(i%h*_+t);e+=this._gridOuter[r]-this._gridInner[r]}}e/=_*_,e/=_;t(.5-e/(2*l),s,4*i)}i(s)};const g=n?.signal;g&&e(g,(()=>r(s())))}))}_initSVG(){return this._svg||(this._svg=r()),this._svg}createSVGString(t,e){const s=this._initSVG(),i=n("path");i.setAttribute("d",t),s.appendChild(i);const r=i.getBBox(),o=r.width/r.height,a=this._canvasSize/2;let h,_,l;if(o>1){h=a/r.width;const t=a*(1/o);_=this._canvasSize/4,l=a-t/2}else{h=a/r.height;_=a-a*o/2,l=this._canvasSize/4}const c=-r.x*h+_,d=-r.y*h+l;i.setAttribute("style",`transform: matrix(${h}, 0, 0, ${h}, ${c}, ${d})`),i.setAttribute("stroke-width",""+.5/h);const g=`<svg style="fill:${e?"red":"none"}; stroke:${e?"none":"red"}" height="${this._canvasSize}" width="${this._canvasSize}" xmlns="http://www.w3.org/2000/svg">${s.innerHTML}</svg>`;return s.removeChild(i),g}_edt(t,e,s){const i=this._f,r=this._d,n=this._v,o=this._z;for(let a=0;a<e;a++){for(let r=0;r<s;r++)i[r]=t[r*e+a];this._edt1d(i,r,n,o,s);for(let i=0;i<s;i++)t[i*e+a]=r[i]}for(let a=0;a<s;a++){for(let s=0;s<e;s++)i[s]=t[a*e+s];this._edt1d(i,r,n,o,e);for(let s=0;s<e;s++)t[a*e+s]=Math.sqrt(r[s])}}_edt1d(t,e,s,i,r){s[0]=0,i[0]=-o,i[1]=+o;for(let n=1,a=0;n<r;n++){let e=(t[n]+n*n-(t[s[a]]+s[a]*s[a]))/(2*n-2*s[a]);for(;e<=i[a];)a--,e=(t[n]+n*n-(t[s[a]]+s[a]*s[a]))/(2*n-2*s[a]);a++,s[a]=n,i[a]=e,i[a+1]=+o}for(let n=0,o=0;n<r;n++){for(;i[o+1]<n;)o++;e[n]=(n-s[o])*(n-s[o])+t[s[o]]}}}export{a as default};
5
+ import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{onAbort as e,createAbortError as s}from"../../../../core/promiseUtils.js";import{destroyHiddenSvg as i,createHiddenSvg as r,createSvgElement as n}from"../svgUtils.js";const o=1e20;class a{constructor(t,e=2){this._textureSize=t,this._rasterizationScale=e,this._canvasSize=this._textureSize*this._rasterizationScale,this._svg=null;const{_canvasSize:s}=this,i=document.createElement("canvas");i.width=i.height=s,this._context=i.getContext("2d",{willReadFrequently:!1}),this._gridOuter=new Float64Array(s*s),this._gridInner=new Float64Array(s*s),this._f=new Float64Array(s),this._d=new Float64Array(s),this._z=new Float64Array(s+1),this._v=new Int16Array(s)}dispose(){this._context=this._gridOuter=this._gridInner=this._f=this._d=this._z=this._v=null,this._svg=i(this._svg)}draw(i,r,n){const{_canvasSize:a,_textureSize:h,_rasterizationScale:_}=this,l=h/4;this._initSVG();const c=this.createSVGString(i,r);return new Promise(((i,r)=>{const d=new Image;d.src="data:image/svg+xml; charset=utf8, "+encodeURIComponent(c),d.onload=()=>{d.onload=null,this._context.clearRect(0,0,a,a),this._context.drawImage(d,0,0,a,a);const e=this._context.getImageData(0,0,a,a),s=new Uint8Array(h*h*4);for(let t=0;t<a*a;t++){const s=e.data[4*t+3]/255;this._gridOuter[t]=1===s?0:0===s?o:Math.max(0,.5-s)**2,this._gridInner[t]=1===s?o:0===s?0:Math.max(0,s-.5)**2}this._edt(this._gridOuter,a,a),this._edt(this._gridInner,a,a);for(let i=0;i<h*h;i++){let e=0;for(let t=0;t<_;t++){const s=Math.floor(i/h)*_+t;for(let t=0;t<_;t++){const r=s*a+(i%h*_+t);e+=this._gridOuter[r]-this._gridInner[r]}}e/=_*_,e/=_;t(.5-e/(2*l),s,4*i)}i(s)};const g=n?.signal;g&&e(g,(()=>r(s())))}))}_initSVG(){return this._svg||(this._svg=r()),this._svg}createSVGString(t,e){const s=this._initSVG(),i=n("path");i.setAttribute("d",t),s.appendChild(i);const r=i.getBBox(),o=r.width/r.height,a=this._canvasSize/2;let h,_,l;if(o>1){h=a/r.width;const t=a*(1/o);_=this._canvasSize/4,l=a-t/2}else{h=a/r.height;_=a-a*o/2,l=this._canvasSize/4}const c=-r.x*h+_,d=-r.y*h+l;i.setAttribute("style",`transform: matrix(${h}, 0, 0, ${h}, ${c}, ${d})`),i.setAttribute("stroke-width",""+.5/h);const g=`<svg style="fill:${e?"red":"none"}; stroke:${e?"none":"red"}" height="${this._canvasSize}" width="${this._canvasSize}" xmlns="http://www.w3.org/2000/svg">${s.innerHTML}</svg>`;return s.removeChild(i),g}_edt(t,e,s){const i=this._f,r=this._d,n=this._v,o=this._z;for(let a=0;a<e;a++){for(let r=0;r<s;r++)i[r]=t[r*e+a];this._edt1d(i,r,n,o,s);for(let i=0;i<s;i++)t[i*e+a]=r[i]}for(let a=0;a<s;a++){for(let s=0;s<e;s++)i[s]=t[a*e+s];this._edt1d(i,r,n,o,e);for(let s=0;s<e;s++)t[a*e+s]=Math.sqrt(r[s])}}_edt1d(t,e,s,i,r){s[0]=0,i[0]=-1e20,i[1]=1e20;for(let n=1,o=0;n<r;n++){let e=(t[n]+n*n-(t[s[o]]+s[o]*s[o]))/(2*n-2*s[o]);for(;e<=i[o];)o--,e=(t[n]+n*n-(t[s[o]]+s[o]*s[o]))/(2*n-2*s[o]);o++,s[o]=n,i[o]=e,i[o+1]=1e20}for(let n=0,o=0;n<r;n++){for(;i[o+1]<n;)o++;e[n]=(n-s[o])*(n-s[o])+t[s[o]]}}}export{a 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{fromRotation as t,multiply as s,translate as i,rotate as e}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o,transformMany as h}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as r}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as f,getYAnchorDirection as c,VAlign as d}from"../../alignmentUtils.js";import m from"../../Rect.js";import g from"../../collisions/BoundingBox.js";const _=22,l=4,u=_+l,x=_-6,p=3,b=Math.PI/180,y=8,w=1.5;class L{constructor(t,s,i,e){this._rotationT=o(),this._xBounds=0,this._yBounds=0,this.minZoom=0,this.maxZoom=255,this._bounds=null;const h=i.rect,n=new Float32Array(8);t*=e,s*=e;const r=i.code?h.width*e:i.metrics.width,a=i.code?h.height*e:i.metrics.height;this.width=r,this.height=a,n[0]=t,n[1]=s,n[2]=t+r,n[3]=s,n[4]=t,n[5]=s+a,n[6]=t+r,n[7]=s+a,this._data=n,this._setTextureCoords(h),this._scale=e,this._mosaic=i,this.x=t,this.y=s,this.maxOffset=Math.max(t+r,s+a)}get mosaic(){return this._mosaic}set angle(s){this._angle=s,t(this._rotationT,-s),this._setOffsets()}get angle(){return this._angle}get xTopLeft(){return this._data[0]}get yTopLeft(){return this._data[1]}get xBottomRight(){return this._data[6]}get yBottomRight(){return this._data[7]}get texcoords(){return this._texcoords}get textureBinding(){return this._mosaic.textureBinding}get offsets(){return this._offsets||this._setOffsets(),this._offsets}get char(){return String.fromCharCode(this._mosaic.code)}get code(){return this._mosaic.code}get bounds(){if(!this._bounds){const{height:t,width:i}=this._mosaic.metrics,e=i*this._scale,n=Math.abs(t)*this._scale,r=new Float32Array(8);r[0]=this.x,r[1]=this.y,r[2]=this.x+e,r[3]=this.y,r[4]=this.x,r[5]=this.y+n,r[6]=this.x+e,r[7]=this.y+n;const a=s(o(),this._rotationT,this._transform);h(r,r,a);let f=1/0,c=1/0,d=-1/0,m=-1/0;for(let s=0;s<4;s++){const t=r[2*s],i=r[2*s+1];f=Math.min(f,t),c=Math.min(c,i),d=Math.max(d,t),m=Math.max(m,i)}const _=d-f,l=m-c,u=f+_/2,x=c+l/2;this._bounds=new g(u,x,_,l)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}_setOffsets(){this._offsets||(this._offsets={topLeft:[0,0],topRight:[0,0],bottomLeft:[0,0],bottomRight:[0,0]});const t=s(o(),this._rotationT,this._transform);this._offsets.topLeft[0]=this._data[0],this._offsets.topLeft[1]=this._data[1],this._offsets.topRight[0]=this._data[2],this._offsets.topRight[1]=this._data[3],this._offsets.bottomLeft[0]=this._data[4],this._offsets.bottomLeft[1]=this._data[5],this._offsets.bottomRight[0]=this._data[6],this._offsets.bottomRight[1]=this._data[7],n(this._offsets.topLeft,this._offsets.topLeft,t),n(this._offsets.topRight,this._offsets.topRight,t),n(this._offsets.bottomLeft,this._offsets.bottomLeft,t),n(this._offsets.bottomRight,this._offsets.bottomRight,t)}_setTextureCoords({x:t,y:s,width:i,height:e}){this._texcoords={topLeft:[t,s],topRight:[t+i,s],bottomLeft:[t,s+e],bottomRight:[t+i,s+e]}}}const M=(t,s)=>({code:0,page:0,sdf:!0,rect:new m(0,0,11,8),textureBinding:s,metrics:{advance:0,height:4,width:t,left:0,top:0}});function R(t,s){return t.forEach((t=>n(t,t,s))),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class B{constructor(t,s,i){this._rotation=0,this._decorate(t,s,i),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=s.length>1,this._hasRotation=0!==i.angle,this._transform=this._createGlyphTransform(this.bounds,i),this._borderLineSizePx=i.borderLineSizePx,(i.borderLineSizePx||i.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const e of t)e.setTransform(this._transform)}setRotation(i){if(0===i&&0===this._rotation)return;this._rotation=i;const e=this._transform,h=t(o(),i);s(e,h,e);for(const t of this.glyphs)t.setTransform(this._transform)}_decorate(t,s,i){if(!i.decoration||"none"===i.decoration||!t.length)return;const e=i.scale,o="underline"===i.decoration?u:x,h=t[0].textureBinding;for(const n of s){const s=n.startX*e,i=n.startY*e,r=(n.width+n.glyphWidthEnd)*e;t.push(new L(s,i+o*e,M(r,h),1))}}shapeBackground(t){const s=this._borderLineSizePx||0,i=(w+s)/2,e=this._borderLineSizePx?i:0,{xmin:o,ymin:h,xmax:n,ymax:r,x:a,y:f,width:c,height:d}=this.bounds,m=[o-y,h-y],_=[n+y,h-y],l=[o-y,r+y],u=[n+y,r+y],x=R([[m[0]-i,m[1]-i],[_[0]+i,_[1]-i],[m[0]+e,m[1]+e],[_[0]-e,_[1]+e]],t),p=R([[l[0]+e,l[1]-e],[u[0]-e,u[1]-e],[l[0]-i,l[1]+i],[u[0]+i,u[1]+i]],t),b=R([[m[0]-i,m[1]-i],[m[0]+e,m[1]+e],[l[0]-i,l[1]+i],[l[0]+e,l[1]-e]],t),L=R([[_[0]-e,_[1]+e],[_[0]+i,_[1]-i],[u[0]-e,u[1]-e],[u[0]+i,u[1]+i]],t),M={main:R([m,_,l,u],t),top:x,bot:p,left:b,right:L};return[new g(a,f,c+2*i,d+2*i),M]}get boundsT(){const t=this.bounds,s=r(a(),t.x,t.y);if(n(s,s,this._transform),this._hasRotation){const i=Math.max(t.width,t.height);return new g(s[0],s[1],i,i)}return new g(s[0],s[1],t.width,t.height)}_createBounds(t){let s=1/0,i=1/0,e=0,o=0;for(const r of t)s=Math.min(s,r.xTopLeft),i=Math.min(i,r.yTopLeft),e=Math.max(e,r.xBottomRight),o=Math.max(o,r.yBottomRight);const h=e-s,n=o-i;return new g(s+h/2,i+n/2,h,n)}_createGlyphTransform(t,s){const h=b*s.angle,n=o(),f=a();return i(n,n,r(f,s.xOffset,-s.yOffset)),s.useCIMAngleBehavior?e(n,n,h):(i(n,n,r(f,t.x,t.y)),e(n,n,h),i(n,n,r(f,-t.x,-t.y))),n}}class T{constructor(t,s,i,e,o,h){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(s,i)),this.end=Math.max(0,Math.max(s,i)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].metrics.width),this.width=e,this.yMin=o,this.yMax=h}}const v=t=>10===t,j=t=>32===t;function A(t,s,i){const e=new Array,o=1/i.scale,h=i.maxLineWidth*o,n=s?t.length-1:0,r=s?-1:t.length,a=s?-1:1;let f=n,c=0,d=0,m=f,g=m,_=0,l=1/0,u=0;for(;f!==r;){const{code:s,metrics:i}=t[f],o=Math.abs(i.top);if(v(s)||j(s)||(l=Math.min(l,o),u=Math.max(u,o+i.height)),v(s))f!==n&&(e.push(new T(t,m,f-a,c,l===1/0?0:l,u)),l=1/0,u=0),c=0,m=f+a,g=f+a,d=0;else if(j(s))g=f+a,d=0,_=i.advance,c+=i.advance;else if(c>h){if(g!==m){const s=g-2*a;c-=_,e.push(new T(t,m,s,c-d,l,u)),l=1/0,u=0,m=g,c=d}else e.push(new T(t,m,f-a,c,l,u)),l=1/0,u=0,m=f,g=f,c=0;c+=i.advance,d+=i.advance}else c+=i.advance,d+=i.advance;f+=a}const x=new T(t,m,f-a,c,l,u);return x.start>=0&&x.end<t.length&&e.push(x),e}function z(t,s){let i=0;for(let h=0;h<t.length;h++){const{width:s}=t[h];i=Math.max(s,i)}const e="underline"===s.decoration?l:0,o=t[0].yMin;return{x:0,y:o,height:t[t.length-1].yMax+s.lineHeight*(t.length-1)+e-o,width:i}}function O(t,s){const i=s.scale,e=new Array,{glyphs:o,isRightToLeft:h}=t,n=A(o,h,s),r=n.length?z(n,s):{x:0,y:0,height:0,width:0},a=f(s.horizontalAlignment),m=c(s.verticalAlignment),g=m===d.Baseline?1:0,l=g?0:m-1,u=(1-g)*-r.y+l*(r.height/2)+(g?1:0)*-_;for(let f=0;f<n.length;f++){const{start:h,end:r,width:c}=n[f];let d=-1*(a+1)*(c/2)-p;const m=(t.isRightToLeft?n.length-1-f:f)*s.lineHeight+u-p;n[f].startX=d,n[f].startY=m;for(let t=h;t<=r;t++){const s=o[t];if(v(s.code))continue;const h=new L(d+s.metrics.left,m-s.metrics.top,s,i);d+=s.metrics.advance,e.push(h)}}return new B(e,n,s)}export{L as ShapedGlyph,B as ShapingInfo,O as shapeGlyphs};
5
+ import{fromRotation as t,multiply as s,translate as i,rotate as e}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o,transformMany as h}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as r}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as f,getYAnchorDirection as c,VAlign as d}from"../../alignmentUtils.js";import m from"../../Rect.js";import g from"../../collisions/BoundingBox.js";const _=22,l=4,u=_+l,x=_-6,p=3,b=Math.PI/180,y=8,w=1.5;class L{constructor(t,s,i,e){this._rotationT=o(),this._xBounds=0,this._yBounds=0,this.minZoom=0,this.maxZoom=255,this._bounds=null;const h=i.rect,n=new Float32Array(8);t*=e,s*=e;const r=i.code?h.width*e:i.metrics.width,a=i.code?h.height*e:i.metrics.height;this.width=r,this.height=a,n[0]=t,n[1]=s,n[2]=t+r,n[3]=s,n[4]=t,n[5]=s+a,n[6]=t+r,n[7]=s+a,this._data=n,this._setTextureCoords(h),this._scale=e,this._mosaic=i,this.x=t,this.y=s,this.maxOffset=Math.max(t+r,s+a)}get mosaic(){return this._mosaic}set angle(s){this._angle=s,t(this._rotationT,-s),this._setOffsets()}get angle(){return this._angle}get xTopLeft(){return this._data[0]}get yTopLeft(){return this._data[1]}get xBottomRight(){return this._data[6]}get yBottomRight(){return this._data[7]}get texcoords(){return this._texcoords}get textureBinding(){return this._mosaic.textureBinding}get offsets(){return this._offsets||this._setOffsets(),this._offsets}get char(){return String.fromCharCode(this._mosaic.code)}get code(){return this._mosaic.code}get bounds(){if(!this._bounds){const{height:t,width:i}=this._mosaic.metrics,e=i*this._scale,n=Math.abs(t)*this._scale,r=new Float32Array(8);r[0]=this.x,r[1]=this.y,r[2]=this.x+e,r[3]=this.y,r[4]=this.x,r[5]=this.y+n,r[6]=this.x+e,r[7]=this.y+n;const a=s(o(),this._rotationT,this._transform);h(r,r,a);let f=1/0,c=1/0,d=-1/0,m=-1/0;for(let s=0;s<4;s++){const t=r[2*s],i=r[2*s+1];f=Math.min(f,t),c=Math.min(c,i),d=Math.max(d,t),m=Math.max(m,i)}const _=d-f,l=m-c,u=f+_/2,x=c+l/2;this._bounds=new g(u,x,_,l)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}_setOffsets(){this._offsets||(this._offsets={topLeft:[0,0],topRight:[0,0],bottomLeft:[0,0],bottomRight:[0,0]});const t=s(o(),this._rotationT,this._transform);this._offsets.topLeft[0]=this._data[0],this._offsets.topLeft[1]=this._data[1],this._offsets.topRight[0]=this._data[2],this._offsets.topRight[1]=this._data[3],this._offsets.bottomLeft[0]=this._data[4],this._offsets.bottomLeft[1]=this._data[5],this._offsets.bottomRight[0]=this._data[6],this._offsets.bottomRight[1]=this._data[7],n(this._offsets.topLeft,this._offsets.topLeft,t),n(this._offsets.topRight,this._offsets.topRight,t),n(this._offsets.bottomLeft,this._offsets.bottomLeft,t),n(this._offsets.bottomRight,this._offsets.bottomRight,t)}_setTextureCoords({x:t,y:s,width:i,height:e}){this._texcoords={topLeft:[t,s],topRight:[t+i,s],bottomLeft:[t,s+e],bottomRight:[t+i,s+e]}}}const M=(t,s)=>({code:0,page:0,sdf:!0,rect:new m(0,0,11,8),textureBinding:s,metrics:{advance:0,height:4,width:t,left:0,top:0}});function R(t,s){return t.forEach((t=>n(t,t,s))),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class B{constructor(t,s,i){this._rotation=0,this._decorate(t,s,i),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=s.length>1,this._hasRotation=0!==i.angle,this._transform=this._createGlyphTransform(this.bounds,i),this._borderLineSizePx=i.borderLineSizePx,(i.borderLineSizePx||i.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const e of t)e.setTransform(this._transform)}setRotation(i){if(0===i&&0===this._rotation)return;this._rotation=i;const e=this._transform,h=t(o(),i);s(e,h,e);for(const t of this.glyphs)t.setTransform(this._transform)}_decorate(t,s,i){if(!i.decoration||"none"===i.decoration||!t.length)return;const e=i.scale,o="underline"===i.decoration?u:x,h=t[0].textureBinding;for(const n of s){const s=n.startX*e,i=n.startY*e,r=(n.width+n.glyphWidthEnd)*e;t.push(new L(s,i+o*e,M(r,h),1))}}shapeBackground(t){const s=this._borderLineSizePx||0,i=(w+s)/2,e=this._borderLineSizePx?i:0,{xmin:o,ymin:h,xmax:n,ymax:r,x:a,y:f,width:c,height:d}=this.bounds,m=[o-y,h-y],_=[n+y,h-y],l=[o-y,r+y],u=[n+y,r+y],x=R([[m[0]-i,m[1]-i],[_[0]+i,_[1]-i],[m[0]+e,m[1]+e],[_[0]-e,_[1]+e]],t),p=R([[l[0]+e,l[1]-e],[u[0]-e,u[1]-e],[l[0]-i,l[1]+i],[u[0]+i,u[1]+i]],t),b=R([[m[0]-i,m[1]-i],[m[0]+e,m[1]+e],[l[0]-i,l[1]+i],[l[0]+e,l[1]-e]],t),L=R([[_[0]-e,_[1]+e],[_[0]+i,_[1]-i],[u[0]-e,u[1]-e],[u[0]+i,u[1]+i]],t),M={main:R([m,_,l,u],t),top:x,bot:p,left:b,right:L};return[new g(a,f,c+2*i,d+2*i),M]}get boundsT(){const t=this.bounds,s=r(a(),t.x,t.y);if(n(s,s,this._transform),this._hasRotation){const i=Math.max(t.width,t.height);return new g(s[0],s[1],i,i)}return new g(s[0],s[1],t.width,t.height)}_createBounds(t){let s=1/0,i=1/0,e=0,o=0;for(const r of t)s=Math.min(s,r.xTopLeft),i=Math.min(i,r.yTopLeft),e=Math.max(e,r.xBottomRight),o=Math.max(o,r.yBottomRight);const h=e-s,n=o-i;return new g(s+h/2,i+n/2,h,n)}_createGlyphTransform(t,s){const h=b*s.angle,n=o(),f=a();return i(n,n,r(f,s.xOffset,-s.yOffset)),s.useCIMAngleBehavior?e(n,n,h):(i(n,n,r(f,t.x,t.y)),e(n,n,h),i(n,n,r(f,-t.x,-t.y))),n}}class T{constructor(t,s,i,e,o,h){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(s,i)),this.end=Math.max(0,Math.max(s,i)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].metrics.width),this.width=e,this.yMin=o,this.yMax=h}}const v=t=>10===t,j=t=>32===t;function A(t,s,i){const e=new Array,o=1/i.scale,h=i.maxLineWidth*o,n=s?t.length-1:0,r=s?-1:t.length,a=s?-1:1;let f=n,c=0,d=0,m=f,g=m,_=0,l=1/0,u=0;for(;f!==r;){const{code:s,metrics:i}=t[f],o=Math.abs(i.top);if(v(s)||j(s)||(l=Math.min(l,o),u=Math.max(u,o+i.height)),v(s))f!==n&&(e.push(new T(t,m,f-a,c,l===1/0?0:l,u)),l=1/0,u=0),c=0,m=f+a,g=f+a,d=0;else if(j(s))g=f+a,d=0,_=i.advance,c+=i.advance;else if(c>h){if(g!==m){const s=g-2*a;c-=_,e.push(new T(t,m,s,c-d,l,u)),l=1/0,u=0,m=g,c=d}else e.push(new T(t,m,f-a,c,l,u)),l=1/0,u=0,m=f,g=f,c=0;c+=i.advance,d+=i.advance}else c+=i.advance,d+=i.advance;f+=a}const x=new T(t,m,f-a,c,l,u);return x.start>=0&&x.end<t.length&&e.push(x),e}function z(t,s){let i=0;for(let h=0;h<t.length;h++){const{width:s}=t[h];i=Math.max(s,i)}const e="underline"===s.decoration?l:0,o=t[0].yMin;return{x:0,y:o,height:t[t.length-1].yMax+s.lineHeight*(t.length-1)+e-o,width:i}}function O(t,s){const i=s.scale,e=new Array,{glyphs:o,isRightToLeft:h}=t,n=A(o,h,s),r=n.length?z(n,s):{x:0,y:0,height:0,width:0},a=f(s.horizontalAlignment),m=c(s.verticalAlignment),g=m===d.Baseline?1:0,_=g?0:m-1,l=(1-g)*-r.y+_*(r.height/2)+-22*(g?1:0);for(let f=0;f<n.length;f++){const{start:h,end:r,width:c}=n[f];let d=-1*(a+1)*(c/2)-p;const m=(t.isRightToLeft?n.length-1-f:f)*s.lineHeight+l-p;n[f].startX=d,n[f].startY=m;for(let t=h;t<=r;t++){const s=o[t];if(v(s.code))continue;const h=new L(d+s.metrics.left,m-s.metrics.top,s,i);d+=s.metrics.advance,e.push(h)}}return new B(e,n,s)}export{L as ShapedGlyph,B as ShapingInfo,O as shapeGlyphs};
@@ -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{textureBindingBitmap as e}from"../../../definitions.js";import{Technique as i}from"../Technique.js";import{TechniqueType as t}from"../TechniqueType.js";import{BitmapShader as s}from"../shaders/BitmapShader.js";import{TextureSamplingMode as o,CompareFunction as n,StencilOperation as r}from"../../../../../../webgl/enums.js";const a={nearest:{samplingMode:o.NEAREST,mips:!1},bilinear:{samplingMode:o.LINEAR,mips:!1},bicubic:{samplingMode:o.LINEAR,mips:!1},trilinear:{samplingMode:o.LINEAR_MIPMAP_LINEAR,mips:!0}},m=(e,i,t)=>{if("dynamic"===t.samplingMode){const{state:t}=e,s=i.resolution/i.pixelRatio/t.resolution,o=Math.round(e.pixelRatio)!==e.pixelRatio,n=s>1.05||s<.95;return t.rotation||n||o||i.isSourceScaled||i.rotation?a.bilinear:a.nearest}return a[t.samplingMode]};class p extends i{constructor(){super(...arguments),this.name="BrushBitmap",this.type=t.Bitmap,this.shaders={bitmap:new s}}render(i,t){const{context:s,renderingOptions:o,painter:p}=i;for(const c of t.bitmaps){if(!c.source||!c.isReady)continue;const t=m(i,c,o);i.timeline.begin(this.name),p.setPipelineState({depth:!1,stencil:{test:{mask:255,ref:c.stencilRef,compare:n.EQUAL,op:{fail:r.KEEP,zFail:r.KEEP,zPass:r.KEEP}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:"additive"===c.blendFunction?"additive":"composite"}});const d=c.getTexture(i);c.setSamplingProfile(t);const{coordScale:l,computedOpacity:u,transforms:f}=c,h={texture:{texture:d,unit:e},dvsMat3:f.displayViewScreenMat3,coordScale:l,opacity:u};p.submitDrawMesh(s,{shader:this.shaders.bitmap,uniforms:{config:h},defines:{bicubic:t===a.bicubic},optionalAttributes:null,useComputeBuffer:!1},p.quadMesh),i.timeline.end(this.name)}}}export{p as BitmapTechnique};
5
+ import{textureBindingBitmap as e}from"../../../definitions.js";import{Technique as i}from"../Technique.js";import{TechniqueType as t}from"../TechniqueType.js";import{BitmapShader as s}from"../shaders/BitmapShader.js";import{TextureSamplingMode as o,CompareFunction as n,StencilOperation as r}from"../../../../../../webgl/enums.js";const a={nearest:{samplingMode:o.NEAREST,mips:!1},bilinear:{samplingMode:o.LINEAR,mips:!1},bicubic:{samplingMode:o.LINEAR,mips:!1},trilinear:{samplingMode:o.LINEAR_MIPMAP_LINEAR,mips:!0}},m=(e,i,t)=>{if("dynamic"===t.samplingMode){const{state:t}=e,s=i.resolution/i.pixelRatio/t.resolution,o=Math.round(e.pixelRatio)!==e.pixelRatio,n=s>1.05||s<.95;return t.rotation||n||o||i.isSourceScaled||i.rotation?a.bilinear:a.nearest}return a[t.samplingMode]};class p extends i{constructor(){super(...arguments),this.name="BrushBitmap",this.type=t.Bitmap,this.shaders={bitmap:new s}}render(i,t){const{context:s,renderingOptions:o,painter:p}=i;for(const c of t.bitmaps){const t=c.texture;if(!c.source||!c.isReady||null==t)continue;const l=m(i,c,o);i.timeline.begin(this.name),p.setPipelineState({depth:!1,stencil:{test:{mask:255,ref:c.stencilRef,compare:n.EQUAL,op:{fail:r.KEEP,zFail:r.KEEP,zPass:r.KEEP}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:"additive"===c.blendFunction?"additive":"composite"}}),c.setSamplingProfile(l);const{coordScale:d,computedOpacity:u,transforms:f}=c,h={texture:{texture:t,unit:e},dvsMat3:f.displayViewScreenMat3,coordScale:d,opacity:u};p.submitDrawMesh(s,{shader:this.shaders.bitmap,uniforms:{config:h},defines:{bicubic:l===a.bicubic},optionalAttributes:null,useComputeBuffer:!1},p.quadMesh),i.timeline.end(this.name)}}}export{p as BitmapTechnique};
@@ -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{dot as t,normalize as u,clamp as n,Float as r,length as i,distance as y,abs as s,step as l,Mat3 as c,Vec3 as e,and as a,greaterThan as o,lessThan as p,cond as x,min as m,not as b,equal as d}from"../../graph/glsl.js";import{epsilonHitTest as w}from"./constants.js";import{cross2 as f}from"./utils.js";function v(n,r){return t(n,u(r))}function j(t,u,s){const l=s.subtract(u),c=v(t.subtract(u),l),e=n(c.divide(i(l)),new r(0),new r(1));return y(t,u.add(e.multiply(s.subtract(u))))}function g(t){const u=s(t);return l(u.x.add(u.y).add(u.z),new r(1.05))}function h(t,u,n,i){const y=new c(n.x.multiply(i.y).subtract(i.x.multiply(n.y)),i.x.multiply(u.y).subtract(u.x.multiply(i.y)),u.x.multiply(n.y).subtract(n.x.multiply(u.y)),n.y.subtract(i.y),i.y.subtract(u.y),u.y.subtract(n.y),i.x.subtract(n.x),u.x.subtract(i.x),n.x.subtract(u.x)),s=u.x.multiply(n.y.subtract(i.y)),l=n.x.multiply(i.y.subtract(u.y)),a=i.x.multiply(u.y.subtract(n.y)),o=s.add(l).add(a);return new r(1).divide(o).multiply(y.multiply(new e(1,t)))}function M(t,u,n,i){return d(g(h(t,u,n,i)),new r(1))}function P(t,u,n,i){const y=n.subtract(u),s=i.subtract(u),l=f(y,s),c=a(p(l,new r(w)),o(l,new r(-w)));return x([a(b(c),M(t.xy,u,n,i)),new r(-1)],[!0,()=>{const r=j(t,u,n),y=j(t,n,i),s=j(t,i,u);return m(m(r,y),s)}])}function q(t){return t.distance.add(1)}function z(t,u,n){const{viewMat3:r,tileMat3:i}=t.view,y=r.multiply(i),s=y.multiply(new e(u.pos,1)),l=y.multiply(new e(n.nextPos1,1)),c=y.multiply(new e(n.nextPos2,1));return P(t.hittestRequest.position,s.xy,l.xy,c.xy)}function R(t,u,n){return y(t,n).subtract(u)}export{j as distPointSegment,P as distPointTriangle,q as failHittest,z as hittestFill,R as hittestMarker,g as inTriangle,v as projectScalar,h as xyToBarycentric};
5
+ import{dot as t,normalize as u,clamp as n,Float as r,length as i,distance as y,abs as s,step as l,Mat3 as c,Vec3 as e,and as a,greaterThan as o,lessThan as p,cond as x,min as m,not as b,equal as d}from"../../graph/glsl.js";import{epsilonHitTest as w}from"./constants.js";import{cross2 as f}from"./utils.js";function v(n,r){return t(n,u(r))}function j(t,u,s){const l=s.subtract(u),c=v(t.subtract(u),l),e=n(c.divide(i(l)),new r(0),new r(1));return y(t,u.add(e.multiply(s.subtract(u))))}function g(t){const u=s(t);return l(u.x.add(u.y).add(u.z),new r(1.05))}function h(t,u,n,i){const y=new c(n.x.multiply(i.y).subtract(i.x.multiply(n.y)),i.x.multiply(u.y).subtract(u.x.multiply(i.y)),u.x.multiply(n.y).subtract(n.x.multiply(u.y)),n.y.subtract(i.y),i.y.subtract(u.y),u.y.subtract(n.y),i.x.subtract(n.x),u.x.subtract(i.x),n.x.subtract(u.x)),s=u.x.multiply(n.y.subtract(i.y)),l=n.x.multiply(i.y.subtract(u.y)),a=i.x.multiply(u.y.subtract(n.y)),o=s.add(l).add(a);return new r(1).divide(o).multiply(y.multiply(new e(1,t)))}function M(t,u,n,i){return d(g(h(t,u,n,i)),new r(1))}function P(t,u,n,i){const y=n.subtract(u),s=i.subtract(u),l=f(y,s),c=a(p(l,new r(w)),o(l,new r(-.05)));return x([a(b(c),M(t.xy,u,n,i)),new r(-1)],[!0,()=>{const r=j(t,u,n),y=j(t,n,i),s=j(t,i,u);return m(m(r,y),s)}])}function q(t){return t.distance.add(1)}function z(t,u,n){const{viewMat3:r,tileMat3:i}=t.view,y=r.multiply(i),s=y.multiply(new e(u.pos,1)),l=y.multiply(new e(n.nextPos1,1)),c=y.multiply(new e(n.nextPos2,1));return P(t.hittestRequest.position,s.xy,l.xy,c.xy)}function R(t,u,n){return y(t,n).subtract(u)}export{j as distPointSegment,P as distPointTriangle,q as failHittest,z as hittestFill,R as hittestMarker,g as inTriangle,v as projectScalar,h as xyToBarycentric};
@@ -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 t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{notDeepEqual as h}from"../../../core/object.js";import{createAbortError as c,createResolver as d,ignoreAbortErrors as p,throwIfNotAbortError as y,isAbortError as g}from"../../../core/promiseUtils.js";import{watch as f,initial as m}from"../../../core/reactiveUtils.js";import{property as w}from"../../../core/accessorSupport/decorators/property.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as v}from"../../../core/support/UpdatingHandles.js";import b from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as F}from"../../../layers/graphics/featureConversionUtils.js";import A from"../../../layers/support/FeatureFilter.js";import{checkCurrentUserSupport as S}from"../../../layers/support/featureLayerUtils.js";import{packFields as j}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as x}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as E}from"../../../layers/support/timeSupport.js";import I from"../../../rest/support/AggregateFeatureSet.js";import U from"../../../rest/support/FeatureSet.js";import k from"../../../rest/support/Query.js";import{LayerView2DMixin as C}from"./LayerView2D.js";import{FeatureContainer as V}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as q}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as R}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as O}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as Q}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as L}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as W}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as H}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as P}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as T}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as M}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as D}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as N}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import G from"./support/FeatureCommandQueue.js";import{handleNoEngineError as J}from"./support/handleNoEngineError.js";import{HighlightCounter as $}from"./support/HighlightCounter.js";import{toJSONGeometryType as z}from"./support/util.js";import{FeatureTileSubscriptionManager as B}from"../tiling/FeatureTileSubscriptionManager.js";import Z from"../../layers/FeatureLayerView.js";import K from"../../layers/LayerView.js";import X from"../../layers/RefreshableLayerView.js";import Y from"../../../geometry/Extent.js";function ee(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const te=4294967294;let re=class extends(Z(X(C(K)))){constructor(){super(...arguments),this._commandsQueue=new G({process:e=>{switch(e.type){case"override":return this._doOverride(e.message);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new $,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new R,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new v,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new b}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(c()),this._commandsQueue.destroy()}initialize(){this._workerAttached=d(),p(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===x(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await q(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(c()),y(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new L(this.layer):new Q(this.layer);case"geojson":case"csv":case"wfs":return new L(this.layer);case"parquet":return new T(this.layer);case"subtype-group":return new D(this.layer);case"ogc-feature":return new H(this.layer);case"stream":return new M(this.layer);case"oriented-imagery":return new P(this.layer);case"knowledge-graph-sublayer":return new W(this.layer);case"catalog-footprint":return new O(this.layer);default:a(this.layer)}return null}get timeExtent(){return E(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t="default"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlights(o,t),n((()=>this._removeHighlights(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const a=await this.getWorker(),{features:o,aggregates:n}=await a.pipeline.getDisplayFeatures(s),u=this.featureContainer.getSortKeys(s),l=({displayId:e},{displayId:t})=>u.has(e)&&u.has(t)?u.get(e)-u.get(t):e-t;return o.sort(l).reverse(),n.sort(l).reverse(),[...n.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...o.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return J(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return J(a,{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return J(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return J(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return J(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return J(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return J(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return J(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return J(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=U.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await J(r,{features:[]}),s=U.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await J(r,{features:[]}),s=I.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return J(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return J(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return J(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return J(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return J(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return J(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await J(r,{count:0,extent:null});return{count:i.count,extent:Y.fromJSON(i.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(e.toJSON(),t),i=await J(r,{features:[]});return U.fromJSON(i)}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this._subscriptionManager.update(e.targetState,this._lastTargetState);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),p(this._updatingHandles.addPromise(this._workerAttached.promise)),p(this._attachProxy()),this.featureContainer=new V(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new B({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),p(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([f((()=>JSON.stringify({displayRefreshVersion:this._displayRefreshVersion,timeExtent:this.timeExtent,clips:this.clips,filter:this.filter,featureEffect:this.featureEffect,sourceRefreshVersion:this._sourceRefreshVersion,timeZone:this.view.timeZone,viewTimeExtent:this.view.timeExtent,effect:this.featureEffect,...this.layerAdapter.getUpdateHashProperties(this.view)})),(()=>this._update()),m),f((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),f((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._editUpdatingHandles.addPromise(this._edit(e)))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=d(),p(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const i of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(i));return r}return Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t))))},fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const i={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await N(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=k.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=k.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();const t=this.layer,r=e.historicMoment?.getTime()??null,i="layerId"in t&&e.editedFeatures?.find((e=>e.layerId===t.layerId));if(i&&this._canEditByFeature(i)){const{adds:e,deletes:t,updates:s}=i.editedFeatures,a=this.layer.objectIdField,o=s.map((e=>e.current)),n=t.map((e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e)),u=await this._resolveIdenifiers(n);return this.addOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0})}const[s,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]),n=[...s,...a];return this._commandsQueue.push({type:"override-by-id",updates:n,removed:o,historicMoment:r,isWeak:!0}).catch(y)}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%te+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%te+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?u.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const i="globalIdField"in this.layer&&this.layer.globalIdField,s=i&&this.availableFields.includes(i);if(r.length&&!s)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${i} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}async addOverrides(e){const t=!1,r=!1,i=z(this.layer.geometryType),s=this.layer.objectIdField,a=[];for(const n of e.added){const e=F(n,i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=F(n,i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return this._commandsQueue.push({type:"override",updates:a,removed:e.removed,release:[],isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null})}async removeOverrides(e){for(const t of e)if(null==t)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:t});return this._commandsQueue.push({type:"override",updates:[],removed:[],release:e,isWeak:!1,historicMoment:null})}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every((e=>this.view.spatialReference.equals(e.geometry?.spatialReference)))&&r.every((e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference)))}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._updateRequiredFields(),S(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=this._createViewSchemaConfig(),s={source:this.layerAdapter.createSourceSchema(i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},a=h(this._lastSchema?.source.mutable,s.source.mutable)||h(this._lastSchema?.processor,s.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=s,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(s,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{this.featureContainer.editStart(),await t.pipeline.onOverride(e),this.featureContainer.editEnd()}catch(r){g(r),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=ee(this._lastAvailableFields,e);return this._lastAvailableFields=t,j(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[ie(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent}}_addHighlights(e,t){this._highlightCounter.addGroup(e,t),this._commandsQueue.push({type:"highlight"})}_removeHighlights(e,t){this._highlightCounter.deleteGroup(e,t),this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=[];for(const i of this._highlightCounter.ids()){const t=this._highlightCounter.getHighlightGroups(i),r=this._getHighlightBits(t);e.push({objectId:i,highlightFlags:r})}const t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{g(e)||u.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function ie(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new A,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new A).toJSON(),n.hiddenIds=Array.from(i)),n}e([w()],re.prototype,"_commandsQueue",void 0),e([w()],re.prototype,"_sourceRefreshVersion",void 0),e([w()],re.prototype,"_displayRefreshVersion",void 0),e([w({readOnly:!0})],re.prototype,"_pipelineUpdating",void 0),e([w()],re.prototype,"_sourceUpdating",void 0),e([w({readOnly:!0})],re.prototype,"dataUpdating",null),e([w({readOnly:!0})],re.prototype,"hasAllFeatures",null),e([w({readOnly:!0})],re.prototype,"hasAllFeaturesInView",null),e([w({readOnly:!0})],re.prototype,"hasFullGeometries",null),e([w()],re.prototype,"featureEffectView",void 0),e([w()],re.prototype,"labelingCollisionInfos",null),e([w()],re.prototype,"layerAdapter",null),e([w({readOnly:!0})],re.prototype,"timeExtent",null),e([w()],re.prototype,"updating",void 0),re=e([_("esri.views.2d.layers.FeatureLayerView2D")],re);const se=re;export{se as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{notDeepEqual as h}from"../../../core/object.js";import{createAbortError as c,createResolver as d,ignoreAbortErrors as p,throwIfNotAbortError as y,isAbortError as g}from"../../../core/promiseUtils.js";import{watch as f,initial as m}from"../../../core/reactiveUtils.js";import{property as w}from"../../../core/accessorSupport/decorators/property.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as v}from"../../../core/support/UpdatingHandles.js";import b from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as A}from"../../../layers/graphics/featureConversionUtils.js";import F from"../../../layers/support/FeatureFilter.js";import{checkCurrentUserSupport as S}from"../../../layers/support/featureLayerUtils.js";import{packFields as j}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as x}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as E}from"../../../layers/support/timeSupport.js";import I from"../../../rest/support/AggregateFeatureSet.js";import U from"../../../rest/support/AttributeBinsFeatureSet.js";import k from"../../../rest/support/AttributeBinsQuery.js";import C from"../../../rest/support/FeatureSet.js";import V from"../../../rest/support/Query.js";import{LayerView2DMixin as R}from"./LayerView2D.js";import{FeatureContainer as q}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as Q}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as O}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as L}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as W}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as H}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as P}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as T}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as M}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as D}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as N}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as G}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as J}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import $ from"./support/FeatureCommandQueue.js";import{handleNoEngineError as B}from"./support/handleNoEngineError.js";import{HighlightCounter as z}from"./support/HighlightCounter.js";import{toJSONGeometryType as Z}from"./support/util.js";import{FeatureTileSubscriptionManager as K}from"../tiling/FeatureTileSubscriptionManager.js";import X from"../../layers/FeatureLayerView.js";import Y from"../../layers/LayerView.js";import ee from"../../layers/RefreshableLayerView.js";import te from"../../../geometry/Extent.js";function re(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const ie=4294967294;let se=class extends(X(ee(R(Y)))){constructor(){super(...arguments),this._commandsQueue=new $({process:e=>{switch(e.type){case"override":return this._doOverride(e.message);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new z,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new O,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new v,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new b}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(c()),this._commandsQueue.destroy()}initialize(){this._workerAttached=d(),p(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===x(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await Q(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(c()),y(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new H(this.layer):new W(this.layer);case"geojson":case"csv":case"wfs":return new H(this.layer);case"parquet":return new D(this.layer);case"subtype-group":return new G(this.layer);case"ogc-feature":return new T(this.layer);case"stream":return new N(this.layer);case"oriented-imagery":return new M(this.layer);case"knowledge-graph-sublayer":return new P(this.layer);case"catalog-footprint":return new L(this.layer);default:a(this.layer)}return null}get timeExtent(){return E(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t="default"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlights(o,t),n((()=>this._removeHighlights(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const a=await this.getWorker(),{features:o,aggregates:n}=await a.pipeline.getDisplayFeatures(s),u=this.featureContainer.getSortKeys(s),l=({displayId:e},{displayId:t})=>u.has(e)&&u.has(t)?u.get(e)-u.get(t):e-t;return o.sort(l).reverse(),n.sort(l).reverse(),[...n.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...o.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return B(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return B(a,{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return B(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return B(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return B(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return B(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return B(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return B(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return B(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=C.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await B(r,{features:[]}),s=C.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await B(r,{features:[]}),s=I.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return B(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return B(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return B(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return B(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return B(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return B(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await B(r,{count:0,extent:null});return{count:i.count,extent:te.fromJSON(i.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),i=await B(r,{features:[]});return U.fromJSON(i)}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this._subscriptionManager.update(e.targetState,this._lastTargetState);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),p(this._updatingHandles.addPromise(this._workerAttached.promise)),p(this._attachProxy()),this.featureContainer=new q(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new K({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),p(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([f((()=>JSON.stringify({displayRefreshVersion:this._displayRefreshVersion,timeExtent:this.timeExtent,clips:this.clips,filter:this.filter,featureEffect:this.featureEffect,sourceRefreshVersion:this._sourceRefreshVersion,timeZone:this.view.timeZone,viewTimeExtent:this.view.timeExtent,effect:this.featureEffect,...this.layerAdapter.getUpdateHashProperties(this.view)})),(()=>this._update()),m),f((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),f((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._editUpdatingHandles.addPromise(this._edit(e)))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=d(),p(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const i of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(i));return r}return Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t))))},fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const i={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await J(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=V.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=k.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=V.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();const t=this.layer,r=e.historicMoment?.getTime()??null,i="layerId"in t&&e.editedFeatures?.find((e=>e.layerId===t.layerId));if(i&&this._canEditByFeature(i)){const{adds:e,deletes:t,updates:s}=i.editedFeatures,a=this.layer.objectIdField,o=s.map((e=>e.current)),n=t.map((e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e)),u=await this._resolveIdenifiers(n);return this.addOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0})}const[s,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]),n=[...s,...a];return this._commandsQueue.push({type:"override-by-id",updates:n,removed:o,historicMoment:r,isWeak:!0}).catch(y)}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%ie+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ie+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?u.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const i="globalIdField"in this.layer&&this.layer.globalIdField,s=i&&this.availableFields.includes(i);if(r.length&&!s)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${i} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}async addOverrides(e){const t=!1,r=!1,i=Z(this.layer.geometryType),s=this.layer.objectIdField,a=[];for(const n of e.added){const e=A(n,i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=A(n,i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return this._commandsQueue.push({type:"override",updates:a,removed:e.removed,release:[],isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null})}async removeOverrides(e){for(const t of e)if(null==t)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:t});return this._commandsQueue.push({type:"override",updates:[],removed:[],release:e,isWeak:!1,historicMoment:null})}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every((e=>this.view.spatialReference.equals(e.geometry?.spatialReference)))&&r.every((e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference)))}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._updateRequiredFields(),S(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=this._createViewSchemaConfig(),s={source:this.layerAdapter.createSourceSchema(i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},a=h(this._lastSchema?.source.mutable,s.source.mutable)||h(this._lastSchema?.processor,s.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=s,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(s,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{this.featureContainer.editStart(),await t.pipeline.onOverride(e),this.featureContainer.editEnd()}catch(r){g(r),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=re(this._lastAvailableFields,e);return this._lastAvailableFields=t,j(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[ae(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent}}_addHighlights(e,t){this._highlightCounter.addGroup(e,t),this._commandsQueue.push({type:"highlight"})}_removeHighlights(e,t){this._highlightCounter.deleteGroup(e,t),this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=[];for(const i of this._highlightCounter.ids()){const t=this._highlightCounter.getHighlightGroups(i),r=this._getHighlightBits(t);e.push({objectId:i,highlightFlags:r})}const t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{g(e)||u.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function ae(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new F,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new F).toJSON(),n.hiddenIds=Array.from(i)),n}e([w()],se.prototype,"_commandsQueue",void 0),e([w()],se.prototype,"_sourceRefreshVersion",void 0),e([w()],se.prototype,"_displayRefreshVersion",void 0),e([w({readOnly:!0})],se.prototype,"_pipelineUpdating",void 0),e([w()],se.prototype,"_sourceUpdating",void 0),e([w({readOnly:!0})],se.prototype,"dataUpdating",null),e([w({readOnly:!0})],se.prototype,"hasAllFeatures",null),e([w({readOnly:!0})],se.prototype,"hasAllFeaturesInView",null),e([w({readOnly:!0})],se.prototype,"hasFullGeometries",null),e([w()],se.prototype,"featureEffectView",void 0),e([w()],se.prototype,"labelingCollisionInfos",null),e([w()],se.prototype,"layerAdapter",null),e([w({readOnly:!0})],se.prototype,"timeExtent",null),e([w()],se.prototype,"updating",void 0),se=e([_("esri.views.2d.layers.FeatureLayerView2D")],se);const oe=se;export{oe 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{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import i from"../../../../../layers/support/FieldsIndex.js";import{tileSize as r}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as n}from"../aggregation/ComputedAggregateField.js";import{GridCell as a}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as l}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as o}from"./AAggregateStrategy.js";import{ASendState as d}from"./AProcessorStrategy.js";import{WithDisplayId as u}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as c}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as h}from"../support/ComputedAttributeStorage.js";import p from"../support/FeatureFilter.js";import{FeatureMetadata as f}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as g}from"../support/FeatureSetReaderJSON.js";import _ from"../../../tiling/TileKey.js";const m=128;class y extends d{constructor(e){super(e),this.didSend=!1,this.done=!1}}class S{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null,e.inner.id,e.displayId);yield i}}clusters(){return this._clusters.values()}updateChunks(e,t){let s=!1;for(const a of e){const e=a.queryInfo;if("tileId"in e){if(new _(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(a.normalizedChunkId)){this._handledChunks.add(a.normalizedChunkId),s=!0;a.getAggregateIndex({...this._indexOptions,scale:this._scale}).put(this._cells)}}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=l(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*r/n),s=Math.floor(e[1]*r/n),l=Math.ceil(e[2]*r/n),o=Math.ceil(e[3]*r/n);i.xMin=Math.min(i.xMin,t),i.yMin=Math.min(i.yMin,s),i.xMax=Math.max(i.xMax,l),i.yMax=Math.max(i.yMax,o)}return null!=this._lastCellBounds&&i.xMin===this._lastCellBounds.xMin&&i.yMin===this._lastCellBounds.yMin&&i.yMin===this._lastCellBounds.yMin&&i.yMax===this._lastCellBounds.yMax||(s=!0,this._lastCellBounds=i),s&&this._clusterCells(i),s}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map((([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue})));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,i){const n=e.subscription,a=[],l=n.tile.transform;for(const o of this._clusters.values()){let e=o.inner.getCentroidX(l);const i=o.inner.getCentroidY(l),d=n.tile.lod,u=d.wrap?d.worldSize[0]:null,c=1===o.inner.count?o.inner.firstObjectId:o.inner.id,h=o.displayId;if(null!=u)if(1===u){const n=new s([],[e,i]),l=new t(n,o.inner.getAttributes(),null,c,h);l.geometry.coords[0]-=r,a.push(l);const d=new s([],[e,i]),u=new t(d,o.inner.getAttributes(),null,c,h);u.geometry.coords[0]+=r,a.push(u)}else e>r+r/2?e-=u*r:e<-r/2&&(e+=u*r);if(e<r+m&&e>=-m&&i<r+m&&i>=-m){const r=new s([],[e,i]),n=new t(r,o.inner.getAttributes(),null,c,h);a.push(n)}}return g.fromOptimizedFeatures(a,i,n.tile.transform)}_clusterCells(e){let t=Array.from(this._cells.values());t=t.sort(((e,t)=>t.count-e.count));const s=[];for(const a of this._clusters.values())s.push(a.inner.id);this._clusters.clear();const i=this._clusterRadius*(1/l(this._indexOptions.spatialReference,this._scale)),r=1+this._clusterRadius/this._indexOptions.cellSize,n=new Set;for(const l of t){if(n.has(l.id))continue;if(l.gridX<e.xMin||l.gridX>e.xMax||l.gridY<e.yMin||l.gridY>e.yMax)continue;const t=this._store.createDisplayIdForObjectId(l.id),s=new u(l.clone(),t);n.add(l.id),this._clusters.set(l.id,s);const o=l.centroidXWorld,d=l.centroidYWorld;for(let e=l.gridY-r;e<=l.gridY+r;e++)for(let t=l.gridX-r;t<=l.gridX+r;t++){if(e===l.gridY&&t===l.gridX)continue;const r=this._cells.get(a.createId(t,e));if(!r||n.has(r.id))continue;const u=Math.abs(r.centroidXWorld-o),c=Math.abs(r.centroidYWorld-d);u<i&&c<i&&(s.inner.merge(r),n.add(r.id))}}for(const a of s)this._store.releaseDisplayIdForObjectId(a)}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,n=e.get(r.name);if(n){const{minValue:e,maxValue:i}=n,r=Math.min(n.minValue,t),a=Math.max(n.maxValue,t);e===r&&i===a||(n.minValue=r,n.maxValue=a,s=!0)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class x extends o{static async create(e,t,s,i,r,a){const l=new h({spatialReference:s}),o={type:"grid",fields:await Promise.all(t.fields.map((async e=>n.create(l,e)))),spatialReference:s,featureFilter:t.featureFilter?await p.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,arcadeContextInfo:a};return new x(e,t.clusterRadius,o,t.fields,i,r)}constructor(e,t,s,r,n,a){super(n,a,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=f.createFeature({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fieldsIndex:new i([...r,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:n.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new y(e)}async*applyOverrideUpdate(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map((e=>[t(e),e]))),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const a of n.clusters()){const e=i.get(a.inner.id);if(null==e){if(1===a.inner.count){const{firstObjectId:e}=a.inner,t=e?i.get(e):null;if(null!=t){const n=s(a.displayId,t,e);r.push(n),i.delete(e)}}}else{const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id)}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of a.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}n.push({...t,displayId:l.displayId})}return{features:r,aggregates:n}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale),s=Array.from(this._sendStates.values()).filter((e=>e.subscription.tile.level===this._requiredLevel));if(t.updateChunks(e,s)||!this._source.updateTracking.updating)for(const n of s)n.subscription.tile.level===this._requiredLevel&&(n.didSend=!1,n.done=!1);const i=Array.from(this._sendStates.values()).filter((e=>e.done)).map((e=>e.subscription.tile.key)),r=new Set(i);for(const n of this._sendStates.values()){if(this._source.updateTracking.updating){if(i.some((e=>e.containsChild(n.subscription.tile.key))))continue;if(n.subscription.tile.key.getChildKeys().every((e=>r.has(e))))continue}n.didSend||n.subscription.tile.level!==this._requiredLevel||(n.didSend=!0,yield*this._update(n,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new S(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),n=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n);const a=new c(e.subscription,i,!0,e.done,{});yield a}}export{y as ClusterState,x as ClusterStrategy};
5
+ import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import i from"../../../../../layers/support/FieldsIndex.js";import{tileSize as r}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as n}from"../aggregation/ComputedAggregateField.js";import{GridCell as a}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as l}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as o}from"./AAggregateStrategy.js";import{ASendState as d}from"./AProcessorStrategy.js";import{WithDisplayId as u}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as c}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as h}from"../support/ComputedAttributeStorage.js";import p from"../support/FeatureFilter.js";import{FeatureMetadata as f}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as g}from"../support/FeatureSetReaderJSON.js";import _ from"../../../tiling/TileKey.js";const m=128;class y extends d{constructor(e){super(e),this.didSend=!1,this.done=!1}}class S{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null,e.inner.id,e.displayId);yield i}}clusters(){return this._clusters.values()}updateChunks(e,t){let s=!1;for(const a of e){const e=a.queryInfo;if("tileId"in e){if(new _(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(a.normalizedChunkId)){this._handledChunks.add(a.normalizedChunkId),s=!0;a.getAggregateIndex({...this._indexOptions,scale:this._scale}).put(this._cells)}}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=l(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*r/n),s=Math.floor(e[1]*r/n),l=Math.ceil(e[2]*r/n),o=Math.ceil(e[3]*r/n);i.xMin=Math.min(i.xMin,t),i.yMin=Math.min(i.yMin,s),i.xMax=Math.max(i.xMax,l),i.yMax=Math.max(i.yMax,o)}return null!=this._lastCellBounds&&i.xMin===this._lastCellBounds.xMin&&i.yMin===this._lastCellBounds.yMin&&i.yMin===this._lastCellBounds.yMin&&i.yMax===this._lastCellBounds.yMax||(s=!0,this._lastCellBounds=i),s&&this._clusterCells(i),s}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map((([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue})));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,i){const n=e.subscription,a=[],l=n.tile.transform;for(const o of this._clusters.values()){let e=o.inner.getCentroidX(l);const i=o.inner.getCentroidY(l),d=n.tile.lod,u=d.wrap?d.worldSize[0]:null,c=1===o.inner.count?o.inner.firstObjectId:o.inner.id,h=o.displayId;if(null!=u)if(1===u){const n=new s([],[e,i]),l=new t(n,o.inner.getAttributes(),null,c,h);l.geometry.coords[0]-=r,a.push(l);const d=new s([],[e,i]),u=new t(d,o.inner.getAttributes(),null,c,h);u.geometry.coords[0]+=r,a.push(u)}else e>r+r/2?e-=u*r:e<-256&&(e+=u*r);if(e<r+m&&e>=-128&&i<r+m&&i>=-128){const r=new s([],[e,i]),n=new t(r,o.inner.getAttributes(),null,c,h);a.push(n)}}return g.fromOptimizedFeatures(a,i,n.tile.transform)}_clusterCells(e){let t=Array.from(this._cells.values());t=t.sort(((e,t)=>t.count-e.count));const s=[];for(const a of this._clusters.values())s.push(a.inner.id);this._clusters.clear();const i=this._clusterRadius*(1/l(this._indexOptions.spatialReference,this._scale)),r=1+this._clusterRadius/this._indexOptions.cellSize,n=new Set;for(const l of t){if(n.has(l.id))continue;if(l.gridX<e.xMin||l.gridX>e.xMax||l.gridY<e.yMin||l.gridY>e.yMax)continue;const t=this._store.createDisplayIdForObjectId(l.id),s=new u(l.clone(),t);n.add(l.id),this._clusters.set(l.id,s);const o=l.centroidXWorld,d=l.centroidYWorld;for(let e=l.gridY-r;e<=l.gridY+r;e++)for(let t=l.gridX-r;t<=l.gridX+r;t++){if(e===l.gridY&&t===l.gridX)continue;const r=this._cells.get(a.createId(t,e));if(!r||n.has(r.id))continue;const u=Math.abs(r.centroidXWorld-o),c=Math.abs(r.centroidYWorld-d);u<i&&c<i&&(s.inner.merge(r),n.add(r.id))}}for(const a of s)this._store.releaseDisplayIdForObjectId(a)}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,n=e.get(r.name);if(n){const{minValue:e,maxValue:i}=n,r=Math.min(n.minValue,t),a=Math.max(n.maxValue,t);e===r&&i===a||(n.minValue=r,n.maxValue=a,s=!0)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class x extends o{static async create(e,t,s,i,r,a){const l=new h({spatialReference:s}),o={type:"grid",fields:await Promise.all(t.fields.map((async e=>n.create(l,e)))),spatialReference:s,featureFilter:t.featureFilter?await p.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,arcadeContextInfo:a};return new x(e,t.clusterRadius,o,t.fields,i,r)}constructor(e,t,s,r,n,a){super(n,a,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=f.createFeature({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fieldsIndex:new i([...r,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:n.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new y(e)}async*applyOverrideUpdate(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map((e=>[t(e),e]))),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const a of n.clusters()){const e=i.get(a.inner.id);if(null==e){if(1===a.inner.count){const{firstObjectId:e}=a.inner,t=e?i.get(e):null;if(null!=t){const n=s(a.displayId,t,e);r.push(n),i.delete(e)}}}else{const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id)}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of a.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}n.push({...t,displayId:l.displayId})}return{features:r,aggregates:n}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale),s=Array.from(this._sendStates.values()).filter((e=>e.subscription.tile.level===this._requiredLevel));if(t.updateChunks(e,s)||!this._source.updateTracking.updating)for(const n of s)n.subscription.tile.level===this._requiredLevel&&(n.didSend=!1,n.done=!1);const i=Array.from(this._sendStates.values()).filter((e=>e.done)).map((e=>e.subscription.tile.key)),r=new Set(i);for(const n of this._sendStates.values()){if(this._source.updateTracking.updating){if(i.some((e=>e.containsChild(n.subscription.tile.key))))continue;if(n.subscription.tile.key.getChildKeys().every((e=>r.has(e))))continue}n.didSend||n.subscription.tile.level!==this._requiredLevel||(n.didSend=!0,yield*this._update(n,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new S(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),n=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n);const a=new c(e.subscription,i,!0,e.done,{});yield a}}export{y as ClusterState,x as ClusterStrategy};
@@ -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{ringsCentroid as t,polygonCentroid as e}from"../../../../../geometry/support/centroid.js";import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGeometry as s,generalizeOptimizedGeometry as i,quantizeOptimizedGeometry as o}from"../../../../../layers/graphics/featureConversionUtils.js";import n from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as h}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as u}from"./FeatureSetReader.js";class a extends u{static from(t,e,r){return new a(t,e,r)}constructor(t,e,r){super(r),this._items=t,this._tile=e,this._index=-1,this._cachedGeometry=null;const s=e.lod;s.wrap&&(this._wrappingInfo={worldSizeX:s.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??[]}hasField(t){return null!=this._current.attributes[t]}field(t){return this.readAttribute(t)}get geometryType(){const t=r(this._current.geometry);return"esriGeometryPoint"===t?"esriGeometryMultipoint":t}getCursor(){return this.copy()}copy(){const t=new a(this._items,this._tile,this.metadata);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._cachedGeometry=this._cachedGeometry,t._index=this._index}get fields(){throw new Error("Fields reading not supported to graphics.")}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw new Error("InternalError: exceededTransferLimit not implemented for graphics.")}get hasZ(){return!1}get hasM(){return!1}get usedMemory(){return this._current.usedMemory}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){throw new Error("InternalError: Setting displayId not supported for graphics.")}setIndex(t){this._index=t}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw new Error("InternalError: readGeometryArea not supported for graphics.")}_readGeometry(){if(!this._cachedGeometry){let t=s(this._current.projectedGeometry,this.hasZ,this.hasM);if("esriGeometryPolyline"===this.geometryType&&(t=i(new n,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform.scale[0])),this._cachedGeometry=o(new n,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(t){if(!this._wrappingInfo)return;const{worldSizeX:e}=this._wrappingInfo;if(t.isPoint)return 1===e?(t.coords.push(h,0),t.coords.push(2*-h,0),void t.lengths.push(3)):2===e?(t.coords.push(2*h,0),t.coords.push(4*-h,0),void t.lengths.push(3)):void this._wrapVertex(t.coords,0,2,e);if("esriGeometryMultipoint"!==this.geometryType);else{if(1===e){const e=t.coords.slice();e[0]-=512;const r=t.coords.slice();r[0]+=512,t.coords.push(...e,...r);const s=t.lengths[0];return void t.lengths.push(s,s)}this._wrapVertex(t.coords,0,2,e)}}_wrapVertex(t,e,r,s){const i=e*r,o=t[i];o<-h*(s-2)?t[i]=o+h*s:o>h*(s-1)&&(t[i]=o-h*s)}_readX(){const t=this._readGeometry();return null!=t?t.coords[0]:0}_readY(){const t=this._readGeometry();return null!=t?t.coords[1]:0}_readServerCentroid(){switch(this.geometryType){case"esriGeometryPolygon":{const t=e(this._current.projectedGeometry),r=new n([],t);return o(new n,r,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}case"esriGeometryPolyline":{const e=this._current.projectedGeometry,r=t(e.paths,this.hasZ),s=new n([],r);return o(new n,s,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}}return null}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return r;const s=t.toLowerCase();for(const i in this._current.attributes)if(i.toLowerCase()===s)return this._current.attributes[i]}_readAttributes(){return this._current.attributes}}export{a as GraphicsReader};
5
+ import{ringsCentroid as t,polygonCentroid as e}from"../../../../../geometry/support/centroid.js";import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGeometry as s,generalizeOptimizedGeometry as i,quantizeOptimizedGeometry as o}from"../../../../../layers/graphics/featureConversionUtils.js";import n from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as h}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as u}from"./FeatureSetReader.js";class a extends u{static from(t,e,r){return new a(t,e,r)}constructor(t,e,r){super(r),this._items=t,this._tile=e,this._index=-1,this._cachedGeometry=null;const s=e.lod;s.wrap&&(this._wrappingInfo={worldSizeX:s.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??[]}hasField(t){return null!=this._current.attributes[t]}field(t){return this.readAttribute(t)}get geometryType(){const t=r(this._current.geometry);return"esriGeometryPoint"===t?"esriGeometryMultipoint":t}getCursor(){return this.copy()}copy(){const t=new a(this._items,this._tile,this.metadata);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._cachedGeometry=this._cachedGeometry,t._index=this._index}get fields(){throw new Error("Fields reading not supported to graphics.")}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw new Error("InternalError: exceededTransferLimit not implemented for graphics.")}get hasZ(){return!1}get hasM(){return!1}get usedMemory(){return this._current.usedMemory}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){throw new Error("InternalError: Setting displayId not supported for graphics.")}setIndex(t){this._index=t}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw new Error("InternalError: readGeometryArea not supported for graphics.")}_readGeometry(){if(!this._cachedGeometry){let t=s(this._current.projectedGeometry,this.hasZ,this.hasM);if("esriGeometryPolyline"===this.geometryType&&(t=i(new n,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform.scale[0])),this._cachedGeometry=o(new n,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(t){if(!this._wrappingInfo)return;const{worldSizeX:e}=this._wrappingInfo;if(t.isPoint)return 1===e?(t.coords.push(h,0),t.coords.push(-1024,0),void t.lengths.push(3)):2===e?(t.coords.push(2*h,0),t.coords.push(-2048,0),void t.lengths.push(3)):void this._wrapVertex(t.coords,0,2,e);if("esriGeometryMultipoint"!==this.geometryType);else{if(1===e){const e=t.coords.slice();e[0]-=512;const r=t.coords.slice();r[0]+=512,t.coords.push(...e,...r);const s=t.lengths[0];return void t.lengths.push(s,s)}this._wrapVertex(t.coords,0,2,e)}}_wrapVertex(t,e,r,s){const i=e*r,o=t[i];o<-h*(s-2)?t[i]=o+h*s:o>h*(s-1)&&(t[i]=o-h*s)}_readX(){const t=this._readGeometry();return null!=t?t.coords[0]:0}_readY(){const t=this._readGeometry();return null!=t?t.coords[1]:0}_readServerCentroid(){switch(this.geometryType){case"esriGeometryPolygon":{const t=e(this._current.projectedGeometry),r=new n([],t);return o(new n,r,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}case"esriGeometryPolyline":{const e=this._current.projectedGeometry,r=t(e.paths,this.hasZ),s=new n([],r);return o(new n,s,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}}return null}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return r;const s=t.toLowerCase();for(const i in this._current.attributes)if(i.toLowerCase()===s)return this._current.attributes[i]}_readAttributes(){return this._current.attributes}}export{a as GraphicsReader};
@@ -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 t}from"../../../chunks/tslib.es6.js";import i from"../../../Viewpoint.js";import o from"../../../core/Accessor.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Point.js";import{rotateBy as r,translateBy as c,padAndScaleAndRotateBy as m}from"../viewpointUtils.js";import{getGoToDuration as h}from"./duration.js";import p from"./ZoomBox.js";import u from"./actions/Pan.js";import l from"./actions/Pinch.js";import w from"./actions/Rotate.js";const v=10,g=1,d=new i({targetGeometry:new a}),_=[0,0],T=250;let f=class extends o{constructor(t){super(t),this._endTimer=null,this._lastEventTimestamp=null,this.animationManager=null,this.interacting=!1}initialize(){this.pan=new u({navigation:this}),this.rotate=new w({navigation:this}),this.pinch=new l({navigation:this}),this.zoomBox=new p({view:this.view,navigation:this})}destroy(){this.pan=n(this.pan),this.rotate=n(this.rotate),this.pinch=n(this.pinch),this.zoomBox=n(this.zoomBox),this.animationManager=null}begin(){this.stop(),this._set("interacting",!0)}end(){this._lastEventTimestamp=performance.now(),this._startTimer(T)}async zoom(t,i=this._getDefaultAnchor()){if(this.begin(),this.view.constraints.snapToZoom&&this.view.constraints.effectiveLODs)return t<1?this.zoomIn(i):this.zoomOut(i);this.setViewpoint(i,t,0,[0,0])}async zoomIn(t){const i=this.view,o=i.constraints.snapToNextScale(i.scale);return this._zoomToScale(o,t)}async zoomOut(t){const i=this.view,o=i.constraints.snapToPreviousScale(i.scale);return this._zoomToScale(o,t)}setViewpoint(t,i,o,n){this.begin(),this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,t,i,o,n),this.end()}setViewpointImmediate(t,i=0,o=[0,0],n=this._getDefaultAnchor()){this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,n,t,i,o)}continuousRotateClockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinuous(t,(t=>{r(t,t,-g)}))}continuousRotateCounterclockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinuous(t,(t=>{r(t,t,g)}))}resetRotation(){this.view.constraints.rotationEnabled&&(this.view.rotation=0)}continuousPanLeft(){this._continuousPan([-v,0])}continuousPanRight(){this._continuousPan([v,0])}continuousPanUp(){this._continuousPan([0,v])}continuousPanDown(){this._continuousPan([0,-v])}continuousPanVector({x:t,y:i}){this._continuousPan([t*v,i*v])}stop(){this.pan.stopMomentumNavigation(),this.animationManager?.stop(),this.end(),null!==this._endTimer&&(clearTimeout(this._endTimer),this._endTimer=null,this._set("interacting",!1))}_continuousPan(t){const i=this.view.viewpoint;this.animationManager?.animateContinuous(i,(i=>{c(i,i,t),this.view.constraints.constrainByGeometry(i)}))}_startTimer(t){return null!==this._endTimer||(this._endTimer=setTimeout((()=>{this._endTimer=null;const t=performance.now()-(this._lastEventTimestamp??0);t<T?this._endTimer=this._startTimer(t):this._set("interacting",!1)}),t)),this._endTimer}_getDefaultAnchor(){const{size:t,padding:{left:i,right:o,top:n,bottom:e}}=this.view;return _[0]=.5*(t[0]-o+i),_[1]=.5*(t[1]-e+n),_}async _zoomToScale(t,i=this._getDefaultAnchor()){const{view:o}=this,{constraints:n,scale:e,viewpoint:s,size:a,padding:r}=o,c=n.canZoomInTo(t),p=n.canZoomOutTo(t);if(!(t<e&&!c||t>e&&!p))return m(d,s,t/e,0,i,a,r),n.constrainByGeometry(d),o.goTo(d,{animate:!0,animationMode:"always",duration:h(),pickClosestTarget:!1})}_scaleRotateTranslateViewpoint(t,i,o,n,e){const{view:s}=this,{size:a,padding:r,constraints:h,scale:p,viewpoint:u}=s,l=p*o,w=h.canZoomInTo(l),v=h.canZoomOutTo(l);return(o<1&&!w||o>1&&!v)&&(o=1),c(u,u,e),m(t,u,o,n,i,a,r),h.constrainByGeometry(t)}};t([e()],f.prototype,"animationManager",void 0),t([e({type:Boolean,readOnly:!0})],f.prototype,"interacting",void 0),t([e()],f.prototype,"pan",void 0),t([e()],f.prototype,"pinch",void 0),t([e()],f.prototype,"rotate",void 0),t([e()],f.prototype,"view",void 0),t([e()],f.prototype,"zoomBox",void 0),f=t([s("esri.views.2d.navigation.MapViewNavigation")],f);const y=f;export{y as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import i from"../../../Viewpoint.js";import o from"../../../core/Accessor.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Point.js";import{rotateBy as r,translateBy as c,padAndScaleAndRotateBy as m}from"../viewpointUtils.js";import{getGoToDuration as h}from"./duration.js";import p from"./ZoomBox.js";import u from"./actions/Pan.js";import l from"./actions/Pinch.js";import w from"./actions/Rotate.js";const v=10,g=1,d=new i({targetGeometry:new a}),_=[0,0],T=250;let f=class extends o{constructor(t){super(t),this._endTimer=null,this._lastEventTimestamp=null,this.animationManager=null,this.interacting=!1}initialize(){this.pan=new u({navigation:this}),this.rotate=new w({navigation:this}),this.pinch=new l({navigation:this}),this.zoomBox=new p({view:this.view,navigation:this})}destroy(){this.pan=n(this.pan),this.rotate=n(this.rotate),this.pinch=n(this.pinch),this.zoomBox=n(this.zoomBox),this.animationManager=null}begin(){this.stop(),this._set("interacting",!0)}end(){this._lastEventTimestamp=performance.now(),this._startTimer(T)}async zoom(t,i=this._getDefaultAnchor()){if(this.begin(),this.view.constraints.snapToZoom&&this.view.constraints.effectiveLODs)return t<1?this.zoomIn(i):this.zoomOut(i);this.setViewpoint(i,t,0,[0,0])}async zoomIn(t){const i=this.view,o=i.constraints.snapToNextScale(i.scale);return this._zoomToScale(o,t)}async zoomOut(t){const i=this.view,o=i.constraints.snapToPreviousScale(i.scale);return this._zoomToScale(o,t)}setViewpoint(t,i,o,n){this.begin(),this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,t,i,o,n),this.end()}setViewpointImmediate(t,i=0,o=[0,0],n=this._getDefaultAnchor()){this.view.stateManager.state.viewpoint=this._scaleRotateTranslateViewpoint(this.view.viewpoint,n,t,i,o)}continuousRotateClockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinuous(t,(t=>{r(t,t,-1)}))}continuousRotateCounterclockwise(){const t=this.view.viewpoint;this.animationManager?.animateContinuous(t,(t=>{r(t,t,g)}))}resetRotation(){this.view.constraints.rotationEnabled&&(this.view.rotation=0)}continuousPanLeft(){this._continuousPan([-10,0])}continuousPanRight(){this._continuousPan([v,0])}continuousPanUp(){this._continuousPan([0,v])}continuousPanDown(){this._continuousPan([0,-10])}continuousPanVector({x:t,y:i}){this._continuousPan([t*v,i*v])}stop(){this.pan.stopMomentumNavigation(),this.animationManager?.stop(),this.end(),null!==this._endTimer&&(clearTimeout(this._endTimer),this._endTimer=null,this._set("interacting",!1))}_continuousPan(t){const i=this.view.viewpoint;this.animationManager?.animateContinuous(i,(i=>{c(i,i,t),this.view.constraints.constrainByGeometry(i)}))}_startTimer(t){return null!==this._endTimer||(this._endTimer=setTimeout((()=>{this._endTimer=null;const t=performance.now()-(this._lastEventTimestamp??0);t<T?this._endTimer=this._startTimer(t):this._set("interacting",!1)}),t)),this._endTimer}_getDefaultAnchor(){const{size:t,padding:{left:i,right:o,top:n,bottom:e}}=this.view;return _[0]=.5*(t[0]-o+i),_[1]=.5*(t[1]-e+n),_}async _zoomToScale(t,i=this._getDefaultAnchor()){const{view:o}=this,{constraints:n,scale:e,viewpoint:s,size:a,padding:r}=o,c=n.canZoomInTo(t),p=n.canZoomOutTo(t);if(!(t<e&&!c||t>e&&!p))return m(d,s,t/e,0,i,a,r),n.constrainByGeometry(d),o.goTo(d,{animate:!0,animationMode:"always",duration:h(),pickClosestTarget:!1})}_scaleRotateTranslateViewpoint(t,i,o,n,e){const{view:s}=this,{size:a,padding:r,constraints:h,scale:p,viewpoint:u}=s,l=p*o,w=h.canZoomInTo(l),v=h.canZoomOutTo(l);return(o<1&&!w||o>1&&!v)&&(o=1),c(u,u,e),m(t,u,o,n,i,a,r),h.constrainByGeometry(t)}};t([e()],f.prototype,"animationManager",void 0),t([e({type:Boolean,readOnly:!0})],f.prototype,"interacting",void 0),t([e()],f.prototype,"pan",void 0),t([e()],f.prototype,"pinch",void 0),t([e()],f.prototype,"rotate",void 0),t([e()],f.prototype,"view",void 0),t([e()],f.prototype,"zoomBox",void 0),f=t([s("esri.views.2d.navigation.MapViewNavigation")],f);const y=f;export{y 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{_ as o}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import e from"./HighlightOptions.js";var p;let i=p=class extends r{constructor(...o){super(...o),this.name="default",this.options=new e}clone(){return new p({name:this.name,options:this.options.clone()})}};o([s({type:String})],i.prototype,"name",void 0),o([s({type:e})],i.prototype,"options",void 0),i=p=o([t("esri.views.2d.support.HighlightGroup")],i);const c=i;export{c as default};
5
+ import{_ as o}from"../../../chunks/tslib.es6.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import t from"./HighlightOptions.js";import p from"../../support/HighlightGroup.js";var e;let i=e=class extends p{constructor(o){super(o),this.options=new t}clone(){return new e({name:this.name,options:this.options.clone()})}};o([r({type:t})],i.prototype,"options",void 0),i=e=o([s("esri.views.2d.support.HighlightGroup")],i);const c=i;export{c 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{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{toUnit as n}from"../../../../core/quantityUtils.js";import{adaptiveVerticalLengthUnit as r,adaptiveLengthUnit as i}from"../../../../core/unitUtils.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as s,b as d,a as l,I as c,f as u,y as m,t as p,e as S,n as g,k as f}from"../../../../chunks/vec32.js";import{create as v,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as A}from"../../../../geometry/support/Axis.js";import{sv3d as P}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{clonePoint as E}from"../../../../layers/graphics/hydratedFeatures.js";import{EuclideanSegment as j}from"../../interactive/visualElements/support/Segment.js";import{autoDistanceBetweenPoints2D as x}from"../../../support/automaticLengthMeasurementUtils.js";import{euclideanDirectDistance as h,euclideanDirectDistanceBetweenPoints as H}from"../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistanceThreshold as T}from"../../../support/geodesicMeasurementUtils.js";function C(t,o,a){if(null==t)return null;let s;if(o===e.Horizontal)s=x(t.elevationAlignedStartPoint,t.elevationAlignedEndPoint);else{const{startRenderSpace:e,endRenderSpace:n}=t.dimensionSegment;s=h(e,n,t.spatialReference)}if(null==s)return null;const d=o===e.Vertical?r(s.value,s.unit,a):i(s.value,s.unit,a);return n(s,d)}function U(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,dimension:{offset:r,measureType:i,orientation:o}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o}}function w({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o},a,d=null){if(null==t||null==n)return null;const l=V(d?.directSegment??new j,{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n},a),c=d?.primaryOffsetAxis??v();B(c,{measureType:i,elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,orientation:o,renderCoordsHelper:a});const u=d?.dimensionSegment??new j;return Y({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n})&&i===e.Vertical?(s(u.startRenderSpace,l.startRenderSpace),s(u.endRenderSpace,l.endRenderSpace)):G(u,{offsetAxis:c,offset:r,relativeToSegment:l,renderCoordsHelper:a}),{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,dimensionSegment:u,primaryOffsetAxis:c,spatialReference:a.spatialReference}}function z(e,t,n,r){return t===b.Start?(s(e.startRenderSpace,n.startRenderSpace),s(e.endRenderSpace,r.startRenderSpace)):(s(e.startRenderSpace,n.endRenderSpace),s(e.endRenderSpace,r.endRenderSpace)),e}var b;function k(e,t,n,r){d(e.startRenderSpace,t.startRenderSpace,n,r),d(e.endRenderSpace,t.endRenderSpace,n,r)}function M(t,n,r,i){switch(n){case e.Direct:return V(t,r,i);case e.Horizontal:case e.Vertical:{const{elevationAlignedStartPoint:o,elevationAlignedEndPoint:a,dimension:s,geometry:d}=r;let l;if(s.measureType===e.Direct){l=D(d,i)===o.z>a.z,n===e.Horizontal&&(l=!l)}else l=!I(d);const[c,u]=l?[o,a]:[a,o],m=E(u,O);return n===e.Horizontal?m.z=c.z:(m.x=c.x,m.y=c.y),i.toRenderCoords(c,t.startRenderSpace),i.toRenderCoords(m,t.endRenderSpace),t}}}function V(e,t,n){return n.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),n.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function D(e,t){const n=e.directSegment.eval(.5,P.get()),r=t.worldUpAtPosition(n,P.get()),i=e.dimensionSegment.eval(.5,P.get()),o=l(P.get(),i,n);return!c(o,R)&&u(o,r)>0}function I(e){const{startRenderSpace:t,endRenderSpace:n}=e.dimensionSegment,{startRenderSpace:r,endRenderSpace:i}=e.directSegment;return m(r,t)<m(i,n)}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(b||(b={}));const O=y(0,0,0,null);function L(e,t,n,r){const{directSegment:i}=n,o=B(P.get(),{measureType:t,directSegment:i,renderCoordsHelper:r}),a=G(q,{offsetAxis:o,offset:0,relativeToSegment:i,renderCoordsHelper:r}).eval(.5,P.get()),s=l(P.get(),e,a);return u(s,o)*r.unitInMeters}const q=new j;function B(n,r){const{measureType:i,elevationAlignedStartPoint:a,elevationAlignedEndPoint:d,directSegment:{startRenderSpace:m,endRenderSpace:f},directSegment:v,renderCoordsHelper:y}=r,E=v.eval(.5,P.get()),j=y.worldUpAtPosition(E,P.get()),x=y.worldBasisAtPosition(E,A.Y,P.get());switch(i){case e.Horizontal:s(n,j);break;case e.Vertical:u(m,j)<u(f,j)?l(n,f,m):l(n,m,f),S(n,n,j),S(n,n,j);break;case e.Direct:{const e=r.orientation??0;if(Y({elevationAlignedStartPoint:a,elevationAlignedEndPoint:d}))o(F,-t(e),j),p(n,x,F);else{const r=l(P.get(),f,m),i=S(P.get(),r,j);S(i,i,r),o(F,t(e),r),p(n,i,F)}break}}return c(n,R)?s(n,x):g(n,n)}const F=a();function Y({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}){return null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function G(e,t){const{offsetAxis:n,offset:r,relativeToSegment:{startRenderSpace:i,endRenderSpace:o},relativeToSegment:a,renderCoordsHelper:s}=t,l=r/s.unitInMeters,[c,u]=J(i,o,n,l);return d(e.startRenderSpace,a.startRenderSpace,n,c),d(e.endRenderSpace,a.endRenderSpace,n,u),e}function J(e,t,n,r=0){const i=u(t,n),o=u(e,n),a=Math.abs(i-o)+r;return i>o?[a,r]:[r,a]}function K(e,t,n){const r=t.directSegment.eval(.5,P.get());return n.worldUpAtPosition(r,e)}function N(e,t){const{startRenderSpace:n,endRenderSpace:r}=t.directSegment;return l(e,r,n)}function Q(e,t,n={invert:!1}){const{startRenderSpace:r,endRenderSpace:i}=t.dimensionSegment;return n.invert?l(e,r,i):l(e,i,r)}function W(e,t){const n=e.directSegment.eval(.5,P.get());return t.headingAtPosition(n,e.primaryOffsetAxis)}function X(e,t){return f(Q(Z,e))/t**2}const Z=v();function $(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:r}=e;if(null==t||null==r)return!1;const i=H(t,r);return null!=i&&n(i,"meters").value>T}function _(e){return null!=e.geometry}export{b as OffsetSegmentLocation,Y as arePointsVerticallyAligned,U as computationToGeometryDependencies,w as computeGeometryFromDimension,C as computeLength,B as computeOffsetAxis,L as computeOffsetForPoint,M as computeSegmentForMeasureType,z as computeSpanningSegment,Q as dimensionStartToEnd,N as directStartToEnd,K as directUp,W as headingFromGeometry,$ as isGeodesicDimension,_ as isValidComputation,X as maxScreenLengthSquaredFromGeometry,k as offsetSegment};
5
+ import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{toUnit as n}from"../../../../core/quantityUtils.js";import{adaptiveVerticalLengthUnit as r,adaptiveLengthUnit as i}from"../../../../core/unitUtils.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as s,b as d,a as c,I as l,f as u,y as p,t as m,e as S,n as g,k as f}from"../../../../chunks/vec32.js";import{create as v,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as A}from"../../../../geometry/support/Axis.js";import{sv3d as P}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{clonePoint as h}from"../../../../layers/graphics/hydratedFeatures.js";import{EuclideanSegment as E}from"../../interactive/visualElements/support/Segment.js";import{autoDistanceBetweenPoints2D as j}from"../../../support/automaticLengthMeasurementUtils.js";import{euclideanDirectDistance as x,euclideanDirectDistanceBetweenPoints as w}from"../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistanceThreshold as U}from"../../../support/geodesicMeasurementUtils.js";class z{constructor(e,t,n,r,i,o){this.elevationAlignedStartPoint=e,this.elevationAlignedEndPoint=t,this.directSegment=n,this.dimensionSegment=r,this.primaryOffsetAxis=i,this.spatialReference=o}}function b(t,o,a){if(null==t)return null;let s;if(o===e.Horizontal)s=j(t.elevationAlignedStartPoint,t.elevationAlignedEndPoint);else{const{startRenderSpace:e,endRenderSpace:n}=t.dimensionSegment;s=x(e,n,t.spatialReference)}if(null==s)return null;const d=o===e.Vertical?r(s.value,s.unit,a):i(s.value,s.unit,a);return n(s,d)}function H(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,dimension:{offset:r,measureType:i,orientation:o}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o}}function C({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o},a,d=null){if(null==t||null==n)return null;const c=D(d?.directSegment??new E,{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n},a),l=d?.primaryOffsetAxis??v();F(l,{measureType:i,elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:c,orientation:o,renderCoordsHelper:a});const u=d?.dimensionSegment??new E;return G({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n})&&i===e.Vertical?(s(u.startRenderSpace,c.startRenderSpace),s(u.endRenderSpace,c.endRenderSpace)):J(u,l,r,c,a),new z(t,n,c,u,l,a.spatialReference)}function T(e,t,n,r){return t===k.Start?(s(e.startRenderSpace,n.startRenderSpace),s(e.endRenderSpace,r.startRenderSpace)):(s(e.startRenderSpace,n.endRenderSpace),s(e.endRenderSpace,r.endRenderSpace)),e}var k;function M(e,t,n,r){d(e.startRenderSpace,t.startRenderSpace,n,r),d(e.endRenderSpace,t.endRenderSpace,n,r)}function V(t,n,r,i){switch(n){case e.Direct:return D(t,r,i);case e.Horizontal:case e.Vertical:{const{elevationAlignedStartPoint:o,elevationAlignedEndPoint:a,dimension:s,geometry:d}=r;let c;if(s.measureType===e.Direct){c=I(d,i)===o.z>a.z,n===e.Horizontal&&(c=!c)}else c=!O(d);const[l,u]=c?[o,a]:[a,o],p=h(u,L);return n===e.Horizontal?p.z=l.z:(p.x=l.x,p.y=l.y),i.toRenderCoords(l,t.startRenderSpace),i.toRenderCoords(p,t.endRenderSpace),t}}}function D(e,t,n){return n.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),n.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function I(e,t){const n=e.directSegment.eval(.5,P.get()),r=t.worldUpAtPosition(n,P.get()),i=e.dimensionSegment.eval(.5,P.get()),o=c(P.get(),i,n);return!l(o,R)&&u(o,r)>0}function O(e){const{startRenderSpace:t,endRenderSpace:n}=e.dimensionSegment,{startRenderSpace:r,endRenderSpace:i}=e.directSegment;return p(r,t)<p(i,n)}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(k||(k={}));const L=y(0,0,0,null);function q(e,t,n,r){const{directSegment:i}=n,o=F(P.get(),{measureType:t,directSegment:i,renderCoordsHelper:r}),a=J(B,o,0,i,r).eval(.5,P.get()),s=c(P.get(),e,a);return u(s,o)*r.unitInMeters}const B=new E;function F(n,r){const{measureType:i,elevationAlignedStartPoint:a,elevationAlignedEndPoint:d,directSegment:{startRenderSpace:p,endRenderSpace:f},directSegment:v,renderCoordsHelper:y}=r,h=v.eval(.5,P.get()),E=y.worldUpAtPosition(h,P.get()),j=y.worldBasisAtPosition(h,A.Y,P.get());switch(i){case e.Horizontal:s(n,E);break;case e.Vertical:u(p,E)<u(f,E)?c(n,f,p):c(n,p,f),S(n,n,E),S(n,n,E);break;case e.Direct:{const e=r.orientation??0;if(G({elevationAlignedStartPoint:a,elevationAlignedEndPoint:d}))o(Y,-t(e),E),m(n,j,Y);else{const r=c(P.get(),f,p),i=S(P.get(),r,E);S(i,i,r),o(Y,t(e),r),m(n,i,Y)}break}}return l(n,R)?s(n,j):g(n,n)}const Y=a();function G({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}){return null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function J(e,t,n,r,i){const{startRenderSpace:o,endRenderSpace:a}=r,s=n/i.unitInMeters,[c,l]=K(o,a,t,s);return d(e.startRenderSpace,r.startRenderSpace,t,c),d(e.endRenderSpace,r.endRenderSpace,t,l),e}function K(e,t,n,r=0){const i=u(t,n),o=u(e,n),a=Math.abs(i-o)+r;return i>o?[a,r]:[r,a]}function N(e,t,n){const r=t.directSegment.eval(.5,P.get());return n.worldUpAtPosition(r,e)}function Q(e,t){const{startRenderSpace:n,endRenderSpace:r}=t.directSegment;return c(e,r,n)}function W(e,t,n={invert:!1}){const{startRenderSpace:r,endRenderSpace:i}=t.dimensionSegment;return n.invert?c(e,r,i):c(e,i,r)}function X(e,t){const n=e.directSegment.eval(.5,P.get());return t.headingAtPosition(n,e.primaryOffsetAxis)}function Z(e,t){return f(W($,e))/t**2}const $=v();function _(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:r}=e;if(null==t||null==r)return!1;const i=w(t,r);return null!=i&&n(i,"meters").value>U}function ee(e){return null!=e.geometry}export{z as LengthDimensionGeometry,k as OffsetSegmentLocation,G as arePointsVerticallyAligned,H as computationToGeometryDependencies,C as computeGeometryFromDimension,b as computeLength,F as computeOffsetAxis,q as computeOffsetForPoint,V as computeSegmentForMeasureType,T as computeSpanningSegment,W as dimensionStartToEnd,Q as directStartToEnd,N as directUp,X as headingFromGeometry,_ as isGeodesicDimension,ee as isValidComputation,Z as maxScreenLengthSquaredFromGeometry,M as offsetSegment};