@arcgis/core 5.0.0-next.15 → 5.0.0-next.17

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 (202) hide show
  1. package/analysis/ElevationProfile/ElevationProfileLineInput.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/234b52b2a391631ceff6.js +1 -0
  4. package/assets/esri/core/workers/chunks/{8f3503b2fb6cd38757b9.js → 458e87902abc24b375da.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{57b410198d83bf0ab708.js → 4a89e120be142ab58a27.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{a410dcf80d17a2383337.js → 65a4099bdbe31834d0cc.js} +1 -1
  7. package/assets/esri/core/workers/chunks/71d9e9b0a7f8c0edd32d.js +1 -0
  8. package/assets/esri/core/workers/chunks/722da7a39a0ad9300752.js +1 -0
  9. package/assets/esri/core/workers/chunks/{cdb4664fd59860ddeb5a.js → 888f188541f8bd68e33e.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{319c3f46f2afb8f3e5a9.js → 89c9cf7f799858d14c76.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{e19cd07df8ce87e18832.js → 8b33732e3c2924c1f60d.js} +1 -1
  12. package/assets/esri/core/workers/chunks/98739414c107ad78e4d8.js +1 -0
  13. package/assets/esri/core/workers/chunks/{bc318b6fef192cee2a72.js → a4518f25b9f8fe704286.js} +17 -17
  14. package/assets/esri/core/workers/chunks/{8b73db0f4d6714396eb0.js → a6fa90eab77ac0e1cdfc.js} +1 -1
  15. package/assets/esri/core/workers/chunks/ac366221e8636b60aee5.js +1 -0
  16. package/assets/esri/core/workers/chunks/{23e17b745adf71a5efc7.js → aca72ca7f43f70eb8077.js} +1 -1
  17. package/assets/esri/core/workers/chunks/ad0c7225941437d18408.js +1 -0
  18. package/assets/esri/core/workers/chunks/b30897952494a3e5b9fe.js +1 -0
  19. package/assets/esri/core/workers/chunks/bfd3d81e8e148be99686.js +1 -0
  20. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  21. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  22. package/assets/esri/themes/base/widgets/_Editor.scss +2 -1
  23. package/assets/esri/themes/base/widgets/_FeatureForm.scss +1 -1
  24. package/assets/esri/themes/dark/main.css +1 -1
  25. package/assets/esri/themes/light/main.css +1 -1
  26. package/assets/esri/themes/light/view.css +1 -1
  27. package/chunks/GaussianSplat.glsl.js +2 -2
  28. package/chunks/lyr3DMain.js +1 -1
  29. package/config.js +1 -1
  30. package/core/accessorSupport/ensureType.js +1 -1
  31. package/core/accessorSupport/extensions/serializableProperty/reader.js +1 -1
  32. package/graphic/graphicOriginUtils.js +1 -1
  33. package/interfaces.d.ts +68 -28
  34. package/kernel.js +1 -1
  35. package/layers/BingMapsLayer.js +1 -1
  36. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  37. package/layers/support/attributionUtils.js +5 -0
  38. package/layers/support/fieldConfigUtils.js +1 -1
  39. package/layers/support/fieldFormatUtils.js +1 -1
  40. package/layers/video/VideoController.js +1 -1
  41. package/libs/parquet/parquet.js +1 -1
  42. package/package.json +1 -1
  43. package/support/revision.js +1 -1
  44. package/symbols/cim/SDFHelper.js +1 -1
  45. package/symbols/cim/cimAnalyzer.js +1 -1
  46. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  47. package/views/2d/engine/flow/dataUtils.js +1 -1
  48. package/views/2d/engine/webgl/TextureManager.js +1 -1
  49. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedPolyShader.js +1 -1
  50. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedFillShader.js +1 -1
  51. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
  52. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
  53. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  54. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  55. package/views/2d/layers/features/Processor.js +1 -1
  56. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  57. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  58. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  59. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  60. package/views/3d/analysis/ElevationProfile/ElevationProfileGeometryVisualization3D.js +1 -1
  61. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  62. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  63. package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
  64. package/views/3d/environment/CloudsCompositionTechnique.js +1 -1
  65. package/views/3d/environment/CloudsTechnique.js +1 -1
  66. package/views/3d/environment/FogTechnique.js +1 -1
  67. package/views/3d/environment/NoiseTextureAtlasTechnique.js +1 -1
  68. package/views/3d/environment/PrecipitationTechnique.js +1 -1
  69. package/views/3d/environment/SimpleAtmosphereTechnique.js +1 -1
  70. package/views/3d/layers/FlowSubView3D.js +1 -1
  71. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  72. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  73. package/views/3d/layers/TiledLayerView3D.js +1 -1
  74. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  75. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  76. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  77. package/views/3d/support/DisplayQualityProfile.js +1 -1
  78. package/views/3d/support/QualitySettings.js +1 -1
  79. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  80. package/views/3d/support/flow/FlowWorker.js +1 -1
  81. package/views/3d/support/flow/FlowWorkerHandle.js +1 -1
  82. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  83. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  84. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  85. package/views/3d/support/flow/constants.js +1 -1
  86. package/views/3d/support/flow/loadUtils.js +1 -1
  87. package/views/3d/support/popupHitTest.js +1 -1
  88. package/views/3d/terrain/BlendLayersTechnique.js +1 -1
  89. package/views/3d/terrain/RasterColorizerTechnique.js +1 -1
  90. package/views/3d/terrain/TerrainSurface.js +1 -1
  91. package/views/3d/terrain/TileAgent.js +1 -1
  92. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  93. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  94. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  95. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  96. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +14 -32
  97. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +17 -0
  98. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +10 -0
  99. package/views/3d/webgl-engine/core/shaderTechnique/{ReloadableShaderModule.js → ReloadableShader.js} +1 -1
  100. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  101. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
  102. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +1 -1
  103. package/views/3d/webgl-engine/effects/glow/GlowBlurTechnique.js +1 -1
  104. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +1 -1
  105. package/views/3d/webgl-engine/effects/haze/HazeCompositingTechnique.js +1 -1
  106. package/views/3d/webgl-engine/effects/haze/HazeTechnique.js +1 -1
  107. package/views/3d/webgl-engine/effects/highlight/HighlightApplyTechnique.js +1 -1
  108. package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +1 -1
  109. package/views/3d/webgl-engine/effects/highlight/HighlightDownsampleTechnique.js +1 -1
  110. package/views/3d/webgl-engine/effects/highlight/HighlightToSingleTechnique.js +1 -1
  111. package/views/3d/webgl-engine/effects/highlight/ShadowHighlightTechnique.js +1 -1
  112. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
  113. package/views/3d/webgl-engine/effects/laserlines/LaserlineTechnique.js +1 -1
  114. package/views/3d/webgl-engine/effects/magnifier/MagnifierTechnique.js +1 -1
  115. package/views/3d/webgl-engine/effects/smaa/SMAABlendWeightsTechnique.js +1 -1
  116. package/views/3d/webgl-engine/effects/smaa/SMAABlurTechnique.js +1 -1
  117. package/views/3d/webgl-engine/effects/smaa/SMAAEdgeDetectTechnique.js +1 -1
  118. package/views/3d/webgl-engine/effects/ssao/SSAOBlurTechnique.js +1 -1
  119. package/views/3d/webgl-engine/effects/ssao/SSAOTechnique.js +1 -1
  120. package/views/3d/webgl-engine/effects/stars/StarsTechnique.js +1 -1
  121. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  122. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  123. package/views/3d/webgl-engine/lib/Program.js +1 -1
  124. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  125. package/views/3d/webgl-engine/lib/TextureBackedBuffer/BufferManager.js +1 -1
  126. package/views/3d/webgl-engine/lib/TextureBackedBuffer/ManagedTextureBackedBuffer.js +1 -1
  127. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  128. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +5 -0
  129. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +5 -0
  130. package/views/3d/webgl-engine/lib/TextureTechnique.js +1 -1
  131. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechnique.js +1 -1
  132. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  133. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  134. package/views/3d/webgl-engine/shaders/AtmosphereCompositingTechnique.js +1 -1
  135. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  136. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  137. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  138. package/views/3d/webgl-engine/shaders/CutFillCompositionTechnique.js +1 -1
  139. package/views/3d/webgl-engine/shaders/CutFillDepthTechnique.js +1 -1
  140. package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +1 -1
  141. package/views/3d/webgl-engine/shaders/CutFillReductionTechnique.js +1 -1
  142. package/views/3d/webgl-engine/shaders/CutFillTargetDepthTechnique.js +1 -1
  143. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  144. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  145. package/views/3d/webgl-engine/shaders/GaussianSplatCompositionTechnique.js +1 -1
  146. package/views/3d/webgl-engine/shaders/GaussianSplatDepthCompositionTechnique.js +1 -1
  147. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +1 -1
  148. package/views/3d/webgl-engine/shaders/GaussianSplatTechnique.js +1 -1
  149. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  150. package/views/3d/webgl-engine/shaders/HUDCompositingTechnique.js +1 -1
  151. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  152. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
  153. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +1 -1
  154. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  155. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  156. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  157. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  158. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  159. package/views/3d/webgl-engine/shaders/OverlayCompositingTechnique.js +1 -1
  160. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  161. package/views/3d/webgl-engine/shaders/PointRendererTechnique.js +1 -1
  162. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  163. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  164. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  165. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  166. package/views/3d/webgl-engine/shaders/ShadowCastClearTechnique.js +1 -1
  167. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  168. package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechnique.js +1 -1
  169. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  170. package/views/3d/webgl-engine/shaders/ViewshedTechnique.js +1 -1
  171. package/views/SceneView.js +1 -1
  172. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  173. package/views/analysis/ElevationProfile/types.d.ts +5 -0
  174. package/views/analysis/ElevationProfile/types.js +5 -0
  175. package/views/input/gamepad/GamepadInputDevice.js +1 -1
  176. package/views/input/gamepad/GamepadSource.js +1 -1
  177. package/views/navigation/gamepad/GamepadSettings.js +1 -1
  178. package/views/webgl/VertexAttributeLocations.js +1 -1
  179. package/widgets/Attribution/AttributionViewModel.js +1 -1
  180. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  181. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  182. package/widgets/Editor/UpdateWorkflow.js +1 -1
  183. package/widgets/Editor/Workflow.js +1 -1
  184. package/widgets/Editor/components/CreateFeaturesPanelContent.js +1 -1
  185. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  186. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  187. package/widgets/Editor.js +1 -1
  188. package/widgets/Feature/support/featureUtils.js +1 -1
  189. package/widgets/FeatureTable/FieldColumn.js +1 -1
  190. package/widgets/FeatureTable/Grid/Column.js +1 -1
  191. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  192. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  193. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  194. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  195. package/assets/esri/core/workers/chunks/097e5deb51ee7e25e654.js +0 -1
  196. package/assets/esri/core/workers/chunks/38ee69125da60464d5a1.js +0 -1
  197. package/assets/esri/core/workers/chunks/4f0016111fd84c612f41.js +0 -1
  198. package/assets/esri/core/workers/chunks/8208dfa8f7fae7e616b9.js +0 -1
  199. package/assets/esri/core/workers/chunks/847f4fc39100fac1df01.js +0 -1
  200. package/assets/esri/core/workers/chunks/ab005fe84952f0676020.js +0 -1
  201. package/assets/esri/core/workers/chunks/bc19a232076d98825eef.js +0 -1
  202. package/assets/esri/core/workers/chunks/c3dcfe26c2c3c829762d.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../request.js";import t from"../../core/Error.js";import{loadParquetModule as n}from"./loadParquetModule.js";import{MultiscaleGeometryField as r,GeometryInfo as o,GeometryType as a,PrimaryGeometryField as i}from"../../chunks/bundle.js";const s=t=>async function(n,r,o,a){const i=t?.(),s=i?{...i,debug:a}:{debug:a},{data:u}=await e(n,{responseType:"array-buffer",query:s,headers:{range:`bytes=${r}-${o}`}});return u},u=t=>async function(n){const{data:r}=await e(n,{responseType:"native",method:"head",query:t?.()}),o=r.headers.get("Content-Length");if(null==o)throw new Error("Unable to parse content length");return parseInt(o,10)};function l(e){switch(e){case"esriGeometryPoint":return a.Point;case"esriGeometryPolygon":return a.Polygon;case"esriGeometryPolyline":return a.Polyline;case"esriGeometryMultipoint":return a.Multipoint;default:throw new t("parquet",`Found unexpected GeometryType: ${e}`)}}function c(e){switch(e.encoding.type){case"wkb":return i.fromWkb(e.encoding.primaryFieldName);case"location":{const{latitudeFieldName:t,longitudeFieldName:n}=e.encoding;return i.fromLocation(t,n)}}}function m(e,n){const a=e.spatialReference.wkid,i=n.wkid;if(!a||!i)throw new t("parquet","Unable to create ParquetFile, in and out wkid must be specified");const s=l(e.geometryType),u=c(e),m=[];if("xz"===e.displayOptimization?.mode){const t=e.displayOptimization.multiscale;for(const e of t.levels??[]){const[t,n]=e.transform.translate,[o,a]=e.transform.scale,i=new Float64Array([t,n]),s=new Float64Array([o,a]);m.push(r.new(e.level,e.column,i,s))}}return o.new(s,a,i,u,m)}async function d(e,t={}){const{ParquetFile:r}=await n(),o=s(t.getCustomParameters),a=u(t.getCustomParameters),i=t.geometryInfo?m(t.geometryInfo,t.outSpatialReference??t.geometryInfo.spatialReference):null;return r.fromUrl(e,o,a,i)}function f(e){const t=e.keyValueMetadata("geo");return null!=t?JSON.parse(t):null}function y(e){const t=e.keyValueMetadata("esri");return null!=t?JSON.parse(t):null}export{d as createParquetFile,y as readEsriMetadata,f as readGeoMetadata};
5
+ import e from"../../request.js";import t from"../../core/Error.js";import{isBlobProtocol as r}from"../../core/urlUtils.js";import{loadParquetModule as n}from"./loadParquetModule.js";import{MultiscaleGeometryField as o,GeometryInfo as a,GeometryType as i,PrimaryGeometryField as s}from"../../chunks/bundle.js";const u=t=>async function(r,n,o,a){const i=t?.(),s=i?{...i,debug:a}:{debug:a},{data:u}=await e(r,{responseType:"array-buffer",query:s,headers:{range:`bytes=${n}-${o}`}});return u},l=t=>async function(n){if(r(n)){const{data:t}=await e(n,{responseType:"blob"});return t.size}const{data:o}=await e(n,{responseType:"native",method:"head",query:t?.()}),a=o.headers.get("Content-Length");if(null==a)throw new Error("Unable to parse content length");return parseInt(a,10)};function c(e){switch(e){case"esriGeometryPoint":return i.Point;case"esriGeometryPolygon":return i.Polygon;case"esriGeometryPolyline":return i.Polyline;case"esriGeometryMultipoint":return i.Multipoint;default:throw new t("parquet",`Found unexpected GeometryType: ${e}`)}}function m(e){switch(e.encoding.type){case"wkb":return s.fromWkb(e.encoding.primaryFieldName);case"location":{const{latitudeFieldName:t,longitudeFieldName:r}=e.encoding;return s.fromLocation(t,r)}}}function f(e,r){const n=e.spatialReference.wkid,i=r.wkid;if(!n||!i)throw new t("parquet","Unable to create ParquetFile, in and out wkid must be specified");const s=c(e.geometryType),u=m(e),l=[];if("xz"===e.displayOptimization?.mode){const t=e.displayOptimization.multiscale;for(const e of t.levels??[]){const[t,r]=e.transform.translate,[n,a]=e.transform.scale,i=new Float64Array([t,r]),s=new Float64Array([n,a]);l.push(o.new(e.level,e.column,i,s))}}return a.new(s,n,i,u,l)}async function p(e,t={}){const{ParquetFile:r}=await n(),o=u(t.getCustomParameters),a=l(t.getCustomParameters),i=t.geometryInfo?f(t.geometryInfo,t.outSpatialReference??t.geometryInfo.spatialReference):null;return r.fromUrl(e,o,a,i)}function d(e){const t=e.keyValueMetadata("geo");return null!=t?JSON.parse(t):null}function y(e){const t=e.keyValueMetadata("esri");return null!=t?JSON.parse(t):null}export{p as createParquetFile,y as readEsriMetadata,d as readGeoMetadata};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.0.0-next.15",
3
+ "version": "5.0.0-next.17",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- const c="20251014",d="01029bc694b76089ee5671cc3c221506fdd857d2";export{c as buildDate,d as commitHash};
5
+ const a="20251016",b="221b2d4354099611e628ad1f585b6244aa0b5673";export{a as buildDate,b as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{packFloatRGBA as t}from"../../core/floatRGBA.js";import{isExtent as o}from"../../geometry/support/jsonUtils.js";import n from"./Rect.js";import{defaultSdfTextureSize as r,spritePadding as i}from"../../views/2d/engine/webgl/definitions.js";const e=.45;function a(t,o=.5){switch(t.type){case"CIMPointSymbol":{const o=t.symbolLayers;if(!o||1!==o.length)return null;const n=o[0];return"CIMVectorMarker"!==n.type?null:a(n)}case"CIMVectorMarker":{const n=t.markerGraphics;if(!n||1!==n.length)return null;const r=n[0];if(!r)return null;const i=r.geometry;if(!i)return null;const e=r.symbol;return!e||"CIMPolygonSymbol"!==e.type&&"CIMLineSymbol"!==e.type||e.symbolLayers?.some(t=>!!t.effects)?null:{type:"sdf",geom:i,sdfPaddingRatio:o,asFill:"CIMPolygonSymbol"===e.type}}}}function l(t){return t?t.rings?t.rings:t.paths?t.paths:void 0!==t.xmin&&void 0!==t.ymin&&void 0!==t.xmax&&void 0!==t.ymax?[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]:null:null}function s(t){let o=1/0,r=-1/0,i=1/0,e=-1/0;for(const n of t)for(const t of n)t[0]<o&&(o=t[0]),t[0]>r&&(r=t[0]),t[1]<i&&(i=t[1]),t[1]>e&&(e=t[1]);return new n(o,i,r-o,e-i)}function f(t){let o=1/0,n=-1/0,r=1/0,i=-1/0;for(const e of t)for(const t of e)t[0]<o&&(o=t[0]),t[0]>n&&(n=t[0]),t[1]<r&&(r=t[1]),t[1]>i&&(i=t[1]);return[o,r,n,i]}function m(t){return t?t.rings?f(t.rings):t.paths?f(t.paths):o(t)?[t.xmin,t.ymin,t.xmax,t.ymax]:null:null}function c(t,o){const[n,e,a,l]=m(t),s=a-n,f=l-e,c=r,h=i,u=Math.floor(.5*(c*o-h)),y=(c-2*(u+h))/Math.max(s,f),d=Math.round(s*y),x=Math.round(f*y);return{pixelDimensions:[s,f],texelDimensions:[Math.round((d+2*u)/y),Math.round((x+2*u)/y)]}}function h(t,o,n,a,l,s,f){const[m,c,h,u]=t;if(h<m||u<c)return{frameSizeRatio:0,anchorX:0,anchorY:0,widthRatio:1,sdfPaddingRatio:.5};const y=h-m,d=u-c,x=Math.max(y,d);let M=.5;if(null!=s&&null!=n){if(!f&&null!=o){s*=(o.ymax-o.ymin)/n}const t=s/(s+x),r=.1;t>e&&t<1&&(M=Math.min(t+r,.99))}const g=r,p=i,R=Math.floor(.5*(g*M-p)),w=(g-2*(R+p))/x,P=Math.round(y*w)+2*R,b=Math.round(d*w)+2*R;let C=1;if(o){C=b*(1-M)/((o.ymax-o.ymin)*w)}let I=0,S=0,j=1;a&&(l?o&&n&&o.ymax-o.ymin>0&&(j=(o.xmax-o.xmin)/(o.ymax-o.ymin),I=a.x/(n*j),S=a.y/n):(I=a.x,S=a.y)),o&&(I=.5*(o.xmax+o.xmin)+I*(o.xmax-o.xmin),S=.5*(o.ymax+o.ymin)+S*(o.ymax-o.ymin)),I-=m,S-=c,I*=w,S*=w,I+=R,S+=R;let v=I/P-.5,F=S/b-.5;return l&&n&&(v*=n*j,F*=n),{frameSizeRatio:C,anchorX:v,anchorY:F,widthRatio:j,sdfPaddingRatio:M}}function u(t){const o=l(t.geom),n=s(o),e=r,a=i,f=Math.floor(.5*(e*t.sdfPaddingRatio-a)),m=e-2*(f+a),c=m/Math.max(n.width,n.height),h=Math.round(n.width*c)+2*f,u=Math.round(n.height*c)+2*f,M=[];for(const r of o)if(r&&r.length>1){const o=[];for(const i of r){let[r,e]=i;r-=n.x,e-=n.y,r*=c,e*=c,r+=f-.5,e+=f-.5,t.asFill?o.push([r,e]):o.push([Math.round(r),Math.round(e)])}if(t.asFill){const t=o.length-1;o[0][0]===o[t][0]&&o[0][1]===o[t][1]||o.push(o[0])}M.push(o)}const g=y(M,h,u,f);return t.asFill&&d(M,h,u,f,g),{data:x(g,f),width:h,height:u,sdfPaddingRatio:t.sdfPaddingRatio,sdfDecodeCoeff:2*f/m}}function y(t,o,n,r){const i=o*n,e=new Array(i),a=r*r+1;for(let l=0;l<i;++l)e[l]=a;for(const l of t){const t=l.length;for(let i=1;i<t;++i){const t=l[i-1],a=l[i];let s,f,m,c;t[0]<a[0]?(s=t[0],f=a[0]):(s=a[0],f=t[0]),t[1]<a[1]?(m=t[1],c=a[1]):(m=a[1],c=t[1]);let h=Math.floor(s)-r,u=Math.floor(f)+r,y=Math.floor(m)-r,d=Math.floor(c)+r;h<0&&(h=0),u>o&&(u=o),y<0&&(y=0),d>n&&(d=n);const x=a[0]-t[0],M=a[1]-t[1],g=x*x+M*M;for(let r=h;r<u;r++)for(let i=y;i<d;i++){const l=r+.5,s=i+.5;let f,m,c=(l-t[0])*x+(s-t[1])*M;c<0?(f=t[0],m=t[1]):c>g?(f=a[0],m=a[1]):(c/=g,f=t[0]+c*x,m=t[1]+c*M);const h=(l-f)*(l-f)+(s-m)*(s-m),u=(n-i-1)*o+r;h<e[u]&&(e[u]=h)}}}for(let l=0;l<i;++l)e[l]=Math.sqrt(e[l]);return e}function d(t,o,n,r,i){for(const e of t){const t=e.length;for(let a=1;a<t;++a){const t=e[a-1],l=e[a];let s,f,m,c;t[0]<l[0]?(s=t[0],f=l[0]):(s=l[0],f=t[0]),t[1]<l[1]?(m=t[1],c=l[1]):(m=l[1],c=t[1]);let h=Math.floor(s),u=Math.floor(f)+1,y=Math.floor(m),d=Math.floor(c)+1;h<r&&(h=r),u>o-r&&(u=o-r),y<r&&(y=r),d>n-r&&(d=n-r);for(let e=y;e<d;++e){if(t[1]>e==l[1]>e)continue;const a=e+.5,s=(n-e-1)*o;for(let o=h;o<u;++o){o+.5<(l[0]-t[0])*(a-t[1])/(l[1]-t[1])+t[0]&&(i[s+o]=-i[s+o])}for(let t=r;t<h;++t)i[s+t]=-i[s+t]}}}}function x(o,n){const r=2*n,i=o.length,e=new Uint8Array(4*i);for(let a=0;a<i;++a){const n=.5-o[a]/r;t(n,e,4*a)}return e}export{u as buildSDF,m as getExtent,c as getSDFDimensions,a as getSDFInfo,h as getSDFMetrics};
5
+ import{packFloatRGBA as t}from"../../core/floatRGBA.js";import{pt2px as o}from"../../core/screenUtils.js";import{isExtent as n}from"../../geometry/support/jsonUtils.js";import r from"./Rect.js";import{defaultSdfTextureSize as e,spritePadding as i}from"../../views/2d/engine/webgl/definitions.js";const a=.45;function s(t){switch(t.type){case"CIMPointSymbol":{const o=t.symbolLayers;if(!o||1!==o.length)return null;const n=o[0];return"CIMVectorMarker"!==n.type?null:s(n)}case"CIMVectorMarker":{const o=t.markerGraphics;if(!o||1!==o.length)return null;const n=o[0];if(!n)return null;const r=n.geometry,e=c(r);if(!e)return null;const i=n.symbol;if(!i||"CIMPolygonSymbol"!==i.type&&"CIMLineSymbol"!==i.type||i.symbolLayers?.some(t=>!!t.effects))return null;let a=0;for(const t of i.symbolLayers??[])a=Math.max("CIMSolidStroke"===t.type?t.width:0,a);const{sdfTextureSize:s,sdfPaddingRatio:l}=d(e,t.frame,t.size,t.anchorPoint,"Relative"!==t.anchorPointUnits,a,t.scaleSymbolsProportionally);return{type:"sdf",geometry:r,sdfTextureSize:s,sdfPaddingRatio:l,asFill:"CIMPolygonSymbol"===i.type}}}}function l(t){return t?t.rings?t.rings:t.paths?t.paths:void 0!==t.xmin&&void 0!==t.ymin&&void 0!==t.xmax&&void 0!==t.ymax?[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]:null:null}function f(t){let o=1/0,n=-1/0,e=1/0,i=-1/0;for(const r of t)for(const t of r)t[0]<o&&(o=t[0]),t[0]>n&&(n=t[0]),t[1]<e&&(e=t[1]),t[1]>i&&(i=t[1]);return new r(o,e,n-o,i-e)}function m(t){let o=1/0,n=-1/0,r=1/0,e=-1/0;for(const i of t)for(const t of i)t[0]<o&&(o=t[0]),t[0]>n&&(n=t[0]),t[1]<r&&(r=t[1]),t[1]>e&&(e=t[1]);return[o,r,n,e]}function c(t){return t?t.rings?m(t.rings):t.paths?m(t.paths):n(t)?[t.xmin,t.ymin,t.xmax,t.ymax]:null:null}function h(t,o,n){const[r,e,a,s]=c(t),l=a-r,f=s-e,m=o,h=i,u=Math.floor(.5*(m*n-h)),d=(m-2*(u+h))/Math.max(l,f),y=Math.round(l*d),x=Math.round(f*d);return{pixelDimensions:[l,f],texelDimensions:[Math.round((y+2*u)/d),Math.round((x+2*u)/d)]}}const u=1.61803;function d(t,n,r,s,l,f,m){const[c,h,d,y]=t;if(d<c||y<h)return{frameSizeRatio:0,anchorX:0,anchorY:0,widthRatio:1,sdfPaddingRatio:.5,sdfTextureSize:e};const x=d-c,M=y-h,g=Math.max(x,M);let p,R=.5;{if(!m&&null!=n){f*=(n.ymax-n.ymin)/r}const t=f/(f+g),o=.1;t>a&&t<1&&(R=Math.min(t+o,.99))}{const t=(g+f)/M,n=o(r)*t;p=Math.floor(n*u+2*i),p=1<<32-Math.clz32(p-1),p=Math.max(p,e)}const S=p,P=i,w=Math.floor(.5*(S*R-P)),b=(S-2*(w+P))/g,z=Math.round(x*b)+2*w,C=Math.round(M*b)+2*w;let I=1;if(n){I=C*(1-R)/((n.ymax-n.ymin)*b)}let j=0,v=0,T=1;s&&(l?n&&r&&n.ymax-n.ymin>0&&(T=(n.xmax-n.xmin)/(n.ymax-n.ymin),j=s.x/(r*T),v=s.y/r):(j=s.x,v=s.y)),n&&(j=.5*(n.xmax+n.xmin)+j*(n.xmax-n.xmin),v=.5*(n.ymax+n.ymin)+v*(n.ymax-n.ymin)),j-=c,v-=h,j*=b,v*=b,j+=w,v+=w;let k=j/z-.5,F=v/C-.5;return l&&r&&(k*=r*T,F*=r),{frameSizeRatio:I,anchorX:k,anchorY:F,widthRatio:T,sdfTextureSize:p,sdfPaddingRatio:R}}function y(t){const o=l(t.geometry),n=f(o),r=t.sdfTextureSize,e=i,a=Math.floor(.5*(r*t.sdfPaddingRatio-e)),s=r-2*(a+e),m=s/Math.max(n.width,n.height),c=Math.round(n.width*m)+2*a,h=Math.round(n.height*m)+2*a,u=[];for(const i of o)if(i&&i.length>1){const o=[];for(const r of i){let[e,i]=r;e-=n.x,i-=n.y,e*=m,i*=m,e+=a-.5,i+=a-.5,t.asFill?o.push([e,i]):o.push([Math.round(e),Math.round(i)])}if(t.asFill){const t=o.length-1;o[0][0]===o[t][0]&&o[0][1]===o[t][1]||o.push(o[0])}u.push(o)}const d=x(u,c,h,a);return t.asFill&&M(u,c,h,a,d),{data:g(d,a),width:c,height:h,sdfPaddingRatio:t.sdfPaddingRatio,sdfDecodeCoeff:2*a/s}}function x(t,o,n,r){const e=o*n,i=new Array(e),a=r*r+1;for(let s=0;s<e;++s)i[s]=a;for(const s of t){const t=s.length;for(let e=1;e<t;++e){const t=s[e-1],a=s[e];let l,f,m,c;t[0]<a[0]?(l=t[0],f=a[0]):(l=a[0],f=t[0]),t[1]<a[1]?(m=t[1],c=a[1]):(m=a[1],c=t[1]);let h=Math.floor(l)-r,u=Math.floor(f)+r,d=Math.floor(m)-r,y=Math.floor(c)+r;h<0&&(h=0),u>o&&(u=o),d<0&&(d=0),y>n&&(y=n);const x=a[0]-t[0],M=a[1]-t[1],g=x*x+M*M;for(let r=h;r<u;r++)for(let e=d;e<y;e++){const s=r+.5,l=e+.5;let f,m,c=(s-t[0])*x+(l-t[1])*M;c<0?(f=t[0],m=t[1]):c>g?(f=a[0],m=a[1]):(c/=g,f=t[0]+c*x,m=t[1]+c*M);const h=(s-f)*(s-f)+(l-m)*(l-m),u=(n-e-1)*o+r;h<i[u]&&(i[u]=h)}}}for(let s=0;s<e;++s)i[s]=Math.sqrt(i[s]);return i}function M(t,o,n,r,e){for(const i of t){const t=i.length;for(let a=1;a<t;++a){const t=i[a-1],s=i[a];let l,f,m,c;t[0]<s[0]?(l=t[0],f=s[0]):(l=s[0],f=t[0]),t[1]<s[1]?(m=t[1],c=s[1]):(m=s[1],c=t[1]);let h=Math.floor(l),u=Math.floor(f)+1,d=Math.floor(m),y=Math.floor(c)+1;h<r&&(h=r),u>o-r&&(u=o-r),d<r&&(d=r),y>n-r&&(y=n-r);for(let i=d;i<y;++i){if(t[1]>i==s[1]>i)continue;const a=i+.5,l=(n-i-1)*o;for(let o=h;o<u;++o){o+.5<(s[0]-t[0])*(a-t[1])/(s[1]-t[1])+t[0]&&(e[l+o]=-e[l+o])}for(let t=r;t<h;++t)e[l+t]=-e[l+t]}}}}function g(o,n){const r=2*n,e=o.length,i=new Uint8Array(4*e);for(let a=0;a<e;++a){const n=.5-o[a]/r;t(n,i,4*a)}return i}export{y as buildSDF,c as getExtent,h as getSDFDimensions,s as getSDFInfo,d as getSDFMetrics};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as t}from"../../core/fontUtils.js";import"../../core/has.js";import{clone as r}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{checkForAnimations as l,getAnimationParams as n,handleAbsoluteAnchor as p,handleMarker as c,handleRelativeAnchor as m,getFrameTranslation as y,translate as d,getStaticParam as f,shouldUseAnimatedPath as h}from"./animationUtils.js";import{forEachSymbolLayer as u,CIMSymbolHelper as v}from"./CIMSymbolHelper.js";import{antialiasingOutlineFillSettings as O}from"./constants.js";import{defaultCIMValues as g}from"./defaultCIMValues.js";import{SymbolUnits as _}from"./enums.js";import{fitVectorMarker as S}from"./fitVectorMarker.js";import{OverrideHelper as M}from"./OverrideHelper.js";import{getExtent as k,getSDFMetrics as C,getSDFDimensions as b}from"./SDFHelper.js";import{colorToArray as x,normalizeAlpha as P,getSize as z,isCIMMarkerStrokePlacement as I,hasStrokeLayer as E,getTintColor as L,getNumericValue as V,normalizePrimitiveOverrideProps as N,getDefaultCIMValue as R,getEnum as A,getStrokeWidth as w,getFillColor as G,getStrokeColor as T,fromCIMFontDecoration as F,fromCIMFontStyle as X,fromCIMVerticalAlignment as j,fromCIMHorizontalAlignment as W,getTextCasing as Y,isValidCIMValue as D,uncapitalize as U}from"./utils.js";import{CIMEffectHelper as H}from"./effects/CIMEffectHelper.js";import{rasterizedVectorMarkerMinSize as J,randomInsidePolygonTextureSize as B}from"../../views/2d/engine/webgl/definitions.js";const q=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function K(e){const t=e.markerPlacement;return t&&t.angleToLine?1:0}class Q{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._hasTextStringTemplates=!1,e&&(this._resourceManager=e)}analyzeSymbolReference(t,r,i){if(this._cimLayers=i??[],!t)return this._cimLayers;if(this._reset(),this._hasTextStringTemplates=t.hasTextStringTemplates??!1,t.primitiveOverrides){this._primitiveOverrides=t.primitiveOverrides;for(const t of this._primitiveOverrides){const r=t.valueExpressionInfo;if(r)this._setPoMap(t.primitiveName,t.propertyName,r);else if(null!=t.value){let r=t.value;t.propertyName.includes("Color")&&(e(r)&&(r=x(r)),r=P(r)),this._setPoMap(t.primitiveName,t.propertyName,r)}}}return this._analyzeSymbol(t.symbol,r),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,t){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,t)}}_analyzeMultiLayerSymbol(e,t){const r=e?.symbolLayers;if(!r)return;for(let l=0;l<r.length;l++){const e=r[l];"CIMVectorMarker"===e.type&&(r[l]=S(e))}const i=e.effects;let o=0;const a=z(e)??0;if("CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=1),oe(r,i))return this._analyzeCompositeOutlineFill(r,i,a);let s={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],shift:[1,1,1,1],hasAnimations:l(e),hasShiftAnimation:!1,hasMotionAnimations:!1};s=n(this._poMap,e,s);const p="CIMPolygonSymbol"===e.type;let c=r.length;for(;c--;){const l=r[c];if(!l||!1===l.enable)continue;let n;i?.length&&(n=[...i]);const m=l.effects;m?.length&&(i?n.push(...m):n=[...m]);let y=null;if(n){y=[];for(const e of n){const t=M.findEffectOverrides(e,this._primitiveOverrides);t&&y.push(t)}}const d=[];switch(M.findApplicableOverrides(l,this._primitiveOverrides,d),l.type){case"CIMSolidFill":this._analyzeSolidFill(l,y,s,E(r));break;case"CIMPictureFill":this._analyzePictureFill(l,y,s);break;case"CIMHatchFill":this._analyzeHatchFill(l,y);break;case"CIMGradientFill":this._analyzeGradientFill(l,y);break;case"CIMSolidStroke":this._analyzeSolidStroke(l,y,p,a,s);break;case"CIMPictureStroke":this._analyzePictureStroke(l,y,p,a,s);break;case"CIMGradientStroke":this._analyzeGradientStroke(l,y,p,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=K(l));const r=[],i=l.primitiveName;i&&r.push(i);const n=p&&I(l.markerPlacement);this._analyzeMarker(l,y,null,r,o,a,t,[],s,!1,n);break}default:q().error("Cannot analyze CIM layer",l.type)}}}_analyzeSolidFill(e,t,r,i){const{primitiveName:o,type:a}=e,s=P(e.color),l=n(this._poMap,e,r);if(!i&&t?.some(e=>"CIMGeometricEffectTaperedPolygon"===e.effect.type)){const r=this._getValueOrOverrideExpression(a,o,"Color",s);return void this._cimLayers.push({type:"outlineFill",colorLocked:!!e.colorLocked,color:r,effects:t,outlineColor:r,outlineColorLocked:!!e.colorLocked,...O,outlineEffects:t})}this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(a,o,"Color",s),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1,animationParams:se(l)})}_analyzePictureFill(e,t,r){const{primitiveName:i,type:o}=e,a=L(e),s=V(e.height,g.CIMPictureFill.height);let l=V(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const t=e.width;let r=1;const i=this._resourceManager.getResource(e.url);null!=i&&(r=i.width/i.height),l/=r*(s/t)}const p={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(i,o)},c=n(this._poMap,e,r);this._cimLayers.push({type:"fill",spriteRasterizationParam:p,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,i,"TintColor",a),height:this._getValueOrOverrideExpression(o,i,"Height",s),scaleX:this._getValueOrOverrideExpression(o,i,"ScaleX",l),angle:this._getValueOrOverrideExpression(o,i,"Rotation",V(e.rotation)),offsetX:this._getValueOrOverrideExpression(o,i,"OffsetX",V(e.offsetX)),offsetY:this._getValueOrOverrideExpression(o,i,"OffsetY",V(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1,animationParams:se(c)})}_analyzeHatchFill(e,t){const{primitiveName:r,type:i}=e,o=this._analyzeMaterialOverrides(r,["Rotation","OffsetX","OffsetY"]),a=N(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const p of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==p.type)continue;const e=p.primitiveName??r;l||!e||p.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=P(p.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const t=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(t){let r=null,o=null;"number"==typeof t?r=t:o=t.valueExpressionInfo;let s=a.find(e=>"strokeWidth"===e.propertyName);s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:r,defaultValue:R(i,"width")},a.push(s))}}const n={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:n,colorLocked:!!e.colorLocked,effects:t,color:s,height:this._getValueOrOverrideExpression(i,r,"Separation",V(e.separation,g.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,r,"Rotation",V(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,r,"OffsetX",V(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,r,"OffsetY",V(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,t){const{angle:r,gradientMethod:i,gradientSize:o,gradientSizeUnits:a,gradientType:s,interval:l,primitiveName:n,type:p}=e,c=g.CIMGradientFill,m=e.colorRamp;this._cimLayers.push({type:"gradientFill",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(n,p)},colorLocked:!1,effects:t,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(p,n,"GradientMethod",i??"Linear"),angle:this._getValueOrOverrideExpression(p,n,"Angle",V(r,c.angle)),gradientType:this._getValueOrOverrideExpression(p,n,"GradientType",s??c.gradientType),interval:this._getValueOrOverrideExpression(p,n,"Interval",V(l,"CIMFixedColorRamp"===m.type?m.colors.length:c.interval)),gradientSize:this._getValueOrOverrideExpression(p,n,"GradientSize",V(o,c.gradientSize)),gradientSizeUnits:"Absolute"===a?_.Absolute:"Relative"===a?_.Relative:c.gradientSizeUnits})}_analyzeCompositeOutlineFill(e,t,r){const i=e.find(e=>"CIMSolidFill"===e.type),o=e.find(e=>"CIMSolidStroke"===e.type);if(null==i||null==o)return;const a=[...t??[],...i.effects??[]].map(e=>M.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>null!=e),s=[...t??[],...o.effects??[]].map(e=>M.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>null!=e),l=V(o.width,g.CIMSolidStroke.width),n=A(o.capStyle,g.CIMSolidStroke.capstyle),p=A(o.joinStyle,g.CIMSolidStroke.joinstyle),c=o.miterLimit;this._cimLayers.push({type:"outlineFill",colorLocked:!!i.colorLocked,color:this._getValueOrOverrideExpression(i.type,i.primitiveName,"Color",P(i.color)),effects:a,outlineColorLocked:!!o.colorLocked,outlineColor:this._getValueOrOverrideExpression(o.type,o.primitiveName,"Color",P(o.color)),outlineWidth:this._getValueOrOverrideExpression(o.type,o.primitiveName,"Width",l),cap:this._getValueOrOverrideExpression(o.type,o.primitiveName,"CapStyle",n),join:this._getValueOrOverrideExpression(o.type,o.primitiveName,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(o.type,o.primitiveName,"MiterLimit",c),referenceWidth:r,outlineEffects:s})}_analyzeSolidStroke(e,t,r,i,o){const{primitiveName:a,type:s}=e,l=P(e.color),p=V(e.width,g.CIMSolidStroke.width),c=A(e.capStyle,g.CIMSolidStroke.capstyle),m=A(e.joinStyle,g.CIMSolidStroke.joinstyle),y=e.miterLimit;let d,f,h,u,v=[];if(this._analyzePrimitiveOverrides(a,t,null,null)&&(v=this._getPrimitiveMaterialOverrides(a,s)),t&&Array.isArray(t)&&t.length>0){const e=t[t.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&(d=e.dashTemplate,f=e.scaleDash,h=e.offsetAlongLine,u=e.primitiveName,(t=[...t]).pop())}null!=u&&v.push(...this._getPrimitiveMaterialOverrides(u,s).filter(e=>"dashTemplate"===e.propertyName));const O=void 0!==d?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:d,primitiveName:u},overrides:v}:null,_=n(this._poMap,e,o);this._cimLayers.push({type:"line",spriteRasterizationParam:O,isOutline:r,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(s,a,"Color",l),width:this._getValueOrOverrideExpression(s,a,"Width",p),cap:this._getValueOrOverrideExpression(s,a,"CapStyle",c),join:this._getValueOrOverrideExpression(s,a,"JoinStyle",m),miterLimit:y&&this._getValueOrOverrideExpression(s,a,"MiterLimit",y),referenceWidth:i,zOrder:$(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(u,"DashTemplate")??d,offsetAlongLine:this._getValueOrOverrideExpression(s,u,"OffsetAlongLine",h??0),scaleDash:f,sampleAlphaOnly:!0,animationParams:se(_)})}_analyzePictureStroke(e,t,r,i,o){const{primitiveName:a,type:s}=e,l=L(e),p=V(e.width,g.CIMPictureStroke.width),c=A(e.capStyle,g.CIMPictureStroke.capstyle),m=A(e.joinStyle,g.CIMPictureStroke.joinstyle),y=e.miterLimit,d={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(a,s)},f=n(this._poMap,e,o);this._cimLayers.push({type:"line",spriteRasterizationParam:d,isOutline:r,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(s,a,"TintColor",l),width:this._getValueOrOverrideExpression(s,a,"Width",p),cap:this._getValueOrOverrideExpression(s,a,"CapStyle",c),join:this._getValueOrOverrideExpression(s,a,"JoinStyle",m),miterLimit:y&&this._getValueOrOverrideExpression(s,a,"MiterLimit",y),referenceWidth:i,zOrder:$(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1,animationParams:se(f)})}_analyzeGradientStroke(e,t,r,i){const{gradientMethod:o,gradientSize:a,gradientSizeUnits:s,gradientType:l,interval:n,primitiveName:p,type:c}=e,m=g.CIMGradientStroke,y=V(e.width,m.width),d=A(e.capStyle,m.capstyle),f=A(e.joinStyle,m.joinstyle),h=e.miterLimit,u=e.colorRamp;this._cimLayers.push({type:"gradientStroke",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(p,c)},colorLocked:!!e.colorLocked,effects:t,color:[255,255,255,1],width:this._getValueOrOverrideExpression(c,p,"Width",y),cap:this._getValueOrOverrideExpression(c,p,"CapStyle",d),join:this._getValueOrOverrideExpression(c,p,"JoinStyle",f),miterLimit:h&&this._getValueOrOverrideExpression(c,p,"MiterLimit",h),referenceWidth:i,isOutline:r,gradientMethod:this._getValueOrOverrideExpression(c,p,"GradientMethod",o??m.gradientMethod),gradientType:this._getValueOrOverrideExpression(c,p,"GradientType",l??m.gradientType),interval:this._getValueOrOverrideExpression(c,p,"Interval",V(n,"CIMFixedColorRamp"===u.type?u.colors.length:m.interval)),gradientSize:this._getValueOrOverrideExpression(c,p,"GradientSize",V(a,m.gradientSize)),gradientSizeUnits:"Absolute"===s?_.Absolute:"Relative"===s?_.Relative:m.gradientSizeUnits})}_analyzeMarker(e,t,r,i,o,a,s,l,y,d=!1,f=!1){d||=!!e.colorLocked;let h=y;if(h=p(e,h),h=c(this._poMap,e,h),h=m(e,h),h=n(this._poMap,e,h),this._analyzeMarkerInsidePolygon(e,t,d,h))return;const u=V(e.size,g.CIMVectorMarker.size),v=V(e.rotation),O=V(e.offsetX),_=V(e.offsetY),{primitiveName:S,type:M}=e,k=this._getValueOrOverrideExpression(M,S,"Size",u),C=this._getValueOrOverrideExpression(M,S,"Rotation",v),b=this._getValueOrOverrideExpression(M,S,"OffsetX",O),x=this._getValueOrOverrideExpression(M,S,"OffsetY",_);switch(e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,t,r,i,o,a,k,C,b,x,l,h,d,f);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,t,r,i,o,a,k,C,b,x,l,h,s,d,f)}}_analyzeMarkerInsidePolygon(e,t,r,i){const{markerPlacement:o,type:s}=e;if(!o||"CIMMarkerPlacementInsidePolygon"!==o.type||i.hasMotionAnimations)return!1;if("CIMVectorMarker"===s||"CIMPictureMarker"===s){const r=e.primitiveName;if(r&&this._analyzePrimitiveOverrides([r],t,null,null))return!1;const i=o.primitiveName;if(i&&this._analyzePrimitiveOverrides([i],t,null,null))return!1;if("CIMVectorMarker"===s){const{markerGraphics:t}=e;if(t)for(const e of t){const{symbol:t}=e;if("CIMPolygonSymbol"===t?.type&&t.symbolLayers){const{symbolLayers:e}=t;for(const t of e)if("CIMSolidStroke"===t.type)return!1}}}else{const{animatedSymbolProperties:t}=e;if(t)return!1}}const l=Math.abs(o.stepX),n=Math.abs(o.stepY);if(0===l||0===n)return!0;let p,c;if("Random"===o.gridType){const e=a(B),t=Math.max(Math.floor(e/l),1);p=n*Math.max(Math.floor(e/n),1);c=t*l/p}else o.shiftOddRows?(p=2*n,c=l/n*.5):(p=n,c=l/n);const m=L(e),y="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:y,colorLocked:r,effects:t,color:m,height:p,scaleX:c,angle:o.gridAngle,offsetX:V(o.offsetX),offsetY:V(o.offsetY),applyRandomOffset:"Random"===o.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0,animationParams:se(i)}),!0}_analyzePictureMarker(e,t,i,o,a,l,n,p,c,m,y,d,f,h){const{animatedSymbolProperties:u,primitiveName:v,type:O}=e;let g=V(e.scaleX,1);const _=L(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const S=this._createGIFAnimatedSymbolPropertiesOverrideExpression(u),M=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const t=e.width;let r=1;const i=this._resourceManager.getResource(e.url);null!=i&&(r=i.width/i.height);g/=r*(V(e.size)/t)}const k=[...o];let C;e.primitiveName&&k.push(e.primitiveName),u||S?C={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(C=r(e),C.markerPlacement=null);const b={type:"sprite-rasterization-param",resource:C,overrides:this._getMaterialOverrides(k,O)};S&&b.overrides.push(...S.overrides);const x=n;this._cimLayers.push({type:"marker",spriteRasterizationParam:b,colorLocked:f,effects:t,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(O,v,"ScaleX",g),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:y},color:this._getValueOrOverrideExpression(O,v,"TintColor",_),anchorPoint:{x:M.x,y:M.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:h,markerPlacement:i,animationParams:se(d),baseSize:x})}_analyzeVectorMarker(e,t,r,i,o,a,s,l,p,c,m,h,u,v,O){const g=e.markerGraphics;if(!g)return;const _=e.frame;let S=0;S=_?_.ymax-_.ymin:a;const M=!!e.scaleSymbolsProportionally;if(S){const t={offsetX:p,offsetY:c,rotation:l,size:s,frameHeight:S,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:M};m=[...m,t]}r||(r=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const k of g)if(k){const s=k.symbol;if(!s)continue;const l=k.primitiveName;l&&i.push(l);let p,c=h;if(("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&_){let t=0,r=0;const i=k.geometry;"x"in i&&"y"in i&&(t+=i.x-.5*(_.xmin+_.xmax),r+=i.y-.5*(_.ymin+_.ymax));const o=e.anchorPoint;let a=!1;o&&("Absolute"===e.anchorPointUnits?(t-=o.x,r-=o.y,a=!0):_&&(t-=(_.xmax-_.xmin)*o.x,r-=(_.ymax-_.ymin)*o.y));const s={offsetX:t,offsetY:r,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:M};p=[...m,s]}const g=k.geometry,[C,b]=y(g,_);switch(0===C&&0===b||(c=d(c,C,b)),"CIMPointSymbol"===s.type&&(c=n(this._poMap,s,c)),s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":u||re(s)?(c={...c,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:f([0,0]),rotation:f(0),scale:f(S),parent:h.transform}},this._analyzeMultiLayerGraphicNonSDF(e,t,r,k,i,o,a,p??m,c,S,v,O)):this._analyzeMultiLayerGraphic(e,t,r,k,i,o,a,p??m,c,S,v,O);break;case"CIMTextSymbol":this._analyzeTextGraphic(t,r,k,i,o,a,p??m,v)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,t,r,i,o,a,s,l,n,p,c,m){const y=i.symbol,d=y.symbolLayers;if(d){if(!te(d)||h(n))return ie(d)?(u(y,e=>{e.colorLocked&&(c=!0)}),void this._analyzeMultiLayerGraphicNonSDF(e,t,r,i,o,a,s,l,n,p,c,m)):void this._analyzeMarkerGraphicSymbolLayers(e,t,r,i,o,a,s,l,n,p,c,m);this._analyzeCompositeMarkerGraphic(e,t,r,i,d,a,s,l,p,c,m)}}_analyzeMarkerGraphicSymbolLayers(e,t,r,i,o,a,s,l,p,c,m,y){const d=i.symbol,f=d.symbolLayers;if(!f)return;const h=H.applyEffects(d.effects,i.geometry);if(!h)return;let u=f.length;for(;u--;){const d=f[u];if(!d||!1===d.enable)continue;const v=d.primitiveName;switch(v&&o.push(v),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const o=H.applyEffects(d.effects,h),f=k(o);if(!f)continue;const u="Relative"!==e.anchorPointUnits,O=w(d)??0,{frameSizeRatio:_,anchorX:S,anchorY:M,widthRatio:x,sdfPaddingRatio:z}=C(f,e.frame,e.size,e.anchorPoint,u,O,e.scaleSymbolsProportionally),I="CIMSolidFill"===d.type,E={type:"sdf",geom:o,sdfPaddingRatio:z,asFill:I},{path:L}=d,N=I?P(G(d)):null==L?P(T(d)):[0,0,0,0],R=I?[0,0,0,0]:P(T(d));if(!I&&!O)break;const A=i.primitiveName;let F=null;I&&!d.colorLocked&&(F=this._maybeGetValueOrOverrideExpression(A,"FillColor"));let X=null;I||d.colorLocked||(X=this._maybeGetValueOrOverrideExpression(A,"StrokeColor"));const j=F??this._getValueOrOverrideExpression(d.type,v,"Color",N),W=X??this._getValueOrOverrideExpression(d.type,v,"Color",R),Y=this._maybeGetValueOrOverrideExpression(A,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,v,"Width",O),D=L?{type:"sprite-rasterization-param",resource:{type:"path",path:L,asFill:I},overrides:[]}:{type:"sprite-rasterization-param",resource:E,overrides:[]},U=n(this._poMap,d,p),J=V(e.size,g.CIMVectorMarker.size),B=this._getValueOrOverrideExpression(e.type,e.primitiveName,"Size",J);this._cimLayers.push({type:"marker",spriteRasterizationParam:D,colorLocked:!!d.colorLocked||!!m,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:S,y:M},isAbsoluteAnchorPoint:u,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:c,widthRatio:x,rotateClockwise:!1,referenceSize:s,sizeRatio:_,color:j,outlineColor:W,outlineWidth:Y,isOutline:y,markerPlacement:r,animationParams:se(U),isStroke:"CIMSolidFill"!==d.type,baseSize:B,...b(o,z)});break}case"CIMPictureMarker":case"CIMVectorMarker":if(d.markerPlacement){q().error("Error analyzing CIM, got unexpected marker placement");break}this._analyzeMarker(d,t,r,o,a,s,!1,l,p,m,y)}v&&o.pop()}}_analyzeTextGraphic(e,r,i,o,a,s,l,n){const p=[];M.findApplicableOverrides(i,this._primitiveOverrides,p);const c=i.geometry;if(!("x"in c)||!("y"in c))return;const m=i.symbol,y=F(m),d=X(m.fontStyleName),f=t(m.fontFamilyName);m.font={family:f,decoration:y,...d};const h=V(m.height,g.CIMTextSymbol.height),u=V(m.angle),v=V(m.offsetX),O=V(m.offsetY),{haloSymbol:_}=m,S=V(m.haloSize,0);let k=[0,0,0,0];if(_?.symbolLayers?.length){const e=_.symbolLayers;for(const t of e)if(t.color){k=this._getValueOrOverrideExpression(m?.haloSymbol?.type??"CIMPolygonSymbol",t.primitiveName,"Color",P(t.color));break}}const C=i.primitiveName;let b=[0,0,0,1],x=[0,0,0,0],z=0,I=!1;if(m.symbol?.symbolLayers)for(const t of m.symbol.symbolLayers){const e=t.primitiveName;if("CIMSolidStroke"===t.type)x=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Color",P(t.color)),z=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Width",w(t)??0);else if("CIMSolidFill"===t.type){const r=P(t.color);I=I??!!t.colorLocked,b=this._getValueOrOverrideExpression("CIMSolidFill",e??C,"Color",r)}}let E=null,L=null,N=null,R=null,A=null;C&&(E=this._maybeGetValueOrOverrideExpression(C,"TextSize"),L=this._maybeGetValueOrOverrideExpression(C,"TextAngle"),N=this._maybeGetValueOrOverrideExpression(C,"TextOffsetX"),R=this._maybeGetValueOrOverrideExpression(C,"TextOffsetY"),I||(A=this._maybeGetValueOrOverrideExpression(C,"FillColor")));const G=A??b;let T=null,Y=null,D=0;if(m.callout&&"CIMBackgroundCallout"===m.callout.type){const e=m.callout;if(e.backgroundSymbol){const t=e.backgroundSymbol.symbolLayers;if(t)for(const e of t)"CIMSolidFill"===e.type?T=P(e.color):"CIMSolidStroke"===e.type&&(Y=P(e.color),D=V(e.width,g.CIMSolidStroke.width))}}const U=this._getValueOrOverrideExpression(m.type,i.primitiveName,"TextString",i.textString??"");if(null==U)return;const{fontStyleName:H}=m,J=f+(H?"-"+H.toLowerCase():"-regular"),B=this._getMaterialOverrides(o,m.type);B.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,m.type)),this._collectDictionaryTemplateOverrides(B,i);const q={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:m.font,symbol:m,primitiveName:i.primitiveName},overrides:B};this._cimLayers.push({type:"text",lineWidth:m.lineWidth,textRasterizationParam:q,colorLocked:!!n||!!I,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:J,decoration:y,haloSize:S,haloColor:k,weight:d.weight,style:d.style,size:E??h,angle:L??u,offsetX:N??v,offsetY:R??O,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:W(m.horizontalAlignment),verticalAlignment:j(m.verticalAlignment),text:U,color:G,outlineColor:x,outlineSize:z,backgroundColor:T,borderLineColor:Y,borderLineWidth:D,referenceSize:s,sizeRatio:1,markerPlacement:r})}_collectDictionaryTemplateOverrides(e,t){if(t.textString&&this._hasTextStringTemplates){const r=Y(t.symbol);e.push({propertyName:"textString",defaultValue:"",valueExpressionInfo:{type:"dictionary-template",textCase:r,template:t.textString},primitiveName:t.primitiveName})}}_analyzeMultiLayerGraphicNonSDF(e,t,r,i,a,s,l,n,p,c,m,y){const d=Z(e,i),f=e.primitiveName,h=this._analyzeMaterialOverrides(f,["Rotation","OffsetX","OffsetY"]),u=N(h),[O,_,S]=v.getTextureAnchor(d,this._resourceManager,J),M=this._getMaterialOverrides(a,e.type);M.push(...u);const k={type:"sprite-rasterization-param",resource:{...d,avoidSDFRasterization:!0},overrides:M},C=V(e.size,g.CIMVectorMarker.size),b=this._getValueOrOverrideExpression(e.type,f,"Size",C);this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:m,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:O,y:_},isAbsoluteAnchorPoint:!1,size:c,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:n},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:c,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:S/o(e.size),isOutline:y,markerPlacement:r,animationParams:se(p),baseSize:b})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const t=[];return M.findApplicableOverrides(e,this._primitiveOverrides,t),{type:"cim-marker-placement-param",placement:e,overrides:ae(t)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const t=[];return M.findApplicableOverrides(e,this._primitiveOverrides,t),{type:"cim-gif-animation-params",animation:e,overrides:ae(t)}}_analyzeCompositeMarkerGraphic(e,t,r,i,o,a,s,l,n,p,c){const m=i.geometry,y=o[0],d=o[1],f=k(m);if(!f)return;const h="Relative"!==e.anchorPointUnits,u=V(y.width,g.CIMSolidStroke.width),{frameSizeRatio:v,anchorX:O,anchorY:_,widthRatio:S,sdfPaddingRatio:M}=C(f,e.frame,e.size,e.anchorPoint,h,u,e.scaleSymbolsProportionally),{path:b}=d,x=d.primitiveName,z=y.primitiveName,I=i.primitiveName;let E=null;d.colorLocked||p||(E=this._maybeGetValueOrOverrideExpression(I,"FillColor"));const L=E??this._getValueOrOverrideExpression(d.type,x,"Color",P(d.color));let N=null;y.colorLocked||p||(N=this._maybeGetValueOrOverrideExpression(I,"StrokeColor"));const R=N??this._getValueOrOverrideExpression(y.type,z,"Color",P(y.color)),A=this._maybeGetValueOrOverrideExpression(I,"StrokeWidth")??this._getValueOrOverrideExpression(y.type,z,"Width",u),w={type:"sprite-rasterization-param",resource:b?{type:"path",path:b,asFill:!0}:{type:"sdf",geom:m,sdfPaddingRatio:M,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:w,colorLocked:p,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:O,y:_},isAbsoluteAnchorPoint:h,size:n,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:n,widthRatio:S,rotateClockwise:!1,referenceSize:s,sizeRatio:v,color:L,outlineColor:R,outlineWidth:A,isOutline:c,markerPlacement:r})}_setPoMap(e,t,r){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[t]=r}_maybeGetValueOrOverrideExpression(e,t,r){return this._getValueOrOverrideExpression("",e,t,r,!1)}_getValueOrOverrideExpression(e,t,r,i,o=!0){if(o&&!D(i)&&(i=R(e,r.toLowerCase())),null==t)return i;const a=this._poMap[t];if(null==a)return i;const s=a[r];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,t,r,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,t){if(!e)return[];const r=[];for(const i of e)r.push(...this._getPrimitiveMaterialOverrides(i,t));return r}_getPrimitiveMaterialOverrides(e,t){if(!e)return[];const r=N(this._primitiveOverrides.filter(t=>t.primitiveName===e));return r.forEach(e=>e.defaultValue=R(t,e.propertyName.toLowerCase())),r}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter(r=>r.primitiveName!==e||!t.includes(r.propertyName))}}function Z(e,t){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[t],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function $(e){if(e?.startsWith("Level_")){const t=parseInt(e.slice(6),10);if(!isNaN(t))return t}return 0}function ee(e,t){if(!t||0===t.length)return e;const i=r(e);return M.applyOverrides(i,t),i}const te=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function re(e){const t=e.symbolLayers;if(!t)return!1;const r=t.find(e=>e.effects?.find(e=>"CIMGeometricEffectDashes"===e.type&&null!=e.dashTemplate)),i=t.find(e=>e.effects?.find(e=>"CIMGeometricEffectAddControlPoints"===e.type));return!!r||!!i}function ie(e){return e.some(e=>"CIMSolidFill"!==e.type&&"CIMSolidStroke"!==e.type&&("CIMVectorMarker"!==e.type&&"CIMPictureMarker"!==e.type||null!=e.markerPlacement))}function oe(e,t){if(t?.some(e=>"CIMGeometricEffectRadial"===e.type)&&t?.some(e=>"CIMGeometricEffectTaperedPolygon"===e.type)&&2===e.length){const t=e.find(e=>"CIMSolidFill"===e.type),r=e.find(e=>"CIMSolidStroke"===e.type),i=r?.effects?.some(e=>"CIMGeometricEffectDashes"===e.type);if(null!=t&&null!=r&&!i)return!0}return!1}function ae(e){return r(e).map(e=>({...e,propertyName:U(e.propertyName)}))}function se(e){return h(e)?{type:"animation-params",params:e}:null}export{Q as CIMAnalyzer,ee as analyzeCIMResource};
5
+ import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as t}from"../../core/fontUtils.js";import"../../core/has.js";import{clone as r}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{checkForAnimations as l,getAnimationParams as n,handleAbsoluteAnchor as p,handleMarker as c,handleRelativeAnchor as m,getFrameTranslation as d,translate as y,getStaticParam as f,shouldUseAnimatedPath as h}from"./animationUtils.js";import{forEachSymbolLayer as u,CIMSymbolHelper as v}from"./CIMSymbolHelper.js";import{antialiasingOutlineFillSettings as O}from"./constants.js";import{defaultCIMValues as g}from"./defaultCIMValues.js";import{SymbolUnits as S}from"./enums.js";import{fitVectorMarker as _}from"./fitVectorMarker.js";import{OverrideHelper as M}from"./OverrideHelper.js";import{getExtent as k,getSDFMetrics as C,getSDFDimensions as b}from"./SDFHelper.js";import{colorToArray as x,normalizeAlpha as P,getSize as z,isCIMMarkerStrokePlacement as I,hasStrokeLayer as E,getTintColor as L,getNumericValue as V,normalizePrimitiveOverrideProps as N,getDefaultCIMValue as R,getEnum as A,getFillColor as T,getStrokeColor as w,fromCIMFontDecoration as G,fromCIMFontStyle as F,getStrokeWidth as X,fromCIMVerticalAlignment as j,fromCIMHorizontalAlignment as W,getTextCasing as Y,isValidCIMValue as D,uncapitalize as U}from"./utils.js";import{CIMEffectHelper as H}from"./effects/CIMEffectHelper.js";import{rasterizedVectorMarkerMinSize as J,randomInsidePolygonTextureSize as B}from"../../views/2d/engine/webgl/definitions.js";const q=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function K(e){const t=e.markerPlacement;return t&&t.angleToLine?1:0}class Q{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._hasTextStringTemplates=!1,e&&(this._resourceManager=e)}analyzeSymbolReference(t,r,i){if(this._cimLayers=i??[],!t)return this._cimLayers;if(this._reset(),this._hasTextStringTemplates=t.hasTextStringTemplates??!1,t.primitiveOverrides){this._primitiveOverrides=t.primitiveOverrides;for(const t of this._primitiveOverrides){const r=t.valueExpressionInfo;if(r)this._setPoMap(t.primitiveName,t.propertyName,r);else if(null!=t.value){let r=t.value;t.propertyName.includes("Color")&&(e(r)&&(r=x(r)),r=P(r)),this._setPoMap(t.primitiveName,t.propertyName,r)}}}return this._analyzeSymbol(t.symbol,r),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,t){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,t)}}_analyzeMultiLayerSymbol(e,t){const r=e?.symbolLayers;if(!r)return;for(let l=0;l<r.length;l++){const e=r[l];"CIMVectorMarker"===e.type&&(r[l]=_(e))}const i=e.effects;let o=0;const a=z(e)??0;if("CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=1),oe(r,i))return this._analyzeCompositeOutlineFill(r,i,a);let s={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],shift:[1,1,1,1],hasAnimations:l(e),hasShiftAnimation:!1,hasMotionAnimations:!1};s=n(this._poMap,e,s);const p="CIMPolygonSymbol"===e.type;let c=r.length;for(;c--;){const l=r[c];if(!l||!1===l.enable)continue;let n;i?.length&&(n=[...i]);const m=l.effects;m?.length&&(i?n.push(...m):n=[...m]);let d=null;if(n){d=[];for(const e of n){const t=M.findEffectOverrides(e,this._primitiveOverrides);t&&d.push(t)}}const y=[];switch(M.findApplicableOverrides(l,this._primitiveOverrides,y),l.type){case"CIMSolidFill":this._analyzeSolidFill(l,d,s,E(r));break;case"CIMPictureFill":this._analyzePictureFill(l,d,s);break;case"CIMHatchFill":this._analyzeHatchFill(l,d);break;case"CIMGradientFill":this._analyzeGradientFill(l,d);break;case"CIMSolidStroke":this._analyzeSolidStroke(l,d,p,a,s);break;case"CIMPictureStroke":this._analyzePictureStroke(l,d,p,a,s);break;case"CIMGradientStroke":this._analyzeGradientStroke(l,d,p,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=K(l));const r=[],i=l.primitiveName;i&&r.push(i);const n=p&&I(l.markerPlacement);this._analyzeMarker(l,d,null,r,o,a,t,[],s,!1,n);break}default:q().error("Cannot analyze CIM layer",l.type)}}}_analyzeSolidFill(e,t,r,i){const{primitiveName:o,type:a}=e,s=P(e.color),l=n(this._poMap,e,r);if(!i&&t?.some(e=>"CIMGeometricEffectTaperedPolygon"===e.effect.type)){const r=this._getValueOrOverrideExpression(a,o,"Color",s);return void this._cimLayers.push({type:"outlineFill",colorLocked:!!e.colorLocked,color:r,effects:t,outlineColor:r,outlineColorLocked:!!e.colorLocked,...O,outlineEffects:t})}this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(a,o,"Color",s),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1,animationParams:se(l)})}_analyzePictureFill(e,t,r){const{primitiveName:i,type:o}=e,a=L(e),s=V(e.height,g.CIMPictureFill.height);let l=V(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const t=e.width;let r=1;const i=this._resourceManager.getResource(e.url);null!=i&&(r=i.width/i.height),l/=r*(s/t)}const p={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(i,o)},c=n(this._poMap,e,r);this._cimLayers.push({type:"fill",spriteRasterizationParam:p,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,i,"TintColor",a),height:this._getValueOrOverrideExpression(o,i,"Height",s),scaleX:this._getValueOrOverrideExpression(o,i,"ScaleX",l),angle:this._getValueOrOverrideExpression(o,i,"Rotation",V(e.rotation)),offsetX:this._getValueOrOverrideExpression(o,i,"OffsetX",V(e.offsetX)),offsetY:this._getValueOrOverrideExpression(o,i,"OffsetY",V(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1,animationParams:se(c)})}_analyzeHatchFill(e,t){const{primitiveName:r,type:i}=e,o=this._analyzeMaterialOverrides(r,["Rotation","OffsetX","OffsetY"]),a=N(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const p of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==p.type)continue;const e=p.primitiveName??r;l||!e||p.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=P(p.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const t=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(t){let r=null,o=null;"number"==typeof t?r=t:o=t.valueExpressionInfo;let s=a.find(e=>"strokeWidth"===e.propertyName);s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:r,defaultValue:R(i,"width")},a.push(s))}}const n={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:n,colorLocked:!!e.colorLocked,effects:t,color:s,height:this._getValueOrOverrideExpression(i,r,"Separation",V(e.separation,g.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,r,"Rotation",V(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,r,"OffsetX",V(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,r,"OffsetY",V(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,t){const{angle:r,gradientMethod:i,gradientSize:o,gradientSizeUnits:a,gradientType:s,interval:l,primitiveName:n,type:p}=e,c=g.CIMGradientFill,m=e.colorRamp;this._cimLayers.push({type:"gradientFill",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(n,p)},colorLocked:!1,effects:t,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(p,n,"GradientMethod",i??"Linear"),angle:this._getValueOrOverrideExpression(p,n,"Angle",V(r,c.angle)),gradientType:this._getValueOrOverrideExpression(p,n,"GradientType",s??c.gradientType),interval:this._getValueOrOverrideExpression(p,n,"Interval",V(l,"CIMFixedColorRamp"===m.type?m.colors.length:c.interval)),gradientSize:this._getValueOrOverrideExpression(p,n,"GradientSize",V(o,c.gradientSize)),gradientSizeUnits:"Absolute"===a?S.Absolute:"Relative"===a?S.Relative:c.gradientSizeUnits})}_analyzeCompositeOutlineFill(e,t,r){const i=e.find(e=>"CIMSolidFill"===e.type),o=e.find(e=>"CIMSolidStroke"===e.type);if(null==i||null==o)return;const a=[...t??[],...i.effects??[]].map(e=>M.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>null!=e),s=[...t??[],...o.effects??[]].map(e=>M.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>null!=e),l=V(o.width,g.CIMSolidStroke.width),n=A(o.capStyle,g.CIMSolidStroke.capstyle),p=A(o.joinStyle,g.CIMSolidStroke.joinstyle),c=o.miterLimit;this._cimLayers.push({type:"outlineFill",colorLocked:!!i.colorLocked,color:this._getValueOrOverrideExpression(i.type,i.primitiveName,"Color",P(i.color)),effects:a,outlineColorLocked:!!o.colorLocked,outlineColor:this._getValueOrOverrideExpression(o.type,o.primitiveName,"Color",P(o.color)),outlineWidth:this._getValueOrOverrideExpression(o.type,o.primitiveName,"Width",l),cap:this._getValueOrOverrideExpression(o.type,o.primitiveName,"CapStyle",n),join:this._getValueOrOverrideExpression(o.type,o.primitiveName,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(o.type,o.primitiveName,"MiterLimit",c),referenceWidth:r,outlineEffects:s})}_analyzeSolidStroke(e,t,r,i,o){const{primitiveName:a,type:s}=e,l=P(e.color),p=V(e.width,g.CIMSolidStroke.width),c=A(e.capStyle,g.CIMSolidStroke.capstyle),m=A(e.joinStyle,g.CIMSolidStroke.joinstyle),d=e.miterLimit;let y,f,h,u,v=[];if(this._analyzePrimitiveOverrides(a,t,null,null)&&(v=this._getPrimitiveMaterialOverrides(a,s)),t&&Array.isArray(t)&&t.length>0){const e=t[t.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&(y=e.dashTemplate,f=e.scaleDash,h=e.offsetAlongLine,u=e.primitiveName,(t=[...t]).pop())}null!=u&&v.push(...this._getPrimitiveMaterialOverrides(u,s).filter(e=>"dashTemplate"===e.propertyName));const O=void 0!==y?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:y,primitiveName:u},overrides:v}:null,S=n(this._poMap,e,o);this._cimLayers.push({type:"line",spriteRasterizationParam:O,isOutline:r,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(s,a,"Color",l),width:this._getValueOrOverrideExpression(s,a,"Width",p),cap:this._getValueOrOverrideExpression(s,a,"CapStyle",c),join:this._getValueOrOverrideExpression(s,a,"JoinStyle",m),miterLimit:d&&this._getValueOrOverrideExpression(s,a,"MiterLimit",d),referenceWidth:i,zOrder:$(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(u,"DashTemplate")??y,offsetAlongLine:this._getValueOrOverrideExpression(s,u,"OffsetAlongLine",h??0),scaleDash:f,sampleAlphaOnly:!0,animationParams:se(S)})}_analyzePictureStroke(e,t,r,i,o){const{primitiveName:a,type:s}=e,l=L(e),p=V(e.width,g.CIMPictureStroke.width),c=A(e.capStyle,g.CIMPictureStroke.capstyle),m=A(e.joinStyle,g.CIMPictureStroke.joinstyle),d=e.miterLimit,y={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(a,s)},f=n(this._poMap,e,o);this._cimLayers.push({type:"line",spriteRasterizationParam:y,isOutline:r,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(s,a,"TintColor",l),width:this._getValueOrOverrideExpression(s,a,"Width",p),cap:this._getValueOrOverrideExpression(s,a,"CapStyle",c),join:this._getValueOrOverrideExpression(s,a,"JoinStyle",m),miterLimit:d&&this._getValueOrOverrideExpression(s,a,"MiterLimit",d),referenceWidth:i,zOrder:$(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1,animationParams:se(f)})}_analyzeGradientStroke(e,t,r,i){const{gradientMethod:o,gradientSize:a,gradientSizeUnits:s,gradientType:l,interval:n,primitiveName:p,type:c}=e,m=g.CIMGradientStroke,d=V(e.width,m.width),y=A(e.capStyle,m.capstyle),f=A(e.joinStyle,m.joinstyle),h=e.miterLimit,u=e.colorRamp;this._cimLayers.push({type:"gradientStroke",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(p,c)},colorLocked:!!e.colorLocked,effects:t,color:[255,255,255,1],width:this._getValueOrOverrideExpression(c,p,"Width",d),cap:this._getValueOrOverrideExpression(c,p,"CapStyle",y),join:this._getValueOrOverrideExpression(c,p,"JoinStyle",f),miterLimit:h&&this._getValueOrOverrideExpression(c,p,"MiterLimit",h),referenceWidth:i,isOutline:r,gradientMethod:this._getValueOrOverrideExpression(c,p,"GradientMethod",o??m.gradientMethod),gradientType:this._getValueOrOverrideExpression(c,p,"GradientType",l??m.gradientType),interval:this._getValueOrOverrideExpression(c,p,"Interval",V(n,"CIMFixedColorRamp"===u.type?u.colors.length:m.interval)),gradientSize:this._getValueOrOverrideExpression(c,p,"GradientSize",V(a,m.gradientSize)),gradientSizeUnits:"Absolute"===s?S.Absolute:"Relative"===s?S.Relative:m.gradientSizeUnits})}_analyzeMarker(e,t,r,i,o,a,s,l,d,y=!1,f=!1){y||=!!e.colorLocked;let h=d;if(h=p(e,h),h=c(this._poMap,e,h),h=m(e,h),h=n(this._poMap,e,h),this._analyzeMarkerInsidePolygon(e,t,y,h))return;const u=V(e.size,g.CIMVectorMarker.size),v=V(e.rotation),O=V(e.offsetX),S=V(e.offsetY),{primitiveName:_,type:M}=e,k=this._getValueOrOverrideExpression(M,_,"Size",u),C=this._getValueOrOverrideExpression(M,_,"Rotation",v),b=this._getValueOrOverrideExpression(M,_,"OffsetX",O),x=this._getValueOrOverrideExpression(M,_,"OffsetY",S);switch(e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,t,r,i,o,a,k,C,b,x,l,h,y,f);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,t,r,i,o,a,k,C,b,x,l,h,s,y,f)}}_analyzeMarkerInsidePolygon(e,t,r,i){const{markerPlacement:o,type:s}=e;if(!o||"CIMMarkerPlacementInsidePolygon"!==o.type||i.hasMotionAnimations)return!1;if("CIMVectorMarker"===s||"CIMPictureMarker"===s){const r=e.primitiveName;if(r&&this._analyzePrimitiveOverrides([r],t,null,null))return!1;const i=o.primitiveName;if(i&&this._analyzePrimitiveOverrides([i],t,null,null))return!1;if("CIMVectorMarker"===s){const{markerGraphics:t}=e;if(t)for(const e of t){const{symbol:t}=e;if("CIMPolygonSymbol"===t?.type&&t.symbolLayers){const{symbolLayers:e}=t;for(const t of e)if("CIMSolidStroke"===t.type)return!1}}}else{const{animatedSymbolProperties:t}=e;if(t)return!1}}const l=Math.abs(o.stepX),n=Math.abs(o.stepY);if(0===l||0===n)return!0;let p,c;if("Random"===o.gridType){const e=a(B),t=Math.max(Math.floor(e/l),1);p=n*Math.max(Math.floor(e/n),1);c=t*l/p}else o.shiftOddRows?(p=2*n,c=l/n*.5):(p=n,c=l/n);const m=L(e),d="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:d,colorLocked:r,effects:t,color:m,height:p,scaleX:c,angle:o.gridAngle,offsetX:V(o.offsetX),offsetY:V(o.offsetY),applyRandomOffset:"Random"===o.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0,animationParams:se(i)}),!0}_analyzePictureMarker(e,t,i,o,a,l,n,p,c,m,d,y,f,h){const{animatedSymbolProperties:u,primitiveName:v,type:O}=e;let g=V(e.scaleX,1);const S=L(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const _=this._createGIFAnimatedSymbolPropertiesOverrideExpression(u),M=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const t=e.width;let r=1;const i=this._resourceManager.getResource(e.url);null!=i&&(r=i.width/i.height);g/=r*(V(e.size)/t)}const k=[...o];let C;e.primitiveName&&k.push(e.primitiveName),u||_?C={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(C=r(e),C.markerPlacement=null);const b={type:"sprite-rasterization-param",resource:C,overrides:this._getMaterialOverrides(k,O)};_&&b.overrides.push(..._.overrides);const x=n;this._cimLayers.push({type:"marker",spriteRasterizationParam:b,colorLocked:f,effects:t,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(O,v,"ScaleX",g),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:d},color:this._getValueOrOverrideExpression(O,v,"TintColor",S),anchorPoint:{x:M.x,y:M.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:h,markerPlacement:i,animationParams:se(y),baseSize:x})}_analyzeVectorMarker(e,t,r,i,o,a,s,l,p,c,m,h,u,v,O){const g=e.markerGraphics;if(!g)return;const S=e.frame;let _=0;_=S?S.ymax-S.ymin:a;const M=!!e.scaleSymbolsProportionally;if(_){const t={offsetX:p,offsetY:c,rotation:l,size:s,frameHeight:_,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:M};m=[...m,t]}r||(r=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const k of g)if(k){const s=k.symbol;if(!s)continue;const l=k.primitiveName;l&&i.push(l);let p,c=h;if(("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&S){let t=0,r=0;const i=k.geometry;"x"in i&&"y"in i&&(t+=i.x-.5*(S.xmin+S.xmax),r+=i.y-.5*(S.ymin+S.ymax));const o=e.anchorPoint;let a=!1;o&&("Absolute"===e.anchorPointUnits?(t-=o.x,r-=o.y,a=!0):S&&(t-=(S.xmax-S.xmin)*o.x,r-=(S.ymax-S.ymin)*o.y));const s={offsetX:t,offsetY:r,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:M};p=[...m,s]}const g=k.geometry,[C,b]=d(g,S);switch(0===C&&0===b||(c=y(c,C,b)),"CIMPointSymbol"===s.type&&(c=n(this._poMap,s,c)),s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":u||re(s)?(c={...c,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:f([0,0]),rotation:f(0),scale:f(_),parent:h.transform}},this._analyzeMultiLayerGraphicNonSDF(e,t,r,k,i,o,a,p??m,c,_,v,O)):this._analyzeMultiLayerGraphic(e,t,r,k,i,o,a,p??m,c,_,v,O);break;case"CIMTextSymbol":this._analyzeTextGraphic(t,r,k,i,o,a,p??m,v)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,t,r,i,o,a,s,l,n,p,c,m){const d=i.symbol,y=d.symbolLayers;if(y){if(!te(y)||h(n))return ie(y)?(u(d,e=>{e.colorLocked&&(c=!0)}),void this._analyzeMultiLayerGraphicNonSDF(e,t,r,i,o,a,s,l,n,p,c,m)):void this._analyzeMarkerGraphicSymbolLayers(e,t,r,i,o,a,s,l,n,p,c,m);this._analyzeCompositeMarkerGraphic(e,t,r,i,y,a,s,l,p,c,m)}}_analyzeMarkerGraphicSymbolLayers(e,t,r,i,o,a,s,l,p,c,m,d){const y=i.symbol,f=y.symbolLayers;if(!f)return;const h=H.applyEffects(y.effects,i.geometry);if(!h)return;let u=f.length;for(;u--;){const y=f[u];if(!y||!1===y.enable)continue;const v=y.primitiveName;switch(v&&o.push(v),y.type){case"CIMSolidFill":case"CIMSolidStroke":{const o=H.applyEffects(y.effects,h),f=k(o);if(!f)continue;const u="Relative"!==e.anchorPointUnits,O="CIMSolidStroke"===y.type?y.width:0,{frameSizeRatio:S,anchorX:_,anchorY:M,widthRatio:x,sdfPaddingRatio:z,sdfTextureSize:I}=C(f,e.frame,e.size,e.anchorPoint,u,O,e.scaleSymbolsProportionally),E="CIMSolidFill"===y.type,L={type:"sdf",geometry:o,sdfPaddingRatio:z,asFill:E,sdfTextureSize:I},{path:N}=y,R=E?P(T(y)):null==N?P(w(y)):[0,0,0,0],A=E?[0,0,0,0]:P(w(y));if(!E&&!O)break;const G=i.primitiveName;let F=null;E&&!y.colorLocked&&(F=this._maybeGetValueOrOverrideExpression(G,"FillColor"));let X=null;E||y.colorLocked||(X=this._maybeGetValueOrOverrideExpression(G,"StrokeColor"));const j=F??this._getValueOrOverrideExpression(y.type,v,"Color",R),W=X??this._getValueOrOverrideExpression(y.type,v,"Color",A),Y=this._maybeGetValueOrOverrideExpression(G,"StrokeWidth")??this._getValueOrOverrideExpression(y.type,v,"Width",O),D=N?{type:"sprite-rasterization-param",resource:{type:"path",path:N,asFill:E},overrides:[]}:{type:"sprite-rasterization-param",resource:L,overrides:[]},U=n(this._poMap,y,p),J=V(e.size,g.CIMVectorMarker.size),B=this._getValueOrOverrideExpression(e.type,e.primitiveName,"Size",J);this._cimLayers.push({type:"marker",spriteRasterizationParam:D,colorLocked:!!y.colorLocked||!!m,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:_,y:M},isAbsoluteAnchorPoint:u,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:c,widthRatio:x,rotateClockwise:!1,referenceSize:s,sizeRatio:S,color:j,outlineColor:W,outlineWidth:Y,isOutline:d,markerPlacement:r,animationParams:se(U),isStroke:"CIMSolidFill"!==y.type,baseSize:B,...b(o,I,z)});break}case"CIMPictureMarker":case"CIMVectorMarker":if(y.markerPlacement){q().error("Error analyzing CIM, got unexpected marker placement");break}this._analyzeMarker(y,t,r,o,a,s,!1,l,p,m,d)}v&&o.pop()}}_analyzeTextGraphic(e,r,i,o,a,s,l,n){const p=[];M.findApplicableOverrides(i,this._primitiveOverrides,p);const c=i.geometry;if(!("x"in c)||!("y"in c))return;const m=i.symbol,d=G(m),y=F(m.fontStyleName),f=t(m.fontFamilyName);m.font={family:f,decoration:d,...y};const h=V(m.height,g.CIMTextSymbol.height),u=V(m.angle),v=V(m.offsetX),O=V(m.offsetY),{haloSymbol:S}=m,_=V(m.haloSize,0);let k=[0,0,0,0];if(S?.symbolLayers?.length){const e=S.symbolLayers;for(const t of e)if(t.color){k=this._getValueOrOverrideExpression(m?.haloSymbol?.type??"CIMPolygonSymbol",t.primitiveName,"Color",P(t.color));break}}const C=i.primitiveName;let b=[0,0,0,1],x=[0,0,0,0],z=0,I=!1;if(m.symbol?.symbolLayers)for(const t of m.symbol.symbolLayers){const e=t.primitiveName;if("CIMSolidStroke"===t.type)x=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Color",P(t.color)),z=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Width",X(t)??0);else if("CIMSolidFill"===t.type){const r=P(t.color);I=I??!!t.colorLocked,b=this._getValueOrOverrideExpression("CIMSolidFill",e??C,"Color",r)}}let E=null,L=null,N=null,R=null,A=null;C&&(E=this._maybeGetValueOrOverrideExpression(C,"TextSize"),L=this._maybeGetValueOrOverrideExpression(C,"TextAngle"),N=this._maybeGetValueOrOverrideExpression(C,"TextOffsetX"),R=this._maybeGetValueOrOverrideExpression(C,"TextOffsetY"),I||(A=this._maybeGetValueOrOverrideExpression(C,"FillColor")));const T=A??b;let w=null,Y=null,D=0;if(m.callout&&"CIMBackgroundCallout"===m.callout.type){const e=m.callout;if(e.backgroundSymbol){const t=e.backgroundSymbol.symbolLayers;if(t)for(const e of t)"CIMSolidFill"===e.type?w=P(e.color):"CIMSolidStroke"===e.type&&(Y=P(e.color),D=V(e.width,g.CIMSolidStroke.width))}}const U=this._getValueOrOverrideExpression(m.type,i.primitiveName,"TextString",i.textString??"");if(null==U)return;const{fontStyleName:H}=m,J=f+(H?"-"+H.toLowerCase():"-regular"),B=this._getMaterialOverrides(o,m.type);B.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,m.type)),this._collectDictionaryTemplateOverrides(B,i);const q={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:m.font,symbol:m,primitiveName:i.primitiveName},overrides:B};this._cimLayers.push({type:"text",lineWidth:m.lineWidth,textRasterizationParam:q,colorLocked:!!n||!!I,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:J,decoration:d,haloSize:_,haloColor:k,weight:y.weight,style:y.style,size:E??h,angle:L??u,offsetX:N??v,offsetY:R??O,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:W(m.horizontalAlignment),verticalAlignment:j(m.verticalAlignment),text:U,color:T,outlineColor:x,outlineSize:z,backgroundColor:w,borderLineColor:Y,borderLineWidth:D,referenceSize:s,sizeRatio:1,markerPlacement:r})}_collectDictionaryTemplateOverrides(e,t){if(t.textString&&this._hasTextStringTemplates){const r=Y(t.symbol);e.push({propertyName:"textString",defaultValue:"",valueExpressionInfo:{type:"dictionary-template",textCase:r,template:t.textString},primitiveName:t.primitiveName})}}_analyzeMultiLayerGraphicNonSDF(e,t,r,i,a,s,l,n,p,c,m,d){const y=Z(e,i),f=e.primitiveName,h=this._analyzeMaterialOverrides(f,["Rotation","OffsetX","OffsetY"]),u=N(h),[O,S,_]=v.getTextureAnchor(y,this._resourceManager,J),M=this._getMaterialOverrides(a,e.type);M.push(...u);const k={type:"sprite-rasterization-param",resource:{...y,avoidSDFRasterization:!0},overrides:M},C=V(e.size,g.CIMVectorMarker.size),b=this._getValueOrOverrideExpression(e.type,f,"Size",C);this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:m,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:O,y:S},isAbsoluteAnchorPoint:!1,size:c,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:n},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:c,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:_/o(e.size),isOutline:d,markerPlacement:r,animationParams:se(p),baseSize:b})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const t=[];return M.findApplicableOverrides(e,this._primitiveOverrides,t),{type:"cim-marker-placement-param",placement:e,overrides:ae(t)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const t=[];return M.findApplicableOverrides(e,this._primitiveOverrides,t),{type:"cim-gif-animation-params",animation:e,overrides:ae(t)}}_analyzeCompositeMarkerGraphic(e,t,r,i,o,a,s,l,n,p,c){const m=i.geometry,d=o[0],y=o[1],f=k(m);if(!f)return;const h="Relative"!==e.anchorPointUnits,u=V(d.width,g.CIMSolidStroke.width),{frameSizeRatio:v,anchorX:O,anchorY:S,widthRatio:_,sdfPaddingRatio:M,sdfTextureSize:b}=C(f,e.frame,e.size,e.anchorPoint,h,u,e.scaleSymbolsProportionally),{path:x}=y,z=y.primitiveName,I=d.primitiveName,E=i.primitiveName;let L=null;y.colorLocked||p||(L=this._maybeGetValueOrOverrideExpression(E,"FillColor"));const N=L??this._getValueOrOverrideExpression(y.type,z,"Color",P(y.color));let R=null;d.colorLocked||p||(R=this._maybeGetValueOrOverrideExpression(E,"StrokeColor"));const A=R??this._getValueOrOverrideExpression(d.type,I,"Color",P(d.color)),T=this._maybeGetValueOrOverrideExpression(E,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,I,"Width",u),w={type:"sprite-rasterization-param",resource:x?{type:"path",path:x,asFill:!0}:{type:"sdf",geometry:m,sdfTextureSize:b,sdfPaddingRatio:M,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:w,colorLocked:p,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:O,y:S},isAbsoluteAnchorPoint:h,size:n,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:n,widthRatio:_,rotateClockwise:!1,referenceSize:s,sizeRatio:v,color:N,outlineColor:A,outlineWidth:T,isOutline:c,markerPlacement:r})}_setPoMap(e,t,r){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[t]=r}_maybeGetValueOrOverrideExpression(e,t,r){return this._getValueOrOverrideExpression("",e,t,r,!1)}_getValueOrOverrideExpression(e,t,r,i,o=!0){if(o&&!D(i)&&(i=R(e,r.toLowerCase())),null==t)return i;const a=this._poMap[t];if(null==a)return i;const s=a[r];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,t,r,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,t){if(!e)return[];const r=[];for(const i of e)r.push(...this._getPrimitiveMaterialOverrides(i,t));return r}_getPrimitiveMaterialOverrides(e,t){if(!e)return[];const r=N(this._primitiveOverrides.filter(t=>t.primitiveName===e));return r.forEach(e=>e.defaultValue=R(t,e.propertyName.toLowerCase())),r}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter(r=>r.primitiveName!==e||!t.includes(r.propertyName))}}function Z(e,t){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[t],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function $(e){if(e?.startsWith("Level_")){const t=parseInt(e.slice(6),10);if(!isNaN(t))return t}return 0}function ee(e,t){if(!t||0===t.length)return e;const i=r(e);return M.applyOverrides(i,t),i}const te=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function re(e){const t=e.symbolLayers;if(!t)return!1;const r=t.find(e=>e.effects?.find(e=>"CIMGeometricEffectDashes"===e.type&&null!=e.dashTemplate)),i=t.find(e=>e.effects?.find(e=>"CIMGeometricEffectAddControlPoints"===e.type));return!!r||!!i}function ie(e){return e.some(e=>"CIMSolidFill"!==e.type&&"CIMSolidStroke"!==e.type&&("CIMVectorMarker"!==e.type&&"CIMPictureMarker"!==e.type||null!=e.markerPlacement))}function oe(e,t){if(t?.some(e=>"CIMGeometricEffectRadial"===e.type)&&t?.some(e=>"CIMGeometricEffectTaperedPolygon"===e.type)&&2===e.length){const t=e.find(e=>"CIMSolidFill"===e.type),r=e.find(e=>"CIMSolidStroke"===e.type),i=r?.effects?.some(e=>"CIMGeometricEffectDashes"===e.type);if(null!=t&&null!=r&&!i)return!0}return!1}function ae(e){return r(e).map(e=>({...e,propertyName:U(e.propertyName)}))}function se(e){return h(e)?{type:"animation-params",params:e}:null}export{Q as CIMAnalyzer,ee as analyzeCIMResource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import{getContrast as i}from"../../../../core/colorUtils.js";import{when as o,watch as s,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{throttle as l}from"../../../../core/throttle.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../layers/GraphicsLayer.js";import m from"../../../../symbols/CIMSymbol.js";import{getConfig as h}from"../../../analysis/ElevationProfile/constants.js";import{createLineGeometry as y}from"../../../analysis/ElevationProfile/elevationProfileVisualizationUtils.js";let d=class extends r{constructor(e){super(e),this._graphic=new t,this._layer=new c({listMode:"hide",internal:!0}),this._updateGeometryThrottled=l(e=>{if(!e)return void(this._graphic.visible=!1);const t=this._layer,r=this.view.map?.layers;r&&(r.includes(t)||r.add(t),r.reorder(t,0)),this._graphic.visible=!0,this._graphic.geometry=y(e.samples,e.spatialReference)},h().profileLinesUpdateThrottleMillis)}initialize(){this._layer.add(this._graphic),this.addHandles([o(()=>!this._visible,()=>{this._graphic.visible=!1}),s(()=>this._colorUpdateParameters,e=>this._updateColor(e),a),s(()=>this.analysisViewData.analysis.geometry,()=>{this._graphic.visible=!1},a),s(()=>this._geometryUpdateParameters,e=>this._updateGeometryThrottled(e),a),this._updateGeometryThrottled])}destroy(){this.view.map?.remove(this._layer),this._layer.destroy(),this._graphic.destroy()}get updating(){return this._updateGeometryThrottled.hasPendingUpdates()}get _visible(){const{analysis:e,visible:t}=this.analysisViewData;return t&&e.viewOptions.geometryVisualizationVisible}get _result(){return this._visible?this.analysisViewData.results.find(e=>e.available&&e.computation.profile.viewOptions.lineVisible):null}get _geometryUpdateParameters(){const e=this._result;return 1!==e?.progress?null:{samples:e.samples,spatialReference:this.view.spatialReference}}get _colorUpdateParameters(){const e=this._result?.computation.profile.color;return e?{color:e.toArray(),contrastColor:i(e).toArray()}:null}_updateColor(e){e&&(this._graphic.symbol=new m({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,10],lineDashEnding:"HalfPattern",controlPointEnding:"HalfPattern"}],capStyle:"Butt",width:1.5,color:e.color},{type:"CIMSolidStroke",capStyle:"Butt",width:2,color:e.contrastColor}]}}}))}};e([p({constructOnly:!0})],d.prototype,"view",void 0),e([p({constructOnly:!0})],d.prototype,"analysisViewData",void 0),e([p()],d.prototype,"updating",null),e([p()],d.prototype,"_visible",null),e([p()],d.prototype,"_result",null),e([p()],d.prototype,"_geometryUpdateParameters",null),e([p()],d.prototype,"_colorUpdateParameters",null),d=e([n("esri.views.2d.analysis.ElevationProfile.ElevationProfileLineVisualization2D")],d);export{d as ElevationProfileLineVisualization2D};
5
+ import{__decorate as t}from"tslib";import e from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import{getContrast as o}from"../../../../core/colorUtils.js";import{when as i,watch as s,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{throttle as l}from"../../../../core/throttle.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../layers/GraphicsLayer.js";import m from"../../../../symbols/CIMSymbol.js";import{getConfig as h}from"../../../analysis/ElevationProfile/constants.js";import{createLineGeometry as y}from"../../../analysis/ElevationProfile/elevationProfileVisualizationUtils.js";let d=class extends r{constructor(t){super(t),this._graphic=new e,this._layer=new c({listMode:"hide",internal:!0}),this._updateGeometryThrottled=l(t=>{if(!t)return void(this._graphic.visible=!1);const e=this._layer,r=this.view.map?.layers;r&&(r.includes(e)||r.add(e),r.reorder(e,0)),this._graphic.visible=!0,this._graphic.geometry=y(t.samples,t.spatialReference)},h().profileLinesUpdateThrottleMillis)}initialize(){this._layer.add(this._graphic),this.addHandles([i(()=>!this.analysisViewData.visible,()=>{this._graphic.visible=!1}),s(()=>this._colorUpdateParameters,t=>this._updateColor(t),a),s(()=>this.analysisViewData.analysis.geometry,()=>{this._graphic.visible=!1},a),s(()=>this._geometryUpdateParameters,t=>this._updateGeometryThrottled(t),a),this._updateGeometryThrottled])}destroy(){this.view.map?.remove(this._layer),this._layer.destroy(),this._graphic.destroy()}get updating(){return this._updateGeometryThrottled.hasPendingUpdates()}get _result(){const{analysisViewData:t}=this;return t.visible?t.results.find(({available:t,computation:e,rawResult:r})=>t&&e.profile.viewOptions.lineVisible&&!0===r?.hasZ):null}get _geometryUpdateParameters(){const t=this._result;return 1!==t?.progress?null:{samples:t.samples,spatialReference:this.view.spatialReference}}get _colorUpdateParameters(){const t=this._result?.computation.profile.color;return t?{color:t.toArray(),contrastColor:o(t).toArray()}:null}_updateColor(t){t&&(this._graphic.symbol=new m({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",capStyle:"Butt",color:t.color,effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],joinStyle:"Round",width:1.5},{type:"CIMSolidStroke",capStyle:"Butt",color:t.contrastColor,joinStyle:"Round",width:1.5}]}}}))}};t([p({constructOnly:!0})],d.prototype,"view",void 0),t([p({constructOnly:!0})],d.prototype,"analysisViewData",void 0),t([p()],d.prototype,"updating",null),t([p()],d.prototype,"_result",null),t([p()],d.prototype,"_geometryUpdateParameters",null),t([p()],d.prototype,"_colorUpdateParameters",null),d=t([n("esri.views.2d.analysis.ElevationProfile.ElevationProfileLineVisualization2D")],d);export{d as ElevationProfileLineVisualization2D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{moduloPositive as e,deg2rad as n}from"../../../../core/mathUtils.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import o from"../../../../core/RandomLCG.js";import i from"../../../../geometry/Extent.js";import{getInfo as s}from"../../../../geometry/support/spatialReferenceUtils.js";const l=()=>t.getLogger("esri.views.2d.engine.flow.dataUtils"),a=10;async function c(t,e,n,o){const i=performance.now(),s=f(e,n),c=performance.now(),h=d(e,s,n.width,n.height),u=performance.now(),m=w(h,!0),y=performance.now(),x="Streamlines"===t?p(m,a):g(m),M=performance.now();return has("esri-2d-profiler")&&(l().info("I.1","_createFlowFieldFromData (ms)",Math.round(c-i)),l().info("I.2","_getStreamlines (ms)",Math.round(u-c)),l().info("I.3","createAnimatedLinesData (ms)",Math.round(y-u)),l().info("I.4","create{Streamlines|Particles}Mesh (ms)",Math.round(M-y)),l().info("I.5","createFlowMesh (ms)",Math.round(M-i)),l().info("I.6","Mesh size (bytes)",x.vertexData.buffer.byteLength+x.indexData.buffer.byteLength)),await Promise.resolve(),r(o),x}function f(t,e){const n=m(e.data,e.width,e.height,t.smoothing);if(t.interpolate){return(t,r)=>{const o=Math.floor(t),i=Math.floor(r);if(o<0||o>=e.width)return[0,0];if(i<0||i>=e.height)return[0,0];const s=t-o,l=r-i,a=o,c=i,f=o<e.width-1?o+1:o,h=i<e.height-1?i+1:i,u=n[2*(c*e.width+a)],d=n[2*(c*e.width+f)],m=n[2*(h*e.width+a)],w=n[2*(h*e.width+f)],p=n[2*(c*e.width+a)+1],g=n[2*(c*e.width+f)+1];return[(u*(1-l)+m*l)*(1-s)+(d*(1-l)+w*l)*s,(p*(1-l)+n[2*(h*e.width+a)+1]*l)*(1-s)+(g*(1-l)+n[2*(h*e.width+f)+1]*l)*s]}}return(t,r)=>{const o=Math.round(t),i=Math.round(r);return o<0||o>=e.width||i<0||i>=e.height?[0,0]:[n[2*(i*e.width+o)],n[2*(i*e.width+o)+1]]}}function h(t,n,r,o,i,s,l,a){const c=[],{raster:f,width:h,height:u,resolutionFactor:d}=a;let m=o,w=i,p=0,[g,y]=r(m,w);g*=n.velocityScale,y*=n.velocityScale;const x=Math.sqrt(g*g+y*y);let M,v;c.push({x:m,y:w,t:p,speed:x});for(let A=0;A<n.verticesPerLine;A++){let[o,i]=r(m,w);o*=n.velocityScale,i*=n.velocityScale;const a=Math.sqrt(o*o+i*i);if(a<n.minSpeedThreshold)return c;const g=t*o/a,y=t*i/a;m+=g*n.segmentLength,w+=y*n.segmentLength,n.wrapAround&&(m=e(m,s[0]));if(p+=t*n.segmentLength/a,Math.acos(g*M+y*v)>n.maxTurnAngle)return c;if(n.collisions){let t=Math.round(m*d);const r=Math.round(w*d);if(n.wrapAround&&(t=e(t,h)),t<0||t>h-1||r<0||r>u-1)return c;const o=f[r*h+t];if(-1!==o&&o!==l)return c;f[r*h+t]=l}c.push({x:m,y:w,t:p,speed:a}),M=g,v=y}return c}function u(t,e,n,r,o,i,s,l){const a=Math.round((.2+.6*s.getFloat())*t.verticesPerLine),c=t.verticesPerLine-a,f=h(-1,{...t,verticesPerLine:c},e,n,r,o,i,l),u=h(1,{...t,verticesPerLine:a},e,n,r,o,i,l),d=f.reverse();d.splice(-1,1);return d.concat(u)}function d(t,e,n,r,i={positions:[]}){if(t.density<=0)return[];const{positions:s}=i,l=[],a=new o,c=1/Math.max(t.lineCollisionWidth,1),f=Math.round(n*c),d=Math.round(r*c),m=new Int32Array(f*d);for(let o=0;o<m.length;o++)m[o]=-1;const w={raster:m,width:f,height:d,resolutionFactor:c},p={},g=t.lineSpacing/Math.sqrt(t.density),y=Math.floor(r/g),x=Math.floor(n/g);for(let o=0;o<y;o++){const t=o*g;for(let e=0;e<x;e++){const n=e*g;p[`${e}-${o}`]={x:n,y:t,positions:[]}}}for(const{x:o,y:h}of s){const t=p[`${Math.floor(o/g)}-${Math.floor(h/g)}`];t&&t.positions.push([o,h])}const M=[];for(const o in p){const t=p[o];if(0===t.positions.length)M.push({x:t.x,y:t.y,sort:.66+.33*a.getFloat(),stage:0});else{const[e]=t.positions.splice(0,1);M.push({x:e[0],y:e[1],sort:.33*a.getFloat(),stage:1});for(const[n,r]of t.positions)M.push({x:n,y:r,sort:.33+.33*a.getFloat(),stage:2})}}M.sort((t,e)=>t.sort-e.sort);for(const{x:o,y:v,stage:A}of M){const i=t.onlyForwardTracing?h(1,t,e,o,v,[n,r],l.length,w):u(t,e,o,v,[n,r],l.length,a,w);i.length<2||l.push({stage:A,vertices:i})}return l}function m(t,e,n,r){if(0===r)return t;const o=Math.round(3*r),i=new Array(2*o+1);let s=0;for(let c=-o;c<=o;c++){const t=Math.exp(-c*c/(r*r));i[c+o]=t,s+=t}for(let c=-o;c<=o;c++)i[c+o]/=s;const l=new Float32Array(t.length);for(let c=0;c<n;c++)for(let n=0;n<e;n++){let r=0,s=0;for(let l=-o;l<=o;l++){if(n+l<0||n+l>=e)continue;const a=i[l+o];r+=a*t[2*(c*e+(n+l))],s+=a*t[2*(c*e+(n+l))+1]}l[2*(c*e+n)]=r,l[2*(c*e+n)+1]=s}const a=new Float32Array(t.length);for(let c=0;c<e;c++)for(let t=0;t<n;t++){let r=0,s=0;for(let a=-o;a<=o;a++){if(t+a<0||t+a>=n)continue;const f=i[a+o];r+=f*l[2*((t+a)*e+c)],s+=f*l[2*((t+a)*e+c)+1]}a[2*(t*e+c)]=r,a[2*(t*e+c)+1]=s}return a}function w(t,e){const n=new o,r=t.reduce((t,e)=>t+e.vertices.length,0),i=new Float32Array(4*r),s=new Array(t.length);let l=0,a=0;for(const{vertices:o}of t){const t=l;for(const e of o)i[4*l]=e.x,i[4*l+1]=e.y,i[4*l+2]=e.t,i[4*l+3]=e.speed,l++;s[a++]={startVertex:t,numberOfVertices:o.length,totalTime:o[o.length-1].t,timeSeed:e?n.getFloat():0}}return{lineVertices:i,lineDescriptors:s}}function p(t,e){const n=9,{lineVertices:r,lineDescriptors:o}=t;let i=0,s=0;for(const d of o){i+=2*d.numberOfVertices;s+=6*(d.numberOfVertices-1)}const l=new Float32Array(i*n),a=new Uint32Array(s);let c=0,f=0;function h(){a[f++]=c-2,a[f++]=c,a[f++]=c-1,a[f++]=c,a[f++]=c+1,a[f++]=c-1}function u(t,e,r,o,i,s,a,f){const h=c*n;let u=0;l[h+u++]=t,l[h+u++]=e,l[h+u++]=1,l[h+u++]=r,l[h+u++]=s,l[h+u++]=a,l[h+u++]=o/2,l[h+u++]=i/2,l[h+u++]=f,c++,l[h+u++]=t,l[h+u++]=e,l[h+u++]=-1,l[h+u++]=r,l[h+u++]=s,l[h+u++]=a,l[h+u++]=-o/2,l[h+u++]=-i/2,l[h+u++]=f,c++}for(const d of o){const{totalTime:t,timeSeed:n}=d;let o=null,i=null,s=null,l=null,a=null,c=null;for(let f=0;f<d.numberOfVertices;f++){const m=r[4*(d.startVertex+f)],w=r[4*(d.startVertex+f)+1],p=r[4*(d.startVertex+f)+2],g=r[4*(d.startVertex+f)+3];let y=null,x=null,M=null,v=null;if(f>0){y=m-o,x=w-i;const r=Math.sqrt(y*y+x*x);if(y/=r,x/=r,f>1){let t=y+a,n=x+c;const r=Math.sqrt(t*t+n*n);t/=r,n/=r;const o=Math.min(1/(t*y+n*x),e);t*=o,n*=o,M=-n,v=t}else M=-x,v=y;null!==M&&null!==v&&(u(o,i,s,M,v,t,n,g),h())}o=m,i=w,s=p,a=y,c=x,l=g}u(o,i,s,-c,a,t,n,l)}return{vertexData:l,indexData:a}}function g(t){const e=16,n=1,r=2,{lineVertices:o,lineDescriptors:i}=t;let s=0,l=0;for(const S of i){const t=S.numberOfVertices-1;s+=4*t*2,l+=6*t*2}const a=new Float32Array(s*e),c=new Uint32Array(l);let f,h,u,d,m,w,p,g,y,x,M,v,A,F,I=0,V=0;function L(){c[V++]=I-8,c[V++]=I-7,c[V++]=I-6,c[V++]=I-7,c[V++]=I-5,c[V++]=I-6,c[V++]=I-4,c[V++]=I-3,c[V++]=I-2,c[V++]=I-3,c[V++]=I-1,c[V++]=I-2}function b(t,o,i,s,l,c,f,h,u,d,m,w,p,g){const y=I*e;let x=0;for(const e of[n,r])for(const n of[1,2,3,4])a[y+x++]=t,a[y+x++]=o,a[y+x++]=i,a[y+x++]=s,a[y+x++]=f,a[y+x++]=h,a[y+x++]=u,a[y+x++]=d,a[y+x++]=e,a[y+x++]=n,a[y+x++]=p,a[y+x++]=g,a[y+x++]=l/2,a[y+x++]=c/2,a[y+x++]=m/2,a[y+x++]=w/2,I++}function D(t,e){let n=y+M,r=x+v;const o=Math.sqrt(n*n+r*r);n/=o,r/=o;const i=y*n+x*r;n/=i,r/=i;let s=M+A,l=v+F;const a=Math.sqrt(s*s+l*l);s/=a,l/=a;const c=M*s+v*l;s/=c,l/=c,b(f,h,u,d,-r,n,m,w,p,g,-l,s,t,e),L()}function k(t,e,n,r,o,i){if(y=M,x=v,M=A,v=F,null==y&&null==x&&(y=M,x=v),null!=m&&null!=w){A=t-m,F=e-w;const n=Math.sqrt(A*A+F*F);A/=n,F/=n}null!=y&&null!=x&&D(o,i),f=m,h=w,u=p,d=g,m=t,w=e,p=n,g=r}function P(t,e){y=M,x=v,M=A,v=F,null==y&&null==x&&(y=M,x=v),null!=y&&null!=x&&D(t,e)}for(const S of i){f=null,h=null,u=null,d=null,m=null,w=null,p=null,g=null,y=null,x=null,M=null,v=null,A=null,F=null;const{totalTime:t,timeSeed:e}=S;for(let n=0;n<S.numberOfVertices;n++){k(o[4*(S.startVertex+n)],o[4*(S.startVertex+n)+1],o[4*(S.startVertex+n)+2],o[4*(S.startVertex+n)+3],t,e)}P(t,e)}return{vertexData:a,indexData:c}}function y(t,e){const r=e.pixels,{width:o,height:i}=e,s=new Float32Array(o*i*2),l=e.mask??new Uint8Array(o*i*2);if(e.mask||l.fill(255),"vector-uv"===t)for(let n=0;n<o*i;n++)s[2*n]=r[0][n],s[2*n+1]=-r[1][n];else if("vector-magdir"===t)for(let a=0;a<o*i;a++){const t=r[0][a],e=n(r[1][a]),o=Math.cos(e-Math.PI/2),i=Math.sin(e-Math.PI/2);s[2*a]=o*t,s[2*a+1]=i*t}return{data:s,mask:l,width:o,height:i}}async function x(t,e,n,r,o,a){const c=performance.now(),f=s(e.spatialReference);if(!f){const i=await M(t,e,n,r,o,a);return has("esri-2d-profiler")&&l().info("I.7","loadImagery, early exit (ms)",Math.round(performance.now()-c)),has("esri-2d-profiler")&&l().info("I.9","Number of parts",1),i}const[h,u]=f.valid,d=u-h,m=Math.ceil(e.width/d),w=e.width/m,p=Math.round(n/m);let g=e.xmin;const y=[],x=performance.now();for(let s=0;s<m;s++){const n=new i({xmin:g,xmax:g+w,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference});y.push(M(t,n,p,r,o,a)),g+=w}const v=await Promise.all(y);if(has("esri-2d-profiler")&&l().info("I.8","All calls to _fetchPart (ms)",Math.round(performance.now()-x)),has("esri-2d-profiler")&&l().info("I.9","Number of parts",v.length),1===v.length)return has("esri-2d-profiler")&&l().info("I.10","loadImagery, general exit without stitching back (ms)",Math.round(performance.now()-c)),v[0];const A={data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};let F=0;for(const i of v){for(let t=0;t<i.height;t++)for(let e=0;e<i.width;e++)F+e>=n||(A.data[2*(t*n+F+e)]=i.data[2*(t*i.width+e)],A.data[2*(t*n+F+e)+1]=i.data[2*(t*i.width+e)+1],A.mask[t*n+F+e]=i.mask[t*i.width+e]);F+=i.width}return has("esri-2d-profiler")&&l().info("I.10","loadImagery, general exit (ms)",Math.round(performance.now()-c)),A}async function M(t,e,n,r,o,i){const s={requestProjectedLocalDirections:!0,signal:i};if(null!=o&&(s.timeExtent=o),"imagery"===t.type){await t.load({signal:i});const o=await t.internalFetchImage(e,n,r,s);if(null==o?.pixelData?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return y(t.rasterInfo.dataType,o.pixelData.pixelBlock)}await t.load({signal:i});const l=await t.fetchPixels(e,n,r,s);if(null==l?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return y(t.serviceRasterInfo.dataType,l.pixelBlock)}export{w as createAnimatedLinesData,f as createFlowFieldFromData,c as createFlowMesh,g as createParticlesMesh,p as createStreamlinesMesh,x as loadImagery,y as toFlowData,d as traceFlowPaths};
5
+ import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{moduloPositive as e,deg2rad as n}from"../../../../core/mathUtils.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import o from"../../../../core/RandomLCG.js";import i from"../../../../geometry/Extent.js";import{getInfo as l}from"../../../../geometry/support/spatialReferenceUtils.js";const s=()=>t.getLogger("esri.views.2d.engine.flow.dataUtils"),a=10;async function c(t,e,n,o){const i=performance.now(),l=f(e,n),c=performance.now(),h=d(e,l,n.width,n.height),u=performance.now(),m=w(h,!0),y=performance.now(),x="Streamlines"===t?p(m,a):g(m),M=performance.now();return has("esri-2d-profiler")&&(s().info("I.1","_createFlowFieldFromData (ms)",Math.round(c-i)),s().info("I.2","_getStreamlines (ms)",Math.round(u-c)),s().info("I.3","createAnimatedLinesData (ms)",Math.round(y-u)),s().info("I.4","create{Streamlines|Particles}Mesh (ms)",Math.round(M-y)),s().info("I.5","createFlowMesh (ms)",Math.round(M-i)),s().info("I.6","Mesh size (bytes)",x.vertexData.buffer.byteLength+x.indexData.buffer.byteLength)),await Promise.resolve(),r(o),x}function f(t,e){const n=m(e.data,e.width,e.height,t.smoothing);if(t.interpolate){return(t,r)=>{const o=Math.floor(t),i=Math.floor(r);if(o<0||o>=e.width)return[0,0];if(i<0||i>=e.height)return[0,0];const l=t-o,s=r-i,a=o,c=i,f=o<e.width-1?o+1:o,h=i<e.height-1?i+1:i,u=n[2*(c*e.width+a)],d=n[2*(c*e.width+f)],m=n[2*(h*e.width+a)],w=n[2*(h*e.width+f)],p=n[2*(c*e.width+a)+1],g=n[2*(c*e.width+f)+1];return[(u*(1-s)+m*s)*(1-l)+(d*(1-s)+w*s)*l,(p*(1-s)+n[2*(h*e.width+a)+1]*s)*(1-l)+(g*(1-s)+n[2*(h*e.width+f)+1]*s)*l]}}return(t,r)=>{const o=Math.round(t),i=Math.round(r);return o<0||o>=e.width||i<0||i>=e.height?[0,0]:[n[2*(i*e.width+o)],n[2*(i*e.width+o)+1]]}}function h(t,n,r,o,i,l,s,a){const c=[],{raster:f,width:h,height:u,resolutionFactor:d}=a;let m=o,w=i,p=0,[g,y]=r(m,w);g*=n.velocityScale,y*=n.velocityScale;const x=Math.sqrt(g*g+y*y);let M,A;c.push({x:m,y:w,t:p,speed:x});for(let v=0;v<n.verticesPerLine;v++){let[o,i]=r(m,w);o*=n.velocityScale,i*=n.velocityScale;const a=Math.sqrt(o*o+i*i);if(a<n.minSpeedThreshold)return c;const g=t*o/a,y=t*i/a;m+=g*n.segmentLength,w+=y*n.segmentLength,n.wrapAround&&(m=e(m,l[0]));if(p+=t*n.segmentLength/a,Math.acos(g*M+y*A)>n.maxTurnAngle)return c;if(n.collisions){let t=Math.round(m*d);const r=Math.round(w*d);if(n.wrapAround&&(t=e(t,h)),t<0||t>h-1||r<0||r>u-1)return c;const o=f[r*h+t];if(-1!==o&&o!==s)return c;f[r*h+t]=s}c.push({x:m,y:w,t:p,speed:a}),M=g,A=y}return c}function u(t,e,n,r,o,i,l,s){const a=Math.round((.2+.6*l.getFloat())*t.verticesPerLine),c=t.verticesPerLine-a,f=h(-1,{...t,verticesPerLine:c},e,n,r,o,i,s),u=h(1,{...t,verticesPerLine:a},e,n,r,o,i,s),d=f.reverse();d.splice(-1,1);return d.concat(u)}function d(t,e,n,r,i={positions:[]}){if(t.density<=0)return[];const{positions:l}=i,s=[],a=new o,c=1/Math.max(t.lineCollisionWidth,1),f=Math.round(n*c),d=Math.round(r*c),m=new Int32Array(f*d);for(let o=0;o<m.length;o++)m[o]=-1;const w={raster:m,width:f,height:d,resolutionFactor:c},p={},g=t.lineSpacing/Math.sqrt(t.density),y=Math.floor(r/g),x=Math.floor(n/g);for(let o=0;o<y;o++){const t=o*g;for(let e=0;e<x;e++){const n=e*g;p[`${e}-${o}`]={x:n,y:t,positions:[]}}}for(const{x:o,y:h}of l){const t=p[`${Math.floor(o/g)}-${Math.floor(h/g)}`];t&&t.positions.push([o,h])}const M=[];for(const o in p){const t=p[o];if(0===t.positions.length)M.push({x:t.x+g/2,y:t.y+g/2,sort:.66+.33*a.getFloat(),stage:0});else{const[e]=t.positions.splice(0,1);M.push({x:e[0],y:e[1],sort:.33*a.getFloat(),stage:1});for(const[n,r]of t.positions)M.push({x:n,y:r,sort:.33+.33*a.getFloat(),stage:2})}}M.sort((t,e)=>t.sort-e.sort);for(const{x:o,y:A,stage:v}of M){const i=t.onlyForwardTracing?h(1,t,e,o,A,[n,r],s.length,w):u(t,e,o,A,[n,r],s.length,a,w);i.length<2||s.push({stage:v,vertices:i})}return s}function m(t,e,n,r){if(0===r)return t;const o=Math.round(3*r),i=new Array(2*o+1);let l=0;for(let c=-o;c<=o;c++){const t=Math.exp(-c*c/(r*r));i[c+o]=t,l+=t}for(let c=-o;c<=o;c++)i[c+o]/=l;const s=new Float32Array(t.length);for(let c=0;c<n;c++)for(let n=0;n<e;n++){let r=0,l=0;for(let s=-o;s<=o;s++){if(n+s<0||n+s>=e)continue;const a=i[s+o];r+=a*t[2*(c*e+(n+s))],l+=a*t[2*(c*e+(n+s))+1]}s[2*(c*e+n)]=r,s[2*(c*e+n)+1]=l}const a=new Float32Array(t.length);for(let c=0;c<e;c++)for(let t=0;t<n;t++){let r=0,l=0;for(let a=-o;a<=o;a++){if(t+a<0||t+a>=n)continue;const f=i[a+o];r+=f*s[2*((t+a)*e+c)],l+=f*s[2*((t+a)*e+c)+1]}a[2*(t*e+c)]=r,a[2*(t*e+c)+1]=l}return a}function w(t,e){const n=new o,r=t.reduce((t,e)=>t+e.vertices.length,0),i=new Float32Array(4*r),l=new Array(t.length);let s=0,a=0;for(const{vertices:o}of t){const t=s;for(const e of o)i[4*s]=e.x,i[4*s+1]=e.y,i[4*s+2]=e.t,i[4*s+3]=e.speed,s++;l[a++]={startVertex:t,numberOfVertices:o.length,totalTime:o[o.length-1].t,timeSeed:e?n.getFloat():0}}return{lineVertices:i,lineDescriptors:l}}function p(t,e){const n=9,{lineVertices:r,lineDescriptors:o}=t;let i=0,l=0;for(const d of o){i+=2*d.numberOfVertices;l+=6*(d.numberOfVertices-1)}const s=new Float32Array(i*n),a=new Uint32Array(l);let c=0,f=0;function h(){a[f++]=c-2,a[f++]=c,a[f++]=c-1,a[f++]=c,a[f++]=c+1,a[f++]=c-1}function u(t,e,r,o,i,l,a,f){const h=c*n;let u=0;s[h+u++]=t,s[h+u++]=e,s[h+u++]=1,s[h+u++]=r,s[h+u++]=l,s[h+u++]=a,s[h+u++]=o/2,s[h+u++]=i/2,s[h+u++]=f,c++,s[h+u++]=t,s[h+u++]=e,s[h+u++]=-1,s[h+u++]=r,s[h+u++]=l,s[h+u++]=a,s[h+u++]=-o/2,s[h+u++]=-i/2,s[h+u++]=f,c++}for(const d of o){const{totalTime:t,timeSeed:n}=d;let o=null,i=null,l=null,s=null,a=null,c=null;for(let f=0;f<d.numberOfVertices;f++){const m=r[4*(d.startVertex+f)],w=r[4*(d.startVertex+f)+1],p=r[4*(d.startVertex+f)+2],g=r[4*(d.startVertex+f)+3];let y=null,x=null,M=null,A=null;if(f>0){y=m-o,x=w-i;const r=Math.sqrt(y*y+x*x);if(y/=r,x/=r,f>1){let t=y+a,n=x+c;const r=Math.sqrt(t*t+n*n);t/=r,n/=r;const o=Math.min(1/(t*y+n*x),e);t*=o,n*=o,M=-n,A=t}else M=-x,A=y;null!==M&&null!==A&&(u(o,i,l,M,A,t,n,g),h())}o=m,i=w,l=p,a=y,c=x,s=g}u(o,i,l,-c,a,t,n,s)}return{vertexData:s,indexData:a}}function g(t){const e=16,n=1,r=2,{lineVertices:o,lineDescriptors:i}=t;let l=0,s=0;for(const S of i){const t=S.numberOfVertices-1;l+=4*t*2,s+=6*t*2}const a=new Float32Array(l*e),c=new Uint32Array(s);let f,h,u,d,m,w,p,g,y,x,M,A,v,F,I=0,V=0;function L(){c[V++]=I-8,c[V++]=I-7,c[V++]=I-6,c[V++]=I-7,c[V++]=I-5,c[V++]=I-6,c[V++]=I-4,c[V++]=I-3,c[V++]=I-2,c[V++]=I-3,c[V++]=I-1,c[V++]=I-2}function b(t,o,i,l,s,c,f,h,u,d,m,w,p,g){const y=I*e;let x=0;for(const e of[n,r])for(const n of[1,2,3,4])a[y+x++]=t,a[y+x++]=o,a[y+x++]=i,a[y+x++]=l,a[y+x++]=f,a[y+x++]=h,a[y+x++]=u,a[y+x++]=d,a[y+x++]=e,a[y+x++]=n,a[y+x++]=p,a[y+x++]=g,a[y+x++]=s/2,a[y+x++]=c/2,a[y+x++]=m/2,a[y+x++]=w/2,I++}function k(t,e){let n=y+M,r=x+A;const o=Math.sqrt(n*n+r*r);n/=o,r/=o;const i=y*n+x*r;n/=i,r/=i;let l=M+v,s=A+F;const a=Math.sqrt(l*l+s*s);l/=a,s/=a;const c=M*l+A*s;l/=c,s/=c,b(f,h,u,d,-r,n,m,w,p,g,-s,l,t,e),L()}function D(t,e,n,r,o,i){if(y=M,x=A,M=v,A=F,null==y&&null==x&&(y=M,x=A),null!=m&&null!=w){v=t-m,F=e-w;const n=Math.sqrt(v*v+F*F);v/=n,F/=n}null!=y&&null!=x&&k(o,i),f=m,h=w,u=p,d=g,m=t,w=e,p=n,g=r}function P(t,e){y=M,x=A,M=v,A=F,null==y&&null==x&&(y=M,x=A),null!=y&&null!=x&&k(t,e)}for(const S of i){f=null,h=null,u=null,d=null,m=null,w=null,p=null,g=null,y=null,x=null,M=null,A=null,v=null,F=null;const{totalTime:t,timeSeed:e}=S;for(let n=0;n<S.numberOfVertices;n++){D(o[4*(S.startVertex+n)],o[4*(S.startVertex+n)+1],o[4*(S.startVertex+n)+2],o[4*(S.startVertex+n)+3],t,e)}P(t,e)}return{vertexData:a,indexData:c}}function y(t,e,r=e.width,o=e.height,i=0,l=0){const s=e.pixels,a=r*o,c=2,f=new Float32Array(a*c),h=e.width,u=(t,e)=>t+i+(e+l)*h,d=(t,e)=>t+e*r;let m;if(null!=e.mask)if(r!==e.width||o!==e.height||0!==i||0!==l){m=new Uint8Array(a*c);const t=e.mask;for(let e=0;e<o;++e)for(let n=0;n<r;++n){const r=u(n,e),o=d(n,e);m[c*o]=t[c*r],m[c*o+1]=t[c*r+1]}}else m=e.mask;else m=new Uint8Array(a*c),m.fill(255);if("vector-uv"===t)for(let n=0;n<o;++n)for(let t=0;t<r;++t){const e=u(t,n),r=d(t,n);f[c*r]=s[0][e],f[c*r+1]=-s[1][e]}else if("vector-magdir"===t){const{cos:t,sin:e}=Math;for(let i=0;i<o;++i)for(let o=0;o<r;++o){const r=u(o,i),l=d(o,i),a=s[0][r],h=n(s[1][r]),m=t(h-Math.PI/2),w=e(h-Math.PI/2);f[c*l]=m*a,f[c*l+1]=w*a}}return{data:f,mask:m,width:r,height:o}}async function x(t,e,n,r,o,a){const c=performance.now(),f=l(e.spatialReference);if(!f){const i=await M(t,e,n,r,o,a);return has("esri-2d-profiler")&&s().info("I.7","loadImagery, early exit (ms)",Math.round(performance.now()-c)),has("esri-2d-profiler")&&s().info("I.9","Number of parts",1),i}const[h,u]=f.valid,d=u-h,m=Math.ceil(e.width/d),w=e.width/m,p=Math.round(n/m);let g=e.xmin;const y=[],x=performance.now();for(let l=0;l<m;l++){const n=new i({xmin:g,xmax:g+w,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference});y.push(M(t,n,p,r,o,a)),g+=w}const A=await Promise.all(y);if(has("esri-2d-profiler")&&s().info("I.8","All calls to _fetchPart (ms)",Math.round(performance.now()-x)),has("esri-2d-profiler")&&s().info("I.9","Number of parts",A.length),1===A.length)return has("esri-2d-profiler")&&s().info("I.10","loadImagery, general exit without stitching back (ms)",Math.round(performance.now()-c)),A[0];const v={data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};let F=0;for(const i of A){for(let t=0;t<i.height;t++)for(let e=0;e<i.width;e++)F+e>=n||(v.data[2*(t*n+F+e)]=i.data[2*(t*i.width+e)],v.data[2*(t*n+F+e)+1]=i.data[2*(t*i.width+e)+1],v.mask[t*n+F+e]=i.mask[t*i.width+e]);F+=i.width}return has("esri-2d-profiler")&&s().info("I.10","loadImagery, general exit (ms)",Math.round(performance.now()-c)),v}async function M(t,e,n,r,o,i){const l={requestProjectedLocalDirections:!0,signal:i};if(null!=o&&(l.timeExtent=o),"imagery"===t.type){await t.load({signal:i});const o=await t.internalFetchImage(e,n,r,l);if(null==o?.pixelData?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return y(t.rasterInfo.dataType,o.pixelData.pixelBlock)}await t.load({signal:i});const s=await t.fetchPixels(e,n,r,l);if(null==s?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return y(t.serviceRasterInfo.dataType,s.pixelBlock)}export{w as createAnimatedLinesData,f as createFlowFieldFromData,c as createFlowMesh,g as createParticlesMesh,p as createStreamlinesMesh,x as loadImagery,y as toFlowData,d as traceFlowPaths};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import r from"../../../../core/Error.js";import{getFullyQualifiedFontName as s}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{throwIfAborted as n,isAbortError as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{pt2px as h}from"../../../../core/screenUtils.js";import{numericHash as l}from"../../../../core/string.js";import u from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as p}from"../../../../symbols/cim/CIMSymbolHelper.js";import m from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as g,textureBindingSpriteAtlas as f,textureBindingGlyphAtlas as y}from"./definitions.js";import _ from"./GlyphMosaic.js";import M from"./GlyphSource.js";import I from"./Rect.js";import w from"./SDFConverter.js";import S from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as z}from"./urlUtils.js";import{charCodes as C,getCIMMarkerPlacementHash as T,isSVGImage as R}from"./Utils.js";import{AnimatableTextureResource as x}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as P}from"./animations/store/AnimationStore.js";const b="arial-unicode-ms-regular",$=()=>a.getLogger("esri.views.MapView"),j=(e,t,i)=>$().error(new r(e,t,i)),v=(e,t="")=>$().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,r){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=r}}class F{constructor(i){this._requestRender=i,this._resourceManager=new u,this._invalidFonts=new Set,this._sdfConverter=new w(g),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new c({concurrency:10,process:async(e,i)=>{n(i);try{return await t(e,{responseType:"image",signal:i})}catch(s){if(!o(s))throw new r("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,s);throw s}}}),this.animationStore=new P,this._spriteMosaic=new S(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new _(1024,1024,this._glyphSource),this._rasterizer=new m(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return j("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:r}=i;return{rect:new I(r.column,r.row,t.length,1),page:r.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return j("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(1,t);return e}const r=await this._rasterizeSprite(i,t);return r&&this._setTextureBinding(0,r),r}getMosaicInfo(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{size:r.size,texture:{texture:r.texture,unit:"sprite"===r.type?f:y}}:(j("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const{context:r}=e,s=this._bindingInfos[t-1],a=s.page,n="Nearest"===s.samplingMode?9728:i?9987:9729;switch(s.mosaicType){case 0:{const t=[this.sprites.getWidth(a),this.sprites.getHeight(a)],i=this._spriteMosaic.getTexture(e,a);return i.setSamplingMode(n),{type:"sprite",texture:i,size:t}}case 1:{const e=[this.glyphs.width,this.glyphs.height],t=this._glyphMosaic.getTexture(r,a);return this._glyphMosaic.bind(r,n,a,y),t.setSamplingMode(n),{type:"glyph",texture:t,size:e}}default:return j("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const r=k.fromMosaic(e,t),s=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,s),this._bindingInfos.push(r)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:r,textString:a}=e,n=s(r),o=this._invalidFonts.has(n),[c,h]=i(a),l=C(c);try{const e=o?b:n;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(e,l,t),isRightToLeft:h}}catch(u){v(`Font ${n} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(n);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(b,l,t),isRightToLeft:h}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${T(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${d(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geom)}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(z(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=l(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];p.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:r,image:s,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,r,{type:"static",data:s},A(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,i){const r=[g,g],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,i);return this._addItemToMosaic(t,r,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const r=e.url,s=this.resourceManager.getResource(r);if(null==s)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if("animated"===e.type)return j("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:r,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,s,i);return this._addItemToMosaic(t,r,{type:"static",data:c},A(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=A(e),c={type:"CIMAnimatedSymbolProperties"},h=0);const l=new x(s,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,i){const s=e.url;if(B(s)||N(s))return this._handleGIFOrPNG(e,t,i);if("animated"===e.type)return j("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let r;const a=this.resourceManager.getResource(s);if(null!=a&&a instanceof HTMLImageElement)r=a;else{const{data:e}=await this._imageRequestQueue.push(s,{...i});r=e}if(R(s))if("width"in e&&"height"in e)r.width=h(e.width),r.height=h(e.height);else if("cim"in e){const t=e;r.width=h(t.width??t.scaleX*t.size),r.height=h(t.size)}if(!r.width||!r.height)return null;const n=r.width,o=r.height,c="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,r,c);return this._addItemToMosaic(t,l,{type:"static",data:p},A(e),u,!1)}catch(j){if(!o(j))throw new r("mapview-invalid-resource",`Could not fetch requested resource at ${s}. ${j.message}`);throw j}}_addItemToMosaic(e,t,i,r,s,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,r,s,a,n,o,c,h)}}function A(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return U(e);default:return!0}}const G=e=>null!=e&&e.startsWith("data:image/gif"),B=e=>e&&(e.includes(".gif")||G(e)),O=e=>null!=e&&e.startsWith("data:image/png"),N=e=>e&&(e.includes(".png")||O(e)),U=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{F as default};
5
+ import e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import r from"../../../../core/Error.js";import{getFullyQualifiedFontName as s}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{throwIfAborted as n,isAbortError as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{pt2px as h}from"../../../../core/screenUtils.js";import{numericHash as l}from"../../../../core/string.js";import u from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as p}from"../../../../symbols/cim/CIMSymbolHelper.js";import m from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as g,textureBindingSpriteAtlas as f,textureBindingGlyphAtlas as y}from"./definitions.js";import _ from"./GlyphMosaic.js";import M from"./GlyphSource.js";import I from"./Rect.js";import w from"./SDFConverter.js";import S from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as z}from"./urlUtils.js";import{charCodes as T,getCIMMarkerPlacementHash as C,isSVGImage as R}from"./Utils.js";import{AnimatableTextureResource as x}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as P}from"./animations/store/AnimationStore.js";const b="arial-unicode-ms-regular",$=()=>a.getLogger("esri.views.MapView"),j=(e,t,i)=>$().error(new r(e,t,i)),v=(e,t="")=>$().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,r){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=r}}class F{constructor(i){this._requestRender=i,this._resourceManager=new u,this._invalidFonts=new Set,this._sdfConverter=new w(g),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new c({concurrency:10,process:async(e,i)=>{n(i);try{return await t(e,{responseType:"image",signal:i})}catch(s){if(!o(s))throw new r("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,s);throw s}}}),this.animationStore=new P,this._spriteMosaic=new S(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new _(1024,1024,this._glyphSource),this._rasterizer=new m(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return j("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:r}=i;return{rect:new I(r.column,r.row,t.length,1),page:r.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return j("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(1,t);return e}const r=await this._rasterizeSprite(i,t);return r&&this._setTextureBinding(0,r),r}getMosaicInfo(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{size:r.size,texture:{texture:r.texture,unit:"sprite"===r.type?f:y}}:(j("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const{context:r}=e,s=this._bindingInfos[t-1],a=s.page,n="Nearest"===s.samplingMode?9728:i?9987:9729;switch(s.mosaicType){case 0:{const t=[this.sprites.getWidth(a),this.sprites.getHeight(a)],i=this._spriteMosaic.getTexture(e,a);return i.setSamplingMode(n),{type:"sprite",texture:i,size:t}}case 1:{const e=[this.glyphs.width,this.glyphs.height],t=this._glyphMosaic.getTexture(r,a);return this._glyphMosaic.bind(r,n,a,y),t.setSamplingMode(n),{type:"glyph",texture:t,size:e}}default:return j("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const r=k.fromMosaic(e,t),s=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,s),this._bindingInfos.push(r)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:r,textString:a}=e,n=s(r),o=this._invalidFonts.has(n),[c,h]=i(a),l=T(c);try{const e=o?b:n;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(e,l,t),isRightToLeft:h}}catch(u){v(`Font ${n} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(n);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(b,l,t),isRightToLeft:h}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${C(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${d(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(z(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=l(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];p.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:r,image:s,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,r,{type:"static",data:s},A(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,i){const r=[g,g],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,i);return this._addItemToMosaic(t,r,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const r=e.url,s=this.resourceManager.getResource(r);if(null==s)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if("animated"===e.type)return j("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:r,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,s,i);return this._addItemToMosaic(t,r,{type:"static",data:c},A(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=A(e),c={type:"CIMAnimatedSymbolProperties"},h=0);const l=new x(s,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,i){const s=e.url;if(B(s)||N(s))return this._handleGIFOrPNG(e,t,i);if("animated"===e.type)return j("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let r;const a=this.resourceManager.getResource(s);if(null!=a&&a instanceof HTMLImageElement)r=a;else{const{data:e}=await this._imageRequestQueue.push(s,{...i});r=e}if(R(s))if("width"in e&&"height"in e)r.width=h(e.width),r.height=h(e.height);else if("cim"in e){const t=e;r.width=h(t.width??t.scaleX*t.size),r.height=h(t.size)}if(!r.width||!r.height)return null;const n=r.width,o=r.height,c="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,r,c);return this._addItemToMosaic(t,l,{type:"static",data:p},A(e),u,!1)}catch(j){if(!o(j))throw new r("mapview-invalid-resource",`Could not fetch requested resource at ${s}. ${j.message}`);throw j}}_addItemToMosaic(e,t,i,r,s,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,r,s,a,n,o,c,h)}}function A(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return U(e);default:return!0}}const G=e=>null!=e&&e.startsWith("data:image/gif"),B=e=>e&&(e.includes(".gif")||G(e)),O=e=>null!=e&&e.startsWith("data:image/png"),N=e=>e&&(e.includes(".png")||O(e)),U=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{F 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{location as e,ComputeVertexInput as o}from"../../GraphShaderModule.js";import{mod as s,Float as i,mix as l,Vec4 as r,or as a,Bool as n,Vec2 as m}from"../../graph/glsl.js";import{AAnimatedShader as c,getValue as d,AAnimatedVertexInput as p,AAnimatedFragmentInput as u}from"./AAnimatedShader.js";import{MarkerConstants as h}from"../markers/markerConstants.js";import{getBitBool as y}from"../shaders/utils.js";import{getVisualVariableColor as x,getVisualVariableOpacity as P}from"../shaders/vvUtils.js";class b extends p{}t([e(9,r)],b.prototype,"tlbr",void 0);class v extends o{}t([e(13,m)],v.prototype,"nextPos1",void 0),t([e(14,m)],v.prototype,"nextPos2",void 0);class S extends u{}class g extends c{_fragmentPoly(t){const e=s(t.uv,new i(1)),o=l(t.tlbr.xy,t.tlbr.zw,e);return this._getColor(o,{color:t.color,distanceToPx:t.distanceToPx,isSDF:t.isSDF,outlineColor:t.outlineColor,outlineSize:t.strokeWidth})}_vertexPoly(t){const{position:e,animationPointer:o,evalParams:s,isOutline:m,unscaledDistanceToPx:c,vvScale:p,strokeWidth:u,scaleSymbolsProportionally:b,scale:v,isSDF:S,baseSize:g,clip:f}=this._vertexPreamble(t,new i(0),t.lineLength||new i(0)),w=this._toNdc(e);let j=d(o,1,s);j=new r(j.rgb.multiply(j.a),j.a);let k=d(o,2,s);k=new r(k.rgb.multiply(k.a),k.a);let z=d(o,3,s);z=new r(z.rgb.multiply(z.a),z.a);const D=d(o,4,s).a,T=d(o,5,s).a,_=x(this,t.id,j,a(y(t.bitset,h.bitset.colorLocked),new n(m))),C=l(_,k,z),F=P(this,t.id),W=l(F,D,T),A=C.multiply(W),L=this.clip(t.id,t.zoomRange).add(f.multiply(2)),O=c.multiply(p);return{unscaledDistanceToPx:c,vvScale:p,strokeWidth:u,scaleSymbolsProportionally:b,scale:v,isSDF:S,baseSize:g,ndc:w,color:A,z:L,isOutline:m,evalParams:s,distanceToPx:O}}}export{g as AAnimatedPolyShader,S as PolyFragmentInput,v as PolyHittestVertexInput,b as PolyVertexInput};
5
+ import{__decorate as t}from"tslib";import{location as e,ComputeVertexInput as o}from"../../GraphShaderModule.js";import{mod as s,Float as i,mix as r,Vec4 as l,or as a,Bool as n,Vec2 as c}from"../../graph/glsl.js";import{AAnimatedShader as m,getValue as p,AAnimatedVertexInput as d,AAnimatedFragmentInput as u}from"./AAnimatedShader.js";import{MarkerConstants as h}from"../markers/markerConstants.js";import{getBitBool as x}from"../shaders/utils.js";import{getVisualVariableColor as P,getVisualVariableOpacity as y}from"../shaders/vvUtils.js";class b extends d{}t([e(9,l)],b.prototype,"tlbr",void 0);class v extends o{}t([e(13,c)],v.prototype,"nextPos1",void 0),t([e(14,c)],v.prototype,"nextPos2",void 0);class S extends u{}class g extends m{constructor(){super(...arguments),this.computeAttributes={pos:["nextPos1","nextPos2"]}}_fragmentPoly(t){const e=s(t.uv,new i(1)),o=r(t.tlbr.xy,t.tlbr.zw,e);return this._getColor(o,{color:t.color,distanceToPx:t.distanceToPx,isSDF:t.isSDF,outlineColor:t.outlineColor,outlineSize:t.strokeWidth})}_vertexPoly(t){const{position:e,animationPointer:o,evalParams:s,isOutline:c,unscaledDistanceToPx:m,vvScale:d,strokeWidth:u,scaleSymbolsProportionally:b,scale:v,isSDF:S,baseSize:g,clip:f}=this._vertexPreamble(t,new i(0),t.lineLength||new i(0)),w=this._toNdc(e);let j=p(o,1,s);j=new l(j.rgb.multiply(j.a),j.a);let k=p(o,2,s);k=new l(k.rgb.multiply(k.a),k.a);let z=p(o,3,s);z=new l(z.rgb.multiply(z.a),z.a);const D=p(o,4,s).a,T=p(o,5,s).a,_=P(this,t.id,j,a(x(t.bitset,h.bitset.colorLocked),new n(c))),C=r(_,k,z),F=y(this,t.id),A=r(F,D,T),W=C.multiply(A),L=this.clip(t.id,t.zoomRange).add(f.multiply(2)),O=m.multiply(d);return{unscaledDistanceToPx:m,vvScale:d,strokeWidth:u,scaleSymbolsProportionally:b,scale:v,isSDF:S,baseSize:g,ndc:w,color:W,z:L,isOutline:c,evalParams:s,distanceToPx:O}}}export{g as AAnimatedPolyShader,S as PolyFragmentInput,v as PolyHittestVertexInput,b as PolyVertexInput};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t,__param as e}from"tslib";import{input as i}from"../../GraphShaderModule.js";import{Float as s,sin as o,cos as r,Vec3 as l,Vec4 as n,Mat3 as a,mix as m}from"../../graph/glsl.js";import{AAnimatedPolyShader as p,PolyVertexInput as u,PolyHittestVertexInput as d,PolyFragmentInput as c}from"./AAnimatedPolyShader.js";import{getPatternMatrix as h}from"../shaders/ComplexFillShader.js";import{hittestFill as y}from"../shaders/hittestUtils.js";class f extends p{constructor(){super(...arguments),this.type="AnimatedFillShader",this.computeAttributes={pos:["nextPos1","nextPos2"]}}vertex(t,e){const{distanceToPx:i,ndc:p,z:u,color:d,isOutline:c,strokeWidth:y,isSDF:f,baseSize:x,scale:g,scaleSymbolsProportionally:b}=this._vertexPoly(t),w=this.view.requiredZoomFactor,P=t.sizing.xy,S=P.multiply(w),v=new s(0),z=o(v),F=r(v),A=h(t.id,S,z,F,t.bitset),O=this.localTileOffset.getPatternOffsetAtTileOrigin(P,z,F),j=w.multiply(t.offset.subtract(O)).divide(S),T=new l(t.pos,1),M=A.multiply(T).xy.subtract(j),C=t.tlbr.divide(this.mosaicInfo.size.xyxy);return{glPosition:new n(p,u,1),tlbr:C,uv:M,color:d.multiply(new s(1).subtract(c)),outlineColor:d.multiply(c),distanceToPx:i,strokeWidth:y.multiply(m(new s(1),g,b)),isOutline:c,isSDF:f,...this.maybeRunHittest(t,e,{pos:t.pos,size:x,sizeCorrection:new s(1),isMapAligned:new s(1),vvRotationMat3:new a(1,0,0,0,1,0,0,0,1),placementMat3:new a(1,0,0,0,1,0,0,0,1),outlineSize:new s(1),distanceToPx:i,isSDF:f})}}fragment(t){const e=this._fragmentPoly(t);return this.getFragmentOutput(e,t)}hittest(t,e,i){return y(this,t,e)}}t([e(0,i(u)),e(1,i(d))],f.prototype,"vertex",null),t([e(0,i(c))],f.prototype,"fragment",null);export{f as AnimatedFillShader};
5
+ import{__decorate as t,__param as e}from"tslib";import{input as i}from"../../GraphShaderModule.js";import{Float as r,sin as s,cos as o,Vec3 as l,Vec4 as n,mix as m}from"../../graph/glsl.js";import{AAnimatedPolyShader as a,PolyVertexInput as p,PolyHittestVertexInput as u,PolyFragmentInput as d}from"./AAnimatedPolyShader.js";import{getPatternMatrix as h}from"../shaders/ComplexFillShader.js";import{hittestFill as y}from"../shaders/hittestUtils.js";class c extends a{constructor(){super(...arguments),this.type="AnimatedFillShader"}vertex(t,e){const{distanceToPx:i,ndc:a,z:p,color:u,isOutline:d,strokeWidth:y,isSDF:c,scale:f,scaleSymbolsProportionally:x}=this._vertexPoly(t),g=this.view.requiredZoomFactor,b=t.sizing.xy,P=b.multiply(g),v=new r(0),S=s(v),w=o(v),F=h(t.id,P,S,w,t.bitset),O=this.localTileOffset.getPatternOffsetAtTileOrigin(b,S,w),j=g.multiply(t.offset.subtract(O)).divide(P),A=new l(t.pos,1),T=F.multiply(A).xy.subtract(j),z=t.tlbr.divide(this.mosaicInfo.size.xyxy);return{glPosition:new n(a,p,1),tlbr:z,uv:T,color:u.multiply(new r(1).subtract(d)),outlineColor:u.multiply(d),distanceToPx:i,strokeWidth:y.multiply(m(new r(1),f,x)),isOutline:d,isSDF:c,...this.maybeRunHittest(t,e,{})}}fragment(t){const e=this._fragmentPoly(t);return this.getFragmentOutput(e,t)}hittest(t,e,i){return y(this,t,e)}}t([e(0,i(p)),e(1,i(u))],c.prototype,"vertex",null),t([e(0,i(d))],c.prototype,"fragment",null);export{c as AnimatedFillShader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t,__param as e}from"tslib";import{location as i,input as s}from"../../GraphShaderModule.js";import{dot as o,Vec2 as l,Vec4 as n,Float as r,Mat3 as a,mix as m,length as d,clamp as p,Vec3 as u,step as c,min as y}from"../../graph/glsl.js";import{AAnimatedPolyShader as h,PolyHittestVertexInput as x,PolyVertexInput as v,PolyFragmentInput as w}from"./AAnimatedPolyShader.js";import{getValue as f}from"./AAnimatedShader.js";import{distPointSegment as S}from"../shaders/hittestUtils.js";import{getLineThinFactor as b}from"../shaders/LineShader.js";class P extends v{}t([i(10,r)],P.prototype,"accumulatedDistance",void 0),t([i(11,l)],P.prototype,"normal",void 0),t([i(12,l)],P.prototype,"segmentDirection",void 0);class g extends w{}class z extends h{constructor(){super(...arguments),this.type="AnimatedLineShader",this.computeAttributes={pos:["nextPos1","nextPos2"]}}vertex(t,e){const{animationPointerAndBaseSizeAndReferenceSize:i}=t,s=i.xy,{distanceToPx:d,ndc:p,z:u,color:c,isOutline:y,strokeWidth:h,isSDF:x,baseSize:v,scale:w,scaleSymbolsProportionally:S,evalParams:b}=this._vertexPoly(t),P=t.sizing.xy,g=P.x.multiply(v).divide(P.y),z=f(s,6,b).a,A=t.accumulatedDistance.subtract(z),{normal:D}=t,j=t.normal.y,M=A.divide(this.view.displayZoomFactor).add(o(t.segmentDirection,t.offset)).divide(g),F=j.add(1).divide(2),R=new l(M,F),T=t.tlbr.divide(this.mosaicInfo.size.xyxy);return{glPosition:new n(p,u,1),tlbr:T,uv:R,color:c.multiply(new r(1).subtract(y)),outlineColor:c.multiply(y),distanceToPx:d,strokeWidth:h.multiply(m(new r(1),w,S)),isOutline:y,isSDF:x,halfWidth:v.divide(2),normal:D,...this.maybeRunHittest(t,e,{pos:t.pos,size:v,sizeCorrection:new r(1),isMapAligned:new r(1),vvRotationMat3:new a(1,0,0,0,1,0,0,0,1),placementMat3:new a(1,0,0,0,1,0,0,0,1),outlineSize:new r(1),distanceToPx:d,isSDF:x})}}fragment(t){const e=this._fragmentPoly(t),{halfWidth:i,normal:s}=t,o=b(i),l=d(s).multiply(i),n=p(o.multiply(i.subtract(l)).divide(o.subtract(new r(1))),new r(0),new r(1));return this.getFragmentOutput(e.multiply(n),t)}hittest(t,e,i){const{viewMat3:s,tileMat3:o}=this.view,l=s.multiply(o),n=l.multiply(new u(t.pos,1)),r=l.multiply(new u(e.nextPos1,1)),a=l.multiply(new u(e.nextPos2,1)),{distance:m,smallSymbolDistance:d,smallSymbolSizeThreshold:p}=this.hittestRequest,h=c(i,p.multiply(.5)).multiply(m.subtract(d)),x=this.hittestRequest.position;return y(S(x,n.xy,r.xy),S(x,n.xy,a.xy)).subtract(i).add(h)}}t([e(0,s(P)),e(1,s(x))],z.prototype,"vertex",null),t([e(0,s(g))],z.prototype,"fragment",null);export{z as AnimatedLineShader};
5
+ import{__decorate as t,__param as i}from"tslib";import{location as e,uniform as s,input as l}from"../../GraphShaderModule.js";import{dot as o,Vec2 as a,Float as n,max as r,Vec4 as d,mix as m,length as p,clamp as u,Vec3 as y,step as c,min as h}from"../../graph/glsl.js";import{AAnimatedPolyShader as x,PolyHittestVertexInput as v,PolyVertexInput as f,PolyFragmentInput as w}from"./AAnimatedPolyShader.js";import{getValue as b}from"./AAnimatedShader.js";import{distPointSegment as g}from"../shaders/hittestUtils.js";import{getLineAntialiasing as S,getLineThinFactor as P,AntialiasingControls as z}from"../shaders/LineShader.js";class A extends f{}t([e(10,n)],A.prototype,"accumulatedDistance",void 0),t([e(11,a)],A.prototype,"normal",void 0),t([e(12,a)],A.prototype,"segmentDirection",void 0);class D extends w{}class j extends x{constructor(){super(...arguments),this.type="AnimatedLineShader"}vertex(t,i){const{animationPointerAndBaseSizeAndReferenceSize:e}=t,s=e.xy,{distanceToPx:l,ndc:p,z:u,color:y,isOutline:c,strokeWidth:h,isSDF:x,baseSize:v,scale:f,scaleSymbolsProportionally:w,evalParams:g}=this._vertexPoly(t),S=t.sizing.xy,P=S.x.multiply(v).divide(S.y),z=b(s,6,g).a,A=t.accumulatedDistance.subtract(z),{normal:D}=t,j=t.normal.y,C=A.divide(this.view.displayZoomFactor).add(o(t.segmentDirection,t.offset)).divide(P),F=j.add(1).divide(2),R=new a(C,F),W=t.tlbr.divide(this.mosaicInfo.size.xyxy),M=v.divide(2),O=new n(.5).multiply(this.antialiasingControls.antialiasing),T=r(M.add(O),new n(.45)).add(new n(.1).multiply(O));return{glPosition:new d(p,u,1),tlbr:W,uv:R,color:y.multiply(new n(1).subtract(c)),outlineColor:y.multiply(c),distanceToPx:l,strokeWidth:h.multiply(m(new n(1),f,w)),isOutline:c,isSDF:x,halfWidth:T,normal:D,...this.maybeRunHittest(t,i,T)}}fragment(t){const i=this._fragmentPoly(t),e=S(t,this.antialiasingControls.blur),{halfWidth:s,normal:l}=t,o=P(s),a=p(l).multiply(s),r=u(o.multiply(s.subtract(a)).divide(o.subtract(new n(1))),new n(0),new n(1));return this.getFragmentOutput(i.multiply(r).multiply(e),t)}hittest(t,i,e){const{viewMat3:s,tileMat3:l}=this.view,o=s.multiply(l),a=o.multiply(new y(t.pos,1)),n=o.multiply(new y(i.nextPos1,1)),r=o.multiply(new y(i.nextPos2,1)),{distance:d,smallSymbolDistance:m,smallSymbolSizeThreshold:p}=this.hittestRequest,u=c(e,p.multiply(.5)).multiply(d.subtract(m)),x=this.hittestRequest.position;return h(g(x,a.xy,n.xy),g(x,a.xy,r.xy)).subtract(e).add(u)}}t([s(z)],j.prototype,"antialiasingControls",void 0),t([i(0,l(A)),i(1,l(v))],j.prototype,"vertex",null),t([i(0,l(D))],j.prototype,"fragment",null);export{j as AnimatedLineShader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{LineTessellation as i}from"../../../TurboLine.js";import{clipLinesMarshall as s,triangulate as r}from"../../../mesh/templates/templateUtils.js";import{AAnimatedMeshWriter as n}from"./AnimatedMeshWriter.js";import{lineLength as o,noTiming as a,zoomRange as h,segmentDirection as l,normal as m,accumulatedDistance as u,sizing as c,animationPointerAndBaseSizeAndReferenceSize as d,tlbr as p,offset as f,pos as x,bitset as _,id as g,noLineLength as P}from"./attributes.js";import{createComputedAnimatedMeshParams as v}from"./ComputedAnimatedParams.js";import{processLineCapInput as L,processLineJoinInput as W}from"../fill/meshWriterUtils.js";import{LineTessellationParams as y}from"../line/LineMeshWriter.js";class b extends n{_write(t,i,s){const r=s??e.fromFeatureSetReaderCIM(i);if(!r)return;const n=this.evaluatedMeshParams.sprite,{textureBinding:o}=n;t.recordStart(this.instanceId,this.attributeLayout,o);const a=i.getDisplayId();this._writePoly(t,a,r.asOptimized()),t.recordEnd()}}class w extends b{constructor(){super(...arguments),this.vertexSpec={createComputedParams:v,attributes:{id:g,bitset:_,pos:x,offset:f.fill,tlbr:p,animationPointerAndBaseSizeAndReferenceSize:d,sizing:c},optionalAttributes:{zoomRange:h,value1Position2Value2:a,lineLength:P}}}_writePoly(t,e,i){const s=[];if(!r(s,i))return;const n=t.vertexCount();i.forEachVertex((i,s)=>{this._writeVertex(t,e,i,s)}),t.indexEnsureSize(s.length);for(const r of s)t.indexWrite(n+r)}}class C{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0}}const z=65535;class j extends b{constructor(){super(...arguments),this.vertexSpec={createComputedParams:v,attributes:{id:g,bitset:_,pos:x,offset:f.line,tlbr:p,animationPointerAndBaseSizeAndReferenceSize:d,sizing:c,accumulatedDistance:u,normal:m,segmentDirection:l},optionalAttributes:{zoomRange:h,value1Position2Value2:a,lineLength:o}},this._tessParams=new y,this._currentWrite=new C,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:z,textured:!1},this._lineLength=0,this._lineTessellator=new i((t,e,i,s,r,n,o,a,h,l,m)=>this._writeTesselatedVertex(t,e,i,s,r,n,o,a,h,l,m,this._lineLength),this._writeTriangle.bind(this),!1)}_writePoly(i,r,n){const o=64,a=!1,h=s(e.fromOptimized(n,"esriGeometryPolyline"),o);if(null==h)return;const{_currentWrite:l,_tessellationOptions:m}=this,{baseSize:u,capType:c,joinType:d,miterLimit:p}=this.evaluatedMeshParams,f=t(.5*u);m.halfWidth=f,m.capType=L(c||"Round"),m.joinType=W(d||"Round"),m.miterLimit=p||2,l.out=i,l.id=r,l.vertexCount=0,l.indexCount=0,l.vertexFrom=i.vertexCount(),l.vertexBounds=1;for(const{line:t,start:e,pathLength:s}of h){m.initialDistance=e%z,l.pathLength=s,this._lineLength=0;for(let e=1;e<t.length;e++){const i=t[e].x-t[e-1].x,s=t[e].y-t[e-1].y;this._lineLength+=Math.sqrt(i*i+s*s)}this._lineTessellator.tessellate(t,m,a)}}_writeTesselatedVertex(t,e,i,s,r,n,o,a,h,l,m,u){const{out:c,id:d,vertexBounds:p,pathLength:f}=this._currentWrite;return this.hasEffects&&c.recordBounds(t,e,p,p),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=h,this._tessParams.normalY=l,this._tessParams.directionX=r,this._tessParams.directionY=n,this._tessParams.distance=m,this._tessParams.pathLength=f,this._tessParams.lineLength=u,this._writeVertex(c,d,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,i){const{out:s}=this._currentWrite;s.indexEnsureSize(3),s.indexWrite(t),s.indexWrite(e),s.indexWrite(i),this._currentWrite.indexCount+=3}}export{b as AAnimatedPolyMeshWriter,w as AnimatedFillMeshWriter,j as AnimatedLineMeshWriter};
5
+ import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{triangulate as s}from"../../../../../../../geometry/libtess.js";import{LineTessellation as i}from"../../../TurboLine.js";import{clipLinesMarshall as r,triangulate as n,clipMarshall as o}from"../../../mesh/templates/templateUtils.js";import{AAnimatedMeshWriter as a}from"./AnimatedMeshWriter.js";import{lineLength as h,noTiming as l,zoomRange as m,segmentDirection as u,normal as c,accumulatedDistance as d,sizing as f,animationPointerAndBaseSizeAndReferenceSize as p,tlbr as x,offset as _,pos as g,bitset as P,id as b,noLineLength as v}from"./attributes.js";import{createComputedAnimatedMeshParams as L}from"./ComputedAnimatedParams.js";import{processLineCapInput as y,processLineJoinInput as W}from"../fill/meshWriterUtils.js";import{LineTessellationParams as w}from"../line/LineMeshWriter.js";class C extends a{_write(t,s,i){const r=i??e.fromFeatureSetReaderCIM(s);if(!r)return;const n=this.evaluatedMeshParams.sprite,{textureBinding:o}=n;t.recordStart(this.instanceId,this.attributeLayout,o);const a=s.getDisplayId();this._writePoly(t,a,r.asOptimized()),t.recordEnd()}}class z extends C{constructor(){super(...arguments),this.vertexSpec={createComputedParams:L,attributes:{id:b,bitset:P,pos:g,offset:_.fill,tlbr:x,animationPointerAndBaseSizeAndReferenceSize:p,sizing:f},optionalAttributes:{zoomRange:m,value1Position2Value2:l,lineLength:v}}}_writePoly(t,e,i){const r=this._clip(i);if(!r)return;i=r;const o=[],a=t.vertexCount();let h;if(n(o,i)){if(0===o.length)return;h=0;for(const s of o){const r=i.coords[2*s],n=i.coords[2*s+1];this._writeVertex(t,e,r,n),h++}}else{const{coords:r,lengths:n}=i,o=s(r,n);h=o.vertexCount;for(let s=0;s<o.buffer.length/2;s++){const i=o.buffer[2*s],r=o.buffer[2*s+1];this._writeVertex(t,e,i,r)}}if(h>0){t.indexEnsureSize(h);for(let e=0;e<h;e++)t.indexWrite(e+a)}}_clip(t){const e=this.hasEffects;return o(t,e?256:8)}}class j{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0}}const S=65535;class T extends C{constructor(){super(...arguments),this.vertexSpec={createComputedParams:L,attributes:{id:b,bitset:P,pos:g,offset:_.line,tlbr:x,animationPointerAndBaseSizeAndReferenceSize:p,sizing:f,accumulatedDistance:d,normal:c,segmentDirection:u},optionalAttributes:{zoomRange:m,value1Position2Value2:l,lineLength:h}},this._tessParams=new w,this._currentWrite=new j,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:S,textured:!1},this._lineLength=0,this._lineTessellator=new i((t,e,s,i,r,n,o,a,h,l,m)=>this._writeTesselatedVertex(t,e,s,i,r,n,o,a,h,l,m,this._lineLength),this._writeTriangle.bind(this),!1)}_writePoly(s,i,n){const o=64,a=!1,h=r(e.fromOptimized(n,"esriGeometryPolyline"),o);if(null==h)return;const{_currentWrite:l,_tessellationOptions:m}=this,{baseSize:u,capType:c,joinType:d,miterLimit:f}=this.evaluatedMeshParams,p=t(.5*u);m.halfWidth=p,m.capType=y(c||"Round"),m.joinType=W(d||"Round"),m.miterLimit=f||2,l.out=s,l.id=i,l.vertexCount=0,l.indexCount=0,l.vertexFrom=s.vertexCount(),l.vertexBounds=1;for(const{line:t,start:e,pathLength:r}of h){m.initialDistance=e%S,l.pathLength=r,this._lineLength=0;for(let e=1;e<t.length;e++){const s=t[e].x-t[e-1].x,i=t[e].y-t[e-1].y;this._lineLength+=Math.sqrt(s*s+i*i)}this._lineTessellator.tessellate(t,m,a)}}_writeTesselatedVertex(t,e,s,i,r,n,o,a,h,l,m,u){const{out:c,id:d,vertexBounds:f,pathLength:p}=this._currentWrite;return this.hasEffects&&c.recordBounds(t,e,f,f),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=h,this._tessParams.normalY=l,this._tessParams.directionX=r,this._tessParams.directionY=n,this._tessParams.distance=m,this._tessParams.pathLength=p,this._tessParams.lineLength=u,this._writeVertex(c,d,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}export{C as AAnimatedPolyMeshWriter,z as AnimatedFillMeshWriter,T as AnimatedLineMeshWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{invert as e,multiply as t}from"../../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{animationDebugFlags as i}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{FeatureTechnique as r}from"../FeatureTechnique.js";import{getSelectionDefines as o,getLocalTileOffset as n,getFeatureUniforms as s,resolveDynamicUniforms as m,getFeaturePipelineState as l}from"../featureTechniqueUtils.js";class u extends r{render(r,u){const{context:c,painter:f}=r,{target:g}=u,{freezeGlobalTime:p}=i,d=0,x=f.textureManager.animationStore.getTexture(c,d),b=[2/r.state.size[0],0,0,0,-2/r.state.size[1],0,-1,1,1],h=Array.from(e(a(),b)),D=Array.from(t(a(),h,g.transforms.displayViewScreenMat3)),T=u.instance.getInput(),y=f.textureManager.getMosaicInfo(r,u.textureKey,!1),{optionalAttributes:z}=T,R=z.zoomRange,S=z.value1Position2Value2,j="accumulatedDistance"in z&&z.accumulatedDistance,A="segmentDirection"in z&&z.segmentDirection,I="normal"in z&&z.normal;f.setShader({shader:this.shaders.geometry,uniforms:{...m(r,u.target,T.uniforms),...s(r,u.target),mosaicInfo:y,animationInfo:{globalTime:r.animationsEnabled?!1===p?r.time/1e3:p:0,animationTextureSize:[x.descriptor.width,x.descriptor.height],animationTexture:{unit:6,texture:x},toScreen:D,toNdc:b,mapRotation:r.state.rotation,pixelRatio:r.state.pixelRatio},localTileOffset:n(u.target)},defines:{...o(r)},optionalAttributes:{zoomRange:R,value1Position2Value2:S,accumulatedDistance:j,segmentDirection:A,normal:I},useComputeBuffer:!0}),f.setPipelineState({...l(r)}),f.submitDraw(r,u),!1===p&&r.animationsEnabled&&g.requestRender()}}export{u as AnimatedTechnique};
5
+ import{invert as e,multiply as t}from"../../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{animationDebugFlags as a}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{FeatureTechnique as o}from"../FeatureTechnique.js";import{isHittest as r,getSelectionDefines as n,getLocalTileOffset as s,getFeatureUniforms as m,resolveDynamicUniforms as l,getFeaturePipelineState as u}from"../featureTechniqueUtils.js";import{getAntialiasingControls as c}from"../line/utils.js";class f extends o{render(o,f){const{context:g,painter:p,pixelRatio:d}=o,{target:x}=f,{freezeGlobalTime:b}=a,h=0,D=p.textureManager.animationStore.getTexture(g,h),T=[2/o.state.size[0],0,0,0,-2/o.state.size[1],0,-1,1,1],R=Array.from(e(i(),T)),j=Array.from(t(i(),R,x.transforms.displayViewScreenMat3)),y=f.instance.getInput(),z=p.textureManager.getMosaicInfo(o,f.textureKey,!1),{optionalAttributes:S}=y,A=S.zoomRange,I=S.value1Position2Value2,M="accumulatedDistance"in S&&S.accumulatedDistance,q="segmentDirection"in S&&S.segmentDirection,w="normal"in S&&S.normal;p.setShader({shader:this.shaders.geometry,uniforms:{...l(o,f.target,y.uniforms),...m(o,f.target),antialiasingControls:c(d),mosaicInfo:z,animationInfo:{globalTime:o.animationsEnabled?!1===b?o.time/1e3:b:0,animationTextureSize:[D.descriptor.width,D.descriptor.height],animationTexture:{unit:6,texture:D},toScreen:j,toNdc:T,mapRotation:o.state.rotation,pixelRatio:o.state.pixelRatio},localTileOffset:s(f.target)},defines:{...n(o)},optionalAttributes:{zoomRange:A,value1Position2Value2:I,accumulatedDistance:M,segmentDirection:q,normal:w},useComputeBuffer:r(o)}),p.setPipelineState({...u(o)}),p.submitDraw(o,f),!1===b&&o.animationsEnabled&&x.requestRender()}}export{f as AnimatedTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t,__param as i}from"tslib";import{location as e,uniform as o,option as l,input as a,UniformGroup as r}from"../../GraphShaderModule.js";import{Vec3 as s,step as n,min as p,max as u,Float as m,Vec4 as d,length as y,clamp as c,Vec2 as f}from"../../graph/glsl.js";import{AFeatureShader as h,BaseHittestVertexInput as v,FeatureVertexInput as w,FeatureFragmentInput as V}from"./AFeatureShader.js";import{thinLineWidthFactor as b,thinLineHalfWidth as S,epsilon as x}from"./constants.js";import{distPointSegment as g}from"./hittestUtils.js";import{VisualVariableColor as j}from"./VisualVariableColor.js";import{VisualVariableOpacity as z}from"./VisualVariableOpacity.js";import{VisualVariableSizeMinMaxValue as M}from"./VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as W}from"./VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as C}from"./VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as P}from"./VisualVariableSizeUnitValue.js";import{getVisualVariableColor as R,getVisualVariableOpacity as H,hasVisualVariableSize as O,getVisualVariableSize as U}from"./vvUtils.js";class q extends w{}t([e(3,d)],q.prototype,"color",void 0),t([e(4,f)],q.prototype,"offset",void 0),t([e(5,f)],q.prototype,"normal",void 0),t([e(6,m)],q.prototype,"halfWidth",void 0),t([e(7,m)],q.prototype,"referenceHalfWidth",void 0),t([e(8,f)],q.prototype,"zoomRange",void 0);class A extends V{}class F extends r{}function D(t){return u(new m(b).multiply(n(t,new m(S))),new m(1))}function G(t,i){const{halfWidth:e,normal:o}=t,l=D(e),a=y(o).multiply(e);return c(l.multiply(e.subtract(a)).divide(i.add(l).subtract(new m(1))),new m(0),new m(1))}function L(t,i){const{id:e,halfWidth:o,referenceHalfWidth:l}=i;if(O(t)){const i=new m(2).multiply(l),a=U(t,e,i);return new m(.5).multiply(o.divide(u(l,new m(x)))).multiply(a)}return o}function T(t,i){const{id:e,offset:o,pos:l,normal:a,zoomRange:r}=i,{displayViewScreenMat3:p,displayViewMat3:y}=t.view,c=R(t,e,i.color),f=H(t,e),h=L(t,i),v=new m(.5).multiply(t.antialiasingControls.antialiasing),w=u(h.add(v),new m(.45)).add(new m(.1).multiply(v)),V=D(w).multiply(w).multiply(o),b=y.multiply(new s(V,new m(0))),S=p.multiply(new s(l,new m(1))).add(b),x=new m(2).multiply(n(h,new m(0))).add(t.clip(e,r)),g=new d(S.xy,x,1);return{color:c,opacity:f,halfWidth:w,normal:a,scaledOffset:V,scaledHalfWidth:h,glPosition:new d(g.xy,x,1)}}function k(t,i){const{opacity:e,color:o}=t,l=G(t,i);return e.multiply(o).multiply(l)}t([o(m)],F.prototype,"antialiasing",void 0),t([o(m)],F.prototype,"blur",void 0);class B extends h{constructor(){super(...arguments),this.type="LineShader",this.computeAttributes={pos:["nextPos1","nextPos2"]}}vertex(t,i){const e=T(this,t);return{...e,...this.maybeRunHittest(t,i,e.halfWidth)}}fragment(t){const i=k(t,this.antialiasingControls.blur);return this.getFragmentOutput(i,t)}hittest(t,i,e){const{viewMat3:o,tileMat3:l}=this.view,a=o.multiply(l),r=a.multiply(new s(t.pos,1)),u=a.multiply(new s(i.nextPos1,1)),m=a.multiply(new s(i.nextPos2,1)),{distance:d,smallSymbolDistance:y,smallSymbolSizeThreshold:c}=this.hittestRequest,f=n(e,c.multiply(.5)).multiply(d.subtract(y)),h=this.hittestRequest.position;return p(g(h,r.xy,u.xy),g(h,r.xy,m.xy)).subtract(e).add(f)}}t([o(F)],B.prototype,"antialiasingControls",void 0),t([l(j)],B.prototype,"visualVariableColor",void 0),t([l(z)],B.prototype,"visualVariableOpacity",void 0),t([l(M)],B.prototype,"visualVariableSizeMinMaxValue",void 0),t([l(W)],B.prototype,"visualVariableSizeScaleStops",void 0),t([l(C)],B.prototype,"visualVariableSizeStops",void 0),t([l(P)],B.prototype,"visualVariableSizeUnitValue",void 0),t([i(0,a(q)),i(1,a(v))],B.prototype,"vertex",null),t([i(0,a(A))],B.prototype,"fragment",null);export{F as AntialiasingControls,A as LineFragmentInput,B as LineShader,q as LineVertexInput,G as getLineAntialiasing,k as getLineFragmentColor,D as getLineThinFactor,T as getLineVertexData};
5
+ import{__decorate as t,__param as i}from"tslib";import{location as e,uniform as o,option as l,input as a,UniformGroup as r}from"../../GraphShaderModule.js";import{Vec3 as s,step as n,min as p,length as u,clamp as m,Float as d,max as y,Vec4 as c,Vec2 as f}from"../../graph/glsl.js";import{AFeatureShader as h,BaseHittestVertexInput as v,FeatureVertexInput as w,FeatureFragmentInput as V}from"./AFeatureShader.js";import{thinLineWidthFactor as b,thinLineHalfWidth as S,epsilon as x}from"./constants.js";import{distPointSegment as g}from"./hittestUtils.js";import{VisualVariableColor as j}from"./VisualVariableColor.js";import{VisualVariableOpacity as z}from"./VisualVariableOpacity.js";import{VisualVariableSizeMinMaxValue as M}from"./VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as W}from"./VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as C}from"./VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as P}from"./VisualVariableSizeUnitValue.js";import{getVisualVariableColor as R,getVisualVariableOpacity as H,hasVisualVariableSize as O,getVisualVariableSize as U}from"./vvUtils.js";class q extends w{}t([e(3,c)],q.prototype,"color",void 0),t([e(4,f)],q.prototype,"offset",void 0),t([e(5,f)],q.prototype,"normal",void 0),t([e(6,d)],q.prototype,"halfWidth",void 0),t([e(7,d)],q.prototype,"referenceHalfWidth",void 0),t([e(8,f)],q.prototype,"zoomRange",void 0);class A extends V{}class F extends r{}function D(t){return y(new d(b).multiply(n(t,new d(S))),new d(1))}function G(t,i){const{halfWidth:e,normal:o}=t,l=D(e),a=u(o).multiply(e);return m(l.multiply(e.subtract(a)).divide(i.add(l).subtract(new d(1))),new d(0),new d(1))}function L(t,i){const{id:e,halfWidth:o,referenceHalfWidth:l}=i;if(O(t)){const i=new d(2).multiply(l),a=U(t,e,i);return new d(.5).multiply(o.divide(y(l,new d(x)))).multiply(a)}return o}function T(t,i){const{id:e,offset:o,pos:l,normal:a,zoomRange:r}=i,{displayViewScreenMat3:p,displayViewMat3:u}=t.view,m=R(t,e,i.color),f=H(t,e),h=L(t,i),v=new d(.5).multiply(t.antialiasingControls.antialiasing),w=y(h.add(v),new d(.45)).add(new d(.1).multiply(v)),V=D(w).multiply(w).multiply(o),b=u.multiply(new s(V,new d(0))),S=p.multiply(new s(l,new d(1))).add(b),x=new d(2).multiply(n(h,new d(0))).add(t.clip(e,r)),g=new c(S.xy,x,1);return{color:m,opacity:f,halfWidth:w,normal:a,scaledOffset:V,scaledHalfWidth:h,glPosition:new c(g.xy,x,1)}}function k(t,i){const{opacity:e,color:o}=t,l=G(t,i);return e.multiply(o).multiply(l)}t([o(d)],F.prototype,"antialiasing",void 0),t([o(d)],F.prototype,"blur",void 0);class B extends h{constructor(){super(...arguments),this.type="LineShader",this.computeAttributes={pos:["nextPos1","nextPos2"]}}vertex(t,i){const e=T(this,t);return{...e,...this.maybeRunHittest(t,i,e.halfWidth)}}fragment(t){const i=k(t,this.antialiasingControls.blur);return this.getFragmentOutput(i,t)}hittest(t,i,e){const{viewMat3:o,tileMat3:l}=this.view,a=o.multiply(l),r=a.multiply(new s(t.pos,1)),u=a.multiply(new s(i.nextPos1,1)),m=a.multiply(new s(i.nextPos2,1)),{distance:d,smallSymbolDistance:y,smallSymbolSizeThreshold:c}=this.hittestRequest,f=n(e,c.multiply(.5)).multiply(d.subtract(y)),h=this.hittestRequest.position;return p(g(h,r.xy,u.xy),g(h,r.xy,m.xy)).subtract(e).add(f)}}t([o(F)],B.prototype,"antialiasingControls",void 0),t([l(j)],B.prototype,"visualVariableColor",void 0),t([l(z)],B.prototype,"visualVariableOpacity",void 0),t([l(M)],B.prototype,"visualVariableSizeMinMaxValue",void 0),t([l(W)],B.prototype,"visualVariableSizeScaleStops",void 0),t([l(C)],B.prototype,"visualVariableSizeStops",void 0),t([l(P)],B.prototype,"visualVariableSizeUnitValue",void 0),t([i(0,a(q)),i(1,a(v))],B.prototype,"vertex",null),t([i(0,a(A))],B.prototype,"fragment",null);export{F as AntialiasingControls,A as LineFragmentInput,B as LineShader,q as LineVertexInput,G as getLineAntialiasing,k as getLineFragmentColor,D as getLineThinFactor,T as getLineVertexData};