@arcgis/core 6.0.0-next.13 → 6.0.0-next.15

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 (220) hide show
  1. package/arcade/containerUtils.js +1 -1
  2. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  3. package/arcade/functions/feature.js +1 -1
  4. package/arcade/functions/featuresetstring.js +1 -1
  5. package/arcade/functions/geomasync.js +1 -1
  6. package/arcade/functions/portal.js +1 -1
  7. package/arcade/functions/string.js +1 -1
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/{5566f14afb63065e438f.js → 0050916e462e3c9e0627.js} +1 -1
  10. package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +1 -0
  11. package/assets/esri/core/workers/chunks/08fe248e412bb170210d.js +1 -0
  12. package/assets/esri/core/workers/chunks/0da6abe3ceabfe78f7a0.js +1 -0
  13. package/assets/esri/core/workers/chunks/0f617980c7dd9ad0444f.js +1 -0
  14. package/assets/esri/core/workers/chunks/{fb444954be74c1962ced.js → 10d80e793019dfb45ca2.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{10445313d0d57b34511b.js → 2145a512d269d64036b0.js} +1 -1
  16. package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +1 -0
  17. package/assets/esri/core/workers/chunks/25f19fc929f25ddd628c.js +1 -0
  18. package/assets/esri/core/workers/chunks/28b74bc77f7c13080074.js +1 -0
  19. package/assets/esri/core/workers/chunks/{2ef5237e4c876d6a4ee0.js → 2bd4ee083ca4ad221f8b.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{f4f9d08b2df856e3b694.js → 2eae542fe7f0f6576ac1.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{2aeb5cc32284dd3e4d22.js → 33e4ff228a8c81b99022.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{42323093827adffe56d3.js → 3418877328f4f0830300.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{8dc1c3042267618fd710.js → 34cbaf844730ac2d92c2.js} +2 -2
  24. package/assets/esri/core/workers/chunks/{96c50a0dda0f1503ef92.js → 3c301a689c7853c9fa67.js} +2 -2
  25. package/assets/esri/core/workers/chunks/{02253bdffbd580af22d8.js → 3ff6d1ed3c0f1285f3e7.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{67e4b5651fd7ff7d8cf0.js → 4ac1d3e49e242e373a92.js} +1 -1
  27. package/assets/esri/core/workers/chunks/4df6cb1bee5d0720a43e.js +1 -0
  28. package/assets/esri/core/workers/chunks/{a4cab24af69260438ff4.js → 4e6f40cbdb8c508e6df1.js} +1 -1
  29. package/assets/esri/core/workers/chunks/5736feefa261589b6273.js +1 -0
  30. package/assets/esri/core/workers/chunks/601e1d020b8115497944.js +1 -0
  31. package/assets/esri/core/workers/chunks/{2686fe5b62dd0be699c0.js → 634523cc7757da9020e4.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{a518ae5683367eeda74c.js → 70d3055f15d8b0cf4074.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{1b946714ca4a1a7359d4.js → 76ab353d80d786777161.js} +2 -2
  34. package/assets/esri/core/workers/chunks/7f8e327acad48c9e75ea.js +1 -0
  35. package/assets/esri/core/workers/chunks/8052da8be251c3ff2176.js +1 -0
  36. package/assets/esri/core/workers/chunks/8e19629899a5becf8e19.js +1 -0
  37. package/assets/esri/core/workers/chunks/{f6e62d2d279a328cbed7.js → 90bdf86f553e2742d67c.js} +1 -1
  38. package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +1 -0
  39. package/assets/esri/core/workers/chunks/94e427040edb469d58ad.js +1 -0
  40. package/assets/esri/core/workers/chunks/{3d9d7d3a40b51eb7ee3d.js → 953ba13299e7aa92c1a0.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{f46d9a19f79d4a4bd354.js → 9e1a3b6a08c96dcefdde.js} +1 -1
  42. package/assets/esri/core/workers/chunks/9f0a973a0dd28953ce25.js +1 -0
  43. package/assets/esri/core/workers/chunks/a2ad3e620c98e2b2eb06.js +1 -0
  44. package/assets/esri/core/workers/chunks/a34b3d2e11a777e1ff3f.js +1 -0
  45. package/assets/esri/core/workers/chunks/{140f2eeb11e39ab15734.js → aa36c3a9bbaa086e3757.js} +1 -1
  46. package/assets/esri/core/workers/chunks/ae31fd416bbb41a81392.js +1 -0
  47. package/assets/esri/core/workers/chunks/b49df4ebd4be1181b0f9.js +2 -0
  48. package/assets/esri/core/workers/chunks/{68d8ae42ab71d01a70a5.js → b557824bc1fa163d72a3.js} +2 -2
  49. package/assets/esri/core/workers/chunks/bc915fb182d463d804e6.js +1 -0
  50. package/assets/esri/core/workers/chunks/{992f102992c2bed7b34e.js → d5d0fe8e198ff5a902ee.js} +1 -1
  51. package/assets/esri/core/workers/chunks/e2190361247f35b02b32.js +1 -0
  52. package/assets/esri/core/workers/chunks/e2f42aec02bff33b25dd.js +1 -0
  53. package/assets/esri/core/workers/chunks/ebc1a2ef3aed8aa29424.js +1 -0
  54. package/assets/esri/core/workers/chunks/ed6e9d7f71bfd2691717.js +1 -0
  55. package/assets/esri/core/workers/chunks/ed8786fed345718ed684.js +1 -0
  56. package/assets/esri/core/workers/chunks/ee6679ef9efa1504e7eb.js +1 -0
  57. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  58. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  59. package/assets/esri/libs/pdfjs/wasm/openjpeg_nowasm_fallback.js +1 -0
  60. package/chunks/BlendWeights.glsl.js +10 -10
  61. package/chunks/Blur.glsl.js +2 -2
  62. package/chunks/EdgeDetect.glsl.js +24 -19
  63. package/chunks/HUDMaterial.glsl.js +11 -1
  64. package/chunks/HighlightApply.glsl.js +4 -5
  65. package/chunks/HighlightBlur.glsl.js +5 -5
  66. package/chunks/HighlightDownsample.glsl.js +2 -2
  67. package/chunks/HighlightSharpApply.glsl.js +61 -0
  68. package/chunks/lyr3DMain.js +1 -1
  69. package/chunks/lyr3DWorker.js +2 -2
  70. package/chunks/portal.js +1 -1
  71. package/config.js +1 -1
  72. package/core/ObjectPool.js +1 -1
  73. package/core/PooledArray.js +1 -1
  74. package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
  75. package/geometry/support/buffer/BufferPool.js +1 -1
  76. package/geometry/support/coordsUtils.js +1 -1
  77. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  78. package/geometry/support/curves/mathUtils.js +1 -1
  79. package/geometry/support/meshUtils.d.ts +5 -6
  80. package/interfaces.d.ts +18 -9
  81. package/kernel.js +1 -1
  82. package/layers/GeospatialPDFLayer.d.ts +154 -4
  83. package/layers/Layer.d.ts +2 -0
  84. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
  85. package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
  86. package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
  87. package/layers/geospatialPDF/projectionToWKTUtils.js +2 -2
  88. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  89. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  90. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  91. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  92. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  93. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  94. package/layers/raster/datasets/TIFFRaster.js +1 -1
  95. package/layers/raster/datasets/pixelReader.js +1 -1
  96. package/layers/raster/functions/clipUtils.js +1 -1
  97. package/layers/support/LabelClass.d.ts +3 -2
  98. package/layers/support/PortalItemData.d.ts +31 -8
  99. package/layers/support/fieldUtils.js +1 -1
  100. package/layers/support/types.d.ts +4 -1
  101. package/package.json +2 -2
  102. package/portal/schemas/definitions.js +1 -1
  103. package/rest/knowledgeGraph/ObjectValue.js +1 -1
  104. package/symbols/cim/cimAnalyzer.js +1 -1
  105. package/views/2d/engine/webgl/GlyphWorker.js +1 -1
  106. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  107. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  108. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  109. package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
  110. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  111. package/views/3d/analysis/LineOfSight/{LineOfSightRootPlugin.js → LineOfSightPlacementRootPlugin.js} +1 -1
  112. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  113. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  114. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
  115. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  116. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  117. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  118. package/views/3d/support/MemoryController.js +1 -1
  119. package/views/3d/terrain/TerrainData.js +1 -1
  120. package/views/3d/terrain/terrainUtils.js +1 -1
  121. package/views/3d/webgl-engine/core/shaderLibrary/HighlightCellGridScreenSpacePass.glsl.js +20 -6
  122. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  123. package/views/3d/webgl-engine/effects/geometry/RenderOccluded.js +1 -1
  124. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  125. package/views/3d/webgl-engine/effects/highlight/HighlightApply.glsl.js +1 -1
  126. package/views/3d/webgl-engine/effects/highlight/HighlightCellGridScreenSpacePassParameters.js +2 -0
  127. package/views/3d/webgl-engine/effects/highlight/HighlightDownsample.glsl.js +1 -1
  128. package/views/3d/webgl-engine/effects/highlight/HighlightPassParameters.js +1 -1
  129. package/views/3d/webgl-engine/effects/highlight/HighlightSharpApply.glsl.js +2 -0
  130. package/views/3d/webgl-engine/effects/highlight/HighlightSharpApplyTechnique.js +2 -0
  131. package/views/3d/webgl-engine/effects/smaa/BlendWeights.glsl.js +1 -1
  132. package/views/3d/webgl-engine/effects/smaa/Blur.glsl.js +1 -1
  133. package/views/3d/webgl-engine/effects/smaa/EdgeDetect.glsl.js +1 -1
  134. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  135. package/views/3d/webgl-engine/effects/smaa/SMAABlendWeightsTechnique.js +1 -1
  136. package/views/3d/webgl-engine/effects/smaa/SMAABlurTechnique.js +1 -1
  137. package/views/3d/webgl-engine/effects/smaa/SMAAEdgeDetectTechnique.js +1 -1
  138. package/views/3d/webgl-engine/effects/smaa/SMAAPassParameters.js +1 -1
  139. package/views/3d/webgl-engine/effects/smaa/SMAATechniqueConfiguration.js +2 -0
  140. package/views/3d/webgl-engine/lib/Compositor.js +1 -1
  141. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  142. package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
  143. package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
  144. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  145. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  146. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  147. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  148. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  149. package/views/draw/DrawTool.js +1 -1
  150. package/views/draw/plugins/MultipointPlugin.js +1 -1
  151. package/views/draw/support/PluginContext.js +1 -1
  152. package/views/draw/support/managers/TooltipManager.js +1 -1
  153. package/views/draw/support/types.d.ts +5 -2
  154. package/views/support/HighlightDefaults.js +1 -1
  155. package/webdoc/applicationProperties/SearchLayerField.d.ts +7 -1
  156. package/webdoc/applicationProperties/SearchLayerField.js +1 -1
  157. package/webdoc/applicationProperties/SearchTableField.d.ts +7 -1
  158. package/webdoc/applicationProperties/SearchTableField.js +1 -1
  159. package/webdoc/applicationProperties/searchMode.js +2 -0
  160. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  161. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  162. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  163. package/widgets/BatchAttributeForm.js +1 -1
  164. package/widgets/Editor/EditorViewModel.d.ts +10 -1
  165. package/widgets/Editor.d.ts +10 -1
  166. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  167. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  168. package/widgets/HistogramRangeSlider.d.ts +2 -2
  169. package/widgets/HistogramRangeSlider.js +1 -1
  170. package/widgets/Legend.d.ts +1 -0
  171. package/widgets/OrientedImageryViewer/services/DepthImageService.js +1 -1
  172. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.d.ts +5 -2
  173. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  174. package/widgets/ScaleRangeSlider.js +1 -1
  175. package/widgets/Search/LayerSearchSource.d.ts +23 -1
  176. package/widgets/Search/LayerSearchSource.js +1 -1
  177. package/widgets/Search/support/layerSearchUtils.js +1 -1
  178. package/widgets/Search/types.d.ts +7 -0
  179. package/widgets/ValuePicker/ValuePickerBaseComponent.d.ts +5 -1
  180. package/widgets/ValuePicker/ValuePickerCollection.d.ts +2 -0
  181. package/widgets/ValuePicker/ValuePickerCombobox.d.ts +7 -1
  182. package/widgets/ValuePicker/ValuePickerLabel.d.ts +7 -1
  183. package/widgets/ValuePicker/ValuePickerSlider.d.ts +2 -0
  184. package/widgets/ValuePicker/ValuePickerSliderVisibleElements.d.ts +5 -1
  185. package/widgets/ValuePicker/ValuePickerVisibleElements.d.ts +5 -1
  186. package/widgets/ValuePicker/types.d.ts +2 -0
  187. package/widgets/support/forms/formUtils.js +1 -1
  188. package/widgets/support/forms/types.d.ts +1 -1
  189. package/assets/esri/core/workers/chunks/037a8cc19debbaaa4e10.js +0 -1
  190. package/assets/esri/core/workers/chunks/0dc66b03ff55d0ea5a09.js +0 -1
  191. package/assets/esri/core/workers/chunks/175c268e64ccd01f8c25.js +0 -1
  192. package/assets/esri/core/workers/chunks/1c65ab9ed611c322ce27.js +0 -1
  193. package/assets/esri/core/workers/chunks/2a1ec30f9ad305763f81.js +0 -2
  194. package/assets/esri/core/workers/chunks/3df5500a85345577480a.js +0 -1
  195. package/assets/esri/core/workers/chunks/3f7d583b676b23b3fadb.js +0 -1
  196. package/assets/esri/core/workers/chunks/408e81c8f1eff8a7b379.js +0 -1
  197. package/assets/esri/core/workers/chunks/4503b20ca6a80fb63d72.js +0 -1
  198. package/assets/esri/core/workers/chunks/4a640548032355e57acd.js +0 -1
  199. package/assets/esri/core/workers/chunks/53be85d04cd2da4f391d.js +0 -1
  200. package/assets/esri/core/workers/chunks/566e129f3d3805d7370a.js +0 -1
  201. package/assets/esri/core/workers/chunks/567a65f4203f6e81f4b4.js +0 -1
  202. package/assets/esri/core/workers/chunks/5982c6a8459c1237b298.js +0 -1
  203. package/assets/esri/core/workers/chunks/5eae5c29149f2429fe96.js +0 -1
  204. package/assets/esri/core/workers/chunks/6dc86e7496157c5e4d2c.js +0 -1
  205. package/assets/esri/core/workers/chunks/74b5c00f93cfc0d59029.js +0 -1
  206. package/assets/esri/core/workers/chunks/7c2c8f786a30267a5f05.js +0 -1
  207. package/assets/esri/core/workers/chunks/88e54449261ef94e390d.js +0 -1
  208. package/assets/esri/core/workers/chunks/9e142551163acf752618.js +0 -1
  209. package/assets/esri/core/workers/chunks/af75747b06d79446a855.js +0 -1
  210. package/assets/esri/core/workers/chunks/dba280c370df13196711.js +0 -1
  211. package/assets/esri/core/workers/chunks/dc486a3595b6d57018bb.js +0 -1
  212. package/assets/esri/core/workers/chunks/e3c1c9e6c62ba5cbcdb8.js +0 -1
  213. package/assets/esri/core/workers/chunks/f1f90adae13b04898008.js +0 -1
  214. package/assets/esri/core/workers/chunks/f47c7065da3b5001245f.js +0 -1
  215. /package/assets/esri/core/workers/chunks/{1b946714ca4a1a7359d4.js.LICENSE.txt → 34cbaf844730ac2d92c2.js.LICENSE.txt} +0 -0
  216. /package/assets/esri/core/workers/chunks/{96c50a0dda0f1503ef92.js.LICENSE.txt → 3c301a689c7853c9fa67.js.LICENSE.txt} +0 -0
  217. /package/assets/esri/core/workers/chunks/{8dc1c3042267618fd710.js.LICENSE.txt → 76ab353d80d786777161.js.LICENSE.txt} +0 -0
  218. /package/assets/esri/core/workers/chunks/{2a1ec30f9ad305763f81.js.LICENSE.txt → b49df4ebd4be1181b0f9.js.LICENSE.txt} +0 -0
  219. /package/assets/esri/core/workers/chunks/{68d8ae42ab71d01a70a5.js.LICENSE.txt → b557824bc1fa163d72a3.js.LICENSE.txt} +0 -0
  220. /package/views/3d/analysis/LineOfSight/{lineOfSightPlacementUtils.js → placementUtils.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as t}from"../../core/accessorSupport/decorators.js";import n from"./GraphObject.js";let r=class extends n{constructor(e){super(e)}};r=e([t(`esri.rest.knowledgeGraph.ObjectValue`)],r);export{r as default};
2
+ import{__decorate as e}from"tslib";import{isPlainObject as t}from"../../core/lang.js";import{subclass as n}from"../../core/accessorSupport/decorators.js";import r from"./GraphObject.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";let a=class extends r{constructor(e){super(e)}writeProperties(e,t,n,r){t[n]=o(e,r)}};e([i(`properties`)],a.prototype,`writeProperties`,null),a=e([n(`esri.rest.knowledgeGraph.ObjectValue`)],a);function o(e,n){return e&&typeof e.write==`function`?e.write({},n):e&&typeof e.toJSON==`function`?e.toJSON(n):Array.isArray(e)?e.map(e=>o(e,n)):t(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,o(t,n)])):e}export{a as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as t}from"../../core/fontUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import r from"../../core/Logger.js";import{pt2px as i,px2pt as a}from"../../core/screenUtils.js";import{numericHash as o}from"../../core/string.js";import{isCurvedGeometry as s}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as c}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{checkForAnimations as l,globalRotation as u,getAnimationParams as d,handleAbsoluteAnchor as f,handleMarker as p,handleRelativeAnchor as m,getFrameTranslation as h,translate as g,getStaticParam as _,shouldUseAnimatedPath as v}from"./animationUtils.js";import{CIMSymbolInflatedSizeHelper as y,CIMSymbolHelper as b,forEachSymbolLayer as x}from"./CIMSymbolHelper.js";import{antialiasingOutlineFillSettings as S}from"./constants.js";import{defaultCIMValues as C}from"./defaultCIMValues.js";import{fitVectorMarker as w}from"./fitVectorMarker.js";import{fromCIMFontStyle as T}from"./fromCIMFontStyle.js";import{OverrideHelper as E}from"./OverrideHelper.js";import{hasRichTextFormattingTags as D}from"./richTextUtils.js";import{getSDFInfo as O,getExtent as k,getSDFMetrics as A,getSDFDimensions as j}from"./SDFHelper.js";import{CIMSymbolUnits as M}from"./types.js";import{colorToArray as N,normalizeAlpha as P,getSize as F,isCIMMarkerStrokePlacement as I,hasStrokeLayer as L,getNumericValue as R,getMaxStrokeWidth as z,getTintColor as B,normalizePrimitiveOverrideProps as V,getDefaultCIMValue as H,getEnum as U,getFillColor as W,getStrokeColor as G,fromCIMFontDecoration as K,getStrokeWidth as q,fromCIMVerticalAlignment as ee,fromCIMHorizontalAlignment as te,getTextCasing as J,isValidCIMValue as ne,uncapitalize as re}from"./utils.js";import{isSupportedCallout as ie,getPointSymbolCalloutTransforms as ae,normalizePointSymbolCalloutScale as oe,normalizeLeaderLineStyle as Y,getPointSymbolCalloutFitProperties as se,normalizeBalloonCalloutStyle as ce}from"./callouts/calloutAnalysisUtils.js";import{EffectHelper as le}from"./effects/EffectHelper.js";import{rasterizedVectorMarkerMinSize as ue,randomInsidePolygonTextureSize as de}from"../../views/2d/engine/webgl/definitions.js";const X=()=>r.getLogger(`esri.symbols.cim.cimAnalyzer`);function fe(e){let t=e.markerPlacement;return t&&t.angleToLine?1:0}class pe{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._hasTextStringTemplates=!1,e&&(this._resourceManager=e)}analyzeSymbolReference(t,n,r){if(this._cimLayers=r??[],!t)return this._cimLayers;if(this._reset(),this._hasTextStringTemplates=t.hasTextStringTemplates??!1,t.primitiveOverrides){this._primitiveOverrides=t.primitiveOverrides;for(let t of this._primitiveOverrides){let n=t.valueExpressionInfo;if(n)this._setPoMap(t.primitiveName,t.propertyName,n);else if(t.value!=null){let n=t.value;t.propertyName.includes(`Color`)&&(e(n)&&(n=N(n)),n=P(n)),this._setPoMap(t.primitiveName,t.propertyName,n)}}}return this._analyzeSymbol(t.symbol,n),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){let n=e?.symbolLayers;if(!n)return;for(let e=0;e<n.length;e++){let t=n[e];t.type===`CIMVectorMarker`&&(n[e]=w(t))}let r=e.effects,i=0,a=F(e)??0;e.type===`CIMPointSymbol`&&e.angleAlignment===`Map`&&(i=1);let o={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};o=u(o),o=d(this._poMap,e,o);let s=null;e.type===`CIMPointSymbol`&&(s=this._analyzePointSymbolHalo(e,i,a,r,o),this._analyzeCallout(e,null,[],o,a,i,t));let c=s?n.filter(e=>e!==s):n;if(Ce(c,r))return this._analyzeCompositeOutlineFill(c,r,a);this._analyzeSymbolLayer(s?{...e,symbolLayers:c}:e,null,[],o,a,i,t)}_analyzeSymbolLayer(e,t,n,r,i,a,o){let s=e?.symbolLayers;if(!s)return;let c=e.type===`CIMPolygonSymbol`,l=e.effects,u=s.length;for(;u--;){let d=s[u];if(!d||d.enable===!1)continue;let f;l?.length&&(f=[...l]);let p=d.effects;p?.length&&(l?f.push(...p):f=[...p]);let m=t?[...t]:null;if(f){m??=[];for(let e of f){let t=E.findEffectOverrides(e,this._primitiveOverrides);t&&m.push(t)}}E.findApplicableOverrides(d,this._primitiveOverrides,[]);let h=this._cimLayers.length;switch(d.type){case`CIMSolidFill`:this._analyzeSolidFill(d,m,r,L(s));break;case`CIMPictureFill`:this._analyzePictureFill(d,m,r);break;case`CIMHatchFill`:this._analyzeHatchFill(d,m,r);break;case`CIMGradientFill`:this._analyzeGradientFill(d,m);break;case`CIMSolidStroke`:this._analyzeSolidStroke(d,m,c,i,r);break;case`CIMPictureStroke`:this._analyzePictureStroke(d,m,c,i,r);break;case`CIMGradientStroke`:this._analyzeGradientStroke(d,m,c,i);break;case`CIMCharacterMarker`:case`CIMPictureMarker`:case`CIMVectorMarker`:{(e.type===`CIMLineSymbol`||e.type===`CIMPolygonSymbol`)&&(a=fe(d));let t=[],s=d.primitiveName;s&&t.push(s);let l=c&&I(d.markerPlacement);this._analyzeMarker(d,m,null,t,a,i,o,n,r,!1,l);break}default:X().error(`Cannot analyze CIM layer`,d.type)}if(m?.some(({effect:e})=>Z(e)))for(let e=h;e<this._cimLayers.length;e++)this._cimLayers[e].effectsChangeGeometryType=!0}}_analyzePointSymbolHalo(e,t,r,i,o){let{haloSymbol:s}=e,c=R(e.haloSize,0);if(c<=0||!s?.symbolLayers)return null;let u=s.symbolLayers.filter(e=>e.enable!==!1),f=u[0];if(!f)return null;let p=u.length===1&&f.type===`CIMSolidFill`;if(e.symbolLayers?.some(e=>l(e))===!0||l(s))return X().warnOnce(`CIM point symbol halos do not support independently animated symbol components`),null;let m=i?.map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null);if(m?.some(({effect:e})=>Z(e))){if(!p)return X().warnOnce(`Complex CIM point symbol halos are not supported with geometry-changing effects`),null;let t=e.symbolLayers?.filter(e=>e.enable!==!1)??[];if(!xe(t,m))return X().warnOnce(`CIM point symbol halos with geometry-changing effects currently require polygon-producing effects and an unambiguous solid-fill effect chain`),null;let n=t.find(e=>e.type===`CIMSolidFill`);if(!n)return null;let i=[...m,...(n.effects??[]).map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],a=z(t),o=this._getValueOrOverrideExpression(f.type,f.primitiveName,`Color`,P(f.color));return this._cimLayers.push({type:`outlineFill`,name:n.name,colorLocked:!!n.colorLocked,color:this._getValueOrOverrideExpression(n.type,n.primitiveName,`Color`,P(n.color)),effects:i,effectsChangeGeometryType:!0,outlineColorLocked:!0,outlineColor:o,outlineWidth:c+a,cap:`Round`,join:`Round`,referenceWidth:r,pixelBufferSize:c+a,outlineEffects:i}),n}let h=e.symbolLayers?.filter(e=>e.enable!==!1)??[],g=h.length===1&&h[0].type===`CIMVectorMarker`?h[0]:null,_=n(e);if(_.effects=void 0,_.angle=0,_.scaleX=1,g){let e=_.symbolLayers?.find(e=>e.type===`CIMVectorMarker`&&e.enable!==!1);e&&(e.rotation=0,e.offsetX=0,e.offsetY=0)}let v={..._,haloSize:0,haloSymbol:void 0},x=y.getPointSymbolHaloPadding(e,this._resourceManager),[S,C,w]=b.getTextureAnchor(v,this._resourceManager,ue,x),T=a(w),D=[];E.findApplicableOverrides(_,this._primitiveOverrides,D);let k=g?D.filter(e=>e.primitiveName!==g.primitiveName||![`Rotation`,`OffsetX`,`OffsetY`].includes(e.propertyName)):D,A=g?[{offsetX:this._getValueOrOverrideExpression(g.type,g.primitiveName,`OffsetX`,R(g.offsetX)),offsetY:this._getValueOrOverrideExpression(g.type,g.primitiveName,`OffsetY`,R(g.offsetY)),rotation:this._getValueOrOverrideExpression(g.type,g.primitiveName,`Rotation`,R(g.rotation)),size:T,frameHeight:T,rotateClockWise:!!g.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:!1}]:[],j=$(p?d(this._poMap,f,o):o),M,N;if(j){let e=b.getEnvelope(v,null,this._resourceManager);e&&(M=[e.width,e.height],N=[e.width+2*x,e.height+2*x])}return this._cimLayers.push({type:`marker`,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:{type:`cim-point-symbol-halo`,symbol:_,sdf:!j&&p&&O(v)!=null},overrides:k},colorLocked:!0,color:p?this._getValueOrOverrideExpression(f.type,f.primitiveName,`Color`,P(f.color)):[255,255,255,1],effects:m??null,effectsChangeGeometryType:m?.some(({effect:e})=>Z(e)),scaleSymbolsProportionally:!1,alignment:t,anchorPoint:{x:S,y:C},isAbsoluteAnchorPoint:!1,size:T,scaleX:R(e.scaleX,1),rotation:g?0:R(e.angle,0),offsetX:0,offsetY:0,outlineColor:[0,0,0,0],outlineWidth:0,transform:{type:`cim-marker-transform-param`,params:A},frameHeight:T,widthRatio:1,rotateClockwise:!1,referenceSize:r||T,sizeRatio:1,markerPlacement:null,isOutline:!1,animationParams:j,baseSize:r||T,pixelDimensions:M,texelDimensions:N}),null}_analyzeSolidFill(e,t,n,r){let{primitiveName:i,type:a}=e,o=P(e.color),s=d(this._poMap,e,n);if(!r&&t?.some(e=>e.effect.type===`CIMGeometricEffectTaperedPolygon`)){let n=this._getValueOrOverrideExpression(a,i,`Color`,o);this._cimLayers.push({type:`outlineFill`,name:e.name,colorLocked:!!e.colorLocked,color:n,effects:t,outlineColor:n,outlineColorLocked:!!e.colorLocked,...S,outlineEffects:t})}else this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(a,i,`Color`,o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1,animationParams:$(s)})}_analyzePictureFill(e,t,n){let{primitiveName:r,type:i}=e,a=B(e),o=R(e.height,C.CIMPictureFill.height),s=R(e.scaleX,1);if(`width`in e&&typeof e.width==`number`){let t=e.width,n=1,r=this._resourceManager.getResource(e.url);r!=null&&(n=r.width/r.height),s/=o/t*n}let c={type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(r,i)},l=d(this._poMap,e,n);this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:c,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(i,r,`TintColor`,a),height:this._getValueOrOverrideExpression(i,r,`Height`,o),scaleX:this._getValueOrOverrideExpression(i,r,`ScaleX`,s),angle:this._getValueOrOverrideExpression(i,r,`Rotation`,R(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,r,`OffsetX`,R(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,r,`OffsetY`,R(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1,animationParams:$(l)})}_analyzeHatchFill(e,t,n){let{primitiveName:r,type:i}=e,a=d(this._poMap,e,n),o=this._analyzeMaterialOverrides(r,[`Rotation`,`OffsetX`,`OffsetY`]),s=V(o),c=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(let t of e.lineSymbol.symbolLayers){if(t.type!==`CIMSolidStroke`)continue;let e=t.primitiveName??r;!l&&e&&!t.colorLocked&&(this._poMap[e]?.Color!=null||this._poMap[e]?.StrokeColor!=null)&&(c=P(t.color),c=this._maybeGetValueOrOverrideExpression(e,`StrokeColor`)??this._getValueOrOverrideExpression(i,e,`Color`,c),l=!0);let n=this._maybeGetValueOrOverrideExpression(e,`StrokeWidth`);if(n){let t=null,r=null;typeof n==`number`?t=n:r=n.valueExpressionInfo;let a=s.find(e=>e.propertyName===`strokeWidth`);a?a.propertyName=`width`:(a={type:`CIMPrimitiveOverride`,primitiveName:e,propertyName:`width`,valueExpressionInfo:r,value:t,defaultValue:H(i,`width`)},s.push(a))}}let u={type:`sprite-rasterization-param`,resource:e,overrides:s};this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:u,colorLocked:!!e.colorLocked,effects:t,color:c,height:this._getValueOrOverrideExpression(i,r,`Separation`,R(e.separation,C.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,r,`Rotation`,R(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,r,`OffsetX`,R(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,r,`OffsetY`,R(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l,animationParams:$(a)})}_analyzeGradientFill(e,t){let{angle:n,gradientMethod:r,gradientSize:i,gradientSizeUnits:a,gradientType:o,interval:s,primitiveName:c,type:l}=e,u=C.CIMGradientFill,d=e.colorRamp;this._cimLayers.push({type:`gradientFill`,name:e.name,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(c,l)},colorLocked:!1,effects:t,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(l,c,`GradientMethod`,r??`Linear`),angle:this._getValueOrOverrideExpression(l,c,`Angle`,R(n,u.angle)),gradientType:this._getValueOrOverrideExpression(l,c,`GradientType`,o??u.gradientType),interval:this._getValueOrOverrideExpression(l,c,`Interval`,R(s,d.type===`CIMFixedColorRamp`?d.colors.length:u.interval)),gradientSize:this._getValueOrOverrideExpression(l,c,`GradientSize`,R(i,u.gradientSize)),gradientSizeUnits:a===`Absolute`?M.Absolute:a===`Relative`?M.Relative:u.gradientSizeUnits})}_analyzeCompositeOutlineFill(e,t,n,r=[]){let i=e.find(e=>e.type===`CIMSolidFill`),a=e.find(e=>e.type===`CIMSolidStroke`);if(i==null||a==null)return;let o=[...r,...[...t??[],...i.effects??[]].map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],s=[...r,...[...t??[],...a.effects??[]].map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],c=R(a.width,C.CIMSolidStroke.width),l=U(a.capStyle,C.CIMSolidStroke.capstyle),u=U(a.joinStyle,C.CIMSolidStroke.joinstyle),d=a.miterLimit;this._cimLayers.push({type:`outlineFill`,name:i.name,colorLocked:!!i.colorLocked,color:this._getValueOrOverrideExpression(i.type,i.primitiveName,`Color`,P(i.color)),effects:o,effectsChangeGeometryType:o.some(({effect:e})=>Z(e))||s.some(({effect:e})=>Z(e)),outlineColorLocked:!!a.colorLocked,outlineColor:this._getValueOrOverrideExpression(a.type,a.primitiveName,`Color`,P(a.color)),outlineWidth:this._getValueOrOverrideExpression(a.type,a.primitiveName,`Width`,c),cap:this._getValueOrOverrideExpression(a.type,a.primitiveName,`CapStyle`,l),join:this._getValueOrOverrideExpression(a.type,a.primitiveName,`JoinStyle`,u),miterLimit:d&&this._getValueOrOverrideExpression(a.type,a.primitiveName,`MiterLimit`,d),referenceWidth:n,outlineEffects:s})}_analyzeSolidStroke(e,t,n,r,i){let{primitiveName:a,type:o}=e,s=P(e.color),c=R(e.width,C.CIMSolidStroke.width),l=U(e.capStyle,C.CIMSolidStroke.capstyle),u=U(e.joinStyle,C.CIMSolidStroke.joinstyle),f=e.miterLimit,p=this._analyzePrimitiveOverrides(a,t,null,null),m=[];p&&(m=this._getPrimitiveMaterialOverrides(a,o));let h,g,_,v;if(t&&Array.isArray(t)&&t.length>0){let e=t[t.length-1].effect;e&&e.type===`CIMGeometricEffectDashes`&&e.lineDashEnding===`NoConstraint`&&(h=e.dashTemplate,g=e.scaleDash,_=e.offsetAlongLine,v=e.primitiveName,t=[...t],t.pop())}v!=null&&m.push(...this._getPrimitiveMaterialOverrides(v,o).filter(e=>e.propertyName===`dashTemplate`));let y=h===void 0?null:{type:`sprite-rasterization-param`,resource:{type:`dash`,dashTemplate:h,primitiveName:v},overrides:m},b=d(this._poMap,e,i);this._cimLayers.push({type:`line`,name:e.name,spriteRasterizationParam:y,isOutline:n,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,a,`Color`,s),width:this._getValueOrOverrideExpression(o,a,`Width`,c),cap:this._getValueOrOverrideExpression(o,a,`CapStyle`,l),join:this._getValueOrOverrideExpression(o,a,`JoinStyle`,u),miterLimit:f&&this._getValueOrOverrideExpression(o,a,`MiterLimit`,f),referenceWidth:r,zOrder:he(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(v,`DashTemplate`)??h,offsetAlongLine:this._getValueOrOverrideExpression(o,v,`OffsetAlongLine`,_??0),scaleDash:g,sampleAlphaOnly:!0,animationParams:$(b)})}_analyzePictureStroke(e,t,n,r,i){let{primitiveName:a,type:o}=e,s=B(e),c=R(e.width,C.CIMPictureStroke.width),l=U(e.capStyle,C.CIMPictureStroke.capstyle),u=U(e.joinStyle,C.CIMPictureStroke.joinstyle),f=e.miterLimit,p={type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(a,o)},m=d(this._poMap,e,i);this._cimLayers.push({type:`line`,name:e.name,spriteRasterizationParam:p,isOutline:n,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,a,`TintColor`,s),width:this._getValueOrOverrideExpression(o,a,`Width`,c),cap:this._getValueOrOverrideExpression(o,a,`CapStyle`,l),join:this._getValueOrOverrideExpression(o,a,`JoinStyle`,u),miterLimit:f&&this._getValueOrOverrideExpression(o,a,`MiterLimit`,f),referenceWidth:r,zOrder:he(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1,animationParams:$(m)})}_analyzeGradientStroke(e,t,n,r){let{gradientMethod:i,gradientSize:a,gradientSizeUnits:o,gradientType:s,interval:c,primitiveName:l,type:u}=e,d=C.CIMGradientStroke,f=R(e.width,d.width),p=U(e.capStyle,d.capstyle),m=U(e.joinStyle,d.joinstyle),h=e.miterLimit,g=e.colorRamp;this._cimLayers.push({type:`gradientStroke`,name:e.name,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(l,u)},colorLocked:!!e.colorLocked,effects:t,color:[255,255,255,1],width:this._getValueOrOverrideExpression(u,l,`Width`,f),cap:this._getValueOrOverrideExpression(u,l,`CapStyle`,p),join:this._getValueOrOverrideExpression(u,l,`JoinStyle`,m),miterLimit:h&&this._getValueOrOverrideExpression(u,l,`MiterLimit`,h),referenceWidth:r,isOutline:n,gradientMethod:this._getValueOrOverrideExpression(u,l,`GradientMethod`,i??d.gradientMethod),gradientType:this._getValueOrOverrideExpression(u,l,`GradientType`,s??d.gradientType),interval:this._getValueOrOverrideExpression(u,l,`Interval`,R(c,g.type===`CIMFixedColorRamp`?g.colors.length:d.interval)),gradientSize:this._getValueOrOverrideExpression(u,l,`GradientSize`,R(a,d.gradientSize)),gradientSizeUnits:o===`Absolute`?M.Absolute:o===`Relative`?M.Relative:d.gradientSizeUnits})}_analyzeMarker(e,t,n,r,i,a,o,s,c,l=!1,u=!1){l||=!!e.colorLocked;let h=c;if(h=f(e,h),h=p(this._poMap,e,h),h=m(e,h),h=d(this._poMap,e,h),this._analyzeMarkerInsidePolygon(e,t,l,h))return;let g=R(e.size,C.CIMVectorMarker.size),_=R(e.rotation),v=R(e.offsetX),y=R(e.offsetY),{primitiveName:b,type:x}=e,S=this._getValueOrOverrideExpression(x,b,`Size`,g),w=this._getValueOrOverrideExpression(x,b,`Rotation`,_),T=this._getValueOrOverrideExpression(x,b,`OffsetX`,v),E=this._getValueOrOverrideExpression(x,b,`OffsetY`,y);switch(e.type){case`CIMPictureMarker`:this._analyzePictureMarker(e,t,n,r,i,a,S,w,T,E,s,h,l,u);break;case`CIMVectorMarker`:this._analyzeVectorMarker(e,t,n,r,i,a,S,w,T,E,s,h,o,l,u)}}_analyzeMarkerInsidePolygon(e,t,n,r){let{markerPlacement:i,type:o}=e;if(!i||i.type!==`CIMMarkerPlacementInsidePolygon`||r.hasMotionAnimations)return!1;if(o===`CIMVectorMarker`||o===`CIMPictureMarker`){let n=e.primitiveName;if(n&&this._analyzePrimitiveOverrides([n],t,null,null))return!1;let r=i.primitiveName;if(r&&this._analyzePrimitiveOverrides([r],t,null,null))return!1;if(o===`CIMVectorMarker`){let{markerGraphics:t}=e;if(t)for(let e of t){let{symbol:t}=e;if(t?.type===`CIMPolygonSymbol`&&t.symbolLayers){let{symbolLayers:e}=t;for(let t of e)if(t.type===`CIMSolidStroke`)return!1}}}else{let{animatedSymbolProperties:t}=e;if(t)return!1}}let s=Math.abs(i.stepX),c=Math.abs(i.stepY);if(s===0||c===0)return!0;let l,u;if(i.gridType===`Random`){let e=a(de),t=Math.max(Math.floor(e/s),1);l=c*Math.max(Math.floor(e/c),1),u=t*s/l}else i.shiftOddRows?(l=c*2,u=s/c*.5):(l=c,u=s/c);let d=B(e),f=e.type===`CIMCharacterMarker`?null:{type:`sprite-rasterization-param`,resource:{...e,effects:e.effects?.filter(e=>!ye(e))},overrides:[]};return this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:f,colorLocked:n,effects:t,color:d,height:l,scaleX:u,angle:i.gridAngle??0,offsetX:R(i.offsetX),offsetY:R(i.offsetY),applyRandomOffset:i.gridType===`Random`,sampleAlphaOnly:e.type!==`CIMPictureMarker`,hasUnresolvedReplacementColor:!0,animationParams:$(r)}),!0}_analyzePictureMarker(e,t,r,i,a,s,c,l,u,d,f,p,m,h){let{animatedSymbolProperties:g,primitiveName:_,type:v}=e,y=R(e.scaleX,1),b=B(e);r||=this._createMarkerPlacementOverrideExpression(e.markerPlacement);let x=this._createGIFAnimatedSymbolPropertiesOverrideExpression(g),S=e.anchorPoint??{x:0,y:0};if(`width`in e&&typeof e.width==`number`){let t=e.width,n=1,r=this._resourceManager.getResource(e.url);r!=null&&(n=r.width/r.height);let i=R(e.size);y/=i/t*n}let C=[...i];e.primitiveName&&C.push(e.primitiveName);let w;g||x?w={type:`animated`,url:e.url,urlHash:`H`+o(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}:(w=n(e),w.markerPlacement=null);let T={type:`sprite-rasterization-param`,resource:w,overrides:this._getMaterialOverrides(C,v)};x&&T.overrides.push(...x.overrides);let E=c;this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:T,colorLocked:m,effects:t,scaleSymbolsProportionally:!1,alignment:a,size:c,scaleX:this._getValueOrOverrideExpression(v,_,`ScaleX`,y),rotation:l,offsetX:u,offsetY:d,transform:{type:`cim-marker-transform-param`,params:f},color:this._getValueOrOverrideExpression(v,_,`TintColor`,b),anchorPoint:{x:S.x,y:S.y},isAbsoluteAnchorPoint:e.anchorPointUnits!==`Relative`,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:s,sizeRatio:1,isOutline:h,markerPlacement:r,animationParams:$(p),baseSize:E})}_analyzeVectorMarker(e,t,n,r,i,a,o,l,u,d,f,p,m,v,y){let b=e.markerGraphics;if(!b)return;let x=e.frame,S=0;S=x?x.ymax-x.ymin:a;let C=!!e.scaleSymbolsProportionally;if(S){let t={offsetX:u,offsetY:d,rotation:l,size:o,frameHeight:S,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:C};f=[...f,t]}n||=this._createMarkerPlacementOverrideExpression(e.markerPlacement);for(let o of b)if(o){let l=o.symbol;if(!l)continue;let u=o.primitiveName;u&&r.push(u);let d=p,b;if((l.type===`CIMPointSymbol`||l.type===`CIMTextSymbol`)&&x){let t=0,n=0,r=o.geometry;`x`in r&&`y`in r&&(t+=r.x-(x.xmin+x.xmax)*.5,n+=r.y-(x.ymin+x.ymax)*.5);let i=e.anchorPoint,a=!1;i&&(e.anchorPointUnits===`Absolute`?(t-=i.x,n-=i.y,a=!0):x&&(t-=(x.xmax-x.xmin)*i.x,n-=(x.ymax-x.ymin)*i.y));let s={offsetX:t,offsetY:n,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:C};b=[...f,s]}(l.type===`CIMPointSymbol`||l.type===`CIMTextSymbol`)&&this._analyzeCallout(l,t,b??f,d,a,i,m);let w=s(o.geometry)?{...o,geometry:c(o.geometry,{maxDeviation:.01})}:o,T=w.geometry,[E,D]=h(T,x);switch((E!==0||D!==0)&&(d=g(d,E,D)),l.type){case`CIMPointSymbol`:case`CIMLineSymbol`:case`CIMPolygonSymbol`:m||ve(l)?(d={...d,transform:{type:`AnimatedTransform`,relativeTranslation:!1,absoluteScale:!0,selectGlobalRotation:!1,translation:_([0,0]),rotation:_(0),scale:_(S),parent:p.transform}},this._analyzeMultiLayerGraphicNonSDF(e,t,n,w,r,i,a,b??f,d,S,v,y)):this._analyzeMultiLayerGraphic(e,t,n,w,r,i,a,b??f,d,S,v,y);break;case`CIMTextSymbol`:this._analyzeTextGraphic(t,n,w,r,i,a,b??f,v)}u&&r.pop()}}_analyzeCallout(e,t,n,r,i,a,o){let s=e.callout;if(!s||!ie(s))return;let c=t??[],{leaderTolerance:l,leaderOffset:u}=s;switch(s.type){case`CIMSimpleLineCallout`:{let{lineSymbol:e,autoSnap:t}=s,d={type:`CIMSimpleLineCallout`,leaderTolerance:l,leaderOffset:u,autoSnap:t,inflateSize:500};this._analyzeSymbolLayer(e,[...c,{type:`cim-effect-param`,effect:d,overrides:[]}],n,r,i,a,o);break}case`CIMBackgroundCallout`:{let{accentBarSymbol:e,gap:t,backgroundSymbol:d,leaderLineSymbol:f,lineStyle:p,margin:m}=s,h=n=>({type:`CIMBackgroundCallout`,leaderTolerance:l,leaderOffset:u,lineStyle:Y(p),gap:t,hasAccentBar:!!e,margin:m,inflateSize:500,part:n}),g=[...c,{type:`cim-effect-param`,effect:h(`background`),overrides:[]}];if(f&&this._analyzeSymbolLayer(f,[...c,{type:`cim-effect-param`,effect:h(`leader`),overrides:[]}],n,r,i,a,o),d){let e=d.symbolLayers??[];Q(e)?this._analyzeCompositeOutlineFill(e,null,i,g):this._analyzeSymbolLayer(d,g,n,r,i,a,o)}e&&this._analyzeSymbolLayer(e,[...c,{type:`cim-effect-param`,effect:h(`accent-bar`),overrides:[]}],n,r,i,a,o);break}case`CIMBalloonCallout`:{let{balloonStyle:e,backgroundSymbol:t,dartSymbol:d,fixedDartWidth:f,margin:p,useDartSymbol:m,useFixedDartWidth:h}=s,g=m===!0&&d!=null,_=t=>({type:`CIMBalloonCallout`,leaderTolerance:l,leaderOffset:u,margin:p,balloonStyle:ce(e),dartWidth:h?f:void 0,inflateSize:500,part:t,separateDart:g}),v=(e,t)=>{let s=[...c,{type:`cim-effect-param`,effect:_(t),overrides:[]}],l=e.symbolLayers??[];Q(l)?this._analyzeCompositeOutlineFill(l,null,i,s):this._analyzeSymbolLayer(e,s,n,r,i,a,o)};g&&v(d,`dart`),v(t,`background`);break}case`CIMPointSymbolCallout`:{let{backgroundScale:e,gap:t,leaderLineSymbol:d,lineStyle:f,pointSymbol:p}=s,m=oe(e),h=ae(p,n),g=e=>({type:`CIMPointSymbolCallout`,leaderTolerance:l,leaderOffset:u,backgroundScale:m,...se(p,e),lineStyle:Y(f),gap:t,inflateSize:500,part:e});d&&this._analyzeSymbolLayer(d,[...c,{type:`cim-effect-param`,effect:g(`leader`),overrides:[]}],n,r,i,a,o),this._analyzeSymbolLayer(p,[...c,{type:`cim-effect-param`,effect:g(`marker`),overrides:[]}],h,r,i,a,o||m!==0);break}case`CIMCompositeCallout`:{let{backgroundSymbol:e,margin:t,shadowSymbol:d}=s,f={type:`CIMBalloonCallout`,leaderTolerance:l,leaderOffset:u,margin:t,balloonStyle:1,inflateSize:500,part:`background`},p=[...c,{type:`cim-effect-param`,effect:f,overrides:[]}],m=e=>{let t=e.symbolLayers??[];Q(t)?this._analyzeCompositeOutlineFill(t,null,i,p):this._analyzeSymbolLayer(e,p,n,r,i,a,o)};d&&m(d),m(e);break}}}_analyzeMultiLayerGraphic(e,t,n,r,i,a,o,s,c,l,u,d){let f=r.symbol,p=f.symbolLayers;p&&(_e(p)&&!v(c)?this._analyzeCompositeMarkerGraphic(e,t,n,r,p,a,o,s,l,u,d):Se(p)?(x(f,e=>{e.colorLocked&&(u=!0)}),this._analyzeMultiLayerGraphicNonSDF(e,t,n,r,i,a,o,s,c,l,u,d)):this._analyzeMarkerGraphicSymbolLayers(e,t,n,r,i,a,o,s,c,l,u,d))}_analyzeMarkerGraphicSymbolLayers(e,t,n,r,i,a,o,s,c,l,u,f){let p=r.symbol,m=p.symbolLayers;if(!m)return;let h=le.applyEffects(p.effects,r.geometry);if(!h)return;let g=m.length;for(;g--;){let p=m[g];if(!p||p.enable===!1)continue;let _=p.primitiveName;switch(_&&i.push(_),p.type){case`CIMSolidFill`:case`CIMSolidStroke`:{let i=le.applyEffects(p.effects,h),m=k(i);if(!m)continue;let g=e.anchorPointUnits!==`Relative`,v=p.type===`CIMSolidStroke`?p.width:0,{frameSizeRatio:y,anchorX:b,anchorY:x,widthRatio:S,sdfPaddingRatio:w,sdfTextureSize:T}=A(m,e.frame,e.size,e.anchorPoint,g,v,e.scaleSymbolsProportionally),E=p.type===`CIMSolidFill`,D={type:`sdf`,geometry:i,sdfPaddingRatio:w,asFill:E,sdfTextureSize:T},{path:O}=p,M=E?P(W(p)):O==null?P(G(p)):[0,0,0,0],N=E?[0,0,0,0]:P(G(p));if(!E&&!v)break;let F=r.primitiveName,I=null;E&&!p.colorLocked&&(I=this._maybeGetValueOrOverrideExpression(F,`FillColor`));let L=null;!E&&!p.colorLocked&&(L=this._maybeGetValueOrOverrideExpression(F,`StrokeColor`));let z=I??this._getValueOrOverrideExpression(p.type,_,`Color`,M),B=L??this._getValueOrOverrideExpression(p.type,_,`Color`,N),V=this._maybeGetValueOrOverrideExpression(F,`StrokeWidth`)??this._getValueOrOverrideExpression(p.type,_,`Width`,v),H=O?{type:`sprite-rasterization-param`,resource:{type:`path`,path:O,asFill:E},overrides:[]}:{type:`sprite-rasterization-param`,resource:D,overrides:[]},U=d(this._poMap,p,c),K=R(e.size,C.CIMVectorMarker.size),q=this._getValueOrOverrideExpression(e.type,e.primitiveName,`Size`,K);this._cimLayers.push({type:`marker`,name:p.name,groupName:e.name,spriteRasterizationParam:H,colorLocked:!!p.colorLocked||!!u,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:b,y:x},isAbsoluteAnchorPoint:g,size:l,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:`cim-marker-transform-param`,params:s},frameHeight:l,widthRatio:S,rotateClockwise:!1,referenceSize:o,sizeRatio:y,color:z,outlineColor:B,outlineWidth:V,isOutline:f,markerPlacement:n,animationParams:$(U),isStroke:p.type!==`CIMSolidFill`,baseSize:q,...j(i,T,w)});break}case`CIMPictureMarker`:case`CIMVectorMarker`:if(p.markerPlacement){X().error(`Error analyzing CIM, got unexpected marker placement`);break}this._analyzeMarker(p,t,n,i,a,o,!1,s,c,u,f)}_&&i.pop()}}_analyzeTextGraphic(e,n,r,i,a,o,s,c){E.findApplicableOverrides(r,this._primitiveOverrides,[]);let l=r.geometry;if(!(`x`in l)||!(`y`in l))return;let u=r.symbol,d=K(u),f=T(u.fontStyleName),p=t(u.fontFamilyName);u.font={family:p,decoration:d,...f};let m=R(u.height,C.CIMTextSymbol.height),h=R(u.angle),g=R(u.offsetX),_=R(u.offsetY),{haloSymbol:v}=u,y=R(u.haloSize,0),b=[0,0,0,0];if(v?.symbolLayers?.length){let e=v.symbolLayers;for(let t of e)if(t.color){b=this._getValueOrOverrideExpression(u?.haloSymbol?.type??`CIMPolygonSymbol`,t.primitiveName,`Color`,P(t.color));break}}let x=r.primitiveName,S=[0,0,0,1],w=[0,0,0,0],O=0,k=!1;if(u.symbol?.symbolLayers)for(let e of u.symbol.symbolLayers){let t=e.primitiveName;if(e.type===`CIMSolidStroke`)w=this._getValueOrOverrideExpression(`CIMSolidStroke`,t,`Color`,P(e.color)),O=this._getValueOrOverrideExpression(`CIMSolidStroke`,t,`Width`,q(e)??0);else if(e.type===`CIMSolidFill`){let n=P(e.color);k??=!!e.colorLocked,S=this._getValueOrOverrideExpression(`CIMSolidFill`,t??x,`Color`,n)}}let A=null,j=null,M=null,N=null,F=null;x&&(A=this._maybeGetValueOrOverrideExpression(x,`TextSize`),j=this._maybeGetValueOrOverrideExpression(x,`TextAngle`),M=this._maybeGetValueOrOverrideExpression(x,`TextOffsetX`),N=this._maybeGetValueOrOverrideExpression(x,`TextOffsetY`),k||(F=this._maybeGetValueOrOverrideExpression(x,`FillColor`)));let I=F??S,L=null,z=null,B=0,V=u.callout?.type===`CIMBackgroundCallout`;if(u.callout?.type===`CIMBackgroundCallout`){let e=u.callout;if(e.backgroundSymbol){let t=e.backgroundSymbol.symbolLayers;if(t)for(let e of t)e.type===`CIMSolidFill`?L=P(e.color):e.type===`CIMSolidStroke`&&(z=P(e.color),B=R(e.width,C.CIMSolidStroke.width))}}let H=this._getValueOrOverrideExpression(u.type,r.primitiveName,`TextString`,r.textString??``);if(H==null)return;let{fontStyleName:U}=u,W=p+(U?`-`+U.toLowerCase():`-regular`),G=this._getMaterialOverrides(i,u.type);G.push(...this._getPrimitiveMaterialOverrides(r.primitiveName,u.type)),this._collectDictionaryTemplateOverrides(G,r);let J={type:`text-rasterization-param`,resource:{type:`text`,textString:r.textString??``,font:u.font,symbol:u,primitiveName:r.primitiveName,supportsRichText:D(r.textString??``)||G.some(e=>e.propertyName===`textString`)},overrides:G};this._cimLayers.push({type:`text`,lineWidth:u.lineWidth,textRasterizationParam:J,colorLocked:!!c||!!k,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:W,decoration:d,haloSize:y,haloColor:b,weight:f.weight,style:f.style,size:A??m,angle:j??h,offsetX:M??g,offsetY:N??_,transform:{type:`cim-marker-transform-param`,params:s},horizontalAlignment:te(u.horizontalAlignment),verticalAlignment:ee(u.verticalAlignment),text:H,color:I,outlineColor:w,outlineSize:O,backgroundColor:L,borderLineColor:z,borderLineWidth:B,useBackgroundCallout:V,referenceSize:o,sizeRatio:1,markerPlacement:n})}_collectDictionaryTemplateOverrides(e,t){if(t.textString&&this._hasTextStringTemplates){let n=J(t.symbol);e.push({propertyName:`textString`,defaultValue:``,valueExpressionInfo:{type:`dictionary-template`,textCase:n,template:t.textString},primitiveName:t.primitiveName})}}_analyzeMultiLayerGraphicNonSDF(e,t,n,r,a,o,s,c,l,u,d,f){let p=me(e,r),m=e.primitiveName,h=this._analyzeMaterialOverrides(m,[`Rotation`,`OffsetX`,`OffsetY`]),g=V(h),[_,v,y]=b.getTextureAnchor(p,this._resourceManager,ue),x=this._getMaterialOverrides(a,e.type).filter(e=>e.primitiveName!==m||![`rotation`,`offsetX`,`offsetY`].includes(e.propertyName));x.push(...g);let S={type:`sprite-rasterization-param`,resource:{...p,avoidSDFRasterization:!0},overrides:x},w=R(e.size,C.CIMVectorMarker.size),T=this._getValueOrOverrideExpression(e.type,m,`Size`,w);this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:S,colorLocked:d,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:o,anchorPoint:{x:_,y:v},isAbsoluteAnchorPoint:!1,size:u,rotation:0,offsetX:0,offsetY:0,transform:{type:`cim-marker-transform-param`,params:c},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:u,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:s,sizeRatio:y/i(e.size),isOutline:f,markerPlacement:n,animationParams:$(l),baseSize:T})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;let t=[];return E.findApplicableOverrides(e,this._primitiveOverrides,t),{type:`cim-marker-placement-param`,placement:e,overrides:we(t)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;let t=[];return E.findApplicableOverrides(e,this._primitiveOverrides,t),{type:`cim-gif-animation-params`,animation:e,overrides:we(t)}}_analyzeCompositeMarkerGraphic(e,t,n,r,i,a,o,s,c,l,u){let d=r.geometry,f=i[0],p=i[1],m=k(d);if(!m)return;let h=e.anchorPointUnits!==`Relative`,g=R(f.width,C.CIMSolidStroke.width),{frameSizeRatio:_,anchorX:v,anchorY:y,widthRatio:b,sdfPaddingRatio:x,sdfTextureSize:S}=A(m,e.frame,e.size,e.anchorPoint,h,g,e.scaleSymbolsProportionally),{path:w}=p,T=p.primitiveName,E=f.primitiveName,D=r.primitiveName,O=null;!p.colorLocked&&!l&&(O=this._maybeGetValueOrOverrideExpression(D,`FillColor`));let j=O??this._getValueOrOverrideExpression(p.type,T,`Color`,P(p.color)),M=null;!f.colorLocked&&!l&&(M=this._maybeGetValueOrOverrideExpression(D,`StrokeColor`));let N=M??this._getValueOrOverrideExpression(f.type,E,`Color`,P(f.color)),F=this._maybeGetValueOrOverrideExpression(D,`StrokeWidth`)??this._getValueOrOverrideExpression(f.type,E,`Width`,g),I={type:`sprite-rasterization-param`,resource:w?{type:`path`,path:w,asFill:!0}:{type:`sdf`,geometry:d,sdfTextureSize:S,sdfPaddingRatio:x,asFill:!0},overrides:[]};this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:I,colorLocked:l,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:v,y},isAbsoluteAnchorPoint:h,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:`cim-marker-transform-param`,params:s},frameHeight:c,widthRatio:b,rotateClockwise:!1,referenceSize:o,sizeRatio:_,color:j,outlineColor:N,outlineWidth:F,isOutline:u,markerPlacement:n})}_setPoMap(e,t,n){let r;this._poMap[e]?r=this._poMap[e]:(r={},this._poMap[e]=r),r[t]=n}_maybeGetValueOrOverrideExpression(e,t,n){return this._getValueOrOverrideExpression(``,e,t,n,!1)}_getValueOrOverrideExpression(e,t,n,r,i=!0){if(i&&!ne(r)&&(r=H(e,n.toLowerCase())),t==null)return r;let a=this._poMap[t];if(a==null)return r;let o=a[n];return typeof o==`string`||typeof o==`number`||Array.isArray(o)?o:o?{valueExpressionInfo:o,defaultValue:r}:r}_analyzePrimitiveOverrides(e,t,n,r){if(e==null)return!1;typeof e==`string`&&(e=[e]);for(let t of this._primitiveOverrides)if(e.includes(t.primitiveName)&&t.valueExpressionInfo)return!0;if(t!=null){for(let e of t)if(e?.overrides.length>0)return!0}if(n!=null){for(let e of n)if(e?.overrides.length>0)return!0}if(r!=null){for(let e of r)if(e?.overrides.length>0)return!0}return!1}_getMaterialOverrides(e,t){if(!e)return[];let n=[];for(let r of e)n.push(...this._getPrimitiveMaterialOverrides(r,t));return n}_getPrimitiveMaterialOverrides(e,t){if(!e)return[];let n=V(this._primitiveOverrides.filter(t=>t.primitiveName===e));return n.forEach(e=>e.defaultValue=H(t,e.propertyName.toLowerCase())),n}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter(n=>n.primitiveName!==e||!t.includes(n.propertyName))}}function me(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 he(e){if(e?.startsWith(`Level_`)){let t=parseInt(e.slice(6),10);if(!isNaN(t))return t}return 0}function ge(e,t){if(!t||t.length===0)return e;let r=n(e);return E.applyOverrides(r,t),r}const _e=e=>e&&e.length===2&&e[0].enable&&e[1].enable&&e[0].type===`CIMSolidStroke`&&e[1].type===`CIMSolidFill`&&e[0].path==null&&e[1].path==null&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function ve(e){let t=e.symbolLayers;if(!t)return!1;let n=t.find(e=>e.effects?.find(e=>e.type===`CIMGeometricEffectDashes`&&e.dashTemplate!=null)),r=t.find(e=>e.effects?.find(e=>e.type===`CIMGeometricEffectAddControlPoints`));return!!n||!!r}function ye(e){return Z(e)}function Z(e){return e.type===`CIMGeometricEffectCircularSector`||e.type===`CIMGeometricEffectRadial`||e.type===`CIMGeometricEffectTaperedPolygon`||e.type===`PrivateDimensionEffect`||e.type===`PrivateMatcherGeometryOverrideEffect`}function be(e){return e.type===`CIMGeometricEffectCircularSector`||e.type===`CIMGeometricEffectTaperedPolygon`}function xe(e,t){let n=e.filter(e=>e.type===`CIMSolidFill`),r=e.every(e=>e.type===`CIMSolidFill`||e.type===`CIMSolidStroke`),i=e.filter(e=>e.effects?.length),a=i.length===0||i.length===1&&n.length===1&&i[0]===n[0];return n.length>0&&r&&a&&t.some(({effect:e})=>be(e))}function Se(e){return e.some(e=>e.type!==`CIMSolidFill`&&e.type!==`CIMSolidStroke`&&(e.type!==`CIMVectorMarker`&&e.type!==`CIMPictureMarker`||e.markerPlacement!=null))}function Ce(e,t){return!!(t?.some(e=>e.type===`CIMGeometricEffectRadial`)&&t?.some(e=>e.type===`CIMGeometricEffectTaperedPolygon`)||t?.some(e=>e.type===`CIMGeometricEffectCircularSector`))&&Q(e)}function Q(e){if(e?.length!==2)return!1;let t=e.find(e=>e.type===`CIMSolidFill`),n=e.find(e=>e.type===`CIMSolidStroke`),r=n?.effects?.some(e=>e.type===`CIMGeometricEffectDashes`);return t!=null&&n!=null&&!r}function we(e){return n(e).map(e=>({...e,propertyName:re(e.propertyName)}))}function $(e){return v(e)?{type:`animation-params`,params:e}:null}export{pe as CIMAnalyzer,ge as analyzeCIMResource};
2
+ import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as t}from"../../core/fontUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import r from"../../core/Logger.js";import{pt2px as i,px2pt as a}from"../../core/screenUtils.js";import{numericHash as o}from"../../core/string.js";import{isCurvedGeometry as s}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as c}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{checkForAnimations as l,globalRotation as u,getAnimationParams as d,handleAbsoluteAnchor as f,handleMarker as p,handleRelativeAnchor as m,getFrameTranslation as h,translate as g,getStaticParam as _,shouldUseAnimatedPath as v}from"./animationUtils.js";import{CIMSymbolInflatedSizeHelper as y,CIMSymbolHelper as b,forEachSymbolLayer as x}from"./CIMSymbolHelper.js";import{antialiasingOutlineFillSettings as S}from"./constants.js";import{defaultCIMValues as C}from"./defaultCIMValues.js";import{fitVectorMarker as w}from"./fitVectorMarker.js";import{fromCIMFontStyle as T}from"./fromCIMFontStyle.js";import{OverrideHelper as E}from"./OverrideHelper.js";import{hasRichTextFormattingTags as D}from"./richTextUtils.js";import{getSDFInfo as O,getExtent as k,getSDFMetrics as A,getSDFDimensions as j}from"./SDFHelper.js";import{CIMSymbolUnits as M}from"./types.js";import{colorToArray as N,normalizeAlpha as P,getSize as F,isCIMMarkerStrokePlacement as I,hasStrokeLayer as L,getNumericValue as R,getMaxStrokeWidth as z,getTintColor as B,normalizePrimitiveOverrideProps as V,getDefaultCIMValue as H,getEnum as U,getFillColor as W,getStrokeColor as G,fromCIMFontDecoration as K,getStrokeWidth as q,fromCIMVerticalAlignment as ee,fromCIMHorizontalAlignment as te,getTextCasing as J,isValidCIMValue as ne,uncapitalize as re}from"./utils.js";import{isSupportedCallout as ie,getPointSymbolCalloutTransforms as ae,normalizePointSymbolCalloutScale as oe,normalizeLeaderLineStyle as Y,getPointSymbolCalloutFitProperties as se,normalizeBalloonCalloutStyle as ce}from"./callouts/calloutAnalysisUtils.js";import{EffectHelper as le}from"./effects/EffectHelper.js";import{rasterizedVectorMarkerMinSize as ue,randomInsidePolygonTextureSize as de}from"../../views/2d/engine/webgl/definitions.js";const X=()=>r.getLogger(`esri.symbols.cim.cimAnalyzer`);function fe(e){let t=e.markerPlacement;return t&&t.angleToLine?1:0}class pe{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._hasTextStringTemplates=!1,e&&(this._resourceManager=e)}analyzeSymbolReference(t,n,r){if(this._cimLayers=r??[],!t)return this._cimLayers;if(this._reset(),this._hasTextStringTemplates=t.hasTextStringTemplates??!1,t.primitiveOverrides){this._primitiveOverrides=t.primitiveOverrides;for(let t of this._primitiveOverrides){let n=t.valueExpressionInfo;if(n)this._setPoMap(t.primitiveName,t.propertyName,n);else if(t.value!=null){let n=t.value;t.propertyName.includes(`Color`)&&(e(n)&&(n=N(n)),n=P(n)),this._setPoMap(t.primitiveName,t.propertyName,n)}}}return this._analyzeSymbol(t.symbol,n),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){let n=e?.symbolLayers;if(!n)return;for(let e=0;e<n.length;e++){let t=n[e];t.type===`CIMVectorMarker`&&(n[e]=w(t))}let r=e.effects,i=0,a=F(e)??0;e.type===`CIMPointSymbol`&&e.angleAlignment===`Map`&&(i=1);let o={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};o=u(o),o=d(this._poMap,e,o);let s=null;e.type===`CIMPointSymbol`&&(s=this._analyzePointSymbolHalo(e,i,a,r,o),this._analyzeCallout(e,null,[],o,a,i,t));let c=s?n.filter(e=>e!==s):n;if(Ce(c,r))return this._analyzeCompositeOutlineFill(c,r,a);this._analyzeSymbolLayer(s?{...e,symbolLayers:c}:e,null,[],o,a,i,t)}_analyzeSymbolLayer(e,t,n,r,i,a,o){let s=e?.symbolLayers;if(!s)return;let c=e.type===`CIMPolygonSymbol`,l=e.effects,u=s.length;for(;u--;){let d=s[u];if(!d||d.enable===!1)continue;let f;l?.length&&(f=[...l]);let p=d.effects;p?.length&&(l?f.push(...p):f=[...p]);let m=t?[...t]:null;if(f){m??=[];for(let e of f){let t=E.findEffectOverrides(e,this._primitiveOverrides);t&&m.push(t)}}E.findApplicableOverrides(d,this._primitiveOverrides,[]);let h=this._cimLayers.length;switch(d.type){case`CIMSolidFill`:this._analyzeSolidFill(d,m,r,L(s));break;case`CIMPictureFill`:this._analyzePictureFill(d,m,r);break;case`CIMHatchFill`:this._analyzeHatchFill(d,m,r);break;case`CIMGradientFill`:this._analyzeGradientFill(d,m);break;case`CIMSolidStroke`:this._analyzeSolidStroke(d,m,c,i,r);break;case`CIMPictureStroke`:this._analyzePictureStroke(d,m,c,i,r);break;case`CIMGradientStroke`:this._analyzeGradientStroke(d,m,c,i);break;case`CIMCharacterMarker`:case`CIMPictureMarker`:case`CIMVectorMarker`:{(e.type===`CIMLineSymbol`||e.type===`CIMPolygonSymbol`)&&(a=fe(d));let t=[],s=d.primitiveName;s&&t.push(s);let l=c&&I(d.markerPlacement);this._analyzeMarker(d,m,null,t,a,i,o,n,r,!1,l);break}default:X().error(`Cannot analyze CIM layer`,d.type)}if(m?.some(({effect:e})=>Z(e)))for(let e=h;e<this._cimLayers.length;e++)this._cimLayers[e].effectsChangeGeometryType=!0}}_analyzePointSymbolHalo(e,t,r,i,o){let{haloSymbol:s}=e,c=R(e.haloSize,0);if(c<=0||!s?.symbolLayers)return null;let u=s.symbolLayers.filter(e=>e.enable!==!1),f=u[0];if(!f)return null;let p=u.length===1&&f.type===`CIMSolidFill`;if(e.symbolLayers?.some(e=>l(e))===!0||l(s))return X().warnOnce(`CIM point symbol halos do not support independently animated symbol components`),null;let m=i?.map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null);if(m?.some(({effect:e})=>Z(e))){if(!p)return X().warnOnce(`Complex CIM point symbol halos are not supported with geometry-changing effects`),null;let t=e.symbolLayers?.filter(e=>e.enable!==!1)??[];if(!xe(t,m))return X().warnOnce(`CIM point symbol halos with geometry-changing effects currently require polygon-producing effects and an unambiguous solid-fill effect chain`),null;let n=t.find(e=>e.type===`CIMSolidFill`);if(!n)return null;let i=[...m,...(n.effects??[]).map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],a=z(t),o=this._getValueOrOverrideExpression(f.type,f.primitiveName,`Color`,P(f.color));return this._cimLayers.push({type:`outlineFill`,name:n.name,colorLocked:!!n.colorLocked,color:this._getValueOrOverrideExpression(n.type,n.primitiveName,`Color`,P(n.color)),effects:i,effectsChangeGeometryType:!0,outlineColorLocked:!0,outlineColor:o,outlineWidth:c+a,cap:`Round`,join:`Round`,referenceWidth:r,pixelBufferSize:c+a,outlineEffects:i}),n}let h=e.symbolLayers?.filter(e=>e.enable!==!1)??[],g=h.length===1&&h[0].type===`CIMVectorMarker`?h[0]:null,_=n(e);if(_.effects=void 0,_.angle=0,_.scaleX=1,g){let e=_.symbolLayers?.find(e=>e.type===`CIMVectorMarker`&&e.enable!==!1);e&&(e.rotation=0,e.offsetX=0,e.offsetY=0)}let v={..._,haloSize:0,haloSymbol:void 0},x=y.getPointSymbolHaloPadding(e,this._resourceManager),[S,C,w]=b.getTextureAnchor(v,this._resourceManager,ue,x),T=a(w),D=[];E.findApplicableOverrides(_,this._primitiveOverrides,D);let k=g?D.filter(e=>e.primitiveName!==g.primitiveName||![`Rotation`,`OffsetX`,`OffsetY`].includes(e.propertyName)):D,A=g?[{offsetX:this._getValueOrOverrideExpression(g.type,g.primitiveName,`OffsetX`,R(g.offsetX)),offsetY:this._getValueOrOverrideExpression(g.type,g.primitiveName,`OffsetY`,R(g.offsetY)),rotation:this._getValueOrOverrideExpression(g.type,g.primitiveName,`Rotation`,R(g.rotation)),size:T,frameHeight:T,rotateClockWise:!!g.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:!1}]:[],j=$(p?d(this._poMap,f,o):o),M,N;if(j){let e=b.getEnvelope(v,null,this._resourceManager);e&&(M=[e.width,e.height],N=[e.width+2*x,e.height+2*x])}return this._cimLayers.push({type:`marker`,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:{type:`cim-point-symbol-halo`,symbol:_,sdf:!j&&p&&O(v)!=null},overrides:k},colorLocked:!0,color:p?this._getValueOrOverrideExpression(f.type,f.primitiveName,`Color`,P(f.color)):[255,255,255,1],effects:m??null,effectsChangeGeometryType:m?.some(({effect:e})=>Z(e)),scaleSymbolsProportionally:!1,alignment:t,anchorPoint:{x:S,y:C},isAbsoluteAnchorPoint:!1,size:T,scaleX:R(e.scaleX,1),rotation:g?0:R(e.angle,0),offsetX:0,offsetY:0,outlineColor:[0,0,0,0],outlineWidth:0,transform:{type:`cim-marker-transform-param`,params:A},frameHeight:T,widthRatio:1,rotateClockwise:!1,referenceSize:r||T,sizeRatio:1,markerPlacement:null,isOutline:!1,animationParams:j,baseSize:r||T,pixelDimensions:M,texelDimensions:N}),null}_analyzeSolidFill(e,t,n,r){let{primitiveName:i,type:a}=e,o=P(e.color),s=d(this._poMap,e,n);if(!r&&t?.some(e=>e.effect.type===`CIMGeometricEffectTaperedPolygon`)){let n=this._getValueOrOverrideExpression(a,i,`Color`,o);this._cimLayers.push({type:`outlineFill`,name:e.name,colorLocked:!!e.colorLocked,color:n,effects:t,outlineColor:n,outlineColorLocked:!!e.colorLocked,...S,outlineEffects:t})}else this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(a,i,`Color`,o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1,animationParams:$(s)})}_analyzePictureFill(e,t,n){let{primitiveName:r,type:i}=e,a=B(e),o=R(e.height,C.CIMPictureFill.height),s=R(e.scaleX,1);if(`width`in e&&typeof e.width==`number`){let t=e.width,n=1,r=this._resourceManager.getResource(e.url);r!=null&&(n=r.width/r.height),s/=o/t*n}let c={type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(r,i)},l=d(this._poMap,e,n);this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:c,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(i,r,`TintColor`,a),height:this._getValueOrOverrideExpression(i,r,`Height`,o),scaleX:this._getValueOrOverrideExpression(i,r,`ScaleX`,s),angle:this._getValueOrOverrideExpression(i,r,`Rotation`,R(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,r,`OffsetX`,R(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,r,`OffsetY`,R(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1,animationParams:$(l)})}_analyzeHatchFill(e,t,n){let{primitiveName:r,type:i}=e,a=d(this._poMap,e,n),o=this._analyzeMaterialOverrides(r,[`Rotation`,`OffsetX`,`OffsetY`]),s=V(o),c=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(let t of e.lineSymbol.symbolLayers){if(t.type!==`CIMSolidStroke`)continue;let e=t.primitiveName??r;!l&&e&&!t.colorLocked&&(this._poMap[e]?.Color!=null||this._poMap[e]?.StrokeColor!=null)&&(c=P(t.color),c=this._maybeGetValueOrOverrideExpression(e,`StrokeColor`)??this._getValueOrOverrideExpression(i,e,`Color`,c),l=!0);let n=this._maybeGetValueOrOverrideExpression(e,`StrokeWidth`);if(n){let t=null,r=null;typeof n==`number`?t=n:r=n.valueExpressionInfo;let a=s.find(e=>e.propertyName===`strokeWidth`);a?a.propertyName=`width`:(a={type:`CIMPrimitiveOverride`,primitiveName:e,propertyName:`width`,valueExpressionInfo:r,value:t,defaultValue:H(i,`width`)},s.push(a))}}let u={type:`sprite-rasterization-param`,resource:e,overrides:s};this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:u,colorLocked:!!e.colorLocked,effects:t,color:c,height:this._getValueOrOverrideExpression(i,r,`Separation`,R(e.separation,C.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,r,`Rotation`,R(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,r,`OffsetX`,R(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,r,`OffsetY`,R(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l,animationParams:$(a)})}_analyzeGradientFill(e,t){let{angle:n,gradientMethod:r,gradientSize:i,gradientSizeUnits:a,gradientType:o,interval:s,primitiveName:c,type:l}=e,u=C.CIMGradientFill,d=e.colorRamp;this._cimLayers.push({type:`gradientFill`,name:e.name,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(c,l)},colorLocked:!1,effects:t,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(l,c,`GradientMethod`,r??`Linear`),angle:this._getValueOrOverrideExpression(l,c,`Angle`,R(n,u.angle)),gradientType:this._getValueOrOverrideExpression(l,c,`GradientType`,o??u.gradientType),interval:this._getValueOrOverrideExpression(l,c,`Interval`,R(s,d.type===`CIMFixedColorRamp`?d.colors.length:u.interval)),gradientSize:this._getValueOrOverrideExpression(l,c,`GradientSize`,R(i,u.gradientSize)),gradientSizeUnits:a===`Absolute`?M.Absolute:a===`Relative`?M.Relative:u.gradientSizeUnits})}_analyzeCompositeOutlineFill(e,t,n,r=[]){let i=e.find(e=>e.type===`CIMSolidFill`),a=e.find(e=>e.type===`CIMSolidStroke`);if(i==null||a==null)return;let o=[...r,...[...t??[],...i.effects??[]].map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],s=[...r,...[...t??[],...a.effects??[]].map(e=>E.findEffectOverrides(e,this._primitiveOverrides)).filter(e=>e!=null)],c=R(a.width,C.CIMSolidStroke.width),l=U(a.capStyle,C.CIMSolidStroke.capstyle),u=U(a.joinStyle,C.CIMSolidStroke.joinstyle),d=a.miterLimit;this._cimLayers.push({type:`outlineFill`,name:i.name,colorLocked:!!i.colorLocked,color:this._getValueOrOverrideExpression(i.type,i.primitiveName,`Color`,P(i.color)),effects:o,effectsChangeGeometryType:o.some(({effect:e})=>Z(e))||s.some(({effect:e})=>Z(e)),outlineColorLocked:!!a.colorLocked,outlineColor:this._getValueOrOverrideExpression(a.type,a.primitiveName,`Color`,P(a.color)),outlineWidth:this._getValueOrOverrideExpression(a.type,a.primitiveName,`Width`,c),cap:this._getValueOrOverrideExpression(a.type,a.primitiveName,`CapStyle`,l),join:this._getValueOrOverrideExpression(a.type,a.primitiveName,`JoinStyle`,u),miterLimit:d&&this._getValueOrOverrideExpression(a.type,a.primitiveName,`MiterLimit`,d),referenceWidth:n,outlineEffects:s})}_analyzeSolidStroke(e,t,n,r,i){let{primitiveName:a,type:o}=e,s=P(e.color),c=R(e.width,C.CIMSolidStroke.width),l=U(e.capStyle,C.CIMSolidStroke.capstyle),u=U(e.joinStyle,C.CIMSolidStroke.joinstyle),f=e.miterLimit,p=this._analyzePrimitiveOverrides(a,t,null,null),m=[];p&&(m=this._getPrimitiveMaterialOverrides(a,o));let h,g,_,v;if(t&&Array.isArray(t)&&t.length>0){let e=t[t.length-1].effect;e&&e.type===`CIMGeometricEffectDashes`&&e.lineDashEnding===`NoConstraint`&&(h=e.dashTemplate,g=e.scaleDash,_=e.offsetAlongLine,v=e.primitiveName,t=[...t],t.pop())}v!=null&&m.push(...this._getPrimitiveMaterialOverrides(v,o).filter(e=>e.propertyName===`dashTemplate`));let y=h===void 0?null:{type:`sprite-rasterization-param`,resource:{type:`dash`,dashTemplate:h,primitiveName:v},overrides:m},b=d(this._poMap,e,i);this._cimLayers.push({type:`line`,name:e.name,spriteRasterizationParam:y,isOutline:n,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,a,`Color`,s),width:this._getValueOrOverrideExpression(o,a,`Width`,c),cap:this._getValueOrOverrideExpression(o,a,`CapStyle`,l),join:this._getValueOrOverrideExpression(o,a,`JoinStyle`,u),miterLimit:f&&this._getValueOrOverrideExpression(o,a,`MiterLimit`,f),referenceWidth:r,zOrder:he(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(v,`DashTemplate`)??h,offsetAlongLine:this._getValueOrOverrideExpression(o,v,`OffsetAlongLine`,_??0),scaleDash:g,sampleAlphaOnly:!0,animationParams:$(b)})}_analyzePictureStroke(e,t,n,r,i){let{primitiveName:a,type:o}=e,s=B(e),c=R(e.width,C.CIMPictureStroke.width),l=U(e.capStyle,C.CIMPictureStroke.capstyle),u=U(e.joinStyle,C.CIMPictureStroke.joinstyle),f=e.miterLimit,p={type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(a,o)},m=d(this._poMap,e,i);this._cimLayers.push({type:`line`,name:e.name,spriteRasterizationParam:p,isOutline:n,colorLocked:!!e.colorLocked,effects:t,color:this._getValueOrOverrideExpression(o,a,`TintColor`,s),width:this._getValueOrOverrideExpression(o,a,`Width`,c),cap:this._getValueOrOverrideExpression(o,a,`CapStyle`,l),join:this._getValueOrOverrideExpression(o,a,`JoinStyle`,u),miterLimit:f&&this._getValueOrOverrideExpression(o,a,`MiterLimit`,f),referenceWidth:r,zOrder:he(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1,animationParams:$(m)})}_analyzeGradientStroke(e,t,n,r){let{gradientMethod:i,gradientSize:a,gradientSizeUnits:o,gradientType:s,interval:c,primitiveName:l,type:u}=e,d=C.CIMGradientStroke,f=R(e.width,d.width),p=U(e.capStyle,d.capstyle),m=U(e.joinStyle,d.joinstyle),h=e.miterLimit,g=e.colorRamp;this._cimLayers.push({type:`gradientStroke`,name:e.name,spriteRasterizationParam:{type:`sprite-rasterization-param`,resource:e,overrides:this._getPrimitiveMaterialOverrides(l,u)},colorLocked:!!e.colorLocked,effects:t,color:[255,255,255,1],width:this._getValueOrOverrideExpression(u,l,`Width`,f),cap:this._getValueOrOverrideExpression(u,l,`CapStyle`,p),join:this._getValueOrOverrideExpression(u,l,`JoinStyle`,m),miterLimit:h&&this._getValueOrOverrideExpression(u,l,`MiterLimit`,h),referenceWidth:r,isOutline:n,gradientMethod:this._getValueOrOverrideExpression(u,l,`GradientMethod`,i??d.gradientMethod),gradientType:this._getValueOrOverrideExpression(u,l,`GradientType`,s??d.gradientType),interval:this._getValueOrOverrideExpression(u,l,`Interval`,R(c,g.type===`CIMFixedColorRamp`?g.colors.length:d.interval)),gradientSize:this._getValueOrOverrideExpression(u,l,`GradientSize`,R(a,d.gradientSize)),gradientSizeUnits:o===`Absolute`?M.Absolute:o===`Relative`?M.Relative:d.gradientSizeUnits})}_analyzeMarker(e,t,n,r,i,a,o,s,c,l=!1,u=!1){l||=!!e.colorLocked;let h=c;if(h=f(e,h),h=p(this._poMap,e,h),h=m(e,h),h=d(this._poMap,e,h),this._analyzeMarkerInsidePolygon(e,t,l,h))return;let g=R(e.size,C.CIMVectorMarker.size),_=R(e.rotation),v=R(e.offsetX),y=R(e.offsetY),{primitiveName:b,type:x}=e,S=this._getValueOrOverrideExpression(x,b,`Size`,g),w=this._getValueOrOverrideExpression(x,b,`Rotation`,_),T=this._getValueOrOverrideExpression(x,b,`OffsetX`,v),E=this._getValueOrOverrideExpression(x,b,`OffsetY`,y),D=this._cimLayers.length;switch(e.type){case`CIMPictureMarker`:this._analyzePictureMarker(e,t,n,r,i,a,S,w,T,E,s,h,l,u);break;case`CIMVectorMarker`:this._analyzeVectorMarker(e,t,n,r,i,a,S,w,T,E,s,h,o,l,u)}if(e.name)for(let t=D;t<this._cimLayers.length;t++){let n=this._cimLayers[t];n.name??=e.name;let r=n.groupNames??=[];r[r.length-1]!==e.name&&r.push(e.name)}}_analyzeMarkerInsidePolygon(e,t,n,r){let{markerPlacement:i,type:o}=e;if(!i||i.type!==`CIMMarkerPlacementInsidePolygon`||r.hasMotionAnimations)return!1;if(o===`CIMVectorMarker`||o===`CIMPictureMarker`){let n=e.primitiveName;if(n&&this._analyzePrimitiveOverrides([n],t,null,null))return!1;let r=i.primitiveName;if(r&&this._analyzePrimitiveOverrides([r],t,null,null))return!1;if(o===`CIMVectorMarker`){let{markerGraphics:t}=e;if(t)for(let e of t){let{symbol:t}=e;if(t?.type===`CIMPolygonSymbol`&&t.symbolLayers){let{symbolLayers:e}=t;for(let t of e)if(t.type===`CIMSolidStroke`)return!1}}}else{let{animatedSymbolProperties:t}=e;if(t)return!1}}let s=Math.abs(i.stepX),c=Math.abs(i.stepY);if(s===0||c===0)return!0;let l,u;if(i.gridType===`Random`){let e=a(de),t=Math.max(Math.floor(e/s),1);l=c*Math.max(Math.floor(e/c),1),u=t*s/l}else i.shiftOddRows?(l=c*2,u=s/c*.5):(l=c,u=s/c);let d=B(e),f=e.type===`CIMCharacterMarker`?null:{type:`sprite-rasterization-param`,resource:{...e,effects:e.effects?.filter(e=>!ye(e))},overrides:[]};return this._cimLayers.push({type:`fill`,name:e.name,spriteRasterizationParam:f,colorLocked:n,effects:t,color:d,height:l,scaleX:u,angle:i.gridAngle??0,offsetX:R(i.offsetX),offsetY:R(i.offsetY),applyRandomOffset:i.gridType===`Random`,sampleAlphaOnly:e.type!==`CIMPictureMarker`,hasUnresolvedReplacementColor:!0,animationParams:$(r)}),!0}_analyzePictureMarker(e,t,r,i,a,s,c,l,u,d,f,p,m,h){let{animatedSymbolProperties:g,primitiveName:_,type:v}=e,y=R(e.scaleX,1),b=B(e);r||=this._createMarkerPlacementOverrideExpression(e.markerPlacement);let x=this._createGIFAnimatedSymbolPropertiesOverrideExpression(g),S=e.anchorPoint??{x:0,y:0};if(`width`in e&&typeof e.width==`number`){let t=e.width,n=1,r=this._resourceManager.getResource(e.url);r!=null&&(n=r.width/r.height);let i=R(e.size);y/=i/t*n}let C=[...i];e.primitiveName&&C.push(e.primitiveName);let w;g||x?w={type:`animated`,url:e.url,urlHash:`H`+o(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}:(w=n(e),w.markerPlacement=null);let T={type:`sprite-rasterization-param`,resource:w,overrides:this._getMaterialOverrides(C,v)};x&&T.overrides.push(...x.overrides);let E=c;this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:T,colorLocked:m,effects:t,scaleSymbolsProportionally:!1,alignment:a,size:c,scaleX:this._getValueOrOverrideExpression(v,_,`ScaleX`,y),rotation:l,offsetX:u,offsetY:d,transform:{type:`cim-marker-transform-param`,params:f},color:this._getValueOrOverrideExpression(v,_,`TintColor`,b),anchorPoint:{x:S.x,y:S.y},isAbsoluteAnchorPoint:e.anchorPointUnits!==`Relative`,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:s,sizeRatio:1,isOutline:h,markerPlacement:r,animationParams:$(p),baseSize:E})}_analyzeVectorMarker(e,t,n,r,i,a,o,l,u,d,f,p,m,v,y){let b=e.markerGraphics;if(!b)return;let x=e.frame,S=0;S=x?x.ymax-x.ymin:a;let C=!!e.scaleSymbolsProportionally;if(S){let t={offsetX:u,offsetY:d,rotation:l,size:o,frameHeight:S,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:C};f=[...f,t]}n||=this._createMarkerPlacementOverrideExpression(e.markerPlacement);for(let o of b)if(o){let l=o.symbol;if(!l)continue;let u=o.primitiveName;u&&r.push(u);let d=p,b;if((l.type===`CIMPointSymbol`||l.type===`CIMTextSymbol`)&&x){let t=0,n=0,r=o.geometry;`x`in r&&`y`in r&&(t+=r.x-(x.xmin+x.xmax)*.5,n+=r.y-(x.ymin+x.ymax)*.5);let i=e.anchorPoint,a=!1;i&&(e.anchorPointUnits===`Absolute`?(t-=i.x,n-=i.y,a=!0):x&&(t-=(x.xmax-x.xmin)*i.x,n-=(x.ymax-x.ymin)*i.y));let s={offsetX:t,offsetY:n,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:C};b=[...f,s]}(l.type===`CIMPointSymbol`||l.type===`CIMTextSymbol`)&&this._analyzeCallout(l,t,b??f,d,a,i,m);let w=s(o.geometry)?{...o,geometry:c(o.geometry,{maxDeviation:.01})}:o,T=w.geometry,[E,D]=h(T,x);switch((E!==0||D!==0)&&(d=g(d,E,D)),l.type){case`CIMPointSymbol`:case`CIMLineSymbol`:case`CIMPolygonSymbol`:m||ve(l)?(d={...d,transform:{type:`AnimatedTransform`,relativeTranslation:!1,absoluteScale:!0,selectGlobalRotation:!1,translation:_([0,0]),rotation:_(0),scale:_(S),parent:p.transform}},this._analyzeMultiLayerGraphicNonSDF(e,t,n,w,r,i,a,b??f,d,S,v,y)):this._analyzeMultiLayerGraphic(e,t,n,w,r,i,a,b??f,d,S,v,y);break;case`CIMTextSymbol`:this._analyzeTextGraphic(t,n,w,r,i,a,b??f,v)}u&&r.pop()}}_analyzeCallout(e,t,n,r,i,a,o){let s=e.callout;if(!s||!ie(s))return;let c=t??[],{leaderTolerance:l,leaderOffset:u}=s;switch(s.type){case`CIMSimpleLineCallout`:{let{lineSymbol:e,autoSnap:t}=s,d={type:`CIMSimpleLineCallout`,leaderTolerance:l,leaderOffset:u,autoSnap:t,inflateSize:500};this._analyzeSymbolLayer(e,[...c,{type:`cim-effect-param`,effect:d,overrides:[]}],n,r,i,a,o);break}case`CIMBackgroundCallout`:{let{accentBarSymbol:e,gap:t,backgroundSymbol:d,leaderLineSymbol:f,lineStyle:p,margin:m}=s,h=n=>({type:`CIMBackgroundCallout`,leaderTolerance:l,leaderOffset:u,lineStyle:Y(p),gap:t,hasAccentBar:!!e,margin:m,inflateSize:500,part:n}),g=[...c,{type:`cim-effect-param`,effect:h(`background`),overrides:[]}];if(f&&this._analyzeSymbolLayer(f,[...c,{type:`cim-effect-param`,effect:h(`leader`),overrides:[]}],n,r,i,a,o),d){let e=d.symbolLayers??[];Q(e)?this._analyzeCompositeOutlineFill(e,null,i,g):this._analyzeSymbolLayer(d,g,n,r,i,a,o)}e&&this._analyzeSymbolLayer(e,[...c,{type:`cim-effect-param`,effect:h(`accent-bar`),overrides:[]}],n,r,i,a,o);break}case`CIMBalloonCallout`:{let{balloonStyle:e,backgroundSymbol:t,dartSymbol:d,fixedDartWidth:f,margin:p,useDartSymbol:m,useFixedDartWidth:h}=s,g=m===!0&&d!=null,_=t=>({type:`CIMBalloonCallout`,leaderTolerance:l,leaderOffset:u,margin:p,balloonStyle:ce(e),dartWidth:h?f:void 0,inflateSize:500,part:t,separateDart:g}),v=(e,t)=>{let s=[...c,{type:`cim-effect-param`,effect:_(t),overrides:[]}],l=e.symbolLayers??[];Q(l)?this._analyzeCompositeOutlineFill(l,null,i,s):this._analyzeSymbolLayer(e,s,n,r,i,a,o)};g&&v(d,`dart`),v(t,`background`);break}case`CIMPointSymbolCallout`:{let{backgroundScale:e,gap:t,leaderLineSymbol:d,lineStyle:f,pointSymbol:p}=s,m=oe(e),h=ae(p,n),g=e=>({type:`CIMPointSymbolCallout`,leaderTolerance:l,leaderOffset:u,backgroundScale:m,...se(p,e),lineStyle:Y(f),gap:t,inflateSize:500,part:e});d&&this._analyzeSymbolLayer(d,[...c,{type:`cim-effect-param`,effect:g(`leader`),overrides:[]}],n,r,i,a,o),this._analyzeSymbolLayer(p,[...c,{type:`cim-effect-param`,effect:g(`marker`),overrides:[]}],h,r,i,a,o||m!==0);break}case`CIMCompositeCallout`:{let{backgroundSymbol:e,margin:t,shadowSymbol:d}=s,f={type:`CIMBalloonCallout`,leaderTolerance:l,leaderOffset:u,margin:t,balloonStyle:1,inflateSize:500,part:`background`},p=[...c,{type:`cim-effect-param`,effect:f,overrides:[]}],m=e=>{let t=e.symbolLayers??[];Q(t)?this._analyzeCompositeOutlineFill(t,null,i,p):this._analyzeSymbolLayer(e,p,n,r,i,a,o)};d&&m(d),m(e);break}}}_analyzeMultiLayerGraphic(e,t,n,r,i,a,o,s,c,l,u,d){let f=r.symbol,p=f.symbolLayers;p&&(_e(p)&&!v(c)?this._analyzeCompositeMarkerGraphic(e,t,n,r,p,a,o,s,l,u,d):Se(p)?(x(f,e=>{e.colorLocked&&(u=!0)}),this._analyzeMultiLayerGraphicNonSDF(e,t,n,r,i,a,o,s,c,l,u,d)):this._analyzeMarkerGraphicSymbolLayers(e,t,n,r,i,a,o,s,c,l,u,d))}_analyzeMarkerGraphicSymbolLayers(e,t,n,r,i,a,o,s,c,l,u,f){let p=r.symbol,m=p.symbolLayers;if(!m)return;let h=le.applyEffects(p.effects,r.geometry);if(!h)return;let g=m.length;for(;g--;){let p=m[g];if(!p||p.enable===!1)continue;let _=p.primitiveName;switch(_&&i.push(_),p.type){case`CIMSolidFill`:case`CIMSolidStroke`:{let i=le.applyEffects(p.effects,h),m=k(i);if(!m)continue;let g=e.anchorPointUnits!==`Relative`,v=p.type===`CIMSolidStroke`?p.width:0,{frameSizeRatio:y,anchorX:b,anchorY:x,widthRatio:S,sdfPaddingRatio:w,sdfTextureSize:T}=A(m,e.frame,e.size,e.anchorPoint,g,v,e.scaleSymbolsProportionally),E=p.type===`CIMSolidFill`,D={type:`sdf`,geometry:i,sdfPaddingRatio:w,asFill:E,sdfTextureSize:T},{path:O}=p,M=E?P(W(p)):O==null?P(G(p)):[0,0,0,0],N=E?[0,0,0,0]:P(G(p));if(!E&&!v)break;let F=r.primitiveName,I=null;E&&!p.colorLocked&&(I=this._maybeGetValueOrOverrideExpression(F,`FillColor`));let L=null;!E&&!p.colorLocked&&(L=this._maybeGetValueOrOverrideExpression(F,`StrokeColor`));let z=I??this._getValueOrOverrideExpression(p.type,_,`Color`,M),B=L??this._getValueOrOverrideExpression(p.type,_,`Color`,N),V=this._maybeGetValueOrOverrideExpression(F,`StrokeWidth`)??this._getValueOrOverrideExpression(p.type,_,`Width`,v),H=O?{type:`sprite-rasterization-param`,resource:{type:`path`,path:O,asFill:E},overrides:[]}:{type:`sprite-rasterization-param`,resource:D,overrides:[]},U=d(this._poMap,p,c),K=R(e.size,C.CIMVectorMarker.size),q=this._getValueOrOverrideExpression(e.type,e.primitiveName,`Size`,K);this._cimLayers.push({type:`marker`,name:p.name,groupNames:e.name?[e.name]:void 0,spriteRasterizationParam:H,colorLocked:!!p.colorLocked||!!u,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:b,y:x},isAbsoluteAnchorPoint:g,size:l,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:`cim-marker-transform-param`,params:s},frameHeight:l,widthRatio:S,rotateClockwise:!1,referenceSize:o,sizeRatio:y,color:z,outlineColor:B,outlineWidth:V,isOutline:f,markerPlacement:n,animationParams:$(U),isStroke:p.type!==`CIMSolidFill`,baseSize:q,...j(i,T,w)});break}case`CIMPictureMarker`:case`CIMVectorMarker`:if(p.markerPlacement){X().error(`Error analyzing CIM, got unexpected marker placement`);break}this._analyzeMarker(p,t,n,i,a,o,!1,s,c,u,f)}_&&i.pop()}}_analyzeTextGraphic(e,n,r,i,a,o,s,c){E.findApplicableOverrides(r,this._primitiveOverrides,[]);let l=r.geometry;if(!(`x`in l)||!(`y`in l))return;let u=r.symbol,d=K(u),f=T(u.fontStyleName),p=t(u.fontFamilyName);u.font={family:p,decoration:d,...f};let m=R(u.height,C.CIMTextSymbol.height),h=R(u.angle),g=R(u.offsetX),_=R(u.offsetY),{haloSymbol:v}=u,y=R(u.haloSize,0),b=[0,0,0,0];if(v?.symbolLayers?.length){let e=v.symbolLayers;for(let t of e)if(t.color){b=this._getValueOrOverrideExpression(u?.haloSymbol?.type??`CIMPolygonSymbol`,t.primitiveName,`Color`,P(t.color));break}}let x=r.primitiveName,S=[0,0,0,1],w=[0,0,0,0],O=0,k=!1;if(u.symbol?.symbolLayers)for(let e of u.symbol.symbolLayers){let t=e.primitiveName;if(e.type===`CIMSolidStroke`)w=this._getValueOrOverrideExpression(`CIMSolidStroke`,t,`Color`,P(e.color)),O=this._getValueOrOverrideExpression(`CIMSolidStroke`,t,`Width`,q(e)??0);else if(e.type===`CIMSolidFill`){let n=P(e.color);k??=!!e.colorLocked,S=this._getValueOrOverrideExpression(`CIMSolidFill`,t??x,`Color`,n)}}let A=null,j=null,M=null,N=null,F=null;x&&(A=this._maybeGetValueOrOverrideExpression(x,`TextSize`),j=this._maybeGetValueOrOverrideExpression(x,`TextAngle`),M=this._maybeGetValueOrOverrideExpression(x,`TextOffsetX`),N=this._maybeGetValueOrOverrideExpression(x,`TextOffsetY`),k||(F=this._maybeGetValueOrOverrideExpression(x,`FillColor`)));let I=F??S,L=null,z=null,B=0,V=u.callout?.type===`CIMBackgroundCallout`;if(u.callout?.type===`CIMBackgroundCallout`){let e=u.callout;if(e.backgroundSymbol){let t=e.backgroundSymbol.symbolLayers;if(t)for(let e of t)e.type===`CIMSolidFill`?L=P(e.color):e.type===`CIMSolidStroke`&&(z=P(e.color),B=R(e.width,C.CIMSolidStroke.width))}}let H=this._getValueOrOverrideExpression(u.type,r.primitiveName,`TextString`,r.textString??``);if(H==null)return;let{fontStyleName:U}=u,W=p+(U?`-`+U.toLowerCase():`-regular`),G=this._getMaterialOverrides(i,u.type);G.push(...this._getPrimitiveMaterialOverrides(r.primitiveName,u.type)),this._collectDictionaryTemplateOverrides(G,r);let J={type:`text-rasterization-param`,resource:{type:`text`,textString:r.textString??``,font:u.font,symbol:u,primitiveName:r.primitiveName,supportsRichText:D(r.textString??``)||G.some(e=>e.propertyName===`textString`)},overrides:G};this._cimLayers.push({type:`text`,lineWidth:u.lineWidth,textRasterizationParam:J,colorLocked:!!c||!!k,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:W,decoration:d,haloSize:y,haloColor:b,weight:f.weight,style:f.style,size:A??m,angle:j??h,offsetX:M??g,offsetY:N??_,transform:{type:`cim-marker-transform-param`,params:s},horizontalAlignment:te(u.horizontalAlignment),verticalAlignment:ee(u.verticalAlignment),text:H,color:I,outlineColor:w,outlineSize:O,backgroundColor:L,borderLineColor:z,borderLineWidth:B,useBackgroundCallout:V,referenceSize:o,sizeRatio:1,markerPlacement:n})}_collectDictionaryTemplateOverrides(e,t){if(t.textString&&this._hasTextStringTemplates){let n=J(t.symbol);e.push({propertyName:`textString`,defaultValue:``,valueExpressionInfo:{type:`dictionary-template`,textCase:n,template:t.textString},primitiveName:t.primitiveName})}}_analyzeMultiLayerGraphicNonSDF(e,t,n,r,a,o,s,c,l,u,d,f){let p=me(e,r),m=e.primitiveName,h=this._analyzeMaterialOverrides(m,[`Rotation`,`OffsetX`,`OffsetY`]),g=V(h),[_,v,y]=b.getTextureAnchor(p,this._resourceManager,ue),x=this._getMaterialOverrides(a,e.type).filter(e=>e.primitiveName!==m||![`rotation`,`offsetX`,`offsetY`].includes(e.propertyName));x.push(...g);let S={type:`sprite-rasterization-param`,resource:{...p,avoidSDFRasterization:!0},overrides:x},w=R(e.size,C.CIMVectorMarker.size),T=this._getValueOrOverrideExpression(e.type,m,`Size`,w);this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:S,colorLocked:d,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:o,anchorPoint:{x:_,y:v},isAbsoluteAnchorPoint:!1,size:u,rotation:0,offsetX:0,offsetY:0,transform:{type:`cim-marker-transform-param`,params:c},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:u,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:s,sizeRatio:y/i(e.size),isOutline:f,markerPlacement:n,animationParams:$(l),baseSize:T})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;let t=[];return E.findApplicableOverrides(e,this._primitiveOverrides,t),{type:`cim-marker-placement-param`,placement:e,overrides:we(t)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;let t=[];return E.findApplicableOverrides(e,this._primitiveOverrides,t),{type:`cim-gif-animation-params`,animation:e,overrides:we(t)}}_analyzeCompositeMarkerGraphic(e,t,n,r,i,a,o,s,c,l,u){let d=r.geometry,f=i[0],p=i[1],m=k(d);if(!m)return;let h=e.anchorPointUnits!==`Relative`,g=R(f.width,C.CIMSolidStroke.width),{frameSizeRatio:_,anchorX:v,anchorY:y,widthRatio:b,sdfPaddingRatio:x,sdfTextureSize:S}=A(m,e.frame,e.size,e.anchorPoint,h,g,e.scaleSymbolsProportionally),{path:w}=p,T=p.primitiveName,E=f.primitiveName,D=r.primitiveName,O=null;!p.colorLocked&&!l&&(O=this._maybeGetValueOrOverrideExpression(D,`FillColor`));let j=O??this._getValueOrOverrideExpression(p.type,T,`Color`,P(p.color)),M=null;!f.colorLocked&&!l&&(M=this._maybeGetValueOrOverrideExpression(D,`StrokeColor`));let N=M??this._getValueOrOverrideExpression(f.type,E,`Color`,P(f.color)),F=this._maybeGetValueOrOverrideExpression(D,`StrokeWidth`)??this._getValueOrOverrideExpression(f.type,E,`Width`,g),I={type:`sprite-rasterization-param`,resource:w?{type:`path`,path:w,asFill:!0}:{type:`sdf`,geometry:d,sdfTextureSize:S,sdfPaddingRatio:x,asFill:!0},overrides:[]};this._cimLayers.push({type:`marker`,name:e.name,spriteRasterizationParam:I,colorLocked:l,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:v,y},isAbsoluteAnchorPoint:h,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:`cim-marker-transform-param`,params:s},frameHeight:c,widthRatio:b,rotateClockwise:!1,referenceSize:o,sizeRatio:_,color:j,outlineColor:N,outlineWidth:F,isOutline:u,markerPlacement:n})}_setPoMap(e,t,n){let r;this._poMap[e]?r=this._poMap[e]:(r={},this._poMap[e]=r),r[t]=n}_maybeGetValueOrOverrideExpression(e,t,n){return this._getValueOrOverrideExpression(``,e,t,n,!1)}_getValueOrOverrideExpression(e,t,n,r,i=!0){if(i&&!ne(r)&&(r=H(e,n.toLowerCase())),t==null)return r;let a=this._poMap[t];if(a==null)return r;let o=a[n];return typeof o==`string`||typeof o==`number`||Array.isArray(o)?o:o?{valueExpressionInfo:o,defaultValue:r}:r}_analyzePrimitiveOverrides(e,t,n,r){if(e==null)return!1;typeof e==`string`&&(e=[e]);for(let t of this._primitiveOverrides)if(e.includes(t.primitiveName)&&t.valueExpressionInfo)return!0;if(t!=null){for(let e of t)if(e?.overrides.length>0)return!0}if(n!=null){for(let e of n)if(e?.overrides.length>0)return!0}if(r!=null){for(let e of r)if(e?.overrides.length>0)return!0}return!1}_getMaterialOverrides(e,t){if(!e)return[];let n=[];for(let r of e)n.push(...this._getPrimitiveMaterialOverrides(r,t));return n}_getPrimitiveMaterialOverrides(e,t){if(!e)return[];let n=V(this._primitiveOverrides.filter(t=>t.primitiveName===e));return n.forEach(e=>e.defaultValue=H(t,e.propertyName.toLowerCase())),n}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter(n=>n.primitiveName!==e||!t.includes(n.propertyName))}}function me(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 he(e){if(e?.startsWith(`Level_`)){let t=parseInt(e.slice(6),10);if(!isNaN(t))return t}return 0}function ge(e,t){if(!t||t.length===0)return e;let r=n(e);return E.applyOverrides(r,t),r}const _e=e=>e&&e.length===2&&e[0].enable&&e[1].enable&&e[0].type===`CIMSolidStroke`&&e[1].type===`CIMSolidFill`&&e[0].path==null&&e[1].path==null&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function ve(e){let t=e.symbolLayers;if(!t)return!1;let n=t.find(e=>e.effects?.find(e=>e.type===`CIMGeometricEffectDashes`&&e.dashTemplate!=null)),r=t.find(e=>e.effects?.find(e=>e.type===`CIMGeometricEffectAddControlPoints`));return!!n||!!r}function ye(e){return Z(e)}function Z(e){return e.type===`CIMGeometricEffectCircularSector`||e.type===`CIMGeometricEffectRadial`||e.type===`CIMGeometricEffectTaperedPolygon`||e.type===`PrivateDimensionEffect`||e.type===`PrivateMatcherGeometryOverrideEffect`}function be(e){return e.type===`CIMGeometricEffectCircularSector`||e.type===`CIMGeometricEffectTaperedPolygon`}function xe(e,t){let n=e.filter(e=>e.type===`CIMSolidFill`),r=e.every(e=>e.type===`CIMSolidFill`||e.type===`CIMSolidStroke`),i=e.filter(e=>e.effects?.length),a=i.length===0||i.length===1&&n.length===1&&i[0]===n[0];return n.length>0&&r&&a&&t.some(({effect:e})=>be(e))}function Se(e){return e.some(e=>e.type!==`CIMSolidFill`&&e.type!==`CIMSolidStroke`&&(e.type!==`CIMVectorMarker`&&e.type!==`CIMPictureMarker`||e.markerPlacement!=null))}function Ce(e,t){return!!(t?.some(e=>e.type===`CIMGeometricEffectRadial`)&&t?.some(e=>e.type===`CIMGeometricEffectTaperedPolygon`)||t?.some(e=>e.type===`CIMGeometricEffectCircularSector`))&&Q(e)}function Q(e){if(e?.length!==2)return!1;let t=e.find(e=>e.type===`CIMSolidFill`),n=e.find(e=>e.type===`CIMSolidStroke`),r=n?.effects?.some(e=>e.type===`CIMGeometricEffectDashes`);return t!=null&&n!=null&&!r}function we(e){return n(e).map(e=>({...e,propertyName:re(e.propertyName)}))}function $(e){return v(e)?{type:`animation-params`,params:e}:null}export{pe as CIMAnalyzer,ge as analyzeCIMResource};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../request.js";import{bidiText as t}from"../../../../core/BidiText.js";import{getFullyQualifiedFontName as n}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import r from"../../../../core/Logger.js";import{throwIfNotAbortError as i}from"../../../../core/promiseUtils.js";import{loadTextModule as a}from"../../../../libs/librust-text/loadTextModule.js";import{parseRichTextRuns as o}from"../../../../symbols/cim/richTextUtils.js";import{decorGlyphRect as s}from"./decorGlyphRect.js";import{sdfRadiusComplex as c,sdfBufferGlyphSDFCreator as l,sdfSizeComplex as u,sdfBufferServer as d,sdfRadiusSimple as f,sdfSizeSimple as p}from"./definitions.js";import{GlyphSDFCreator as m}from"./GlyphSDFCreator.js";import h from"./GlyphSource.js";import{hashMosaic as g}from"./hashMosaic.js";import _ from"./Rect.js";import v from"./RectangleBinPack.js";const y=`arial-unicode-ms-regular`,b=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,x=new Set([`Noto Sans Khmer`,`Noto Sans Lao`,`Noto Sans Myanmar`,`Noto Sans Thai`]),S=()=>r.getLogger(`esri.views.MapView`),C=(e,t=``)=>S().warnOnce(e,t);class w{constructor(){this._glyphSources=new Map,this._snapCoords=!0,this._currentPage=0,this._faces=new Map,this._facePromises=new Map,this._pbfRangePromises=new Map,this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._invalidFonts=new Set,this._preloadCache={},this._glyphSDFCreator=new m({sdfSizePx:u,sdfBufferPx:l,radius:c,cutoff:.25})}set remoteClient(e){this._client=e.createInvokeProxy();let t=this._client.getOptions();this._inited=this._init(t)}async rasterizeText(e,t,n){await this._inited;let r=t.symbol?o(t):null;return r?{type:`rich-glyphs`,runs:(await Promise.all(r.map(async t=>({fontSize:t.fontSize,characterSpacing:t.characterSpacing,decoration:t.font.decoration,color:t.color,glyphs:await this._rasterizeTextRun(e,t.font,t.text,n)})))).filter(e=>e.glyphs!=null)}:this._rasterizeTextRun(e,t.font,t.textString,n)}async _rasterizeTextRun(e,t,r,i){let a=n(t),o=this._invalidFonts.has(a),s=!!has(`esri-2d-force-complex-shaping`),c=!!has(`esri-2d-complex-shaping`)&&b.test(r),l=x.has(t.family),u=s||c||l,d=o?y:a,f=await this.getGlyphItems(r,u,e,d,!1,i);return f||=(C(`Font ${a} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(a),await this.getGlyphItems(r,u,e,y,!1,i)),f}async getGlyphItems(e,n,r,i,a,o){await this._inited;let s=this._getSource(r),m=n?u:p,h=n?c:f,g=n?l:d,_,v,y;if(has(`esri-2d-stabilize-glyphs`)&&await this.preloadASCIIGlyphCache(s,i).catch(()=>{}),n){let t=await this._getFace(s,i);if(!t)return null;let n=this._glyphCache.get(i);n||(n=new Map,this._glyphCache.set(i,n));let{shaping:r,isRTL:a}=this._shape(t,e);y=a,_=r.map(e=>this._getShapedGlyph(t,n,e)),v={baseline:t.baseline()/m,midline:t.midline()/m}}else{let n=this._pbfGlyphCache.get(i);n||(n=new Map,this._pbfGlyphCache.set(i,n));let[r,c,l]=t(e),u=O(r);try{await this._fetchRanges(s,i,u,o)}catch{return null}y=c,_=u.map(e=>this._getPBFGlyph(n,s,i,e,a)).filter(e=>!!e)}let b=_.filter(e=>e.needsRecord);return b.length>0&&await this._client.recordGlyphs(b),{type:`glyphs`,glyphs:_,faceInfo:v,isRightToLeft:y,sdfSize:m,sdfRadius:h,sdfPadding:g}}async _init(e){let{width:t,height:n,snapCoords:r}=await e;this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._binPack=new v(t,n),this._snapCoords=r,this._currentPage=0,this._initDecorationGlyphs()}_getShapedGlyph(e,t,n){let r,i,a=t.get(n.glyphId);if(!a){r=this._glyphSDFCreator.draw(e,n.glyphId);let o=this._glyphSDFCreator.sdfBufferPx;a={mosaicItem:{rect:this._recordGlyph(r?.rect,o),page:this._currentPage,sdf:!0,textureBinding:g(1,this._currentPage,!0)},glyphRect:r?.rect??{width:0,height:0,top:0,left:0}},t.set(n.glyphId,a),i=!0}return{mosaicItem:a.mosaicItem,rect:a.glyphRect,shaping:{xAdvance:n.xAdvance,yAdvance:n.yAdvance,xOffset:n.xOffset,yOffset:n.yOffset},code:n.isNewline?10:n.isWhitespace?32:NaN,sdf:r,needsRecord:i}}_getPBFGlyph(e,t,n,r,i=!1){let a,o,s=e.get(r);if(!s){let c=t.getRange(n,r),u=c?.getRect(r),d=c?.getShaping(r),f=c?.getBitmap(r);if(i&&(!u||!d))return;if(!u||!d)return D(r);let p={rect:f?this._recordGlyph(u,l):new _(0,0,0,0),sdf:!0,page:this._currentPage,textureBinding:g(1,this._currentPage,!0)};a=f&&{buffer:f,rect:u},s={mosaicItem:p,rect:u,shaping:d,code:r},o=!0,e.set(r,s)}let{mosaicItem:c,rect:u,shaping:d}=s;return{mosaicItem:c,rect:u,shaping:d,code:r,sdf:a,needsRecord:o}}_shape(e,n){let r=this._glyphSDFCreator.sdfSizePx,[i,a,o]=t(n,!1),s=new Uint32Array(Array.from(i).map((e,t)=>o.levels[o.targetToSource[t]]));return{shaping:e.shape(i,s,r),isRTL:a}}async _getFace(t,n,r){if(this._faces.has(n))return this._faces.get(n);let i=t.woffURL(n);return await E(this._facePromises,n,async()=>{let t=await e(i,{responseType:`array-buffer`,...r}),o=(await a()).Face.parseWoff2(new Uint8Array(t.data));this._faces.set(n,o)}),this._faces.get(n)}_getSource(e){return this._glyphSources.has(e)||this._glyphSources.set(e,new h(e)),this._glyphSources.get(e)}async _fetchRanges(e,t,n,r){let i=T(n),a=[];i.forEach(n=>{a.push(this._fetchRange(e,t,n,r))}),await Promise.all(a)}async _fetchRange(e,t,n,r){if(n>256)return;let i=t+n;return E(this._pbfRangePromises,i,()=>e.fetchRange(t,n,r))}_allocNewPage(){this._currentPage++,this._binPack=new v(this._binPack.width,this._binPack.height),this._initDecorationGlyphs()}_recordGlyph(e,t){let n=this._binPack;if(!e||e.width===0)return new _;let r=e.width+t*2,i=e.height+t*2,a=r,o=i;if(this._snapCoords){let e=r%4?4-r%4:4,t=i%4?4-i%4:4;a+=e,o+=t}let s=n.allocate(a,o);return s.isEmpty?(this._allocNewPage(),n.allocate(a,o)):s}_initDecorationGlyphs(){this._recordGlyph(s,d),this._recordGlyph(s,d)}preloadASCIIGlyphCache(e,t){let n=this._preloadCache[t];if(n!=null)return n;let r=e.preloadASCIIRange(t).then(async()=>{let n=this._pbfGlyphCache.get(t);n||(n=new Map,this._pbfGlyphCache.set(t,n));let r=[];for(let i=0;i<256;i++){let a=this._getPBFGlyph(n,e,t,i);a?.needsRecord&&r.push(a)}await this._client.recordGlyphs(r)},e=>{throw delete this._preloadCache[t],e});return this._preloadCache[t]=r,r}}function T(e){let t=new Set;for(let n of e)t.add(Math.floor(n/256));return t}function E(e,t,n){return e.has(t)||e.set(t,n().finally(()=>{e.delete(t)}).catch(e=>{i(e)})),e.get(t)}const D=e=>({mosaicItem:{rect:new _(0,0,0,0),sdf:!0,page:0},rect:{left:0,width:0,height:0,top:0},shaping:{xAdvance:0,yAdvance:0,xOffset:0,yOffset:0},code:e});function O(e){let t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t}export{w as default};
2
+ import e from"../../../../request.js";import{bidiText as t}from"../../../../core/BidiText.js";import{getFullyQualifiedFontName as n}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import r from"../../../../core/Logger.js";import{ignoreAbortErrors as i,throwIfNotAbortError as a}from"../../../../core/promiseUtils.js";import{loadTextModule as o}from"../../../../libs/librust-text/loadTextModule.js";import{parseRichTextRuns as s}from"../../../../symbols/cim/richTextUtils.js";import{decorGlyphRect as c}from"./decorGlyphRect.js";import{sdfRadiusComplex as l,sdfBufferGlyphSDFCreator as u,sdfSizeComplex as d,sdfBufferServer as f,sdfRadiusSimple as p,sdfSizeSimple as m}from"./definitions.js";import{GlyphSDFCreator as h}from"./GlyphSDFCreator.js";import g from"./GlyphSource.js";import{hashMosaic as _}from"./hashMosaic.js";import v from"./Rect.js";import y from"./RectangleBinPack.js";const b=`arial-unicode-ms-regular`,x=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,S=new Set([`Noto Sans Khmer`,`Noto Sans Lao`,`Noto Sans Myanmar`,`Noto Sans Thai`]),C=()=>r.getLogger(`esri.views.MapView`),w=(e,t=``)=>C().warnOnce(e,t);class T{constructor(){this._glyphSources=new Map,this._snapCoords=!0,this._currentPage=0,this._faces=new Map,this._facePromises=new Map,this._pbfRangePromises=new Map,this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._invalidFonts=new Set,this._preloadCache={},this._glyphSDFCreator=new h({sdfSizePx:d,sdfBufferPx:u,radius:l,cutoff:.25})}set remoteClient(e){this._client=e.createInvokeProxy();let t=i(this._client.getOptions());this._inited=this._init(t)}async rasterizeText(e,t,n){await this._inited;let r=t.symbol?s(t):null;return r?{type:`rich-glyphs`,runs:(await Promise.all(r.map(async t=>({fontSize:t.fontSize,characterSpacing:t.characterSpacing,decoration:t.font.decoration,color:t.color,glyphs:await this._rasterizeTextRun(e,t.font,t.text,n)})))).filter(e=>e.glyphs!=null)}:this._rasterizeTextRun(e,t.font,t.textString,n)}async _rasterizeTextRun(e,t,r,i){let a=n(t),o=this._invalidFonts.has(a),s=!!has(`esri-2d-force-complex-shaping`),c=!!has(`esri-2d-complex-shaping`)&&x.test(r),l=S.has(t.family),u=s||c||l,d=o?b:a,f=await this.getGlyphItems(r,u,e,d,!1,i);return f||=(w(`Font ${a} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(a),await this.getGlyphItems(r,u,e,b,!1,i)),f}async getGlyphItems(e,n,r,i,a,o){await this._inited;let s=this._getSource(r),c=n?d:m,h=n?l:p,g=n?u:f,_,v,y;if(has(`esri-2d-stabilize-glyphs`)&&await this.preloadASCIIGlyphCache(s,i).catch(()=>{}),n){let t=await this._getFace(s,i);if(!t)return null;let n=this._glyphCache.get(i);n||(n=new Map,this._glyphCache.set(i,n));let{shaping:r,isRTL:a}=this._shape(t,e);y=a,_=r.map(e=>this._getShapedGlyph(t,n,e)),v={baseline:t.baseline()/c,midline:t.midline()/c}}else{let n=this._pbfGlyphCache.get(i);n||(n=new Map,this._pbfGlyphCache.set(i,n));let[r,c,l]=t(e),u=k(r);try{await this._fetchRanges(s,i,u,o)}catch{return null}y=c,_=u.map(e=>this._getPBFGlyph(n,s,i,e,a)).filter(e=>!!e)}let b=_.filter(e=>e.needsRecord);return b.length>0&&await this._client.recordGlyphs(b),{type:`glyphs`,glyphs:_,faceInfo:v,isRightToLeft:y,sdfSize:c,sdfRadius:h,sdfPadding:g}}async _init(e){let t=await e;if(!t)return;let{width:n,height:r,snapCoords:i}=t;this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._binPack=new y(n,r),this._snapCoords=i,this._currentPage=0,this._initDecorationGlyphs()}_getShapedGlyph(e,t,n){let r,i,a=t.get(n.glyphId);if(!a){r=this._glyphSDFCreator.draw(e,n.glyphId);let o=this._glyphSDFCreator.sdfBufferPx;a={mosaicItem:{rect:this._recordGlyph(r?.rect,o),page:this._currentPage,sdf:!0,textureBinding:_(1,this._currentPage,!0)},glyphRect:r?.rect??{width:0,height:0,top:0,left:0}},t.set(n.glyphId,a),i=!0}return{mosaicItem:a.mosaicItem,rect:a.glyphRect,shaping:{xAdvance:n.xAdvance,yAdvance:n.yAdvance,xOffset:n.xOffset,yOffset:n.yOffset},code:n.isNewline?10:n.isWhitespace?32:NaN,sdf:r,needsRecord:i}}_getPBFGlyph(e,t,n,r,i=!1){let a,o,s=e.get(r);if(!s){let c=t.getRange(n,r),l=c?.getRect(r),d=c?.getShaping(r),f=c?.getBitmap(r);if(i&&(!l||!d))return;if(!l||!d)return O(r);let p={rect:f?this._recordGlyph(l,u):new v(0,0,0,0),sdf:!0,page:this._currentPage,textureBinding:_(1,this._currentPage,!0)};a=f&&{buffer:f,rect:l},s={mosaicItem:p,rect:l,shaping:d,code:r},o=!0,e.set(r,s)}let{mosaicItem:c,rect:l,shaping:d}=s;return{mosaicItem:c,rect:l,shaping:d,code:r,sdf:a,needsRecord:o}}_shape(e,n){let r=this._glyphSDFCreator.sdfSizePx,[i,a,o]=t(n,!1),s=new Uint32Array(Array.from(i).map((e,t)=>o.levels[o.targetToSource[t]]));return{shaping:e.shape(i,s,r),isRTL:a}}async _getFace(t,n,r){if(this._faces.has(n))return this._faces.get(n);let i=t.woffURL(n);return await D(this._facePromises,n,async()=>{let t=await e(i,{responseType:`array-buffer`,...r}),a=(await o()).Face.parseWoff2(new Uint8Array(t.data));this._faces.set(n,a)}),this._faces.get(n)}_getSource(e){return this._glyphSources.has(e)||this._glyphSources.set(e,new g(e)),this._glyphSources.get(e)}async _fetchRanges(e,t,n,r){let i=E(n),a=[];i.forEach(n=>{a.push(this._fetchRange(e,t,n,r))}),await Promise.all(a)}async _fetchRange(e,t,n,r){if(n>256)return;let i=t+n;return D(this._pbfRangePromises,i,()=>e.fetchRange(t,n,r))}_allocNewPage(){this._currentPage++,this._binPack=new y(this._binPack.width,this._binPack.height),this._initDecorationGlyphs()}_recordGlyph(e,t){let n=this._binPack;if(!e||e.width===0)return new v;let r=e.width+t*2,i=e.height+t*2,a=r,o=i;if(this._snapCoords){let e=r%4?4-r%4:4,t=i%4?4-i%4:4;a+=e,o+=t}let s=n.allocate(a,o);return s.isEmpty?(this._allocNewPage(),n.allocate(a,o)):s}_initDecorationGlyphs(){this._recordGlyph(c,f),this._recordGlyph(c,f)}preloadASCIIGlyphCache(e,t){let n=this._preloadCache[t];if(n!=null)return n;let r=e.preloadASCIIRange(t).then(async()=>{let n=this._pbfGlyphCache.get(t);n||(n=new Map,this._pbfGlyphCache.set(t,n));let r=[];for(let i=0;i<256;i++){let a=this._getPBFGlyph(n,e,t,i);a?.needsRecord&&r.push(a)}await this._client.recordGlyphs(r)},e=>{throw delete this._preloadCache[t],e});return this._preloadCache[t]=r,r}}function E(e){let t=new Set;for(let n of e)t.add(Math.floor(n/256));return t}function D(e,t,n){return e.has(t)||e.set(t,n().finally(()=>{e.delete(t)}).catch(e=>{a(e)})),e.get(t)}const O=e=>({mosaicItem:{rect:new v(0,0,0,0),sdf:!0,page:0},rect:{left:0,width:0,height:0,top:0},shaping:{xAdvance:0,yAdvance:0,xOffset:0,yOffset:0},code:e});function k(e){let t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t}export{T as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../../../../core/Logger.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{CIMSymbolHelper as n}from"../../../../../../../symbols/cim/CIMSymbolHelper.js";import{defaultCIMValues as r}from"../../../../../../../symbols/cim/defaultCIMValues.js";import{Techniques as i}from"../../../../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{defineMeshWriterReferences as a}from"../../../../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterReferences.js";import{getMaxSizeVVSize as o,noVisualVariables as s}from"../VisualVariablesSchema.js";import{getAnimatedTechniqueSprite as c,hasSizeVVUniform as l}from"./utils.js";function u(t,n){if(t&&n){let r=t.toLowerCase(),i=n.get(r);if(i!==void 0)return{name:r,index:i};e.getLogger(`esri.views.2d.layers.features.schema.processor.symbols/ComplexSymbolSchema`).warn(`Invalid symbol layer name: "${t}"`)}return null}function d(e,t){if(t?.enabled&&t.drawOrder){let n=t.drawOrder.map(e=>e.toLowerCase()).slice().reverse(),r=new Map;for(let t of e)if(t.groupName&&t.name){let e=t.name.toLowerCase(),i=t.groupName.toLowerCase(),a=n.indexOf(i);a!==-1&&(r.has(a)||r.set(a,[]),r.get(a).push(e))}let i=[];n.forEach((e,t)=>{r.has(t)?i.push(...r.get(t)):i.push(e)});let a=new Map;return i.forEach((e,t)=>{a.set(e,t)}),a}return null}function f(e){return e.minScale||e.maxScale?{minScale:e.minScale??0,maxScale:e.maxScale??0}:null}function p(e){if(e==null)return null;if(Array.isArray(e)){let[t,n,r,i]=e;return[t,n,r,i*255]}return typeof e==`string`?e:{...e,defaultValue:p(e?.defaultValue)}}async function m(e,t,n=!1){return g(e,t,n,!0)}async function h(e,t,n=!1){return g(e,t,n,!1)}async function g(e,t,r,i){let{cimResourceManager:o,cimAnalyzer:s,scaleExpression:c,symbolLayerDrawing:l}=t.schemaOptions,u=e.symbol;if(u==null)return[];await n.normalizeSymbolAndFetchResources(u,o);let p=s.analyzeSymbolReference(e,!1),m=f(e),h=d(p,l),g=_(u,p,r),v=u.type===`CIMPointSymbol`&&u.angleAlignment!==`Map`,b=v||g?t.schemaOptions.viewRotation:null,x={scaleInfo:m,scaleExpression:c,rotationVariable:t.rotationVariable??null,viewRotation:b,viewRotationForCalloutsOnly:g&&!v,layerOrderMap:h},S=[];for(let e of p)switch(e.type){case`marker`:S.push(...y(e,t,x));break;case`fill`:S.push(...D(e,t,x));break;case`outlineFill`:S.push(...w(e,t,x));break;case`gradientFill`:S.push(...k(e,t,x));break;case`line`:S.push(...j(e,t,x));break;case`gradientStroke`:S.push(...I(e,t,x));break;case`text`:S.push(...R(e,t,x))}if(r)for(let e of S)e.inputParams.collisionVisibility=!0;return i?a(S):S}function _(e,t,n){return!n&&e.type===`CIMLineSymbol`&&t.some(e=>(e.type===`marker`||e.type===`text`)&&e.alignment===0)&&t.some(v)}function v(e){return[...e.effects??[],...`outlineEffects`in e?e.outlineEffects??[]:[]].some(({effect:e})=>e.type===`CIMSimpleLineCallout`||e.type===`CIMBackgroundCallout`||e.type===`CIMBalloonCallout`||e.type===`CIMPointSymbolCallout`)}function y(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:c}=n,l=e.isOutline?{...s,visualVariableSizeScaleStops:r.visualVariableSizeOutlineScaleStops}:{visualVariableColor:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue,visualVariableRotation:r.visualVariableRotation};if(e.animationParams){let{hasShiftAnimation:t}=e.animationParams.params,r=t?i.animatedMarkerShift:i.animatedMarker;return b(o.ensureInstance(r,{uniforms:l,optionalAttributes:{zoomRange:!0,value1Position2Value2:e.animationParams.params.hasShiftAnimation,lineLength:t}},u(e.name,c)),e,s,n)}return S(o.ensureInstance(i.marker,{uniforms:l,optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,c)),e,r,n)}function b(e,t,n,r){return t.animationParams?[e.createMeshInfo({pixelDimensions:t.pixelDimensions,texelDimensions:t.texelDimensions,effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null,sprite:c(t),animations:t.animationParams,scaleInfo:r.scaleInfo,scaleSymbolsProportionally:t.scaleSymbolsProportionally,strokeWidth:t.outlineWidth,isMapAligned:t.alignment===1,colorLocked:t.colorLocked,isStroke:t.isStroke,baseSize:t.baseSize,placement:t.markerPlacement,referenceSize:t.referenceSize,angleToLine:t.markerPlacement?t.markerPlacement.placement&&`angleToLine`in t.markerPlacement.placement&&t.markerPlacement.placement.angleToLine:!1,sizeRatio:t.sizeRatio,patternHeight:null})]:[]}function x(e,t,n,r){return t.animationParams?[e.createMeshInfo({effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null,sprite:c(t),animations:t.animationParams,scaleInfo:r.scaleInfo,scaleSymbolsProportionally:!1,strokeWidth:1,isMapAligned:!0,colorLocked:t.colorLocked||!1,isStroke:!1,baseSize:`width`in t?t.width:-1,placement:null,referenceSize:2,angleToLine:!1,sizeRatio:1,patternHeight:t.type===`fill`&&t.spriteRasterizationParam?t.height:null,joinType:`join`in t?t.join:`round`,capType:`cap`in t?t.cap:`round`,miterLimit:`miterLimit`in t&&t.miterLimit||2,angle:`angle`in t?t.angle:0})]:[]}function S(e,t,n,{scaleInfo:i,scaleExpression:a}){let s=l(n);return[e.createMeshInfo({size:t.size,scaleX:t.scaleX,anchorX:t.anchorPoint.x,anchorY:t.anchorPoint.y,angle:t.rotation,color:p(t.color)??[0,0,0,0],colorLocked:t.colorLocked,frameHeight:t.frameHeight,widthRatio:t.widthRatio,scaleInfo:i,offsetX:t.offsetX,offsetY:t.offsetY,outlineColor:p(t.outlineColor)??[0,0,0,0],outlineSize:t.outlineWidth,referenceSize:t.referenceSize||r.CIMVectorMarker.size,rotateClockwise:t.rotateClockwise,scaleFactor:a??1,sizeRatio:t.sizeRatio,alignment:t.alignment,isAbsoluteAnchorPoint:t.isAbsoluteAnchorPoint,scaleSymbolsProportionally:t.scaleSymbolsProportionally,sprite:t.spriteRasterizationParam,hasSizeVV:s,placement:t.markerPlacement,effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null,transforms:t.transform,minPixelBuffer:o(n)})]}function C(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:c}=n,l={visualVariableColor:e.colorLocked?null:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity};if(e.animationParams){let t=i.animatedFill;return x(o.ensureInstance(t,{uniforms:{...l,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null,visualVariableSizeScaleStops:null,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,lineLength:!1}},u(e.name,c)),e,s,n)}return E(o.ensureInstance(i.fill,{uniforms:l,optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,c)),e,n)}function w(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:s}=n;return T(o.ensureInstance(i.outlineFill,{uniforms:{visualVariableColor:e.colorLocked?null:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeMinMaxValue:null,visualVariableSizeScaleStops:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null},optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,s)),e,n)}function T(e,n,r){let i=p(n.color)??[0,0,0,0],a=p(n.outlineColor)??[0,0,0,0];return[e.createMeshInfo({color:i,outlineColor:a,width:n.outlineWidth,referenceWidth:n.referenceWidth,minPixelBuffer:n.pixelBufferSize==null?0:t(n.pixelBufferSize)+1,capType:n.cap,joinType:n.join,miterLimit:n.miterLimit,outlineUsesColorVV:!n.outlineColorLocked,hasSizeVV:!1,scaleInfo:r.scaleInfo,...N(n,r),effects:n.effects?{type:`cim-effect-infos`,effectInfos:n.effects}:null,outlineEffects:n.outlineEffects?{type:`cim-effect-infos`,effectInfos:n.outlineEffects}:null})]}function E(e,t,n){let{scaleInfo:r}=n;return[e.createMeshInfo({color:p(t.color)??[0,0,0,0],scaleInfo:r,...N(t,n),effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null})]}function D(e,t,n){let{layerOrderMap:r}=n;if(!e.spriteRasterizationParam)return C(e,t,n);let{uniforms:a,schemaOptions:o}=t,{store:c}=o,l={visualVariableColor:e.colorLocked?null:a.visualVariableColor,visualVariableOpacity:a.visualVariableOpacity};if(e.animationParams){let t=i.animatedFill;return x(c.ensureInstance(t,{uniforms:{...l,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null,visualVariableSizeScaleStops:null,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,lineLength:!1,angle:!!e.angle}},u(e.name,r)),e,s,n)}return O(c.ensureInstance(i.complexFill,{uniforms:l,optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,r)),e,a.visualVariableColor!=null,n)}function O(e,t,n,r){let{scaleInfo:i}=r;if(!t.spriteRasterizationParam)throw Error(`InternalError: Sprite should always be defined`);let a=!!t.hasUnresolvedReplacementColor&&(!n||t.colorLocked),o=t.sampleAlphaOnly&&!a,s=t.spriteRasterizationParam;return[e.createMeshInfo({color:p(t.color)??[0,0,0,0],height:t.height,aspectRatio:t.scaleX,offsetX:t.offsetX,offsetY:t.offsetY,scaleX:1,scaleY:1,angle:t.angle,applyRandomOffset:t.applyRandomOffset,sampleAlphaOnly:o,scaleProportionally:s.resource.type===`CIMHatchFill`,sprite:s,scaleInfo:i,...N(t,r),effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null})]}function k(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:s}=n;return A(o.ensureInstance(i.gradientFill,{uniforms:{visualVariableColor:null,visualVariableOpacity:r.visualVariableOpacity},optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,s)),e,n)}function A(e,t,n){let{scaleInfo:r}=n;if(!t.spriteRasterizationParam)throw Error(`InternalError: Sprite should always be defined`);let i=t.spriteRasterizationParam;return[e.createMeshInfo({color:p(t.color)??[0,0,0,0],angle:t.angle,gradientMethod:t.gradientMethod,gradientSize:t.gradientSize,gradientSizeUnits:t.gradientSizeUnits,gradientType:t.gradientType,sprite:i,scaleInfo:r,...N(t,n),effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null})]}function j(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:c}=n,l=e.isOutline?{...s,visualVariableSizeScaleStops:r.visualVariableSizeOutlineScaleStops}:{visualVariableColor:e.colorLocked?null:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue};if(e.animationParams){let{hasShiftAnimation:t}=e.animationParams.params,r=i.animatedLine;return x(o.ensureInstance(r,{uniforms:{...l,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,accumulatedDistance:!0,segmentDirection:!0,normal:!0,lineLength:t,angle:!1}},u(e.name,c)),e,s,n)}let d={uniforms:l,optionalAttributes:{zoomRange:!!n.scaleInfo}},f=!!(l.visualVariableSizeMinMaxValue||l.visualVariableSizeScaleStops||l.visualVariableSizeStops||l.visualVariableSizeUnitValue);return e.spriteRasterizationParam?F(o.ensureInstance(i.texturedLine,d,u(e.name,c)),e,f,n):P(o.ensureInstance(i.line,d,u(e.name,c)),e,f,n)}function M(e,t,n){let{scaleInfo:r}=n;return{color:p(e.color)??[0,0,0,0],width:e.width,referenceWidth:e.referenceWidth,capType:e.cap,joinType:e.join,miterLimit:e.miterLimit,scaleInfo:r,hasSizeVV:t,...N(e,n),effects:e.effects?{type:`cim-effect-infos`,effectInfos:e.effects}:null}}function N(e,{rotationVariable:t,viewRotation:n,viewRotationForCalloutsOnly:r}){if(!e.effects?.length&&!e.outlineEffects?.length)return{};let i={};if(e.effectsChangeGeometryType&&(i.useEffectOrigin=!0),n!=null&&(!r||e.type!==`text`&&v(e))&&(i.viewRotation=n),!t)return i;let a=t.valueExpression??(t.field?`$feature[${JSON.stringify(t.field)}]`:null);return a&&(i.effectRotation={valueExpressionInfo:{type:`CIMExpressionInfo`,expression:a},defaultValue:0},i.effectRotationType=t.rotationType),i}function P(e,t,n,r){if(t.spriteRasterizationParam)throw Error(`InternalError: Sprite should not be defined`);let i=M(t,n,r);return[e.createMeshInfo(i)]}function F(e,t,n,r){let{spriteRasterizationParam:i,scaleDash:a,sampleAlphaOnly:o}=t;if(!i)throw Error(`InternalError: Sprite should be defined`);return[e.createMeshInfo({...M(t,n,r),offsetAlongLine:t.offsetAlongLine??0,shouldScaleDash:a??!1,shouldSampleAlphaOnly:o,isSDF:i.resource.type!==`CIMPictureStroke`&&i.resource.type!==`CIMGradientStroke`,sprite:i})]}function I(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:c}=n;return L(o.ensureInstance(i.gradientStroke,{uniforms:e.isOutline?{...s,visualVariableSizeScaleStops:r.visualVariableSizeOutlineScaleStops}:{visualVariableColor:null,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,c)),e,n)}function L(e,t,n){if(!t.spriteRasterizationParam)throw Error(`InternalError: Sprite should always be defined`);let r=t.spriteRasterizationParam;return[e.createMeshInfo({...M(t,!1,n),gradientMethod:t.gradientMethod,gradientSize:t.gradientSize,gradientSizeUnits:t.gradientSizeUnits,gradientType:t.gradientType,sprite:r,effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null})]}function R(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:s}=n;return z(o.ensureInstance(i.text,{uniforms:{visualVariableColor:e.colorLocked?null:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableRotation:r.visualVariableRotation,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!!n.scaleInfo,referenceSymbol:!1,clipAngle:!1}},u(e.name,s)),e,r,n)}function z(e,t,n,{scaleInfo:r,scaleExpression:i}){return[e.createMeshInfo({alignment:t.alignment,boxBackgroundColor:null,boxBorderLineColor:null,boxBorderLineSize:0,backgroundColor:p(t.backgroundColor),borderLineColor:p(t.borderLineColor),borderLineWidth:t.borderLineWidth??0,useBackgroundCallout:t.useBackgroundCallout,color:p(t.color)??[0,0,0,0],offsetX:t.offsetX,offsetY:t.offsetY,postAngle:t.angle,fontSize:t.size,referenceSize:t.referenceSize,decoration:t.decoration,haloColor:p(t.haloColor)??[0,0,0,0],haloSize:t.haloSize??0,outlineColor:p(t.outlineColor)??[0,0,0,0],outlineSize:t.outlineSize,lineWidth:t.lineWidth||512,lineHeightRatio:1,horizontalAlignment:t.horizontalAlignment??`center`,verticalAlignment:t.verticalAlignment??`baseline`,useCIMAngleBehavior:!1,glyphs:t.textRasterizationParam,scaleInfo:r,effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null,placement:t.markerPlacement,transforms:t.transform,scaleFactor:i??1,minPixelBuffer:o(n),repeatLabel:null,repeatLabelDistance:null,allowOverrun:null,labelPosition:null,layerId:null,labelClassId:null})]}export{b as createAnimatedMarkerMeshInfos,x as createAnimatedPolyMeshInfos,O as createComplexFillMeshInfos,S as createComplexMarkerMeshInfos,E as createComplexSimpleFillMeshInfos,P as createComplexSimpleLineMeshInfos,T as createComplexSimpleOutlineFillMeshInfos,m as createComplexSymbolInstances,h as createComplexSymbolPartSchemas,z as createComplexTextMeshInfos,F as createComplexTexturedLineMeshInfos,A as createGradientFillMeshInfos,L as createGradientStrokeMeshInfos,f as getScaleInfo};
2
+ import e from"../../../../../../../core/Logger.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{CIMSymbolHelper as n}from"../../../../../../../symbols/cim/CIMSymbolHelper.js";import{defaultCIMValues as r}from"../../../../../../../symbols/cim/defaultCIMValues.js";import{Techniques as i}from"../../../../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{defineMeshWriterReferences as a}from"../../../../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterReferences.js";import{getMaxSizeVVSize as o,noVisualVariables as s}from"../VisualVariablesSchema.js";import{getAnimatedTechniqueSprite as c,hasSizeVVUniform as l}from"./utils.js";function u(t,n){if(t&&n){let r=t.toLowerCase(),i=n.get(r);if(i!==void 0)return{name:r,index:i};e.getLogger(`esri.views.2d.layers.features.schema.processor.symbols/ComplexSymbolSchema`).warn(`Invalid symbol layer name: "${t}"`)}return null}function d(e,t){if(!t?.enabled||!t.drawOrder)return null;let n=t.drawOrder.map(e=>e.toLowerCase()).reverse(),r=new Map;for(let t of e){if(!t.name)continue;let e=f(t,n);if(e===-1)continue;let i=t.name.toLowerCase(),a=r.get(e);a?a.push(i):r.set(e,[i])}let i=new Map,a=0;for(let[e,t]of n.entries()){let n=r.get(e)??[t];for(let e of n)i.set(e,a++)}return i}function f(e,t){for(let n of[e.name,...e.groupNames??[]]){if(!n)continue;let e=t.indexOf(n.toLowerCase());if(e!==-1)return e}return-1}function p(e){return e.minScale||e.maxScale?{minScale:e.minScale??0,maxScale:e.maxScale??0}:null}function m(e){if(e==null)return null;if(Array.isArray(e)){let[t,n,r,i]=e;return[t,n,r,i*255]}return typeof e==`string`?e:{...e,defaultValue:m(e?.defaultValue)}}async function h(e,t,n=!1){return _(e,t,n,!0)}async function g(e,t,n=!1){return _(e,t,n,!1)}async function _(e,t,r,i){let{cimResourceManager:o,cimAnalyzer:s,scaleExpression:c,symbolLayerDrawing:l}=t.schemaOptions,u=e.symbol;if(u==null)return[];await n.normalizeSymbolAndFetchResources(u,o);let f=s.analyzeSymbolReference(e,!1),m=p(e),h=d(f,l),g=v(u,f,r),_=u.type===`CIMPointSymbol`&&u.angleAlignment!==`Map`,y=_||g?t.schemaOptions.viewRotation:null,x={scaleInfo:m,scaleExpression:c,rotationVariable:t.rotationVariable??null,viewRotation:y,viewRotationForCalloutsOnly:g&&!_,layerOrderMap:h},S=[];for(let e of f)switch(e.type){case`marker`:S.push(...b(e,t,x));break;case`fill`:S.push(...O(e,t,x));break;case`outlineFill`:S.push(...T(e,t,x));break;case`gradientFill`:S.push(...A(e,t,x));break;case`line`:S.push(...M(e,t,x));break;case`gradientStroke`:S.push(...L(e,t,x));break;case`text`:S.push(...z(e,t,x))}if(r)for(let e of S)e.inputParams.collisionVisibility=!0;return i?a(S):S}function v(e,t,n){return!n&&e.type===`CIMLineSymbol`&&t.some(e=>(e.type===`marker`||e.type===`text`)&&e.alignment===0)&&t.some(y)}function y(e){return[...e.effects??[],...`outlineEffects`in e?e.outlineEffects??[]:[]].some(({effect:e})=>e.type===`CIMSimpleLineCallout`||e.type===`CIMBackgroundCallout`||e.type===`CIMBalloonCallout`||e.type===`CIMPointSymbolCallout`)}function b(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:c}=n,l=e.isOutline?{...s,visualVariableSizeScaleStops:r.visualVariableSizeOutlineScaleStops}:{visualVariableColor:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue,visualVariableRotation:r.visualVariableRotation};if(e.animationParams){let{hasShiftAnimation:t}=e.animationParams.params,r=t?i.animatedMarkerShift:i.animatedMarker;return x(o.ensureInstance(r,{uniforms:l,optionalAttributes:{zoomRange:!0,value1Position2Value2:e.animationParams.params.hasShiftAnimation,lineLength:t}},u(e.name,c)),e,s,n)}return C(o.ensureInstance(i.marker,{uniforms:l,optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,c)),e,r,n)}function x(e,t,n,r){return t.animationParams?[e.createMeshInfo({pixelDimensions:t.pixelDimensions,texelDimensions:t.texelDimensions,effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null,sprite:c(t),animations:t.animationParams,scaleInfo:r.scaleInfo,scaleSymbolsProportionally:t.scaleSymbolsProportionally,strokeWidth:t.outlineWidth,isMapAligned:t.alignment===1,colorLocked:t.colorLocked,isStroke:t.isStroke,baseSize:t.baseSize,placement:t.markerPlacement,referenceSize:t.referenceSize,angleToLine:t.markerPlacement?t.markerPlacement.placement&&`angleToLine`in t.markerPlacement.placement&&t.markerPlacement.placement.angleToLine:!1,sizeRatio:t.sizeRatio,patternHeight:null})]:[]}function S(e,t,n,r){return t.animationParams?[e.createMeshInfo({effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null,sprite:c(t),animations:t.animationParams,scaleInfo:r.scaleInfo,scaleSymbolsProportionally:!1,strokeWidth:1,isMapAligned:!0,colorLocked:t.colorLocked||!1,isStroke:!1,baseSize:`width`in t?t.width:-1,placement:null,referenceSize:2,angleToLine:!1,sizeRatio:1,patternHeight:t.type===`fill`&&t.spriteRasterizationParam?t.height:null,joinType:`join`in t?t.join:`round`,capType:`cap`in t?t.cap:`round`,miterLimit:`miterLimit`in t&&t.miterLimit||2,angle:`angle`in t?t.angle:0})]:[]}function C(e,t,n,{scaleInfo:i,scaleExpression:a}){let s=l(n);return[e.createMeshInfo({size:t.size,scaleX:t.scaleX,anchorX:t.anchorPoint.x,anchorY:t.anchorPoint.y,angle:t.rotation,color:m(t.color)??[0,0,0,0],colorLocked:t.colorLocked,frameHeight:t.frameHeight,widthRatio:t.widthRatio,scaleInfo:i,offsetX:t.offsetX,offsetY:t.offsetY,outlineColor:m(t.outlineColor)??[0,0,0,0],outlineSize:t.outlineWidth,referenceSize:t.referenceSize||r.CIMVectorMarker.size,rotateClockwise:t.rotateClockwise,scaleFactor:a??1,sizeRatio:t.sizeRatio,alignment:t.alignment,isAbsoluteAnchorPoint:t.isAbsoluteAnchorPoint,scaleSymbolsProportionally:t.scaleSymbolsProportionally,sprite:t.spriteRasterizationParam,hasSizeVV:s,placement:t.markerPlacement,effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null,transforms:t.transform,minPixelBuffer:o(n)})]}function w(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:c}=n,l={visualVariableColor:e.colorLocked?null:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity};if(e.animationParams){let t=i.animatedFill;return S(o.ensureInstance(t,{uniforms:{...l,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null,visualVariableSizeScaleStops:null,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,lineLength:!1}},u(e.name,c)),e,s,n)}return D(o.ensureInstance(i.fill,{uniforms:l,optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,c)),e,n)}function T(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:s}=n;return E(o.ensureInstance(i.outlineFill,{uniforms:{visualVariableColor:e.colorLocked?null:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeMinMaxValue:null,visualVariableSizeScaleStops:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null},optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,s)),e,n)}function E(e,n,r){let i=m(n.color)??[0,0,0,0],a=m(n.outlineColor)??[0,0,0,0];return[e.createMeshInfo({color:i,outlineColor:a,width:n.outlineWidth,referenceWidth:n.referenceWidth,minPixelBuffer:n.pixelBufferSize==null?0:t(n.pixelBufferSize)+1,capType:n.cap,joinType:n.join,miterLimit:n.miterLimit,outlineUsesColorVV:!n.outlineColorLocked,hasSizeVV:!1,scaleInfo:r.scaleInfo,...P(n,r),effects:n.effects?{type:`cim-effect-infos`,effectInfos:n.effects}:null,outlineEffects:n.outlineEffects?{type:`cim-effect-infos`,effectInfos:n.outlineEffects}:null})]}function D(e,t,n){let{scaleInfo:r}=n;return[e.createMeshInfo({color:m(t.color)??[0,0,0,0],scaleInfo:r,...P(t,n),effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null})]}function O(e,t,n){let{layerOrderMap:r}=n;if(!e.spriteRasterizationParam)return w(e,t,n);let{uniforms:a,schemaOptions:o}=t,{store:c}=o,l={visualVariableColor:e.colorLocked?null:a.visualVariableColor,visualVariableOpacity:a.visualVariableOpacity};if(e.animationParams){let t=i.animatedFill;return S(c.ensureInstance(t,{uniforms:{...l,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null,visualVariableSizeScaleStops:null,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,lineLength:!1,angle:!!e.angle}},u(e.name,r)),e,s,n)}return k(c.ensureInstance(i.complexFill,{uniforms:l,optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,r)),e,a.visualVariableColor!=null,n)}function k(e,t,n,r){let{scaleInfo:i}=r;if(!t.spriteRasterizationParam)throw Error(`InternalError: Sprite should always be defined`);let a=!!t.hasUnresolvedReplacementColor&&(!n||t.colorLocked),o=t.sampleAlphaOnly&&!a,s=t.spriteRasterizationParam;return[e.createMeshInfo({color:m(t.color)??[0,0,0,0],height:t.height,aspectRatio:t.scaleX,offsetX:t.offsetX,offsetY:t.offsetY,scaleX:1,scaleY:1,angle:t.angle,applyRandomOffset:t.applyRandomOffset,sampleAlphaOnly:o,scaleProportionally:s.resource.type===`CIMHatchFill`,sprite:s,scaleInfo:i,...P(t,r),effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null})]}function A(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:s}=n;return j(o.ensureInstance(i.gradientFill,{uniforms:{visualVariableColor:null,visualVariableOpacity:r.visualVariableOpacity},optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,s)),e,n)}function j(e,t,n){let{scaleInfo:r}=n;if(!t.spriteRasterizationParam)throw Error(`InternalError: Sprite should always be defined`);let i=t.spriteRasterizationParam;return[e.createMeshInfo({color:m(t.color)??[0,0,0,0],angle:t.angle,gradientMethod:t.gradientMethod,gradientSize:t.gradientSize,gradientSizeUnits:t.gradientSizeUnits,gradientType:t.gradientType,sprite:i,scaleInfo:r,...P(t,n),effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null})]}function M(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:c}=n,l=e.isOutline?{...s,visualVariableSizeScaleStops:r.visualVariableSizeOutlineScaleStops}:{visualVariableColor:e.colorLocked?null:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue};if(e.animationParams){let{hasShiftAnimation:t}=e.animationParams.params,r=i.animatedLine;return S(o.ensureInstance(r,{uniforms:{...l,visualVariableRotation:null},optionalAttributes:{zoomRange:!0,value1Position2Value2:!1,accumulatedDistance:!0,segmentDirection:!0,normal:!0,lineLength:t,angle:!1}},u(e.name,c)),e,s,n)}let d={uniforms:l,optionalAttributes:{zoomRange:!!n.scaleInfo}},f=!!(l.visualVariableSizeMinMaxValue||l.visualVariableSizeScaleStops||l.visualVariableSizeStops||l.visualVariableSizeUnitValue);return e.spriteRasterizationParam?I(o.ensureInstance(i.texturedLine,d,u(e.name,c)),e,f,n):F(o.ensureInstance(i.line,d,u(e.name,c)),e,f,n)}function N(e,t,n){let{scaleInfo:r}=n;return{color:m(e.color)??[0,0,0,0],width:e.width,referenceWidth:e.referenceWidth,capType:e.cap,joinType:e.join,miterLimit:e.miterLimit,scaleInfo:r,hasSizeVV:t,...P(e,n),effects:e.effects?{type:`cim-effect-infos`,effectInfos:e.effects}:null}}function P(e,{rotationVariable:t,viewRotation:n,viewRotationForCalloutsOnly:r}){if(!e.effects?.length&&!e.outlineEffects?.length)return{};let i={};if(e.effectsChangeGeometryType&&(i.useEffectOrigin=!0),n!=null&&(!r||e.type!==`text`&&y(e))&&(i.viewRotation=n),!t)return i;let a=t.valueExpression??(t.field?`$feature[${JSON.stringify(t.field)}]`:null);return a&&(i.effectRotation={valueExpressionInfo:{type:`CIMExpressionInfo`,expression:a},defaultValue:0},i.effectRotationType=t.rotationType),i}function F(e,t,n,r){if(t.spriteRasterizationParam)throw Error(`InternalError: Sprite should not be defined`);let i=N(t,n,r);return[e.createMeshInfo(i)]}function I(e,t,n,r){let{spriteRasterizationParam:i,scaleDash:a,sampleAlphaOnly:o}=t;if(!i)throw Error(`InternalError: Sprite should be defined`);return[e.createMeshInfo({...N(t,n,r),offsetAlongLine:t.offsetAlongLine??0,shouldScaleDash:a??!1,shouldSampleAlphaOnly:o,isSDF:i.resource.type!==`CIMPictureStroke`&&i.resource.type!==`CIMGradientStroke`,sprite:i})]}function L(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:c}=n;return R(o.ensureInstance(i.gradientStroke,{uniforms:e.isOutline?{...s,visualVariableSizeScaleStops:r.visualVariableSizeOutlineScaleStops}:{visualVariableColor:null,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!!n.scaleInfo}},u(e.name,c)),e,n)}function R(e,t,n){if(!t.spriteRasterizationParam)throw Error(`InternalError: Sprite should always be defined`);let r=t.spriteRasterizationParam;return[e.createMeshInfo({...N(t,!1,n),gradientMethod:t.gradientMethod,gradientSize:t.gradientSize,gradientSizeUnits:t.gradientSizeUnits,gradientType:t.gradientType,sprite:r,effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null})]}function z(e,t,n){let{uniforms:r,schemaOptions:a}=t,{store:o}=a,{layerOrderMap:s}=n;return B(o.ensureInstance(i.text,{uniforms:{visualVariableColor:e.colorLocked?null:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableRotation:r.visualVariableRotation,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue},optionalAttributes:{zoomRange:!!n.scaleInfo,referenceSymbol:!1,clipAngle:!1}},u(e.name,s)),e,r,n)}function B(e,t,n,{scaleInfo:r,scaleExpression:i}){return[e.createMeshInfo({alignment:t.alignment,boxBackgroundColor:null,boxBorderLineColor:null,boxBorderLineSize:0,backgroundColor:m(t.backgroundColor),borderLineColor:m(t.borderLineColor),borderLineWidth:t.borderLineWidth??0,useBackgroundCallout:t.useBackgroundCallout,color:m(t.color)??[0,0,0,0],offsetX:t.offsetX,offsetY:t.offsetY,postAngle:t.angle,fontSize:t.size,referenceSize:t.referenceSize,decoration:t.decoration,haloColor:m(t.haloColor)??[0,0,0,0],haloSize:t.haloSize??0,outlineColor:m(t.outlineColor)??[0,0,0,0],outlineSize:t.outlineSize,lineWidth:t.lineWidth||512,lineHeightRatio:1,horizontalAlignment:t.horizontalAlignment??`center`,verticalAlignment:t.verticalAlignment??`baseline`,useCIMAngleBehavior:!1,glyphs:t.textRasterizationParam,scaleInfo:r,effects:t.effects?{type:`cim-effect-infos`,effectInfos:t.effects}:null,placement:t.markerPlacement,transforms:t.transform,scaleFactor:i??1,minPixelBuffer:o(n),repeatLabel:null,repeatLabelDistance:null,allowOverrun:null,labelPosition:null,layerId:null,labelClassId:null})]}export{x as createAnimatedMarkerMeshInfos,S as createAnimatedPolyMeshInfos,k as createComplexFillMeshInfos,C as createComplexMarkerMeshInfos,D as createComplexSimpleFillMeshInfos,F as createComplexSimpleLineMeshInfos,E as createComplexSimpleOutlineFillMeshInfos,h as createComplexSymbolInstances,g as createComplexSymbolPartSchemas,B as createComplexTextMeshInfos,I as createComplexTexturedLineMeshInfos,j as createGradientFillMeshInfos,R as createGradientStrokeMeshInfos,p as getScaleInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import{abortMaybe as t,destroyMaybe as n}from"../../../core/maybe.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as a}from"../../../support/getDefaultUnitForView.js";import o from"./AnalysisView3D.js";import{DirectLineMeasurementController as s}from"./DirectLineMeasurement/DirectLineMeasurementController.js";import{DirectLineMeasurementVisualization as c}from"./DirectLineMeasurement/DirectLineMeasurementVisualization.js";import l from"../interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js";import{connectAnalysisViewToTool as u,removeAnalysisViewTool as d,startPlaceOperation as f}from"../../analysis/analysisViewUtils.js";let p=class extends o{constructor(e){super(e),this.type=`direct-line-measurement-view-3d`,this.analysis=null,this.tool=null,this.result=null,this.measurementMode=0,this.elevationAlignedStartPoint=null,this.elevationAlignedEndPoint=null,this.userOperation=null}initialize(){let{analysis:e,view:t}=this;this._analysisVisualization=new c({view:t,analysis:e,analysisView:this}),this._analysisController=new s({view:t,analysis:e,viewData:this}),this.addHandles(u(this,l))}destroy(){d(this),this.userOperation=t(this.userOperation),this._analysisController=n(this._analysisController),this._analysisVisualization=n(this._analysisVisualization)}get updating(){return!!this._analysisVisualization?.loadingMessages||!!this._analysisController?.updating}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get viewMode(){return this._analysisVisualization.viewMode}get actualVisualizedMeasurement(){return this._analysisVisualization.actualVisualizedMeasurement}get visualElementOrientation(){return this._analysisVisualization.visualElementOrientation}set visualElementOrientation(e){this._analysisVisualization.visualElementOrientation=e}get allowVisualElementsOrientationChange(){return this._analysisVisualization.allowVisualElementsOrientationChange}set allowVisualElementsOrientationChange(e){this._analysisVisualization.allowVisualElementsOrientationChange=e}get triangleCollapseRatioThreshold(){return this._analysisVisualization.triangleCollapseRatioThreshold}set triangleCollapseRatioThreshold(e){this._analysisVisualization.triangleCollapseRatioThreshold=e}get directLabelText(){return this._analysisVisualization.labels.direct?.text??``}get horizontalLabelText(){return this._analysisVisualization.labels.horizontal?.text??``}get verticalLabelText(){return this._analysisVisualization.labels.vertical?.text??``}get unit(){return this.analysis.unit??this.view.options.displayUnits.length??a(this.view)}get testData(){}place(e){return f(this,{placementOptions:e})}};e([r()],p.prototype,`_analysisVisualization`,void 0),e([r()],p.prototype,`_analysisController`,void 0),e([r()],p.prototype,`updating`,null),e([r({readOnly:!0})],p.prototype,`type`,void 0),e([r({constructOnly:!0,nonNullable:!0})],p.prototype,`analysis`,void 0),e([r()],p.prototype,`tool`,void 0),e([r()],p.prototype,`result`,void 0),e([r()],p.prototype,`measurementMode`,void 0),e([r()],p.prototype,`elevationAlignedStartPoint`,void 0),e([r()],p.prototype,`elevationAlignedEndPoint`,void 0),e([r({readOnly:!0})],p.prototype,`viewMode`,null),e([r({readOnly:!0})],p.prototype,`actualVisualizedMeasurement`,null),e([r()],p.prototype,`visualElementOrientation`,null),e([r()],p.prototype,`allowVisualElementsOrientationChange`,null),e([r()],p.prototype,`triangleCollapseRatioThreshold`,null),e([r({readOnly:!0})],p.prototype,`directLabelText`,null),e([r({readOnly:!0})],p.prototype,`horizontalLabelText`,null),e([r({readOnly:!0})],p.prototype,`verticalLabelText`,null),e([r()],p.prototype,`unit`,null),e([r()],p.prototype,`userOperation`,void 0),p=e([i(`esri.views.3d.analysis.DirectLineMeasurementAnalysisView3D`)],p);const m=p;export{m as default};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import{abortMaybe as t,destroyMaybe as n}from"../../../core/maybe.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as a}from"../../../support/getDefaultUnitForView.js";import o from"./AnalysisView3D.js";import{DirectLineMeasurementController as s}from"./DirectLineMeasurement/DirectLineMeasurementController.js";import{DirectLineMeasurementVisualization as c}from"./DirectLineMeasurement/DirectLineMeasurementVisualization.js";import l from"../interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js";import{connectAnalysisViewToTool as u,removeAnalysisViewTool as d,startPlaceOperation as f}from"../../analysis/analysisViewUtils.js";let p=class extends o{constructor(e){super(e),this.type=`direct-line-measurement-view-3d`,this.analysis=null,this.tool=null,this.result=null,this.measurementMode=0,this.elevationAlignedStartPoint=null,this.elevationAlignedEndPoint=null,this.userOperation=null}initialize(){let{analysis:e,view:t}=this;this._analysisVisualization=new c({view:t,analysis:e,analysisView:this}),this._analysisController=new s({view:t,analysis:e,viewData:this}),this.addHandles(u(this,l))}destroy(){d(this),this.userOperation=t(this.userOperation),this._analysisController=n(this._analysisController),this._analysisVisualization=n(this._analysisVisualization)}get updating(){return!!this._analysisVisualization?.loadingMessages||!!this._analysisController?.updating||!!this.tool?.updating}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get viewMode(){return this._analysisVisualization.viewMode}get actualVisualizedMeasurement(){return this._analysisVisualization.actualVisualizedMeasurement}get visualElementOrientation(){return this._analysisVisualization.visualElementOrientation}set visualElementOrientation(e){this._analysisVisualization.visualElementOrientation=e}get allowVisualElementsOrientationChange(){return this._analysisVisualization.allowVisualElementsOrientationChange}set allowVisualElementsOrientationChange(e){this._analysisVisualization.allowVisualElementsOrientationChange=e}get triangleCollapseRatioThreshold(){return this._analysisVisualization.triangleCollapseRatioThreshold}set triangleCollapseRatioThreshold(e){this._analysisVisualization.triangleCollapseRatioThreshold=e}get directLabelText(){return this._analysisVisualization.labels.direct?.text??``}get horizontalLabelText(){return this._analysisVisualization.labels.horizontal?.text??``}get verticalLabelText(){return this._analysisVisualization.labels.vertical?.text??``}get unit(){return this.analysis.unit??this.view.options.displayUnits.length??a(this.view)}get testData(){}place(e){return f(this,{placementOptions:e})}};e([r()],p.prototype,`_analysisVisualization`,void 0),e([r()],p.prototype,`_analysisController`,void 0),e([r()],p.prototype,`updating`,null),e([r({readOnly:!0})],p.prototype,`type`,void 0),e([r({constructOnly:!0,nonNullable:!0})],p.prototype,`analysis`,void 0),e([r()],p.prototype,`tool`,void 0),e([r()],p.prototype,`result`,void 0),e([r()],p.prototype,`measurementMode`,void 0),e([r()],p.prototype,`elevationAlignedStartPoint`,void 0),e([r()],p.prototype,`elevationAlignedEndPoint`,void 0),e([r({readOnly:!0})],p.prototype,`viewMode`,null),e([r({readOnly:!0})],p.prototype,`actualVisualizedMeasurement`,null),e([r()],p.prototype,`visualElementOrientation`,null),e([r()],p.prototype,`allowVisualElementsOrientationChange`,null),e([r()],p.prototype,`triangleCollapseRatioThreshold`,null),e([r({readOnly:!0})],p.prototype,`directLabelText`,null),e([r({readOnly:!0})],p.prototype,`horizontalLabelText`,null),e([r({readOnly:!0})],p.prototype,`verticalLabelText`,null),e([r()],p.prototype,`unit`,null),e([r()],p.prototype,`userOperation`,void 0),p=e([i(`esri.views.3d.analysis.DirectLineMeasurementAnalysisView3D`)],p);const m=p;export{m as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../core/Evented.js";import{handlesGroup as n}from"../../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import i from"../../../../core/ReactiveMap.js";import{initial as a,watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{create as d,fromPoints as f}from"../../../../geometry/support/lineSegment.js";import{LineOfSightInteractionVisuals as p}from"./LineOfSightInteractionVisuals.js";import{LineOfSightObserverManipulator as m,LineOfSightTargetManipulator as h,LineOfSightTargetManipulatorState as g,getInteractiveLineOfSightTargetManipulatorState as _}from"./LineOfSightManipulators.js";import{SnappingVisualizer3D as v}from"../../interactive/SnappingVisualizer3D.js";import{screenToMapAtSceneSurface as y}from"../../interactive/editingTools/dragEventPipeline3D.js";import{mouseButtons as b}from"../../../input/mouseButtons.js";import{createManipulatorDragEventPipeline as x,dragAtLocation as S,sceneSnappingAtLocation as C,dragManipulatedObject as w}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as T}from"../../../interactive/InteractiveToolBase.js";import{SnappingContext as E}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{enterInputModeIfAvailable as O}from"../../../interactive/tooltip/tooltipCommonUtils.js";const k=d(),A=Symbol(`inactiveManipulatorDisplay`);let j=class extends T{get _manipulatorsToHide(){let e=this._manipulatorByObject.values();return this.view.tools.some(e=>e.hasGrabbedManipulators)||e.some(e=>e.grabbing)?e.filter(e=>!e.grabbing).toArray():[]}constructor(e){super(e),this.events=new t,this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this.interacting=!1,this.manipulatorsInteractive=!0,this._objectByItem=new Map,this._manipulatorByObject=new i,this._updatingHandles=new u,this._interactionVisuals=null,this._grabbedManipulator=null,this._visualsManipulator=null}initialize(){let{view:e}=this;this._interactionVisuals=new p({view:e}),this.addHandles([this._updatingHandles.add(()=>({analysisVisible:this.analysisViewData.visible,computations:this.analysisViewData.computations.toArray().map(e=>({isTargetVisible:e.computationResult.isTargetVisible,isValid:e.computationResult.isValid,target:e.target})),grabbedManipulator:this._grabbedManipulator,interacting:this.interacting,manipulatorsInteractive:this.manipulatorsInteractive,visible:this.visible}),()=>this._syncManipulators(),a),o(()=>this._manipulatorsToHide,e=>{let t=e.map(e=>e.disableDisplay());this.removeHandles(A),this.addHandles(t,A)},s)]),this.finishToolCreation()}destroy(){this.removeHandles(A),this._interactionVisuals=r(this._interactionVisuals),this._updatingHandles.destroy(),this._objectByItem.clear(),this._manipulatorByObject.clear(),super.destroy()}get updating(){return this._updatingHandles.updating||this.snappingManager.updating}get laserLineVisualElement(){return this._interactionVisuals?.laserLineVisualElement??null}get verticalLineVisualElement(){return this._interactionVisuals?.verticalLineVisualElement??null}showInteractionVisuals(e){this._visualsManipulator=this._manipulatorByObject.get(e),this._syncInteractionVisuals()}hideInteractionVisuals(){this._visualsManipulator=null,this._syncInteractionVisuals()}addObject(e){if(this._manipulatorByObject.has(e))return;let t=e.item.type===`observer`?new m(this.view,{deleting:!1,intersection:null,type:`observer`}):new h(this.view,{deleting:!1,target:e.item,type:`target`});t.cursor=`move`,this._objectByItem.set(e.item,e),this._manipulatorByObject.set(e,t),this.manipulators.add(t),this.addHandles(this._connectManipulator(e,t),e),this._syncManipulator(e,t)}removeObject(e){let t=this._manipulatorByObject.get(e);t!=null&&(this._grabbedManipulator===t&&(this._grabbedManipulator=null),this._visualsManipulator===t&&this.hideInteractionVisuals(),this.removeHandles(e),this.removeHandles(e),this._objectByItem.delete(e.item),this._manipulatorByObject.delete(e),this.manipulators.remove(t),t.destroy())}getManipulator(e){let t=this._objectByItem.get(e);return t==null?null:this._manipulatorByObject.get(t)}hasManipulatorAt(e,t){for(let n of this._manipulatorByObject.values())if(n.consumesClicks&&n.intersectionDistance(e,t)!=null)return!0;return!1}selectObject(e){let t=!1;for(let[n,r]of this._manipulatorByObject){let i=n===e;r.selected=i,t||=i}return this._syncManipulators(),t}onInputEvent(e){e.type===`hold`&&this._grabbedManipulator!=null&&(this._visualsManipulator=this._grabbedManipulator,this._syncInteractionVisuals()),O(e,this.tooltip)}onManipulatorSelectionChanged(){[...this._manipulatorByObject.values()].some(e=>e.selected)||this.events.emit(`selection-cleared`)}_connectManipulator(e,t){let r=()=>this._syncManipulator(e,t);return n([e.on(`committed`,r),e.on(`modified-externally`,r),t.events.on(`immediate-click`,n=>{this.events.emit(`select-item`,{item:e.item}),n.button===b.Right&&t.metadata.type===`target`&&this.events.emit(`delete-item`,{target:t.metadata.target}),n.stopPropagation()}),t.events.on(`grab-changed`,({action:n})=>{n===`start`?(this.events.emit(`select-item`,{item:e.item}),this._grabbedManipulator=t):this._grabbedManipulator===t&&(this._grabbedManipulator=null,this.hideInteractionVisuals()),this._manipulatorByObject.set(e,t)}),t.events.on(`drag`,t=>{e.updateDragIntersection(t),t.action===`start`&&this.showInteractionVisuals(e)}),t.events.on(`location-update`,()=>this._syncInteractionVisuals()),this._createDragHandle(e,t)])}_createDragHandle(e,t){return x(t,(n,r,i,a)=>{let o=e.operations;if(o==null)return;let s=null,{cancelSnapping:c,snappingStep:l}=D({snappingContext:new E({editGeometryOperations:o,elevationInfo:e.elevationInfo,pointer:a,visualizer:new v}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!0});i.next(e=>(s?.undo(null),s=null,e)).next(c);let u=o.data.allVerticesUnordered.at(0);r.next(t=>(t.action===`start`&&(s=e.createUndoRecord()),{...t,snapOrigin:u?.pos})).next(S(this.view,t.elevationAlignedLocation)).next(y(this.view,o.data.geometry,e.elevationInfo,o.data.spatialReference)).next(C(this.view,e.elevationInfo)).next(...l).next(w(e)).next(e=>(e.action===`end`&&s!=null&&(this.events.emit(`record-undo`,{record:s}),s=null),e))})}_syncManipulators(){for(let[e,t]of this._manipulatorByObject)this._syncManipulator(e,t);this._syncInteractionVisuals()}_syncManipulator(e,t){let n=e.origin;if(t.available=this.visible&&e.visible&&n!=null,t.interactive=this.manipulatorsInteractive&&(this._grabbedManipulator==null||this._grabbedManipulator===t),n!=null&&(t.elevationAlignedLocation=n),e.item.type!==`target`)return;let r=this.analysisViewData.computations.find(t=>t.target===e.item),i=r==null||!r.computationResult.isValid?g.undefined:r.computationResult.isTargetVisible?g.visible:g.occluded;t.state=this.interacting&&t.selected?_(i):i}_syncInteractionVisuals(){let e=this._interactionVisuals,t=this._visualsManipulator,n=this.visible&&this.analysisViewData.visible;if(e==null||t==null||!n){e?.hide();return}let r=[...this._manipulatorByObject.entries()].find(([e])=>e.item.type===`observer`)?.[1];if(r==null){e.hide();return}let i=t===r?null:f(r.renderLocation,t.renderLocation,k);e.update({target:t.renderLocation,lineVerticalPlaneSegment:i,visible:!0})}};e([c({constructOnly:!0})],j.prototype,`analysisViewData`,void 0),e([c({constructOnly:!0})],j.prototype,`snappingManager`,void 0),e([c({constructOnly:!0})],j.prototype,`view`,void 0),e([c({constructOnly:!0})],j.prototype,`tooltip`,void 0),e([c()],j.prototype,`automaticManipulatorSelection`,void 0),e([c()],j.prototype,`removeIncompleteOnCancel`,void 0),e([c()],j.prototype,`interacting`,void 0),e([c()],j.prototype,`manipulatorsInteractive`,void 0),e([c()],j.prototype,`_grabbedManipulator`,void 0),e([c()],j.prototype,`_manipulatorsToHide`,null),e([c()],j.prototype,`updating`,null),j=e([l(`esri.views.3d.analysis.LineOfSight.LineOfSightItemTool`)],j);export{j as LineOfSightItemTool};
2
+ import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../core/Evented.js";import{handlesGroup as n}from"../../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import i from"../../../../core/ReactiveMap.js";import{initial as a,watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{create as d,fromPoints as f}from"../../../../geometry/support/lineSegment.js";import{LineOfSightInteractionVisuals as p}from"./LineOfSightInteractionVisuals.js";import{LineOfSightObserverManipulator as m,LineOfSightTargetManipulator as h,LineOfSightTargetManipulatorState as g,getInteractiveLineOfSightTargetManipulatorState as _}from"./LineOfSightManipulators.js";import{SnappingVisualizer3D as v}from"../../interactive/SnappingVisualizer3D.js";import{screenToMapAtSceneSurface as y}from"../../interactive/editingTools/dragEventPipeline3D.js";import{mouseButtons as b}from"../../../input/mouseButtons.js";import{createManipulatorDragEventPipeline as x,dragAtLocation as S,sceneSnappingAtLocation as C,dragManipulatedObject as w}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as T}from"../../../interactive/InteractiveToolBase.js";import{SnappingContext as E}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{enterInputModeIfAvailable as O}from"../../../interactive/tooltip/tooltipCommonUtils.js";const k=d(),A=Symbol(`inactiveManipulatorDisplay`);let j=class extends T{get _manipulatorsToHide(){let e=this._manipulatorByObject.values();return this.view.tools.some(e=>e.hasGrabbedManipulators)||e.some(e=>e.grabbing)?e.filter(e=>!e.grabbing).toArray():[]}constructor(e){super(e),this.events=new t,this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this.interacting=!1,this.manipulatorsInteractive=!0,this._objectByItem=new Map,this._manipulatorByObject=new i,this._updatingHandles=new u,this._interactionVisuals=null,this._grabbedManipulator=null,this._visualsManipulator=null}initialize(){let{view:e}=this;this._interactionVisuals=new p({view:e}),this.addHandles([this._updatingHandles.add(()=>({analysisVisible:this.analysisViewData.visible,computations:this.analysisViewData.computations.toArray().map(e=>({isTargetVisible:e.computationResult.isTargetVisible,isValid:e.computationResult.isValid,target:e.target})),grabbedManipulator:this._grabbedManipulator,interacting:this.interacting,manipulatorsInteractive:this.manipulatorsInteractive,visible:this.visible}),()=>this._syncManipulators(),a),o(()=>this._manipulatorsToHide,e=>{let t=e.map(e=>e.disableDisplay());this.removeHandles(A),this.addHandles(t,A)},s)]),this.finishToolCreation()}destroy(){this.removeHandles(A),this._interactionVisuals=r(this._interactionVisuals),this._updatingHandles.destroy(),this._objectByItem.clear(),this._manipulatorByObject.clear(),super.destroy()}get updating(){return this._updatingHandles.updating||this.snappingManager.updating}get laserLineVisualElement(){return this._interactionVisuals?.laserLineVisualElement??null}get verticalLineVisualElement(){return this._interactionVisuals?.verticalLineVisualElement??null}showInteractionVisuals(e){this._visualsManipulator=this._manipulatorByObject.get(e),this._syncInteractionVisuals()}hideInteractionVisuals(){this._visualsManipulator=null,this._syncInteractionVisuals()}addObject(e){if(this._manipulatorByObject.has(e))return;let t=e.item.type===`observer`?new m(this.view,{deleting:!1,intersection:null,type:`observer`}):new h(this.view,{deleting:!1,target:e.item,type:`target`});t.cursor=`move`,this._objectByItem.set(e.item,e),this._manipulatorByObject.set(e,t),this.manipulators.add(t),this.addHandles(this._connectManipulator(e,t),e),this._syncManipulator(e,t)}removeObject(e){let t=this._manipulatorByObject.get(e);t!=null&&(this._grabbedManipulator===t&&(this._grabbedManipulator=null),this._visualsManipulator===t&&this.hideInteractionVisuals(),this.removeHandles(e),this._objectByItem.delete(e.item),this._manipulatorByObject.delete(e),this.manipulators.remove(t),t.destroy())}getManipulator(e){let t=this._objectByItem.get(e);return t==null?null:this._manipulatorByObject.get(t)}hasManipulatorAt(e,t){for(let n of this._manipulatorByObject.values())if(n.consumesClicks&&n.intersectionDistance(e,t)!=null)return!0;return!1}selectObject(e){let t=!1;for(let[n,r]of this._manipulatorByObject){let i=n===e;r.selected=i,t||=i}return this._syncManipulators(),t}onInputEvent(e){e.type===`hold`&&this._grabbedManipulator!=null&&(this._visualsManipulator=this._grabbedManipulator,this._syncInteractionVisuals()),O(e,this.tooltip)}onManipulatorSelectionChanged(){[...this._manipulatorByObject.values()].some(e=>e.selected)||this.events.emit(`selection-cleared`)}_connectManipulator(e,t){let r=()=>this._syncManipulator(e,t);return n([e.on(`committed`,r),e.on(`modified-externally`,r),t.events.on(`immediate-click`,n=>{this.events.emit(`select-item`,{item:e.item}),n.button===b.Right&&t.metadata.type===`target`&&this.events.emit(`delete-item`,{target:t.metadata.target}),n.stopPropagation()}),t.events.on(`grab-changed`,({action:n})=>{n===`start`?(this.events.emit(`select-item`,{item:e.item}),this._grabbedManipulator=t):this._grabbedManipulator===t&&(this._grabbedManipulator=null,this.hideInteractionVisuals()),this._manipulatorByObject.set(e,t)}),t.events.on(`drag`,t=>{e.updateDragIntersection(t),t.action===`start`&&this.showInteractionVisuals(e)}),t.events.on(`location-update`,()=>this._syncInteractionVisuals()),this._createDragHandle(e,t)])}_createDragHandle(e,t){return x(t,(n,r,i,a)=>{let o=e.operations;if(o==null)return;let s=null,{cancelSnapping:c,snappingStep:l}=D({snappingContext:new E({editGeometryOperations:o,elevationInfo:e.elevationInfo,pointer:a,visualizer:new v}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!0});i.next(e=>(s?.undo(null),s=null,e)).next(c);let u=o.data.allVerticesUnordered.at(0);r.next(t=>(t.action===`start`&&(s=e.createUndoRecord()),{...t,snapOrigin:u?.pos})).next(S(this.view,t.elevationAlignedLocation)).next(y(this.view,o.data.geometry,e.elevationInfo,o.data.spatialReference)).next(C(this.view,e.elevationInfo)).next(...l).next(w(e)).next(e=>(e.action===`end`&&s!=null&&(this.events.emit(`record-undo`,{record:s}),s=null),e))})}_syncManipulators(){for(let[e,t]of this._manipulatorByObject)this._syncManipulator(e,t);this._syncInteractionVisuals()}_syncManipulator(e,t){let n=e.origin;if(t.available=this.visible&&e.visible&&n!=null,t.interactive=this.manipulatorsInteractive&&(this._grabbedManipulator==null||this._grabbedManipulator===t),n!=null&&(t.elevationAlignedLocation=n),e.item.type!==`target`)return;let r=this.analysisViewData.computations.find(t=>t.target===e.item),i=r==null||!r.computationResult.isValid?g.undefined:r.computationResult.isTargetVisible?g.visible:g.occluded;t.state=this.interacting&&t.selected?_(i):i}_syncInteractionVisuals(){let e=this._interactionVisuals,t=this._visualsManipulator,n=this.visible&&this.analysisViewData.visible;if(e==null||t==null||!n){e?.hide();return}let r=[...this._manipulatorByObject.entries()].find(([e])=>e.item.type===`observer`)?.[1];if(r==null){e.hide();return}let i=t===r?null:f(r.renderLocation,t.renderLocation,k);e.update({target:t.renderLocation,lineVerticalPlaneSegment:i,visible:!0})}};e([c({constructOnly:!0})],j.prototype,`analysisViewData`,void 0),e([c({constructOnly:!0})],j.prototype,`snappingManager`,void 0),e([c({constructOnly:!0})],j.prototype,`view`,void 0),e([c({constructOnly:!0})],j.prototype,`tooltip`,void 0),e([c()],j.prototype,`automaticManipulatorSelection`,void 0),e([c()],j.prototype,`removeIncompleteOnCancel`,void 0),e([c()],j.prototype,`interacting`,void 0),e([c()],j.prototype,`manipulatorsInteractive`,void 0),e([c()],j.prototype,`_grabbedManipulator`,void 0),e([c()],j.prototype,`_manipulatorsToHide`,null),e([c()],j.prototype,`updating`,null),j=e([l(`esri.views.3d.analysis.LineOfSight.LineOfSightItemTool`)],j);export{j as LineOfSightItemTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{lineOfSightPlacementLeafPluginMarker as a}from"./LineOfSightPlacementLeafPlugin.js";import{PluginBase as o}from"../../../draw/plugins/PluginBase.js";var s,c;const l=Symbol(`line-of-sight-observer-vertex`),u=Symbol(`line-of-sight-observer-plugin-marker`);let d=class extends o{constructor(){super(...arguments),this[s]=!0,this[c]=!0,this.observer=null,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.preservedIntersection=null,this._interactiveHandle=null}static{s=u,c=a}start(e){super.start(e),this.preservedIntersection=null;let{session:r,positionOfLastUserInput:i}=e,a=this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??i:this.inputMapPosition??i;a&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&r.appendOrReplacePoint(l,a),this._interactiveHandle||(this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:this.defaultCaptureMode===`grabbable-object`?a??void 0:void 0}),this.addHandles(t(()=>this._interactiveHandle?.outputMapPosition,e=>{e&&!this._isComplete&&this._session?.appendOrReplacePoint(l,e)},n),this._ownHandlesKey))}};e([r({constructOnly:!0})],d.prototype,`observer`,void 0),e([r()],d.prototype,`defaultCaptureMode`,void 0),e([r()],d.prototype,`inputMapPosition`,void 0),e([r()],d.prototype,`preservedIntersection`,void 0),e([r()],d.prototype,`_interactiveHandle`,void 0),d=e([i(`esri.views.3d.analysis.LineOfSight.LineOfSightObserverPlugin`)],d);function f(e){return!!e&&u in e}function p(e={}){return{uniqueId:Symbol(`line-of-sight-observer-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new d(e)}}export{d as LineOfSightObserverPlugin,p as createLineOfSightObserverPluginConfiguration,f as isLineOfSightObserverPlugin,u as lineOfSightObserverPluginMarker};
2
+ import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{lineOfSightPlacementLeafPluginMarker as a}from"./LineOfSightPlacementLeafPlugin.js";import{PluginBase as o}from"../../../draw/plugins/PluginBase.js";var s,c;const l=Symbol(`line-of-sight-observer-vertex`),u=Symbol(`line-of-sight-observer-plugin-marker`);let d=class extends o{constructor(){super(...arguments),this[s]=!0,this[c]=!0,this.observer=null,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.preservedIntersection=null,this._interactiveHandle=null}static{s=u,c=a}start(e){super.start(e),this.preservedIntersection=null;let{session:r,positionOfLastUserInput:i}=e,a=this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??i:this.inputMapPosition??i;a&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&r.appendOrReplacePoint(l,a),this._interactiveHandle||(this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:this.defaultCaptureMode===`grabbable-object`?a??void 0:void 0},{elevationFieldProperties:{unlockOnVertexPlacement:!0}}),this.addHandles(t(()=>this._interactiveHandle?.outputMapPosition,e=>{e&&!this._isComplete&&this._session?.appendOrReplacePoint(l,e)},n),this._ownHandlesKey))}};e([r({constructOnly:!0})],d.prototype,`observer`,void 0),e([r()],d.prototype,`defaultCaptureMode`,void 0),e([r()],d.prototype,`inputMapPosition`,void 0),e([r()],d.prototype,`preservedIntersection`,void 0),e([r()],d.prototype,`_interactiveHandle`,void 0),d=e([i(`esri.views.3d.analysis.LineOfSight.LineOfSightObserverPlugin`)],d);function f(e){return!!e&&u in e}function p(e={}){return{uniqueId:Symbol(`line-of-sight-observer-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new d(e)}}export{d as LineOfSightObserverPlugin,p as createLineOfSightObserverPluginConfiguration,f as isLineOfSightObserverPlugin,u as lineOfSightObserverPluginMarker};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{when as r,syncAndInitial as i,watch as a}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{absoluteHeightElevationInfo as c}from"../../../../support/elevationInfoUtils.js";import{convertLineOfSightElevationMode as l}from"./LineOfSightAuthoringUtils.js";import{createDrawTool as u}from"./lineOfSightPlacementUtils.js";import{createLineOfSightRootPluginConfiguration as d}from"./LineOfSightRootPlugin.js";import{isLineOfSightTargetPlugin as f}from"./LineOfSightTargetPlugin.js";import{Manipulator3D as p}from"../../interactive/Manipulator3D.js";const m=Symbol(`hiddenManipulatorHandle`);let h=class extends t{get active(){return!!this._drawTool?.active}get canRedo(){return this._drawTool?.canRedo??!1}get canUndo(){return this._drawTool?.canUndo??!1}get updating(){return this._drawTool?.updating??!1}get activeTooltipInfo(){return this._drawTool?.activeTooltipInfo??null}get tooltip(){return this._drawTool?.tooltip??null}constructor(e){super(e),this.visible=!0,this.observerPlacementElevationInfo=null,this.targetPlacementElevationInfo=null,this._drawTool=null,this._renderer=null,this._observerSessionElevationInfo=null,this._targetSessionElevationInfo=null,this._sessionStartedWithValidAnalysis=!1}initialize(){this.addHandles([r(()=>!this.active,()=>{this.analysisViewData.cursorTarget=null},i),a(()=>this.activeTooltipInfo,e=>{e&&(e.elevationModeContext=this._elevationModeContext)},i)])}destroy(){this._destroyDrawTool()}get _placementElevationInfo(){return this.analysis.observer==null?this._observerSessionElevationInfo:this._targetSessionElevationInfo}get _effectiveElevationInfo(){return this._placementElevationInfo??c}get _elevationModeContext(){let e=this;return{get mode(){return e._effectiveElevationInfo.mode},get disabled(){return!e._drawTool?.interactiveHandleManager?.focusedHandle?.outputMapPosition},onChange:e=>this.setElevationMode(e)}}setElevationMode(e){let t=this._drawTool,n=t?.interactiveHandleManager?.focusedHandle,r=n?.outputMapPosition;if(!t||!n||!r||e===this._effectiveElevationInfo.mode)return;let i=t.activeTooltipInfo?.getConstraintFieldByName(n,`elevation`)?.locked===!0,{position:a,elevationInfo:o}=l({view:this.view,point:r,sourceElevationInfo:this._placementElevationInfo,mode:e,preserveZ:i}),s=()=>{t.defaultZ=a.z,this.analysis.observer==null?this._observerSessionElevationInfo=o:this._targetSessionElevationInfo=o,n.inputMapPosition=a.clone(),n.selectedSnappingResult=null,n.outputMapPosition=a},c=t.mostDownstreamPlugin;f(c)?c.changeElevationMode(e,i,s):s(),this._renderer?.refresh()}continue(){if(this._drawTool?.active)return;this._sessionStartedWithValidAnalysis=this.analysis.valid,this._observerSessionElevationInfo=this.observerPlacementElevationInfo?.clone()??null,this._targetSessionElevationInfo=this.targetPlacementElevationInfo?.clone()??null;let{drawTool:e,renderer:t}=this._createDrawTool();this._drawTool=e,this._renderer=t,this.view.addAndActivateTool(e),e.begin([d({analysis:this.analysis,analysisViewData:this.analysisViewData,getObserverElevationInfo:()=>this._observerSessionElevationInfo,getTargetElevationInfo:()=>this._targetSessionElevationInfo,view:this.view})])}stop(){this._destroyDrawTool()}redo(){this._drawTool?.redo()}undo(){this._drawTool?.undo()}get testInfo(){}_createDrawTool(){return u({analysis:this.analysis,analysisViewData:this.analysisViewData,snappingManager:this.snappingManager,view:this.view,getSourceElevationInfo:()=>this._effectiveElevationInfo,getVisible:()=>this.visible,onCancel:e=>{e===this._drawTool&&!this._sessionStartedWithValidAnalysis&&this.analysis.observer==null&&(this.analysis.clear(),this.analysisViewData.cursorTarget=null),this._destroyDrawTool(e)},onComplete:e=>this._destroyDrawTool(e),onManipulatorCountChange:e=>this._hideManipulatorOnAppearance(e),shouldPreventVertexAdd:this.shouldPreventVertexAdd})}_destroyDrawTool(e=this._drawTool){if(e==null)return;let t=e===this._drawTool;this.view.activeTool===e&&(this.view.activeTool=null),this.view.tools.includes(e)&&this.view.tools.remove(e),e.destroy(),t&&(this._drawTool=null,this._renderer=null,this._sessionStartedWithValidAnalysis=!1)}_hideManipulatorOnAppearance(e){e.removeHandles(m),e.addHandles(e.manipulators.toArray().map(e=>e instanceof p?e.disableDisplay():null).filter(n),m)}};e([o({constructOnly:!0})],h.prototype,`view`,void 0),e([o({constructOnly:!0})],h.prototype,`analysis`,void 0),e([o({constructOnly:!0})],h.prototype,`analysisViewData`,void 0),e([o({constructOnly:!0})],h.prototype,`parent`,void 0),e([o({constructOnly:!0})],h.prototype,`shouldPreventVertexAdd`,void 0),e([o({constructOnly:!0})],h.prototype,`snappingManager`,void 0),e([o()],h.prototype,`visible`,void 0),e([o()],h.prototype,`observerPlacementElevationInfo`,void 0),e([o()],h.prototype,`targetPlacementElevationInfo`,void 0),e([o()],h.prototype,`active`,null),e([o()],h.prototype,`canRedo`,null),e([o()],h.prototype,`canUndo`,null),e([o()],h.prototype,`updating`,null),e([o()],h.prototype,`activeTooltipInfo`,null),e([o()],h.prototype,`tooltip`,null),e([o()],h.prototype,`_drawTool`,void 0),e([o()],h.prototype,`_renderer`,void 0),e([o()],h.prototype,`_observerSessionElevationInfo`,void 0),e([o()],h.prototype,`_targetSessionElevationInfo`,void 0),e([o()],h.prototype,`_elevationModeContext`,null),h=e([s(`esri.views.3d.analysis.LineOfSight.LineOfSightPlacementController`)],h);export{h as LineOfSightPlacementController};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{when as r,syncAndInitial as i,watch as a}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{absoluteHeightElevationInfo as c}from"../../../../support/elevationInfoUtils.js";import{convertLineOfSightElevationMode as l}from"./LineOfSightAuthoringUtils.js";import{createLineOfSightPlacementRootPluginConfiguration as u}from"./LineOfSightPlacementRootPlugin.js";import{isLineOfSightTargetPlugin as d}from"./LineOfSightTargetPlugin.js";import{createDrawTool as f}from"./placementUtils.js";import{Manipulator3D as p}from"../../interactive/Manipulator3D.js";const m=Symbol(`hiddenManipulatorHandle`);let h=class extends t{get active(){return!!this._drawTool?.active}get canRedo(){return this._drawTool?.canRedo??!1}get canUndo(){return this._drawTool?.canUndo??!1}get updating(){return this._drawTool?.updating??!1}get activeTooltipInfo(){return this._drawTool?.activeTooltipInfo??null}get tooltip(){return this._drawTool?.tooltip??null}constructor(e){super(e),this.visible=!0,this.observerPlacementElevationInfo=null,this.targetPlacementElevationInfo=null,this._drawTool=null,this._renderer=null,this._observerSessionElevationInfo=null,this._targetSessionElevationInfo=null,this._sessionStartedWithValidAnalysis=!1}initialize(){this.addHandles([r(()=>!this.active,()=>{this.analysisViewData.cursorTarget=null},i),a(()=>this.activeTooltipInfo,e=>{e&&(e.elevationModeContext=this._elevationModeContext)},i)])}destroy(){this._destroyDrawTool()}get _placementElevationInfo(){return this.analysis.observer==null?this._observerSessionElevationInfo:this._targetSessionElevationInfo}get _effectiveElevationInfo(){return this._placementElevationInfo??c}get _elevationModeContext(){let e=this;return{get mode(){return e._effectiveElevationInfo.mode},get disabled(){return!e._drawTool?.interactiveHandleManager?.focusedHandle?.outputMapPosition},onChange:e=>this.setElevationMode(e)}}setElevationMode(e){let t=this._drawTool,n=t?.interactiveHandleManager?.focusedHandle,r=n?.outputMapPosition;if(!t||!n||!r||e===this._effectiveElevationInfo.mode)return;let i=t.activeTooltipInfo?.getConstraintFieldByName(n,`elevation`)?.locked===!0,{position:a,elevationInfo:o}=l({view:this.view,point:r,sourceElevationInfo:this._placementElevationInfo,mode:e,preserveZ:i}),s=()=>{t.defaultZ=a.z,this.analysis.observer==null?this._observerSessionElevationInfo=o:this._targetSessionElevationInfo=o,n.inputMapPosition=a.clone(),n.selectedSnappingResult=null,n.outputMapPosition=a},c=t.mostDownstreamPlugin;d(c)?c.changeElevationMode(e,i,s):s(),this._renderer?.refresh()}continue(){if(this._drawTool?.active)return;this._sessionStartedWithValidAnalysis=this.analysis.valid,this._observerSessionElevationInfo=this.observerPlacementElevationInfo?.clone()??null,this._targetSessionElevationInfo=this.targetPlacementElevationInfo?.clone()??null;let{drawTool:e,renderer:t}=this._createDrawTool();this._drawTool=e,this._renderer=t,this.view.addAndActivateTool(e),e.begin([u({analysis:this.analysis,analysisViewData:this.analysisViewData,getObserverElevationInfo:()=>this._observerSessionElevationInfo,getTargetElevationInfo:()=>this._targetSessionElevationInfo,view:this.view})])}stop(){this._destroyDrawTool()}redo(){this._drawTool?.redo()}undo(){this._drawTool?.undo()}get testInfo(){}_createDrawTool(){return f({analysis:this.analysis,analysisViewData:this.analysisViewData,snappingManager:this.snappingManager,view:this.view,getSourceElevationInfo:()=>this._effectiveElevationInfo,getVisible:()=>this.visible,onCancel:e=>{e===this._drawTool&&!this._sessionStartedWithValidAnalysis&&this.analysis.observer==null&&(this.analysis.clear(),this.analysisViewData.cursorTarget=null),this._destroyDrawTool(e)},onComplete:e=>this._destroyDrawTool(e),onManipulatorCountChange:e=>this._hideManipulatorOnAppearance(e),shouldPreventVertexAdd:this.shouldPreventVertexAdd})}_destroyDrawTool(e=this._drawTool){if(e==null)return;let t=e===this._drawTool;this.view.activeTool===e&&(this.view.activeTool=null),this.view.tools.includes(e)&&this.view.tools.remove(e),e.destroy(),t&&(this._drawTool=null,this._renderer=null,this._sessionStartedWithValidAnalysis=!1)}_hideManipulatorOnAppearance(e){e.removeHandles(m),e.addHandles(e.manipulators.toArray().map(e=>e instanceof p?e.disableDisplay():null).filter(n),m)}};e([o({constructOnly:!0})],h.prototype,`view`,void 0),e([o({constructOnly:!0})],h.prototype,`analysis`,void 0),e([o({constructOnly:!0})],h.prototype,`analysisViewData`,void 0),e([o({constructOnly:!0})],h.prototype,`shouldPreventVertexAdd`,void 0),e([o({constructOnly:!0})],h.prototype,`snappingManager`,void 0),e([o()],h.prototype,`visible`,void 0),e([o()],h.prototype,`observerPlacementElevationInfo`,void 0),e([o()],h.prototype,`targetPlacementElevationInfo`,void 0),e([o()],h.prototype,`active`,null),e([o()],h.prototype,`canRedo`,null),e([o()],h.prototype,`canUndo`,null),e([o()],h.prototype,`updating`,null),e([o()],h.prototype,`activeTooltipInfo`,null),e([o()],h.prototype,`tooltip`,null),e([o()],h.prototype,`_drawTool`,void 0),e([o()],h.prototype,`_renderer`,void 0),e([o()],h.prototype,`_observerSessionElevationInfo`,void 0),e([o()],h.prototype,`_targetSessionElevationInfo`,void 0),e([o()],h.prototype,`_elevationModeContext`,null),h=e([s(`esri.views.3d.analysis.LineOfSight.LineOfSightPlacementController`)],h);export{h as LineOfSightPlacementController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../analysis/LineOfSightAnalysisObserver.js";import n from"../../../../analysis/LineOfSightAnalysisTarget.js";import r from"../../../../core/Collection.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{isPoint as s,isMultipoint as c}from"../../../../geometry/support/typeUtils.js";import{updateLineOfSightItemFromAuthoredPoint as l}from"./LineOfSightAuthoringUtils.js";import{isLineOfSightObserverPlugin as u,createLineOfSightObserverPluginConfiguration as d}from"./LineOfSightObserverPlugin.js";import{isLineOfSightPlacementLeafPlugin as f}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as p}from"./LineOfSightRayIntersector.js";import{isLineOfSightTargetPlugin as m,createLineOfSightTargetPluginConfiguration as h}from"./LineOfSightTargetPlugin.js";import{PluginBase as g}from"../../../draw/plugins/PluginBase.js";let _=class extends g{constructor(){super(...arguments),this._intersector=null,this._downstreamPlugin=null,this._initialObserver=null,this._operationObserver=null,this._initialTargets=new r,this._operationTargets=new r}initialize(){this._intersector=new p({view:this.view})}destroy(){this._intersector=i(this._intersector)}start(e){super.start(e),this._initialObserver=this.analysis.observer,this._operationObserver=this._initialObserver,y(this._initialTargets,this.analysis.targets.toArray()),this._operationTargets.removeAll(),e.session.appendOrReplacePart(null,[]),this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}beforeAttachPlugin(e){return{geometryType:`point`,useStandaloneSession:!0}}beforeComplete(){return{downstreamPluginCompletionMode:`cancel`}}attachPlugin(e){this._downstreamPlugin=e}afterUndoRedo(){this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}detachPlugin(e,r){if(this._downstreamPlugin===e&&(this._downstreamPlugin=null),m(e)&&this._clearCursorTarget(),r!==`complete`){this._syncAnalysisFromSession();return}let i=this._context?.getSession(e)?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:`point`});if(!i||!s(i)){this._syncAnalysisFromSession(),this._restartDownstreamPlugin();return}this._truncateItemsToSession();let a=f(e)?e.preservedIntersection:null;if(u(e)){let n=e.observer??this._operationObserver??new t;if(!this._intersector||!l(this.view,n,this._intersector,i,{elevationInfo:this.getObserverElevationInfo(),preservedIntersection:a})){this._syncAnalysisFromSession(),this._restartDownstreamPlugin();return}this._operationObserver=n}else if(m(e)){let t=e.target??new n;if(!this._intersector||!l(this.view,t,this._intersector,i,{elevationInfo:this.getTargetElevationInfo(),preservedIntersection:a})){this._syncAnalysisFromSession(),this._restartDownstreamPlugin();return}this._operationTargets.add(t)}this._appendCommittedPoint(i),this._syncAnalysisFromSession(),this._restartDownstreamPlugin(),this._clearCursorTarget()}_appendCommittedPoint(e){let t=this._session;t&&(t.appendOrReplacePoint(null,e),t.appendOrReplacePart(null,[]),t.automaticRestart=!1,t.groupGeometryChanges())}_clearCursorTarget(){this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget)}_truncateItemsToSession(){let e=this._getCommittedPointCount();this._initialObserver==null&&e===0&&(this._operationObserver=null),this._operationTargets.splice(this._getCommittedOperationTargetCount(e))}_restartDownstreamPlugin(){let e=this.analysis.observer==null,t=e?this._createObserverPluginConfiguration():this._createTargetPluginConfiguration();e&&u(this._downstreamPlugin)||!e&&m(this._downstreamPlugin)||this._context?.requestBeginDownstreamPlugin(t,{cancelExisting:!0})}_createObserverPluginConfiguration(e=null){return d({observer:e,defaultCaptureMode:e?`grabbable-object`:`capture-always`,inputMapPosition:e?.position??null})}_createTargetPluginConfiguration(e=null){return h({analysis:this.analysis,analysisViewData:this.analysisViewData,defaultCaptureMode:e?`grabbable-object`:`capture-always`,getElevationInfo:this.getTargetElevationInfo,inputMapPosition:e?.position??null,target:e,view:this.view})}_syncAnalysisFromSession(){let e=this._getCommittedPointCount(),t=this._getCommittedOperationTargetCount(e);this.analysis.observer=this._getActiveObserver(e),y(this.analysis.targets,this._initialTargets.toArray().concat(this._operationTargets.toArray().slice(0,t)))}_getActiveObserver(e){return this._initialObserver==null?e>0?this._operationObserver:null:this._operationObserver??null}_getCommittedOperationTargetCount(e){return Math.max(0,e-(this._initialObserver==null?Math.min(e,1):0))}_getCommittedPointCount(){let e=this._session?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:`multipoint`});return e&&c(e)?e.points.length:0}};e([a({constructOnly:!0})],_.prototype,`analysis`,void 0),e([a({constructOnly:!0})],_.prototype,`analysisViewData`,void 0),e([a({constructOnly:!0})],_.prototype,`view`,void 0),e([a({constructOnly:!0})],_.prototype,`getObserverElevationInfo`,void 0),e([a({constructOnly:!0})],_.prototype,`getTargetElevationInfo`,void 0),e([a()],_.prototype,`_intersector`,void 0),e([a()],_.prototype,`_downstreamPlugin`,void 0),_=e([o(`esri.views.3d.analysis.LineOfSight.LineOfSightRootPlugin`)],_);function v(e){return{uniqueId:Symbol(`line-of-sight-root-plugin`),kind:[`multipart`],geometryType:`multipoint`,hidden:!0,localizationKey:`line-of-sight-root`,icon:`point`,create:()=>new _(e)}}function y(e,t){let n=-1;for(let r=0;r<Math.min(e.length,t.length);r++)if(e.getItemAt(r)!==t[r]){n=r;break}if(n===-1){if(e.length===t.length)return;n=Math.min(e.length,t.length)}e.splice(n,e.length-n,...t.slice(n))}export{_ as LineOfSightRootPlugin,v as createLineOfSightRootPluginConfiguration};
2
+ import{__decorate as e}from"tslib";import t from"../../../../analysis/LineOfSightAnalysisObserver.js";import n from"../../../../analysis/LineOfSightAnalysisTarget.js";import r from"../../../../core/Collection.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{isPoint as s,isMultipoint as c}from"../../../../geometry/support/typeUtils.js";import{updateLineOfSightItemFromAuthoredPoint as l}from"./LineOfSightAuthoringUtils.js";import{isLineOfSightObserverPlugin as u,createLineOfSightObserverPluginConfiguration as d}from"./LineOfSightObserverPlugin.js";import{isLineOfSightPlacementLeafPlugin as f}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as p}from"./LineOfSightRayIntersector.js";import{isLineOfSightTargetPlugin as m,createLineOfSightTargetPluginConfiguration as h}from"./LineOfSightTargetPlugin.js";import{PluginBase as g}from"../../../draw/plugins/PluginBase.js";let _=class extends g{constructor(){super(...arguments),this._intersector=null,this._downstreamPlugin=null,this._initialObserver=null,this._operationObserver=null,this._initialTargets=new r,this._operationTargets=new r}initialize(){this._intersector=new p({view:this.view})}destroy(){this._intersector=i(this._intersector)}start(e){super.start(e),this._initialObserver=this.analysis.observer,this._operationObserver=this._initialObserver,y(this._initialTargets,this.analysis.targets.toArray()),this._operationTargets.removeAll(),e.session.appendOrReplacePart(null,[]),this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}beforeAttachPlugin(e){return{geometryType:`point`,useStandaloneSession:!0}}beforeComplete(){return{downstreamPluginCompletionMode:`cancel`}}attachPlugin(e){this._downstreamPlugin=e}afterUndoRedo(){this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}detachPlugin(e,r){if(this._downstreamPlugin===e&&(this._downstreamPlugin=null),m(e)&&this._clearCursorTarget(),r!==`complete`){this._syncAnalysisFromSession();return}let i=this._context?.getSession(e)?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:`point`});if(!i||!s(i)){this._syncAnalysisFromSession(),this._restartDownstreamPlugin();return}this._truncateItemsToSession();let a=f(e)?e.preservedIntersection:null;if(u(e)){let n=e.observer??this._operationObserver??new t;if(!this._intersector||!l(this.view,n,this._intersector,i,{elevationInfo:this.getObserverElevationInfo(),preservedIntersection:a})){this._syncAnalysisFromSession(),this._restartDownstreamPlugin();return}this._operationObserver=n}else if(m(e)){let t=e.target??new n;if(!this._intersector||!l(this.view,t,this._intersector,i,{elevationInfo:this.getTargetElevationInfo(),preservedIntersection:a})){this._syncAnalysisFromSession(),this._restartDownstreamPlugin();return}this._operationTargets.add(t)}this._appendCommittedPoint(i),this._syncAnalysisFromSession(),this._restartDownstreamPlugin(),this._clearCursorTarget()}_appendCommittedPoint(e){let t=this._session;t&&(t.appendOrReplacePoint(null,e),t.appendOrReplacePart(null,[]),t.automaticRestart=!1,t.groupGeometryChanges())}_clearCursorTarget(){this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget)}_truncateItemsToSession(){let e=this._getCommittedPointCount();this._initialObserver==null&&e===0&&(this._operationObserver=null),this._operationTargets.splice(this._getCommittedOperationTargetCount(e))}_restartDownstreamPlugin(){let e=this.analysis.observer==null,t=e?this._createObserverPluginConfiguration():this._createTargetPluginConfiguration();e&&u(this._downstreamPlugin)||!e&&m(this._downstreamPlugin)||this._context?.requestBeginDownstreamPlugin(t,{cancelExisting:!0})}_createObserverPluginConfiguration(e=null){return d({observer:e,defaultCaptureMode:e?`grabbable-object`:`capture-always`,inputMapPosition:e?.position??null})}_createTargetPluginConfiguration(e=null){return h({analysis:this.analysis,analysisViewData:this.analysisViewData,defaultCaptureMode:e?`grabbable-object`:`capture-always`,getElevationInfo:this.getTargetElevationInfo,inputMapPosition:e?.position??null,target:e,view:this.view})}_syncAnalysisFromSession(){let e=this._getCommittedPointCount(),t=this._getCommittedOperationTargetCount(e);this.analysis.observer=this._getActiveObserver(e),y(this.analysis.targets,this._initialTargets.toArray().concat(this._operationTargets.toArray().slice(0,t)))}_getActiveObserver(e){return this._initialObserver==null?e>0?this._operationObserver:null:this._operationObserver??null}_getCommittedOperationTargetCount(e){return Math.max(0,e-(this._initialObserver==null?Math.min(e,1):0))}_getCommittedPointCount(){let e=this._session?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:`multipoint`});return e&&c(e)?e.points.length:0}};e([a({constructOnly:!0})],_.prototype,`analysis`,void 0),e([a({constructOnly:!0})],_.prototype,`analysisViewData`,void 0),e([a({constructOnly:!0})],_.prototype,`view`,void 0),e([a({constructOnly:!0})],_.prototype,`getObserverElevationInfo`,void 0),e([a({constructOnly:!0})],_.prototype,`getTargetElevationInfo`,void 0),e([a()],_.prototype,`_intersector`,void 0),e([a()],_.prototype,`_downstreamPlugin`,void 0),_=e([o(`esri.views.3d.analysis.LineOfSight.LineOfSightPlacementRootPlugin`)],_);function v(e){return{uniqueId:Symbol(`line-of-sight-root-plugin`),kind:[`multipart`],geometryType:`multipoint`,hidden:!0,localizationKey:`line-of-sight-root`,icon:`point`,create:()=>new _(e)}}function y(e,t){let n=-1;for(let r=0;r<Math.min(e.length,t.length);r++)if(e.getItemAt(r)!==t[r]){n=r;break}if(n===-1){if(e.length===t.length)return;n=Math.min(e.length,t.length)}e.splice(n,e.length-n,...t.slice(n))}export{_ as LineOfSightPlacementRootPlugin,v as createLineOfSightPlacementRootPluginConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../analysis/LineOfSightAnalysisTarget.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,sync as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{updateLineOfSightItemFromIntersection as s,updateLineOfSightItemFromAuthoredPoint as c,convertLineOfSightElevationMode as l}from"./LineOfSightAuthoringUtils.js";import{lineOfSightPlacementLeafPluginMarker as u}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as d}from"./LineOfSightRayIntersector.js";import{PluginBase as f}from"../../../draw/plugins/PluginBase.js";var p,m;const h=Symbol(`line-of-sight-target-vertex`),g=Symbol(`line-of-sight-target-plugin-marker`);let _=class extends f{constructor(){super(...arguments),this[p]=!0,this[m]=!0,this.target=null,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.preservedIntersection=null,this._interactiveHandle=null,this._intersector=null,this._changingElevationMode=!1}static{p=g,m=u}initialize(){this._intersector=new d({view:this.view})}destroy(){this._intersector=n(this._intersector)}start(e){super.start(e),this.preservedIntersection=null;let{positionOfLastUserInput:a,session:o}=e,l=this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??a:this.inputMapPosition??a;l&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&o.appendOrReplacePoint(h,l);let u=this.defaultCaptureMode===`capture-always`&&l!=null;this._interactiveHandle&&this._clearCursorTarget(),this._interactiveHandle||(this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:this.defaultCaptureMode===`grabbable-object`?l??void 0:void 0}),this.addHandles(r(()=>[this._interactiveHandle?.outputMapPosition,this.getElevationInfo()],([e,r])=>{if(!e||this._isComplete||this._changingElevationMode)return;let i=this.analysisViewData.cursorTarget??new t,a={elevationInfo:r},o=this._interactiveHandle?.screenPosition,l=o&&this._intersector?this._intersector.getScreenPointIntersection(o):null;this._session?.appendOrReplacePoint(h,e),u?(u=!1,this._clearCursorTarget()):l==null?o!=null&&this.preservedIntersection!=null?(this.analysisViewData.cursorTarget=i,s(this.view,i,this.preservedIntersection,{...a,snappedMapPoint:e})):o==null?!this._intersector||!c(this.view,i,this._intersector,e,{...a,preservedIntersection:this.preservedIntersection})?this.analysisViewData.cursorTarget=n(this.analysisViewData.cursorTarget):this.analysisViewData.cursorTarget=i:this.analysisViewData.cursorTarget=n(this.analysisViewData.cursorTarget):(this.analysisViewData.cursorTarget=i,s(this.view,i,l,{...a,snappedMapPoint:e}))},i),this._ownHandlesKey))}changeElevationMode(e,t,n){let r=this.analysisViewData.cursorTarget,i=r?.position,a=i?l({view:this.view,point:i,sourceElevationInfo:r.elevationInfo,mode:e,preserveZ:t}):null;this._changingElevationMode=!0;try{n();let e=this._interactiveHandle?.outputMapPosition;e&&this._session?.appendOrReplacePoint(h,e),r&&a&&(r.position=a.position,r.elevationInfo=a.elevationInfo)}finally{this._changingElevationMode=!1}}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}_clearCursorTarget(){this.analysisViewData.cursorTarget=n(this.analysisViewData.cursorTarget)}};e([a({constructOnly:!0})],_.prototype,`analysis`,void 0),e([a({constructOnly:!0})],_.prototype,`analysisViewData`,void 0),e([a({constructOnly:!0})],_.prototype,`view`,void 0),e([a({constructOnly:!0})],_.prototype,`target`,void 0),e([a({constructOnly:!0})],_.prototype,`getElevationInfo`,void 0),e([a()],_.prototype,`defaultCaptureMode`,void 0),e([a()],_.prototype,`inputMapPosition`,void 0),e([a()],_.prototype,`preservedIntersection`,void 0),e([a()],_.prototype,`_interactiveHandle`,void 0),e([a()],_.prototype,`_intersector`,void 0),_=e([o(`esri.views.3d.analysis.LineOfSight.LineOfSightTargetPlugin`)],_);function v(e){return!!e&&g in e}function y(e){return{uniqueId:Symbol(`line-of-sight-target-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new _(e)}}export{_ as LineOfSightTargetPlugin,y as createLineOfSightTargetPluginConfiguration,v as isLineOfSightTargetPlugin,g as lineOfSightTargetPluginMarker};
2
+ import{__decorate as e}from"tslib";import t from"../../../../analysis/LineOfSightAnalysisTarget.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,sync as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{updateLineOfSightItemFromIntersection as s,updateLineOfSightItemFromAuthoredPoint as c,convertLineOfSightElevationMode as l}from"./LineOfSightAuthoringUtils.js";import{lineOfSightPlacementLeafPluginMarker as u}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as d}from"./LineOfSightRayIntersector.js";import{PluginBase as f}from"../../../draw/plugins/PluginBase.js";var p,m;const h=Symbol(`line-of-sight-target-vertex`),g=Symbol(`line-of-sight-target-plugin-marker`);let _=class extends f{constructor(){super(...arguments),this[p]=!0,this[m]=!0,this.target=null,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.preservedIntersection=null,this._interactiveHandle=null,this._intersector=null,this._changingElevationMode=!1}static{p=g,m=u}initialize(){this._intersector=new d({view:this.view})}destroy(){this._intersector=n(this._intersector)}start(e){super.start(e),this.preservedIntersection=null;let{positionOfLastUserInput:a,session:o}=e,l=this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??a:this.inputMapPosition??a;l&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&o.appendOrReplacePoint(h,l);let u=this.defaultCaptureMode===`capture-always`&&l!=null;this._interactiveHandle&&this._clearCursorTarget(),this._interactiveHandle||(this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:this.defaultCaptureMode===`grabbable-object`?l??void 0:void 0},{elevationFieldProperties:{unlockOnVertexPlacement:!0}}),this.addHandles(r(()=>[this._interactiveHandle?.outputMapPosition,this.getElevationInfo()],([e,r])=>{if(!e||this._isComplete||this._changingElevationMode)return;let i=this.analysisViewData.cursorTarget??new t,a={elevationInfo:r},o=this._interactiveHandle?.screenPosition,l=o&&this._intersector?this._intersector.getScreenPointIntersection(o):null;this._session?.appendOrReplacePoint(h,e),u?(u=!1,this._clearCursorTarget()):l==null?o!=null&&this.preservedIntersection!=null?(this.analysisViewData.cursorTarget=i,s(this.view,i,this.preservedIntersection,{...a,snappedMapPoint:e})):o==null?!this._intersector||!c(this.view,i,this._intersector,e,{...a,preservedIntersection:this.preservedIntersection})?this.analysisViewData.cursorTarget=n(this.analysisViewData.cursorTarget):this.analysisViewData.cursorTarget=i:this.analysisViewData.cursorTarget=n(this.analysisViewData.cursorTarget):(this.analysisViewData.cursorTarget=i,s(this.view,i,l,{...a,snappedMapPoint:e}))},i),this._ownHandlesKey))}changeElevationMode(e,t,n){let r=this.analysisViewData.cursorTarget,i=r?.position,a=i?l({view:this.view,point:i,sourceElevationInfo:r.elevationInfo,mode:e,preserveZ:t}):null;this._changingElevationMode=!0;try{n();let e=this._interactiveHandle?.outputMapPosition;e&&this._session?.appendOrReplacePoint(h,e),r&&a&&(r.position=a.position,r.elevationInfo=a.elevationInfo)}finally{this._changingElevationMode=!1}}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}_clearCursorTarget(){this.analysisViewData.cursorTarget=n(this.analysisViewData.cursorTarget)}};e([a({constructOnly:!0})],_.prototype,`analysis`,void 0),e([a({constructOnly:!0})],_.prototype,`analysisViewData`,void 0),e([a({constructOnly:!0})],_.prototype,`view`,void 0),e([a({constructOnly:!0})],_.prototype,`target`,void 0),e([a({constructOnly:!0})],_.prototype,`getElevationInfo`,void 0),e([a()],_.prototype,`defaultCaptureMode`,void 0),e([a()],_.prototype,`inputMapPosition`,void 0),e([a()],_.prototype,`preservedIntersection`,void 0),e([a()],_.prototype,`_interactiveHandle`,void 0),e([a()],_.prototype,`_intersector`,void 0),_=e([o(`esri.views.3d.analysis.LineOfSight.LineOfSightTargetPlugin`)],_);function v(e){return!!e&&g in e}function y(e){return{uniqueId:Symbol(`line-of-sight-target-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new _(e)}}export{_ as LineOfSightTargetPlugin,y as createLineOfSightTargetPluginConfiguration,v as isLineOfSightTargetPlugin,g as lineOfSightTargetPluginMarker};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import o from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightEditTool as s}from"./LineOfSightEditTool.js";import{LineOfSightPlacementController as c}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as l}from"./LineOfSightRayIntersector.js";import{ExclusiveOperationManager as u}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as d}from"../../../input/InputManager.js";import{AnalysisToolBase as f}from"../../../interactive/AnalysisToolBase.js";import{deactivateTool as p}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as m}from"../../../interactive/keybindings.js";import{acquire as h}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as g}from"../../../interactive/snapping/snappingUtils.js";const _={ready:`ready`,creating:`creating`,created:`created`};let v=class extends f{constructor(e){super(e),this._operationManager=new u,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1;let{snappingManager:t}=this._snappingManagerResult=h(e.view);this._editIntersector=new l({view:e.view}),this._editTool=new s({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:this._editIntersector,snappingManager:t,view:e.view}),this._placementController=new c({...e,parent:this,snappingManager:t,shouldPreventVertexAdd:(e,t)=>this._editTool.hasManipulatorAt(e,t)})}get active(){return this._editTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get selectedItem(){return this._editTool.selectedItem}get state(){return this._placementController.active?_.creating:this.analysis.observer?.position==null?_.ready:_.created}get cursor(){return this._placementController.active?`crosshair`:null}get updating(){return this._editTool.updating||this._placementController.updating}initialize(){g(this),this.addHandles([this._snappingManagerResult,this.view.on(`key-down`,e=>this._onKeyDown(e),d.WIDGET),n(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),r),n(()=>this.state===_.created,e=>{e?this.finishToolCreation():this._set(`created`,!1)},r),n(()=>this.analysisViewData.visible,e=>{this.visible=e},r),n(()=>this.editable,e=>{this.analysisViewData.editable=e},r)])}destroy(){this._operationManager.destroy(),this._editTool.stop(),this._placementController.stop(),this._editTool.destroy(),this._placementController.destroy(),this._editIntersector.destroy()}place(e){return this.analysisViewData.interactive=!0,this._operationManager.start(`place`,async(i,a)=>{let{elevationInfo:o}=e??{},s=o&&`observer`in o?o.observer:o,c=o&&`targets`in o?o.targets:o;this._placementController.observerPlacementElevationInfo=y(s),this._placementController.targetPlacementElevationInfo=y(c);let l=this.analysis.clone(),u=!1,d=!1,f=()=>{if(d)return;if(d=!0,this.stop(),!this.analysis.valid){this.analysis.clear(),i.reject();return}if(a.aborted||this.analysis.equals(l)){i.reject();return}let e=this.analysis.targets.at(-1);e!=null&&this._editTool.selectItem(e),i.resolve({})};i.handles.push(t(()=>this.stop()),n(()=>this._placementController.active,e=>{e?u=!0:u&&f()},r)),this.continue()},e)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),!this.analysis.valid&&!this._placementController.active&&this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.observerPlacementElevationInfo=null,this._placementController.targetPlacementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}get snappingOptions(){return this._snappingManager.options}set snappingOptions(e){this._snappingManager.options=e}get _snappingManager(){return this._snappingManagerResult.snappingManager}onEditableChange(){this.analysisViewData.editable=this.editable,this._editTool.setEditableFlag(1,!0),this._editTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideEditTool(){this._editTool.stop(),this._editTool.visible=!1}_onKeyDown(e){let t=e.key;t===m.undo&&this.canUndo?(e.stopPropagation(),this.undo()):t===m.redo&&this.canRedo?(e.stopPropagation(),this.redo()):m.delete.includes(t)&&!this.active?this._editTool.deleteSelectedItem()&&e.stopPropagation():t===m.cancel&&!this.active&&this._editTool.clearSelection()&&e.stopPropagation()}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active||!this._canActivateEditTool?this._placementController.active?this._placementController:null:this._editTool:null}get _canActivateEditTool(){return this.visible&&this.editable&&this.analysis.valid&&this.analysis.observer?.position!=null}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{let e=this.analysisViewData.interactive,t=this._canActivateEditTool;if(this._placementController.visible=this.visible&&e,this._editTool.manipulatorsInteractive=e&&!this._placementController.active,!e){this._placementController.stop(),this._hideEditTool(),this.analysisViewData.cursorTarget=null,p(this.view,this);return}if(!this.visible){this._editTool.stop(),this._editTool.visible=!0,p(this.view,this);return}if(this._placementController.active){this._editTool.stop(),this._editTool.visible=this.visible,p(this.view,this);return}if(!t){this._hideEditTool(),p(this.view,this);return}this._editTool.visible=!0,this.analysisViewData.cursorTarget=null,p(this.view,this)}finally{this._syncingActiveTool=!1}}}};e([i({constructOnly:!0})],v.prototype,`view`,void 0),e([i({constructOnly:!0})],v.prototype,`analysis`,void 0),e([i({constructOnly:!0})],v.prototype,`analysisViewData`,void 0),e([i()],v.prototype,`active`,null),e([i()],v.prototype,`canRedo`,null),e([i()],v.prototype,`canUndo`,null),e([i()],v.prototype,`selectedItem`,null),e([i()],v.prototype,`state`,null),e([i()],v.prototype,`cursor`,null),e([i()],v.prototype,`updating`,null),e([i()],v.prototype,`removeIncompleteOnCancel`,void 0),e([i()],v.prototype,`snappingOptions`,null),e([i()],v.prototype,`_canActivateEditTool`,null),v=e([a(`esri.views.3d.analysis.LineOfSight.LineOfSightTool`)],v);function y(e){if(e==null)return null;let{featureExpressionInfo:t,mode:n,offset:r,unit:i}=e;return new o({featureExpressionInfo:t,mode:n,offset:r,unit:i})}export{v as LineOfSightTool};
2
+ import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import o from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightEditTool as s}from"./LineOfSightEditTool.js";import{LineOfSightPlacementController as c}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as l}from"./LineOfSightRayIntersector.js";import{ExclusiveOperationManager as u}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as d}from"../../../input/InputManager.js";import{AnalysisToolBase as f}from"../../../interactive/AnalysisToolBase.js";import{deactivateTool as p}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as m}from"../../../interactive/keybindings.js";import{acquire as h}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as g}from"../../../interactive/snapping/snappingUtils.js";const _={ready:`ready`,creating:`creating`,created:`created`};let v=class extends f{constructor(e){super(e),this._operationManager=new u,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1;let{snappingManager:t}=this._snappingManagerResult=h(e.view);this._editIntersector=new l({view:e.view}),this._editTool=new s({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:this._editIntersector,snappingManager:t,view:e.view}),this._placementController=new c({...e,snappingManager:t,shouldPreventVertexAdd:(e,t)=>this._editTool.hasManipulatorAt(e,t)})}get active(){return this._editTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get selectedItem(){return this._editTool.selectedItem}get state(){return this._placementController.active?_.creating:this.analysis.observer?.position==null?_.ready:_.created}get cursor(){return this._placementController.active?`crosshair`:null}get updating(){return this._editTool.updating||this._placementController.updating}initialize(){g(this),this.addHandles([this._snappingManagerResult,this.view.on(`key-down`,e=>this._onKeyDown(e),d.WIDGET),n(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),r),n(()=>this.state===_.created,e=>{e?this.finishToolCreation():this._set(`created`,!1)},r),n(()=>this.analysisViewData.visible,e=>{this.visible=e},r),n(()=>this.editable,e=>{this.analysisViewData.editable=e},r)])}destroy(){this._operationManager.destroy(),this._editTool.stop(),this._placementController.stop(),this._editTool.destroy(),this._placementController.destroy(),this._editIntersector.destroy()}place(e){return this.analysisViewData.interactive=!0,this._operationManager.start(`place`,async(i,a)=>{let{elevationInfo:o}=e??{},s=o&&`observer`in o?o.observer:o,c=o&&`targets`in o?o.targets:o;this._placementController.observerPlacementElevationInfo=y(s),this._placementController.targetPlacementElevationInfo=y(c);let l=this.analysis.clone(),u=!1,d=!1,f=()=>{if(d)return;if(d=!0,this.stop(),!this.analysis.valid){this.analysis.clear(),i.reject();return}if(a.aborted||this.analysis.equals(l)){i.reject();return}let e=this.analysis.targets.at(-1);e!=null&&this._editTool.selectItem(e),i.resolve({})};i.handles.push(t(()=>this.stop()),n(()=>this._placementController.active,e=>{e?u=!0:u&&f()},r)),this.continue()},e)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),!this.analysis.valid&&!this._placementController.active&&this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.observerPlacementElevationInfo=null,this._placementController.targetPlacementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}get snappingOptions(){return this._snappingManager.options}set snappingOptions(e){this._snappingManager.options=e}get _snappingManager(){return this._snappingManagerResult.snappingManager}onEditableChange(){this.analysisViewData.editable=this.editable,this._editTool.setEditableFlag(1,!0),this._editTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideEditTool(){this._editTool.stop(),this._editTool.visible=!1}_onKeyDown(e){let t=e.key;t===m.undo&&this.canUndo?(e.stopPropagation(),this.undo()):t===m.redo&&this.canRedo?(e.stopPropagation(),this.redo()):m.delete.includes(t)&&!this.active?this._editTool.deleteSelectedItem()&&e.stopPropagation():t===m.cancel&&!this.active&&this._editTool.clearSelection()&&e.stopPropagation()}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active?this._placementController:this._canActivateEditTool?this._editTool:null:null}get _canActivateEditTool(){return this.visible&&this.editable&&this.analysis.valid&&this.analysis.observer?.position!=null}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{let e=this.analysisViewData.interactive,t=this._canActivateEditTool;if(this._placementController.visible=this.visible&&e,this._editTool.manipulatorsInteractive=e&&!this._placementController.active,!e){this._placementController.stop(),this._hideEditTool(),this.analysisViewData.cursorTarget=null,p(this.view,this);return}if(!this.visible){this._editTool.stop(),this._editTool.visible=!0,p(this.view,this);return}if(this._placementController.active){this._editTool.stop(),this._editTool.visible=this.visible,p(this.view,this);return}if(!t){this._hideEditTool(),p(this.view,this);return}this._editTool.visible=!0,this.analysisViewData.cursorTarget=null,p(this.view,this)}finally{this._syncingActiveTool=!1}}}};e([i({constructOnly:!0})],v.prototype,`view`,void 0),e([i({constructOnly:!0})],v.prototype,`analysis`,void 0),e([i({constructOnly:!0})],v.prototype,`analysisViewData`,void 0),e([i()],v.prototype,`active`,null),e([i()],v.prototype,`canRedo`,null),e([i()],v.prototype,`canUndo`,null),e([i()],v.prototype,`selectedItem`,null),e([i()],v.prototype,`state`,null),e([i()],v.prototype,`cursor`,null),e([i()],v.prototype,`updating`,null),e([i()],v.prototype,`removeIncompleteOnCancel`,void 0),e([i()],v.prototype,`snappingOptions`,null),e([i()],v.prototype,`_canActivateEditTool`,null),v=e([a(`esri.views.3d.analysis.LineOfSight.LineOfSightTool`)],v);function y(e){if(e==null)return null;let{featureExpressionInfo:t,mode:n,offset:r,unit:i}=e;return new o({featureExpressionInfo:t,mode:n,offset:r,unit:i})}export{v as LineOfSightTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{PluginBase as a}from"../../../draw/plugins/PluginBase.js";var o;const s=Symbol(`viewshed-placement-point-plugin-marker`);let c=class extends a{static{o=s}constructor(e){super(e),this[o]=!0,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.outputMapPosition=null,this.screenPosition=null,this.hasCommittedPoint=!1,this._vertexId=Symbol(`viewshed-placement-point-vertex`)}start(e){super.start(e);let{positionOfLastUserInput:t,session:n}=e,r=this._getInitialMapPoint(t);r&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&(n.appendOrReplacePoint(this._vertexId,r),this.outputMapPosition=r.clone()),this._ensureInteractiveHandle(e,r)}completeStep(){this.hasCommittedPoint=!0,this._context?.requestComplete()}_ensureInteractiveHandle(e,r){if(this._interactiveHandle)return;let{defaultCaptureMode:i}=this;this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:i,inputMapPosition:i===`grabbable-object`?r:void 0},{disableDefaultXYFields:this.step===`target`}),this.addHandles(t(()=>{let e=this._interactiveHandle;return{outputMapPosition:e?.outputMapPosition,screenPosition:e?.screenPosition}},({outputMapPosition:e,screenPosition:t})=>{this.outputMapPosition=e?.clone(),this.screenPosition=t,e&&!this._isComplete&&this._session?.appendOrReplacePoint(this._vertexId,e)},n),this._ownHandlesKey)}_getInitialMapPoint(e){return this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??e:this.inputMapPosition??e}};e([r({constructOnly:!0})],c.prototype,`step`,void 0),e([r()],c.prototype,`defaultCaptureMode`,void 0),e([r()],c.prototype,`inputMapPosition`,void 0),e([r()],c.prototype,`outputMapPosition`,void 0),e([r()],c.prototype,`screenPosition`,void 0),e([r()],c.prototype,`hasCommittedPoint`,void 0),e([r()],c.prototype,`_interactiveHandle`,void 0),c=e([i(`esri.views.3d.analysis.Viewshed.ViewshedPlacementPointPlugin`)],c);function l(e){return{uniqueId:Symbol(`viewshed-${e}-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new c({step:e})}}export{c as ViewshedPlacementPointPlugin,l as createViewshedPlacementPointPluginConfiguration};
2
+ import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{PluginBase as a}from"../../../draw/plugins/PluginBase.js";var o;const s=Symbol(`viewshed-placement-point-plugin-marker`);let c=class extends a{static{o=s}constructor(e){super(e),this[o]=!0,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.outputMapPosition=null,this.screenPosition=null,this.hasCommittedPoint=!1,this._vertexId=Symbol(`viewshed-placement-point-vertex`)}start(e){super.start(e);let{positionOfLastUserInput:t,session:n}=e,r=this._getInitialMapPoint(t);r&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&(n.appendOrReplacePoint(this._vertexId,r),this.outputMapPosition=r.clone()),this._ensureInteractiveHandle(e,r)}completeStep(){this.hasCommittedPoint=!0,this._context?.requestComplete()}_ensureInteractiveHandle(e,r){if(this._interactiveHandle)return;let{defaultCaptureMode:i}=this;this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:i,inputMapPosition:i===`grabbable-object`?r:void 0},{disableDefaultXYFields:this.step===`target`,elevationFieldProperties:{unlockOnVertexPlacement:!0}}),this.addHandles(t(()=>{let e=this._interactiveHandle;return{outputMapPosition:e?.outputMapPosition,screenPosition:e?.screenPosition}},({outputMapPosition:e,screenPosition:t})=>{this.outputMapPosition=e?.clone(),this.screenPosition=t,e&&!this._isComplete&&this._session?.appendOrReplacePoint(this._vertexId,e)},n),this._ownHandlesKey)}_getInitialMapPoint(e){return this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??e:this.inputMapPosition??e}};e([r({constructOnly:!0})],c.prototype,`step`,void 0),e([r()],c.prototype,`defaultCaptureMode`,void 0),e([r()],c.prototype,`inputMapPosition`,void 0),e([r()],c.prototype,`outputMapPosition`,void 0),e([r()],c.prototype,`screenPosition`,void 0),e([r()],c.prototype,`hasCommittedPoint`,void 0),e([r()],c.prototype,`_interactiveHandle`,void 0),c=e([i(`esri.views.3d.analysis.Viewshed.ViewshedPlacementPointPlugin`)],c);function l(e){return{uniqueId:Symbol(`viewshed-${e}-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new c({step:e})}}export{c as ViewshedPlacementPointPlugin,l as createViewshedPlacementPointPluginConfiguration};