@arcgis/core 5.0.0-next.37 → 5.0.0-next.39

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 (147) hide show
  1. package/Color.js +1 -1
  2. package/analysis/DimensionSimpleStyle.js +1 -1
  3. package/analysis/ElevationProfileAnalysis.js +1 -1
  4. package/applications/Components/testUtils.d.ts +4 -0
  5. package/applications/Components/testUtils.js +5 -0
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/02a65563779b4c64b2cf.js +1 -0
  8. package/assets/esri/core/workers/chunks/{328106e181e5957ceaa5.js → 09ac2bbc7327e6e6b5a2.js} +1 -1
  9. package/assets/esri/core/workers/chunks/1a9ed3c59a9a8bafb251.js +1 -0
  10. package/assets/esri/core/workers/chunks/{b96af22ec1470905e4fb.js → 1c857191e5898aba50fe.js} +1 -1
  11. package/assets/esri/core/workers/chunks/2795e491f803654413d2.js +1 -0
  12. package/assets/esri/core/workers/chunks/{3904f8732c9953cb177d.js → 28b235b56a83c498d73f.js} +1 -1
  13. package/assets/esri/core/workers/chunks/36d15c35fbbd4dedd5cb.js +1 -0
  14. package/assets/esri/core/workers/chunks/48f805929fe6241952f5.js +1 -0
  15. package/assets/esri/core/workers/chunks/4c278fb2d51ca6226050.js +1 -0
  16. package/assets/esri/core/workers/chunks/6052eccb9395c8efb295.js +1 -0
  17. package/assets/esri/core/workers/chunks/613cbac9cb925cd20b48.js +1 -0
  18. package/assets/esri/core/workers/chunks/{febce0d80f019dc2a427.js → 646f58b69d2354f1ef27.js} +1 -1
  19. package/assets/esri/core/workers/chunks/7eab0bb42f9f062522ef.js +1 -0
  20. package/assets/esri/core/workers/chunks/{5e34a183420e7007a989.js → 8e8d5422f57269d8c8d2.js} +1 -1
  21. package/assets/esri/core/workers/chunks/9100330ed4b4437c819d.js +1 -0
  22. package/assets/esri/core/workers/chunks/95cb062cae4c31c07124.js +1 -0
  23. package/assets/esri/core/workers/chunks/{ce8fc1ca229d53a4b68d.js → 96f798ee286b59396131.js} +50 -50
  24. package/assets/esri/core/workers/chunks/{e9bc3c6482ba778c9349.js → 9d95f38da21f97214f83.js} +1 -1
  25. package/assets/esri/core/workers/chunks/ad4fcb73cfe9a1e4b710.js +1 -0
  26. package/assets/esri/core/workers/chunks/{a8a017d7969562d21d2e.js → b48aceaeefa07214e430.js} +1 -1
  27. package/assets/esri/core/workers/chunks/c1a4d1ec0125617374b4.js +1 -0
  28. package/assets/esri/core/workers/chunks/{d2a6f035022a3f060ffa.js → c320a29df40e85fb4a8e.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{52c8687b473c9953c2f2.js → d9958654c6438f28237b.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{27ec791318e81285c222.js → dca6a61fd239cf1ff90c.js} +1 -1
  31. package/assets/esri/core/workers/chunks/e66bcdfd75e0113d1cec.js +1 -0
  32. package/assets/esri/core/workers/chunks/f1381c5a2a1de1ef9139.js +1 -0
  33. package/assets/esri/core/workers/chunks/f21cb5b34d4d1e3af1a9.js +1 -0
  34. package/chunks/ChapmanAtmosphere.glsl.js +20 -20
  35. package/chunks/GaussianSplat.glsl.js +2 -2
  36. package/chunks/HUDMaterial.glsl.js +38 -38
  37. package/chunks/Haze.glsl.js +23 -23
  38. package/config.js +1 -1
  39. package/core/Collection.js +1 -1
  40. package/core/CollectionFlattener.js +1 -1
  41. package/core/arrayUtils.js +1 -1
  42. package/geometry/support/buffer/BufferView.js +1 -1
  43. package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
  44. package/interfaces.d.ts +74 -0
  45. package/kernel.js +1 -1
  46. package/layers/ImageryTileLayer.js +1 -1
  47. package/layers/RouteLayer.js +1 -1
  48. package/layers/support/FeatureReductionCluster.js +1 -1
  49. package/layers/support/LabelClass.js +1 -1
  50. package/package.json +3 -3
  51. package/renderers/FlowRenderer.js +1 -1
  52. package/renderers/HeatmapRenderer.js +1 -1
  53. package/renderers/PieChartRenderer.js +1 -1
  54. package/rest/route/utils.js +1 -1
  55. package/rest/support/PointBarrier.js +1 -1
  56. package/rest/support/Stop.js +1 -1
  57. package/support/revision.js +1 -1
  58. package/support/tests/meshUtils.js +5 -0
  59. package/support/tests/serviceMockDependencies.js +5 -0
  60. package/support/tests/setupServiceMocksMesh.js +5 -0
  61. package/symbols/Font.js +1 -1
  62. package/symbols/IconSymbol3DLayer.js +1 -1
  63. package/symbols/LineSymbol.js +1 -1
  64. package/symbols/LineSymbol3DLayer.js +1 -1
  65. package/symbols/MarkerSymbol.js +1 -1
  66. package/symbols/PictureFillSymbol.js +1 -1
  67. package/symbols/PictureMarkerSymbol.js +1 -1
  68. package/symbols/TextSymbol.js +1 -1
  69. package/symbols/TextSymbol3DLayer.js +1 -1
  70. package/symbols/callouts/LineCallout3D.js +1 -1
  71. package/symbols/edges/Edges3D.js +1 -1
  72. package/symbols/support/Symbol3DIconOutline.js +1 -1
  73. package/symbols/support/Symbol3DOutline.js +1 -1
  74. package/symbols/support/Symbol3DVerticalOffset.js +1 -1
  75. package/views/2d/layers/RouteLayerView2D.js +1 -1
  76. package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
  77. package/views/2d/layers/support/util.js +1 -1
  78. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  79. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  80. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  81. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  82. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  83. package/views/3d/camera/intersectionUtils.js +1 -1
  84. package/views/3d/environment/ChapmanApproximation.glsl.js +8 -8
  85. package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
  86. package/views/3d/environment/ChapmanRaymarching.glsl.js +16 -15
  87. package/views/3d/layers/FlowSubView3D.js +1 -1
  88. package/views/3d/layers/PointCloudWorker.js +1 -1
  89. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  90. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  91. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  92. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  93. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  94. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  95. package/views/3d/state/NearFarHeuristic.js +1 -1
  96. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  97. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  98. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  99. package/views/3d/terrain/OverlayRenderer.js +1 -1
  100. package/views/3d/terrain/TerrainSurface.js +1 -1
  101. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +4 -4
  102. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +1 -1
  103. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +12 -12
  104. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +8 -8
  105. package/views/3d/webgl-engine/lib/CutFillColor.js +1 -1
  106. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  107. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  108. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  109. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +5 -0
  110. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
  111. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  112. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayoutField.js +5 -0
  113. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferUtils.js +5 -0
  114. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +5 -0
  115. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +5 -0
  116. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  117. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  118. package/views/BreakpointsOwner.js +1 -1
  119. package/views/ToolViewManager.js +1 -1
  120. package/views/View.js +1 -1
  121. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  122. package/views/draw/support/Reshape.js +1 -1
  123. package/views/interactive/InteractiveToolBase.js +1 -1
  124. package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
  125. package/views/layers/GroupLayerView.js +1 -1
  126. package/views/support/Scheduler.js +1 -1
  127. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  128. package/widgets/ScaleRangeSlider.js +1 -1
  129. package/widgets/Slider.js +1 -1
  130. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  131. package/assets/esri/core/workers/chunks/1d877c3c96c40eab906c.js +0 -1
  132. package/assets/esri/core/workers/chunks/22f745539ca54d8cd30d.js +0 -1
  133. package/assets/esri/core/workers/chunks/42f3e83826b3a3dedaaa.js +0 -1
  134. package/assets/esri/core/workers/chunks/44471962c30344dfafdf.js +0 -1
  135. package/assets/esri/core/workers/chunks/8ca83a9af9d24b192128.js +0 -1
  136. package/assets/esri/core/workers/chunks/951a3442d4342539f2ea.js +0 -1
  137. package/assets/esri/core/workers/chunks/9527f1a611557a7af237.js +0 -1
  138. package/assets/esri/core/workers/chunks/ad3a4d139613b4c0e0b4.js +0 -1
  139. package/assets/esri/core/workers/chunks/c1c77a00f639eaee9c0d.js +0 -1
  140. package/assets/esri/core/workers/chunks/c5967133f3ba34a883f8.js +0 -1
  141. package/assets/esri/core/workers/chunks/c8d2cce4a426c72ab173.js +0 -1
  142. package/assets/esri/core/workers/chunks/e0a74250d22fa1d7dc18.js +0 -1
  143. package/assets/esri/core/workers/chunks/e3be67c762af672ec602.js +0 -1
  144. package/assets/esri/core/workers/chunks/eefad79be500667af96e.js +0 -1
  145. package/assets/esri/core/workers/chunks/f8caceeaa14d99c35526.js +0 -1
  146. package/assets/esri/core/workers/chunks/f919f0db9f9ec0c649b9.js +0 -1
  147. package/views/3d/webgl-engine/core/shaderLibrary/util/FastApproximateTrigonometry.glsl.js +0 -26
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,abortMaybe as p,assertIsSome as l}from"../../../core/maybe.js";import{pausable as c,when as d,watch as m,initial as u,sync as v}from"../../../core/reactiveUtils.js";import{property as y,subclass as _}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../../../core/support/UpdatingHandles.js";import f from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{fromGeometry as G,toGeometry as x}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as M,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{isPoint as S}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as E}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as O,toEllipticArc7 as w}from"../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as I,isCircularArc as L,isEllipticArc4 as H,isBezierCurve as k,isCoordinate as V,isEllipticArc7 as P}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as R}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as T}from"../../../geometry/support/curves/mathUtils.js";import A from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as U}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as j}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as F,cloneMove as D}from"./drawUtils.js";import z from"./GraphicMover.js";import K from"./HighlightHelper.js";import{addUniqueLayer as N,isConnectedReshapeSupportedLayer as q}from"./layerUtils.js";import{createTooltipInfos as Z,connectTooltip as $,updateTranslateTooltipInfo as B,updateTranslateVertexTooltipInfo as J}from"./reshapeTooltipUtils.js";import{defaultSymbols as Q,createMidpointGraphics as W,createVertexGraphics as X,createCurveControlPointGraphics as Y,createCurveConstructionLineGraphics as tt,attributeKeys as et,getMidpoint as it,controlPointKinds as st,saveUpdatedCurveOrCoordinate as ot,toolIdAttribute as rt,splitCurve as nt,isSingleSegmentCircle as at,isSingleSegmentEllipse as ht}from"./reshapeUtils.js";import{ViewEventPriorities as pt}from"../../input/InputManager.js";import{createCoordinateHelper as lt}from"../../interactive/coordinateHelper.js";import{sketchKeys as ct}from"../../interactive/keybindings.js";import{EditGeometryOperations as dt}from"../../interactive/editGeometry/EditGeometryOperations.js";import mt from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as ut}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as vt,enterInputModeIfAvailable as yt}from"../../interactive/tooltip/tooltipCommonUtils.js";const _t=Symbol(),gt={mode:"on-the-ground",offset:0};let ft=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._updatingHandles=new g,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=Q,this.tooltip=null,this.activeTooltipInfo=null,this.sketchOptions=new mt,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new K({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=c(()=>this.graphic?.geometry,t=>{if(!t)return;const e=new Set(this.selectedManipulators.map(It));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(It(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).items;i&&h.push(o),s?.set("graphics",h)},v),this.tooltip=vt(()=>({view:t,options:this.sketchOptions.tooltips})),this.tooltipInfos=Z(this.sketchOptions),this.addHandles([d(()=>t?.ready,()=>{const{layer:t,view:e}=this;N(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),pt.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),m(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),$(this.tooltip,()=>this._tooltipsContext),m(()=>this.sketchOptions.labels.enabled,t=>{this._segmentLabels?this._segmentLabels.visible=t:this._setUpGeometryHelper()}),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),u),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=h(this._mover),this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._updatingHandles=h(this._updatingHandles)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??lt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,sketchOptions:i,activeTooltipInfo:s,graphic:o}=this;return{sketchOptions:i,activeTooltipInfo:s,graphic:o,selectedVertex:this._selectedManipulator,automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}get updating(){return this._updatingHandles.updating}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&M(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;if(null==t||"mesh"===t.type||"extent"===t.type)return this._segmentLabels=h(this._segmentLabels),void this._logGeometryTypeError();this._editGeometryOperations?this._syncEditGeometryOperations(t):this._editGeometryOperations=dt.fromGeometry(t,2,{allowCurves:!0}),this._updatingHandles.addPromise(this._setupSegmentLabels())}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new A({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;l(i),this._snappingContext=new ut({editGeometryOperations:i,elevationInfo:gt,pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new U(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._activeOperationInfo=null,this._mover=h(this._mover),this.removeHandles(_t)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=bt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=W(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){this._removeVertexGraphics();const e=X(t,this.symbols,this._coordinateHelper);this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}_setupCurveGraphics(t){this._removeCurveGraphics();const e=Y(t,this.symbols,this._coordinateHelper),i=tt(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(e)}async _setupSegmentLabels(){const t=this._editGeometryOperations,e=this.sketchOptions.labels.enabled;if(t&&this._segmentLabels?.context?.editGeometryOperations===t&&e||(this._segmentLabels=h(this._segmentLabels)),!this._segmentLabels&&t&&e){const e=this._segmentLabelsImportTask??=i(async t=>{const e=import("../../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(e);return t.aborted?null:i}),s=await e.promise;if(!s)return;this._segmentLabels=h(this._segmentLabels),this._segmentLabels=new s({context:{view:this.view,editGeometryOperations:t,elevationInfo:gt,labelOptions:this.sketchOptions.labels,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},visible:!0})}}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",t),hover:this.symbols.controlPoints.hover?.clone().set("color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[et.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).items;t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new z({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager=new j({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?Ht(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,kt(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else{if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const e=bt(n);this._updateVertexGraphicLocations(e);const{dxMap:o,dyMap:r}=F(i,s,this.view);this._connectedReshapeManager?.translate(o,r,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}this._syncEditGeometryOperations(n)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t,{operationType:r}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)||o.getAttribute(et.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(I(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.midpointGraphics){const{pathIndex:s,pointIndexStart:o,pointIndexEnd:r}=i.attributes,n=t[s];i.geometry=it(n[o],n[r],e)}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=wt(s);null!=t&&null!=e&&s.getAttribute(et.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=wt(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(L(r)||H(r)){const i=I(t[e][o-1]),n=L(r)?O(i,r):R(i,r),[a,h]=E(n,.25);s.geometry=new f({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(k(r)){const t=s.getAttribute(et.controlPointKind),[e,i]=t===st.bezier.cp1?r.b[1]:r.b[2];s.geometry=new f({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(et.controlPointKind),[o,r]=wt(s),n=t[o],a=I(n[r-1]),h=I(n[r]),p=t[o][r];i===st.bezier.line1?s.geometry=new b({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new b({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=wt(t);s===e&&o>=i&&t.setAttribute(et.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(et.pathIndex)!==e)continue;const t=o.getAttribute(et.pointIndexStart);t>=i&&(o.setAttribute(et.pointIndexStart,t+1),o.setAttribute(et.pointIndexEnd,o.getAttribute(et.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=wt(t);return l(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&S(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new f(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});p.valid&&(this._stagedVertex=p.apply(),this._syncGeometryAfterVertexMove(t,new f(this._stagedVertex),e,s,h),r())})}else{const i=null!=this._stagedVertex?new f(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}else r()}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=this._editGeometryOperations?.data.geometry.clone();if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);if(h){const t=n.getZ(a),e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){const o=n.spatialReference,[a,h]=wt(t);let p=Gt(r);const l=n.pointToArray(e);this._updateGeometryFromGraphic(t,p,a,h,l,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)?(p=this._moveRelatedCoordinates(p,t,l),p=this._moveSelectedHandleCoordinates(p,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(p),this._updateCurveGraphicLocations(p)):this._isMidpoint(t)&&this._updateCurveGraphicLocations(p),ot(r,p)}this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_syncEditGeometryOperations(t){const e=this._editGeometryOperations?.trySetGeometry(t);e||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(t,e,i){const{relatedGraphicIndices:s}=e.attributes,o=this._coordinateHelper.spatialReference;if(!s?.length)return t;for(const r of s){const s=this.vertexGraphics.at(r),[n,a]=wt(s);Ot(t,n,a,i,o),s.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=wt(n),h=n.getAttribute(et.relatedGraphicIndices),p=D(n.geometry,i,s,this.view),l=C(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,l,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=wt(e);Ot(t,s,o,l,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?Mt(e,i,s,[o[0],o[1]],t.getAttribute(et.controlPointKind)):(Ot(e,i,s,o,r),n&&(0===s?Ot(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(_t),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=i.clone(),o=[],{[et.pathIndex]:r,[et.pointIndexStart]:n,[et.pointIndexEnd]:a}=e.attributes,h=C(e.geometry),p=0===a?n+1:a;e.attributes={[et.tool]:rt,[et.pathIndex]:r,[et.pointIndex]:p,[et.relatedGraphicIndices]:[]};const l=Gt(s),c=l[r][a];if(V(c)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=I(l[r][p]);l[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(et.controlPointKind,st.circle.interior),e.setAttribute(et.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),ot(s,l)}else l[r].splice(p,0,h),o.push({coordinates:l[r][p],componentIndex:r,vertexIndex:p})}else{const t=I(l[r][n]),e=nt(t,c,.5,this._coordinateHelper);l[r].splice(a,1,...e),o.push({coordinates:I(l[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),this._syncEditGeometryOperations(s),o}_addToSelection(t){const e=Lt(t);for(const i of e)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&yt(t,this.tooltip)||ct.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),t.stopPropagation())}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=e.clone();let r=Gt(o);const n=[],a=Lt(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=I(s[o]);if(t===a&&e===h){n.push({coordinates:I(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!V(t)&&(r[i][o]=I(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=I(t[0]),[s,o]=I(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);ot(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),_t)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,B(i,o,this._tooltipsContext,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,J(i,o,n,this._tooltipsContext,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function bt(t){const e=Gt(t.clone());if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!V(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function Gt(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function xt(t,e,i,s){const o=t[e][i];if(L(o))o.c[1]=s;else if(H(o)){const o=I(t[e][i]);t[e][i]={c:[o,s]}}}function Mt(t,e,i,s,o){switch(o){case st.circle.interior:xt(t,e,i,s);break;case st.bezier.cp1:t[e][i].b[1]=s;break;case st.bezier.cp2:t[e][i].b[2]=s}}function Ct(t,e){return t<1e-8*e}function St(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[l,c]=n,d=l-h,m=c-p;e-=h,i-=p;const u=a?o>r:o<r,[v,y]=s?[e,i]:u?[-i,e]:[i,-e],[_,g]=[d,m],[f,b]=[v,y],G=_*b-g*f,x=(d**2+m**2)/2;if(Ct(Math.abs(G),x))return[(h+l)/2,(p+c)/2];const[M,C]=[b/G*x,-f/G*x],S=M**2+C**2,[E,O]=[d/2-M,m/2-C];if(Ct(E**2+O**2,S)){const[t,e]=u?[-C,M]:[C,-M];return[t+M+h,e+C+p]}const w=Math.sqrt((M**2+C**2)/(E**2+O**2))*Math.sign(d*v+m*y);return[E*w+M+h,O*w+C+p]}function Et(t,e,i){const s=G(new b({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=x(s,i),r=o[0][1];return P(r)?r:w(t,r)}function Ot(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(at(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(ht(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,l]=[n-o,a-r],c=T(l,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,c,h,i.a[6]]})}const a=I(r);if(V(r))r.splice(0,r.length,...s);else if(k(r))r.b[0].splice(0,r.b[0].length,...s);else if(L(r)||H(r)){const o=I(t[e][i-1]),n=L(r)?O(o,r):R(o,r);t[e].splice(i,1,{c:[[...s],St(o,n,s,!0)]})}else if(P(r)){r.a[0].splice(0,r.a[0].length,...s);const n=I(t[e][i-1]);r.a=Et(n,r,o).a}if(n&&!V(n)&&!k(r))if(L(n)||H(n)){const o=I(n),r=L(n)?O(a,n):R(a,n);t[e].splice(i+1,1,{c:[o,St(o,r,s,!1)]})}else if(P(n)){const t=I(r);n.a=Et(t,n,o).a}}function wt({attributes:t}){return[t?.[et.pathIndex]||0,t?.[et.pointIndex]||0]}function It({attributes:t}){return`${t?.[et.pathIndex]}-${t?.[et.pointIndex]}`}function Lt(t){return t instanceof e?[t]:[...t]}function Ht(t){const e=t.sourceLayer??t.layer;return q(e)?{graphic:t,layer:e}:null}function kt(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[et.pathIndex],vertexIndex:t[et.pointIndex]}))}t([y()],ft.prototype,"_activeOperationInfo",void 0),t([y()],ft.prototype,"_connectedReshapeManager",void 0),t([y()],ft.prototype,"_coordinateHelper",null),t([y()],ft.prototype,"_editGeometryOperations",void 0),t([y()],ft.prototype,"_segmentLabels",void 0),t([y()],ft.prototype,"test",null),t([y()],ft.prototype,"_segmentLabelsImportTask",void 0),t([y()],ft.prototype,"_updatingHandles",void 0),t([y()],ft.prototype,"_selectedManipulator",null),t([y()],ft.prototype,"_tooltipsContext",null),t([y()],ft.prototype,"callbacks",void 0),t([y()],ft.prototype,"connectedReshapeProviders",void 0),t([y()],ft.prototype,"enableMidpoints",void 0),t([y()],ft.prototype,"enableCurveOnMidpoint",void 0),t([y()],ft.prototype,"enableMovement",void 0),t([y()],ft.prototype,"enableVertices",void 0),t([y()],ft.prototype,"graphic",void 0),t([y()],ft.prototype,"highlightName",void 0),t([y()],ft.prototype,"highlightsEnabled",void 0),t([y()],ft.prototype,"layer",void 0),t([y()],ft.prototype,"snappingManager",void 0),t([y({readOnly:!0})],ft.prototype,"state",null),t([y()],ft.prototype,"symbols",void 0),t([y()],ft.prototype,"tooltip",void 0),t([y()],ft.prototype,"tooltipInfos",void 0),t([y()],ft.prototype,"activeTooltipInfo",void 0),t([y({constructOnly:!0})],ft.prototype,"automaticAreaMeasurementUtils",void 0),t([y({constructOnly:!0})],ft.prototype,"automaticLengthMeasurementUtils",void 0),t([y()],ft.prototype,"updating",null),t([y({type:mt})],ft.prototype,"sketchOptions",void 0),t([y({readOnly:!0})],ft.prototype,"type",void 0),t([y({readOnly:!0})],ft.prototype,"vertexGraphics",void 0),t([y({readOnly:!0})],ft.prototype,"curveControlPointGraphics",void 0),t([y({readOnly:!0})],ft.prototype,"constructionLineGraphics",void 0),t([y({readOnly:!0})],ft.prototype,"midpointGraphics",void 0),t([y({readOnly:!0})],ft.prototype,"selectedManipulators",void 0),t([y()],ft.prototype,"view",void 0),ft=t([_("esri.views.draw.support.Reshape")],ft);const Vt=ft;export{Vt as default};
5
+ import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,abortMaybe as p,assertIsSome as l}from"../../../core/maybe.js";import{pausable as c,when as d,watch as m,initial as u,sync as v}from"../../../core/reactiveUtils.js";import{property as y,subclass as _}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../../../core/support/UpdatingHandles.js";import f from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{fromGeometry as G,toGeometry as x}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as M,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{isPoint as S}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as E}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as O,toEllipticArc7 as w}from"../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as I,isCircularArc as L,isEllipticArc4 as H,isBezierCurve as k,isCoordinate as V,isEllipticArc7 as P}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as R}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as T}from"../../../geometry/support/curves/mathUtils.js";import A from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as U}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as j}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as F,cloneMove as D}from"./drawUtils.js";import z from"./GraphicMover.js";import K from"./HighlightHelper.js";import{addUniqueLayer as N,isConnectedReshapeSupportedLayer as q}from"./layerUtils.js";import{createTooltipInfos as Z,connectTooltip as $,updateTranslateTooltipInfo as B,updateTranslateVertexTooltipInfo as J}from"./reshapeTooltipUtils.js";import{defaultSymbols as Q,createMidpointGraphics as W,createVertexGraphics as X,createCurveControlPointGraphics as Y,createCurveConstructionLineGraphics as tt,attributeKeys as et,getMidpoint as it,controlPointKinds as st,saveUpdatedCurveOrCoordinate as ot,toolIdAttribute as rt,splitCurve as nt,isSingleSegmentCircle as at,isSingleSegmentEllipse as ht}from"./reshapeUtils.js";import{ViewEventPriorities as pt}from"../../input/InputManager.js";import{createCoordinateHelper as lt}from"../../interactive/coordinateHelper.js";import{sketchKeys as ct}from"../../interactive/keybindings.js";import{EditGeometryOperations as dt}from"../../interactive/editGeometry/EditGeometryOperations.js";import mt from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as ut}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as vt,enterInputModeIfAvailable as yt}from"../../interactive/tooltip/tooltipCommonUtils.js";const _t=Symbol(),gt={mode:"on-the-ground",offset:0};let ft=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._updatingHandles=new g,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=Q,this.tooltip=null,this.activeTooltipInfo=null,this.sketchOptions=new mt,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new K({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=c(()=>this.graphic?.geometry,t=>{if(!t)return;const e=new Set(this.selectedManipulators.map(It));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(It(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).toArray();i&&h.push(o),s?.set("graphics",h)},v),this.tooltip=vt(()=>({view:t,options:this.sketchOptions.tooltips})),this.tooltipInfos=Z(this.sketchOptions),this.addHandles([d(()=>t?.ready,()=>{const{layer:t,view:e}=this;N(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),pt.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),m(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),$(this.tooltip,()=>this._tooltipsContext),m(()=>this.sketchOptions.labels.enabled,t=>{this._segmentLabels?this._segmentLabels.visible=t:this._setUpGeometryHelper()}),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),u),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=h(this._mover),this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._updatingHandles=h(this._updatingHandles)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??lt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,sketchOptions:i,activeTooltipInfo:s,graphic:o}=this;return{sketchOptions:i,activeTooltipInfo:s,graphic:o,selectedVertex:this._selectedManipulator,automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}get updating(){return this._updatingHandles.updating}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&M(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;if(null==t||"mesh"===t.type||"extent"===t.type)return this._segmentLabels=h(this._segmentLabels),void this._logGeometryTypeError();this._editGeometryOperations?this._syncEditGeometryOperations(t):this._editGeometryOperations=dt.fromGeometry(t,2,{allowCurves:!0}),this._updatingHandles.addPromise(this._setupSegmentLabels())}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new A({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;l(i),this._snappingContext=new ut({editGeometryOperations:i,elevationInfo:gt,pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new U(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._activeOperationInfo=null,this._mover=h(this._mover),this.removeHandles(_t)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=bt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=W(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){this._removeVertexGraphics();const e=X(t,this.symbols,this._coordinateHelper);this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}_setupCurveGraphics(t){this._removeCurveGraphics();const e=Y(t,this.symbols,this._coordinateHelper),i=tt(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(e)}async _setupSegmentLabels(){const t=this._editGeometryOperations,e=this.sketchOptions.labels.enabled;if(t&&this._segmentLabels?.context?.editGeometryOperations===t&&e||(this._segmentLabels=h(this._segmentLabels)),!this._segmentLabels&&t&&e){const e=this._segmentLabelsImportTask??=i(async t=>{const e=import("../../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(e);return t.aborted?null:i}),s=await e.promise;if(!s)return;this._segmentLabels=h(this._segmentLabels),this._segmentLabels=new s({context:{view:this.view,editGeometryOperations:t,elevationInfo:gt,labelOptions:this.sketchOptions.labels,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},visible:!0})}}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",t),hover:this.symbols.controlPoints.hover?.clone().set("color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[et.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).toArray();t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new z({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager=new j({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?Ht(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,kt(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else{if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const e=bt(n);this._updateVertexGraphicLocations(e);const{dxMap:o,dyMap:r}=F(i,s,this.view);this._connectedReshapeManager?.translate(o,r,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}this._syncEditGeometryOperations(n)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t,{operationType:r}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)||o.getAttribute(et.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(I(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.midpointGraphics){const{pathIndex:s,pointIndexStart:o,pointIndexEnd:r}=i.attributes,n=t[s];i.geometry=it(n[o],n[r],e)}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=wt(s);null!=t&&null!=e&&s.getAttribute(et.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=wt(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(L(r)||H(r)){const i=I(t[e][o-1]),n=L(r)?O(i,r):R(i,r),[a,h]=E(n,.25);s.geometry=new f({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(k(r)){const t=s.getAttribute(et.controlPointKind),[e,i]=t===st.bezier.cp1?r.b[1]:r.b[2];s.geometry=new f({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(et.controlPointKind),[o,r]=wt(s),n=t[o],a=I(n[r-1]),h=I(n[r]),p=t[o][r];i===st.bezier.line1?s.geometry=new b({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new b({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=wt(t);s===e&&o>=i&&t.setAttribute(et.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(et.pathIndex)!==e)continue;const t=o.getAttribute(et.pointIndexStart);t>=i&&(o.setAttribute(et.pointIndexStart,t+1),o.setAttribute(et.pointIndexEnd,o.getAttribute(et.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=wt(t);return l(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&S(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new f(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});p.valid&&(this._stagedVertex=p.apply(),this._syncGeometryAfterVertexMove(t,new f(this._stagedVertex),e,s,h),r())})}else{const i=null!=this._stagedVertex?new f(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}else r()}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=this._editGeometryOperations?.data.geometry.clone();if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);if(h){const t=n.getZ(a),e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){const o=n.spatialReference,[a,h]=wt(t);let p=Gt(r);const l=n.pointToArray(e);this._updateGeometryFromGraphic(t,p,a,h,l,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)?(p=this._moveRelatedCoordinates(p,t,l),p=this._moveSelectedHandleCoordinates(p,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(p),this._updateCurveGraphicLocations(p)):this._isMidpoint(t)&&this._updateCurveGraphicLocations(p),ot(r,p)}this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_syncEditGeometryOperations(t){const e=this._editGeometryOperations?.trySetGeometry(t);e||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(t,e,i){const{relatedGraphicIndices:s}=e.attributes,o=this._coordinateHelper.spatialReference;if(!s?.length)return t;for(const r of s){const s=this.vertexGraphics.at(r),[n,a]=wt(s);Ot(t,n,a,i,o),s.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=wt(n),h=n.getAttribute(et.relatedGraphicIndices),p=D(n.geometry,i,s,this.view),l=C(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,l,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=wt(e);Ot(t,s,o,l,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?Mt(e,i,s,[o[0],o[1]],t.getAttribute(et.controlPointKind)):(Ot(e,i,s,o,r),n&&(0===s?Ot(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(_t),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=i.clone(),o=[],{[et.pathIndex]:r,[et.pointIndexStart]:n,[et.pointIndexEnd]:a}=e.attributes,h=C(e.geometry),p=0===a?n+1:a;e.attributes={[et.tool]:rt,[et.pathIndex]:r,[et.pointIndex]:p,[et.relatedGraphicIndices]:[]};const l=Gt(s),c=l[r][a];if(V(c)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=I(l[r][p]);l[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(et.controlPointKind,st.circle.interior),e.setAttribute(et.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),ot(s,l)}else l[r].splice(p,0,h),o.push({coordinates:l[r][p],componentIndex:r,vertexIndex:p})}else{const t=I(l[r][n]),e=nt(t,c,.5,this._coordinateHelper);l[r].splice(a,1,...e),o.push({coordinates:I(l[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),this._syncEditGeometryOperations(s),o}_addToSelection(t){const e=Lt(t);for(const i of e)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&yt(t,this.tooltip)||ct.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),t.stopPropagation())}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=e.clone();let r=Gt(o);const n=[],a=Lt(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=I(s[o]);if(t===a&&e===h){n.push({coordinates:I(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!V(t)&&(r[i][o]=I(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=I(t[0]),[s,o]=I(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);ot(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),_t)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,B(i,o,this._tooltipsContext,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,J(i,o,n,this._tooltipsContext,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function bt(t){const e=Gt(t.clone());if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!V(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function Gt(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function xt(t,e,i,s){const o=t[e][i];if(L(o))o.c[1]=s;else if(H(o)){const o=I(t[e][i]);t[e][i]={c:[o,s]}}}function Mt(t,e,i,s,o){switch(o){case st.circle.interior:xt(t,e,i,s);break;case st.bezier.cp1:t[e][i].b[1]=s;break;case st.bezier.cp2:t[e][i].b[2]=s}}function Ct(t,e){return t<1e-8*e}function St(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[l,c]=n,d=l-h,m=c-p;e-=h,i-=p;const u=a?o>r:o<r,[v,y]=s?[e,i]:u?[-i,e]:[i,-e],[_,g]=[d,m],[f,b]=[v,y],G=_*b-g*f,x=(d**2+m**2)/2;if(Ct(Math.abs(G),x))return[(h+l)/2,(p+c)/2];const[M,C]=[b/G*x,-f/G*x],S=M**2+C**2,[E,O]=[d/2-M,m/2-C];if(Ct(E**2+O**2,S)){const[t,e]=u?[-C,M]:[C,-M];return[t+M+h,e+C+p]}const w=Math.sqrt((M**2+C**2)/(E**2+O**2))*Math.sign(d*v+m*y);return[E*w+M+h,O*w+C+p]}function Et(t,e,i){const s=G(new b({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=x(s,i),r=o[0][1];return P(r)?r:w(t,r)}function Ot(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(at(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(ht(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,l]=[n-o,a-r],c=T(l,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,c,h,i.a[6]]})}const a=I(r);if(V(r))r.splice(0,r.length,...s);else if(k(r))r.b[0].splice(0,r.b[0].length,...s);else if(L(r)||H(r)){const o=I(t[e][i-1]),n=L(r)?O(o,r):R(o,r);t[e].splice(i,1,{c:[[...s],St(o,n,s,!0)]})}else if(P(r)){r.a[0].splice(0,r.a[0].length,...s);const n=I(t[e][i-1]);r.a=Et(n,r,o).a}if(n&&!V(n)&&!k(r))if(L(n)||H(n)){const o=I(n),r=L(n)?O(a,n):R(a,n);t[e].splice(i+1,1,{c:[o,St(o,r,s,!1)]})}else if(P(n)){const t=I(r);n.a=Et(t,n,o).a}}function wt({attributes:t}){return[t?.[et.pathIndex]||0,t?.[et.pointIndex]||0]}function It({attributes:t}){return`${t?.[et.pathIndex]}-${t?.[et.pointIndex]}`}function Lt(t){return t instanceof e?[t]:[...t]}function Ht(t){const e=t.sourceLayer??t.layer;return q(e)?{graphic:t,layer:e}:null}function kt(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[et.pathIndex],vertexIndex:t[et.pointIndex]}))}t([y()],ft.prototype,"_activeOperationInfo",void 0),t([y()],ft.prototype,"_connectedReshapeManager",void 0),t([y()],ft.prototype,"_coordinateHelper",null),t([y()],ft.prototype,"_editGeometryOperations",void 0),t([y()],ft.prototype,"_segmentLabels",void 0),t([y()],ft.prototype,"test",null),t([y()],ft.prototype,"_segmentLabelsImportTask",void 0),t([y()],ft.prototype,"_updatingHandles",void 0),t([y()],ft.prototype,"_selectedManipulator",null),t([y()],ft.prototype,"_tooltipsContext",null),t([y()],ft.prototype,"callbacks",void 0),t([y()],ft.prototype,"connectedReshapeProviders",void 0),t([y()],ft.prototype,"enableMidpoints",void 0),t([y()],ft.prototype,"enableCurveOnMidpoint",void 0),t([y()],ft.prototype,"enableMovement",void 0),t([y()],ft.prototype,"enableVertices",void 0),t([y()],ft.prototype,"graphic",void 0),t([y()],ft.prototype,"highlightName",void 0),t([y()],ft.prototype,"highlightsEnabled",void 0),t([y()],ft.prototype,"layer",void 0),t([y()],ft.prototype,"snappingManager",void 0),t([y({readOnly:!0})],ft.prototype,"state",null),t([y()],ft.prototype,"symbols",void 0),t([y()],ft.prototype,"tooltip",void 0),t([y()],ft.prototype,"tooltipInfos",void 0),t([y()],ft.prototype,"activeTooltipInfo",void 0),t([y({constructOnly:!0})],ft.prototype,"automaticAreaMeasurementUtils",void 0),t([y({constructOnly:!0})],ft.prototype,"automaticLengthMeasurementUtils",void 0),t([y()],ft.prototype,"updating",null),t([y({type:mt})],ft.prototype,"sketchOptions",void 0),t([y({readOnly:!0})],ft.prototype,"type",void 0),t([y({readOnly:!0})],ft.prototype,"vertexGraphics",void 0),t([y({readOnly:!0})],ft.prototype,"curveControlPointGraphics",void 0),t([y({readOnly:!0})],ft.prototype,"constructionLineGraphics",void 0),t([y({readOnly:!0})],ft.prototype,"midpointGraphics",void 0),t([y({readOnly:!0})],ft.prototype,"selectedManipulators",void 0),t([y()],ft.prototype,"view",void 0),ft=t([_("esri.views.draw.support.Reshape")],ft);const Vt=ft;export{Vt as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{EventedAccessor as e}from"../../core/Evented.js";import"../../core/has.js";import"../../core/Logger.js";import{createResolver as i}from"../../core/promiseUtils.js";import{property as a,subclass as o}from"../../core/accessorSupport/decorators.js";import{ManipulatorCollection as s}from"./ManipulatorCollection.js";let n=class extends e{constructor(t){super(t),this.manipulators=new s,this.automaticManipulatorSelection=!0,this.hasGrabbedManipulators=!1,this.hasHoveredManipulators=!1,this.firstGrabbedManipulator=null,this.created=!1,this.removeIncompleteOnCancel=!0,this._editableFlags=new Map([[1,!0],[0,!0]]),this._creationFinishedResolver=i()}get active(){return null!=this.view&&this.view.activeTool===this}set visible(t){this._get("visible")!==t&&(this._set("visible",t),this._syncVisible())}get editable(){return this.getEditableFlag(0)}set editable(t){this.setEditableFlag(0,t)}get updating(){return!1}get cursor(){return null}get hasFocusedManipulators(){return this.hasGrabbedManipulators||this.hasHoveredManipulators}destroy(){this.manipulators.destroy(),this._set("view",null)}onAdd(){this._syncVisible()}activate(){null!=this.view&&(this.view.focus(),this.onActivate())}deactivate(){this.onDeactivate()}cancel(){this.emit("cancel")}handleInputEvent(t){this.onInputEvent(t)}handleInputEventAfter(t){this.onInputEventAfter(t)}setEditableFlag(t,e){this._editableFlags.set(t,e),this.manipulators.isToolEditable=this.internallyEditable,this._updateManipulatorAttachment(),0===t&&this.notifyChange("editable"),this.onEditableChange(),this.onManipulatorSelectionChanged()}getEditableFlag(t){return this._editableFlags.get(t)??!1}endDrag(){const t=this.view.inputManager.latestPointerInfo?.location;if(!t)return;let e=!1;this.manipulators.forEach(({manipulator:i})=>{i.dragging&&(e=!0,i.events.emit("drag",{action:"end",start:t,screenPoint:t}))}),e&&(this.view.toolViewManager.activeTool=null)}whenCreated(){return this._creationFinishedResolver.promise}onManipulatorSelectionChanged(){}onActivate(){}onDeactivate(){}onShow(){}onHide(){}onEditableChange(){}onInputEvent(t){}onInputEventAfter(t){}get internallyEditable(){return this.getEditableFlag(0)&&this.getEditableFlag(1)}finishToolCreation(){this.created||this._creationFinishedResolver.resolve(this),this._set("created",!0)}_syncVisible(){if(this.initialized)if(this.visible)this._show();else if(this._hide(),this.active)return void(this.view.activeTool=null)}_show(){this._updateManipulatorAttachment(),this.onShow()}_hide(){this._updateManipulatorAttachment(),this.onHide()}_updateManipulatorAttachment(){this.visible?this.manipulators.attach():this.manipulators.detach()}};t([a({constructOnly:!0})],n.prototype,"view",void 0),t([a({readOnly:!0})],n.prototype,"active",null),t([a({value:!0})],n.prototype,"visible",null),t([a({value:!0})],n.prototype,"editable",null),t([a({readOnly:!0})],n.prototype,"manipulators",void 0),t([a({readOnly:!0})],n.prototype,"updating",null),t([a()],n.prototype,"cursor",null),t([a({readOnly:!0})],n.prototype,"automaticManipulatorSelection",void 0),t([a()],n.prototype,"hasFocusedManipulators",null),t([a()],n.prototype,"hasGrabbedManipulators",void 0),t([a()],n.prototype,"hasHoveredManipulators",void 0),t([a()],n.prototype,"firstGrabbedManipulator",void 0),t([a({readOnly:!0})],n.prototype,"created",void 0),t([a({readOnly:!0})],n.prototype,"removeIncompleteOnCancel",void 0),n=t([o("esri.views.interactive.InteractiveToolBase")],n);export{n as InteractiveToolBase};
5
+ import{__decorate as t}from"tslib";import{EventedAccessor as e}from"../../core/Evented.js";import"../../core/has.js";import"../../core/Logger.js";import{createResolver as i}from"../../core/promiseUtils.js";import{property as a,subclass as o}from"../../core/accessorSupport/decorators.js";import{ManipulatorCollection as s}from"./ManipulatorCollection.js";let n=class extends e{constructor(t){super(t),this.manipulators=new s,this.automaticManipulatorSelection=!0,this.multiTouchEnabled=!0,this.hasGrabbedManipulators=!1,this.hasHoveredManipulators=!1,this.firstGrabbedManipulator=null,this.created=!1,this.removeIncompleteOnCancel=!0,this._editableFlags=new Map([[1,!0],[0,!0]]),this._creationFinishedResolver=i()}get active(){return null!=this.view&&this.view.activeTool===this}set visible(t){this._get("visible")!==t&&(this._set("visible",t),this._syncVisible())}get editable(){return this.getEditableFlag(0)}set editable(t){this.setEditableFlag(0,t)}get updating(){return!1}get cursor(){return null}get hasFocusedManipulators(){return this.hasGrabbedManipulators||this.hasHoveredManipulators}destroy(){this.manipulators.destroy(),this._set("view",null)}onAdd(){this._syncVisible()}activate(){null!=this.view&&(this.view.focus(),this.onActivate())}deactivate(){this.onDeactivate()}cancel(){this.emit("cancel")}handleInputEvent(t){this.onInputEvent(t)}handleInputEventAfter(t){this.onInputEventAfter(t)}setEditableFlag(t,e){this._editableFlags.set(t,e),this.manipulators.isToolEditable=this.internallyEditable,this._updateManipulatorAttachment(),0===t&&this.notifyChange("editable"),this.onEditableChange(),this.onManipulatorSelectionChanged()}getEditableFlag(t){return this._editableFlags.get(t)??!1}endDrag(){const t=this.view.inputManager.latestPointerInfo?.location;if(!t)return;let e=!1;this.manipulators.forEach(({manipulator:i})=>{i.dragging&&(e=!0,i.events.emit("drag",{action:"end",start:t,screenPoint:t}))}),e&&(this.view.toolViewManager.activeTool=null)}whenCreated(){return this._creationFinishedResolver.promise}onManipulatorSelectionChanged(){}onActivate(){}onDeactivate(){}onShow(){}onHide(){}onEditableChange(){}onInputEvent(t){}onInputEventAfter(t){}get internallyEditable(){return this.getEditableFlag(0)&&this.getEditableFlag(1)}finishToolCreation(){this.created||this._creationFinishedResolver.resolve(this),this._set("created",!0)}_syncVisible(){if(this.initialized)if(this.visible)this._show();else if(this._hide(),this.active)return void(this.view.activeTool=null)}_show(){this._updateManipulatorAttachment(),this.onShow()}_hide(){this._updateManipulatorAttachment(),this.onHide()}_updateManipulatorAttachment(){this.visible?this.manipulators.attach():this.manipulators.detach()}};t([a({constructOnly:!0})],n.prototype,"view",void 0),t([a({readOnly:!0})],n.prototype,"active",null),t([a({value:!0})],n.prototype,"visible",null),t([a({value:!0})],n.prototype,"editable",null),t([a({readOnly:!0})],n.prototype,"manipulators",void 0),t([a({readOnly:!0})],n.prototype,"updating",null),t([a()],n.prototype,"cursor",null),t([a({readOnly:!0})],n.prototype,"automaticManipulatorSelection",void 0),t([a({readOnly:!0})],n.prototype,"multiTouchEnabled",void 0),t([a()],n.prototype,"hasFocusedManipulators",null),t([a()],n.prototype,"hasGrabbedManipulators",void 0),t([a()],n.prototype,"hasHoveredManipulators",void 0),t([a()],n.prototype,"firstGrabbedManipulator",void 0),t([a({readOnly:!0})],n.prototype,"created",void 0),t([a({readOnly:!0})],n.prototype,"removeIncompleteOnCancel",void 0),n=t([o("esri.views.interactive.InteractiveToolBase")],n);export{n as InteractiveToolBase};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import{find as o}from"../../core/iteratorUtils.js";import{clamp as r}from"../../core/mathUtils.js";import i from"../../core/ReactiveMap.js";import{createScreenPoint as a}from"../../core/screenUtils.js";import{property as n,subclass as s}from"../../core/accessorSupport/decorators.js";import{areToolManipulatorsEditable as l}from"./interactiveToolUtils.js";import{createScreenPointFromEvent as p}from"../support/screenUtils.js";let u=class extends e{constructor(){super(...arguments),this._pointerLocations=new Map,this._hoveredManipulators=new i,this._grabbedManipulators=new i,this._draggedManipulators=new Map,this._stopDrag=!1,this._externallyDragging=!1,this._revertToNullActiveTool=!1}get cursor(){return this._cursorFromMap(this._grabbedManipulators,"grabbing")??this._cursorFromMap(this._hoveredManipulators,"pointer")}get hasFocusedManipulators(){return this._grabbedManipulators.size>0||this._draggedManipulators.size>0}handleInputEvent(t,e){const o=()=>t.stopPropagation();switch(t.type){case"pointer-move":d(t.pointerType)&&this._pointerLocations.set(t.pointerId,{x:t.x,y:t.y,pointerType:t.pointerType});break;case"drag":this._grabbedManipulators.size>0?this._stopDrag=!0:"start"===t.action?this._externallyDragging=!0:"end"===t.action&&(this._externallyDragging=!1),this._stopDrag&&(o(),"end"===t.action&&(this._stopDrag=!1));break;case"pointer-down":{if(!g(t))break;const r=p(t),i=c(r,t.pointerType,e.tools);if(null==i)break;const a=i.manipulator,n=i.tool;null==a||null==n||!a.interactive||a.grabbable&&a.grabbableForEvent(t)||!a.grabbing||a.dragging||this._releaseManipulatorBeforeDragging(a,t,e),null!=a&&null!=n&&a.interactive&&a.grabbable&&a.grabbableForEvent(t)&&!a.grabbing&&(this._grabbedManipulators.set(t.pointerId,{manipulator:a,tool:n,start:r,pointerType:t.pointerType}),1===this._grabbedManipulators.size&&null==e.activeTool&&(this._revertToNullActiveTool=!0,e.setActiveTool(i.tool)),a.grabbing=!0,a.events.emit("grab-changed",{action:"start",pointerType:t.pointerType,screenPoint:r}),o());break}case"pointer-up":this._draggedManipulators.has(t.pointerId)||this._handlePointerEnd(t,e);break;case"pointer-drag":{if(!g(t))break;const i=this._grabbedManipulators.get(t.pointerId),a=i?.manipulator,n=i?.tool;if(null==a||null==n)break;const s=p(t);s.x=r(s.x,0,e.view.width),s.y=r(s.y,0,e.view.height);const l=i.start,u=this._draggedManipulators.get(t.pointerId);switch(t.action){case"start":case"update":"update"!==t.action&&1!==this._grabbedManipulators.size||(a.dragging=!0,u?a.events.emit("drag",{action:"update",start:l,screenPoint:s}):a.events.emit("drag",{action:"start",start:l,screenPoint:s,pointerType:t.pointerType}),this._draggedManipulators.set(t.pointerId,{tool:n,manipulator:a,start:l}));break;case"end":a.dragging=!1,u&&a.events.emit("drag",{action:"end",start:l,screenPoint:s}),this._draggedManipulators.delete(t.pointerId),this._handlePointerEnd(t,e)}o();break}case"immediate-click":{const r=p(t),i=c(r,t.pointerType,e.tools);if(!h(t))for(const t of e.tools)if((null==i||i.tool!==t||t.automaticManipulatorSelection)&&t.manipulators){let e=!1;t.manipulators.forEach(({manipulator:t})=>{t.selected&&(t.selected=!1,e=!0)}),e&&t.onManipulatorSelectionChanged&&t.onManipulatorSelectionChanged()}if(null==i)break;const{manipulator:a,tool:n}=i;if(!a.interactive)break;a.selectable&&n.automaticManipulatorSelection&&(a.selected=!a.selected,n.onManipulatorSelectionChanged&&n.onManipulatorSelectionChanged());const s=t.native.shiftKey;a.events.emit("immediate-click",{screenPoint:r,button:t.button,pointerType:t.pointerType,shiftKey:s,stopPropagation:o}),b(a,o);break}case"click":{const r=p(t),i=c(r,t.pointerType,e.tools),a=i?.manipulator;if(null==a||!a.interactive)break;const n=t.native.shiftKey;a.events.emit(t.type,{screenPoint:r,button:t.button,pointerType:t.pointerType,shiftKey:n}),o();break}case"double-click":{const r=p(t),i=c(r,t.pointerType,e.tools),a=null!=i?i.manipulator:null;if(null==a||!a.interactive)break;const n=t.native.shiftKey;a.events.emit("double-click",{screenPoint:r,button:t.button,pointerType:t.pointerType,shiftKey:n,stopPropagation:o}),b(a,o);break}case"immediate-double-click":{const r=p(t),i=c(r,t.pointerType,e.tools),a=null!=i?i.manipulator:null;if(null==a||!a.interactive)break;const n=t.native.shiftKey;a.events.emit("immediate-double-click",{screenPoint:r,button:t.button,pointerType:t.pointerType,shiftKey:n,stopPropagation:o}),"mouse"===t.pointerType&&b(a,o);break}}this._onFocusChange(e.tools)}_releaseManipulatorBeforeDragging(t,e,o){t.grabbing=!1,t.events.emit("grab-changed",{action:"end",pointerType:e.pointerType,screenPoint:p(e)}),this._grabbedManipulators.forEach(({manipulator:e},o)=>{e===t&&this._grabbedManipulators.delete(o)}),this._afterManipulatorRelease(o.setActiveTool)}_handlePointerEnd(t,e){const o=this._grabbedManipulators.get(t.pointerId)?.manipulator;null!=o&&o.grabbing&&(o.grabbing=!1,o.events.emit("grab-changed",{action:"end",pointerType:t.pointerType,screenPoint:p(t)}),this._grabbedManipulators.delete(t.pointerId),this._afterManipulatorRelease(e.setActiveTool))}_onFocusChange(t){this._updateFocusedManipulatorTools(t)}_updateFocusedManipulatorTools(t){const e=new Set,r=new Set;this._grabbedManipulators.forEach(({tool:t})=>e.add(t)),this._hoveredManipulators.forEach(({tool:t})=>r.add(t));for(const i of t){i.hasGrabbedManipulators=e.has(i),i.hasHoveredManipulators=r.has(i);const t=this._grabbedManipulators.values(),a=o(t,({tool:t})=>t===i);i.firstGrabbedManipulator=null!=a?a.manipulator:null}}clearPointers(t,{tools:e,setActiveTool:o},r=!0,i){const a=(e,o)=>e===t&&(null==i||i===o);this._grabbedManipulators.forEach(({tool:t,manipulator:e,pointerType:o},r)=>{a(t,e)&&(this._grabbedManipulators.delete(r),e.grabbing=!1,e.events.emit("grab-changed",{action:"end",screenPoint:null,pointerType:o}))}),this._draggedManipulators.forEach(({tool:t,manipulator:e},o)=>{a(t,e)&&(this._draggedManipulators.delete(o),e.dragging=!1,e.events.emit("drag",{action:"cancel"}))}),r&&this._hoveredManipulators.forEach(({tool:t,manipulator:e},o)=>{a(t,e)&&(this._hoveredManipulators.delete(o),e.hovering=!1)}),this._afterManipulatorRelease(o),this._onFocusChange(e)}updateHoveredStateFromKnownPointers(t){this._pointerLocations.forEach((e,o)=>{this._updateHoveredStateForPointerAtScreenPosition(a(e.x,e.y),o,e.pointerType,t)})}handleHoverEvent(t,e){const o=t.type;"pointer-up"!==o&&"immediate-click"!==o&&"pointer-move"!==o||!d(t.pointerType)||("pointer-up"!==o&&this._externallyDragging?this._clearHoveredManipulatorStates(t.pointerId):this._updateHoveredStateForPointerAtScreenPosition(p(t),t.pointerId,t.pointerType,e))}_updateHoveredStateForPointerAtScreenPosition(t,e,o,r){let i=c(t,o,r);const a=this._hoveredManipulators.get(e)?.manipulator;null==i||i.manipulator.interactive||(i=null),null!=i&&a===i.manipulator||(null!=a&&(a.hovering=!1),null!=i?(i.manipulator.hovering=!0,this._hoveredManipulators.set(e,i)):this._hoveredManipulators.delete(e),this._onFocusChange(r))}_afterManipulatorRelease(t){0===this._grabbedManipulators.size&&this._revertToNullActiveTool&&(t(null),this._revertToNullActiveTool=!1)}_clearHoveredManipulatorStates(t){this._hoveredManipulators.forEach(({manipulator:e},o)=>{t===o&&(this._hoveredManipulators.delete(t),e.hovering=!1)})}_cursorFromMap(t,e){if(!t?.size)return null;for(const{manipulator:o}of t.values())if(o?.interactive){if(o.grabbing&&o.grabCursor)return o.grabCursor;if(o.cursor)return o.cursor}return e}};function c(t,e,o){for(const r of o){if(null==r.manipulators||!l(r))continue;const o=r.manipulators.intersect(t,e);if(null!=o)return{tool:r,manipulator:o}}return null}function d(t){return"mouse"===t}function g(t){return"mouse"!==t.pointerType||0===t.button}function h(t){return!!t.native.shiftKey}function b(t,e){t?.consumesClicks&&e()}t([n()],u.prototype,"cursor",null),u=t([s("esri.views.interactive.ToolViewManagerManipulatorState")],u);export{u as ToolViewManagerManipulatorState};
5
+ import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import{find as o}from"../../core/iteratorUtils.js";import{clamp as r}from"../../core/mathUtils.js";import i from"../../core/ReactiveMap.js";import{createScreenPoint as a}from"../../core/screenUtils.js";import{property as n,subclass as s}from"../../core/accessorSupport/decorators.js";import{areToolManipulatorsEditable as l}from"./interactiveToolUtils.js";import{createScreenPointFromEvent as p}from"../support/screenUtils.js";let u=class extends e{constructor(){super(...arguments),this._pointerLocations=new Map,this._hoveredManipulators=new i,this._grabbedManipulators=new i,this._draggedManipulators=new Map,this._stopDrag=!1,this._externallyDragging=!1,this._revertToNullActiveTool=!1}get cursor(){return this._cursorFromMap(this._grabbedManipulators,"grabbing")??this._cursorFromMap(this._hoveredManipulators,"pointer")}get hasFocusedManipulators(){return this._grabbedManipulators.size>0||this._draggedManipulators.size>0}handleInputEvent(t,e){const o=()=>t.stopPropagation();switch(t.type){case"pointer-move":d(t.pointerType)&&this._pointerLocations.set(t.pointerId,{x:t.x,y:t.y,pointerType:t.pointerType});break;case"drag":this._grabbedManipulators.size>0?this._stopDrag=!0:"start"===t.action?this._externallyDragging=!0:"end"===t.action&&(this._externallyDragging=!1),this._stopDrag&&(o(),"end"===t.action&&(this._stopDrag=!1));break;case"pointer-down":{if(!g(t))break;const r=p(t),i=c(r,t.pointerType,e.tools);if(null==i)break;const a=i.manipulator,n=i.tool;null==a||null==n||!a.interactive||a.grabbable&&a.grabbableForEvent(t)||!a.grabbing||a.dragging||this._releaseManipulatorBeforeDragging(a,t,e),null!=a&&null!=n&&a.interactive&&a.grabbable&&a.grabbableForEvent(t)&&!a.grabbing&&(this._grabbedManipulators.set(t.pointerId,{manipulator:a,tool:n,start:r,pointerType:t.pointerType}),1===this._grabbedManipulators.size&&null==e.activeTool&&(this._revertToNullActiveTool=!0,e.setActiveTool(i.tool)),a.grabbing=!0,a.events.emit("grab-changed",{action:"start",pointerType:t.pointerType,screenPoint:r}),o());break}case"pointer-up":this._draggedManipulators.has(t.pointerId)||this._handlePointerEnd(t,e);break;case"pointer-drag":{if(!g(t))break;const i=this._grabbedManipulators.get(t.pointerId),a=i?.manipulator,n=i?.tool,{activeTool:s}=e;if(null!=s&&!s.multiTouchEnabled&&e.multiTouchActive&&0===this._draggedManipulators.size&&this._grabbedManipulators.size>0){this.clearPointers(s,e,!0);break}if(null==a||null==n)break;const l=p(t);l.x=r(l.x,0,e.view.width),l.y=r(l.y,0,e.view.height);const u=i.start,c=this._draggedManipulators.get(t.pointerId);switch(t.action){case"start":case"update":"update"!==t.action&&1!==this._grabbedManipulators.size||(a.dragging=!0,c?a.events.emit("drag",{action:"update",start:u,screenPoint:l}):a.events.emit("drag",{action:"start",start:u,screenPoint:l,pointerType:t.pointerType}),this._draggedManipulators.set(t.pointerId,{tool:n,manipulator:a,start:u}));break;case"end":a.dragging=!1,c&&a.events.emit("drag",{action:"end",start:u,screenPoint:l}),this._draggedManipulators.delete(t.pointerId),this._handlePointerEnd(t,e)}o();break}case"immediate-click":{const r=p(t),i=c(r,t.pointerType,e.tools);if(!h(t))for(const t of e.tools)if((null==i||i.tool!==t||t.automaticManipulatorSelection)&&t.manipulators){let e=!1;t.manipulators.forEach(({manipulator:t})=>{t.selected&&(t.selected=!1,e=!0)}),e&&t.onManipulatorSelectionChanged&&t.onManipulatorSelectionChanged()}if(null==i)break;const{manipulator:a,tool:n}=i;if(!a.interactive)break;a.selectable&&n.automaticManipulatorSelection&&(a.selected=!a.selected,n.onManipulatorSelectionChanged&&n.onManipulatorSelectionChanged());const s=t.native.shiftKey;a.events.emit("immediate-click",{screenPoint:r,button:t.button,pointerType:t.pointerType,shiftKey:s,stopPropagation:o}),b(a,o);break}case"click":{const r=p(t),i=c(r,t.pointerType,e.tools),a=i?.manipulator;if(null==a||!a.interactive)break;const n=t.native.shiftKey;a.events.emit(t.type,{screenPoint:r,button:t.button,pointerType:t.pointerType,shiftKey:n}),o();break}case"double-click":{const r=p(t),i=c(r,t.pointerType,e.tools),a=null!=i?i.manipulator:null;if(null==a||!a.interactive)break;const n=t.native.shiftKey;a.events.emit("double-click",{screenPoint:r,button:t.button,pointerType:t.pointerType,shiftKey:n,stopPropagation:o}),b(a,o);break}case"immediate-double-click":{const r=p(t),i=c(r,t.pointerType,e.tools),a=null!=i?i.manipulator:null;if(null==a||!a.interactive)break;const n=t.native.shiftKey;a.events.emit("immediate-double-click",{screenPoint:r,button:t.button,pointerType:t.pointerType,shiftKey:n,stopPropagation:o}),"mouse"===t.pointerType&&b(a,o);break}}this._onFocusChange(e.tools)}_releaseManipulatorBeforeDragging(t,e,o){t.grabbing=!1,t.events.emit("grab-changed",{action:"end",pointerType:e.pointerType,screenPoint:p(e)}),this._grabbedManipulators.forEach(({manipulator:e},o)=>{e===t&&this._grabbedManipulators.delete(o)}),this._afterManipulatorRelease(o.setActiveTool)}_handlePointerEnd(t,e){const o=this._grabbedManipulators.get(t.pointerId)?.manipulator;null!=o&&o.grabbing&&(o.grabbing=!1,o.events.emit("grab-changed",{action:"end",pointerType:t.pointerType,screenPoint:p(t)}),this._grabbedManipulators.delete(t.pointerId),this._afterManipulatorRelease(e.setActiveTool))}_onFocusChange(t){this._updateFocusedManipulatorTools(t)}_updateFocusedManipulatorTools(t){const e=new Set,r=new Set;this._grabbedManipulators.forEach(({tool:t})=>e.add(t)),this._hoveredManipulators.forEach(({tool:t})=>r.add(t));for(const i of t){i.hasGrabbedManipulators=e.has(i),i.hasHoveredManipulators=r.has(i);const t=this._grabbedManipulators.values(),a=o(t,({tool:t})=>t===i);i.firstGrabbedManipulator=null!=a?a.manipulator:null}}clearPointers(t,{tools:e,setActiveTool:o},r=!0,i){const a=(e,o)=>!(null!=t&&e!==t||null!=i&&i!==o);this._grabbedManipulators.forEach(({tool:t,manipulator:e,pointerType:o},r)=>{a(t,e)&&(this._grabbedManipulators.delete(r),e.grabbing=!1,e.events.emit("grab-changed",{action:"end",screenPoint:null,pointerType:o}))}),this._draggedManipulators.forEach(({tool:t,manipulator:e},o)=>{a(t,e)&&(this._draggedManipulators.delete(o),e.dragging=!1,e.events.emit("drag",{action:"cancel"}))}),r&&this._hoveredManipulators.forEach(({tool:t,manipulator:e},o)=>{a(t,e)&&(this._hoveredManipulators.delete(o),e.hovering=!1)}),this._afterManipulatorRelease(o),this._onFocusChange(e)}updateHoveredStateFromKnownPointers(t){this._pointerLocations.forEach((e,o)=>{this._updateHoveredStateForPointerAtScreenPosition(a(e.x,e.y),o,e.pointerType,t)})}handleHoverEvent(t,e){const o=t.type;"pointer-up"!==o&&"immediate-click"!==o&&"pointer-move"!==o||!d(t.pointerType)||("pointer-up"!==o&&this._externallyDragging?this._clearHoveredManipulatorStates(t.pointerId):this._updateHoveredStateForPointerAtScreenPosition(p(t),t.pointerId,t.pointerType,e))}_updateHoveredStateForPointerAtScreenPosition(t,e,o,r){let i=c(t,o,r);const a=this._hoveredManipulators.get(e)?.manipulator;null==i||i.manipulator.interactive||(i=null),null!=i&&a===i.manipulator||(null!=a&&(a.hovering=!1),null!=i?(i.manipulator.hovering=!0,this._hoveredManipulators.set(e,i)):this._hoveredManipulators.delete(e),this._onFocusChange(r))}_afterManipulatorRelease(t){0===this._grabbedManipulators.size&&this._revertToNullActiveTool&&(t(null),this._revertToNullActiveTool=!1)}_clearHoveredManipulatorStates(t){this._hoveredManipulators.forEach(({manipulator:e},o)=>{t===o&&(this._hoveredManipulators.delete(t),e.hovering=!1)})}_cursorFromMap(t,e){if(!t?.size)return null;for(const{manipulator:o}of t.values())if(o?.interactive){if(o.grabbing&&o.grabCursor)return o.grabCursor;if(o.cursor)return o.cursor}return e}};function c(t,e,o){for(const r of o){if(null==r.manipulators||!l(r))continue;const o=r.manipulators.intersect(t,e);if(null!=o)return{tool:r,manipulator:o}}return null}function d(t){return"mouse"===t}function g(t){return"mouse"!==t.pointerType||0===t.button}function h(t){return!!t.native.shiftKey}function b(t,e){t?.consumesClicks&&e()}t([n()],u.prototype,"cursor",null),u=t([s("esri.views.interactive.ToolViewManagerManipulatorState")],u);export{u as ToolViewManagerManipulatorState};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as i}from"tslib";import e from"../../core/Collection.js";import{referenceSetter as s,castForReferenceSetter as r}from"../../core/collectionUtils.js";import{watch as t,sync as l}from"../../core/reactiveUtils.js";import{property as a,subclass as y}from"../../core/accessorSupport/decorators.js";import o from"./LayerView.js";let h=class extends o{constructor(i){super(i),this.type="group",this.layerViews=new e}destroy(){this.layerViews.length=0}_allLayerViewVisibility(i){this.layerViews.forEach(e=>{e.visible=i})}initialize(){this.addHandles([this.layerViews.on("change",i=>this._layerViewsChangeHandler(i)),t(()=>this.layer?.visibilityMode,()=>{this.layer&&this._applyVisibility(()=>this._allLayerViewVisibility(this.visible),()=>this._applyExclusiveVisibility(null))},l),t(()=>this.visible,i=>{this._applyVisibility(()=>this._allLayerViewVisibility(i),()=>{})},l)],"grouplayerview"),this._layerViewsChangeHandler({target:null,added:this.layerViews.toArray(),removed:[],moved:[]})}get creatingLayerViews(){return this.view?.layerViewManager?.isCreatingLayerViewsForLayer(this.layer)??!1}set layerViews(i){this._set("layerViews",s(i,this._get("layerViews")))}get updatingProgress(){return 0===this.layerViews.length?1:this.layerViews.reduce((i,e)=>i+e.updatingProgress,0)/this.layerViews.length}isUpdating(){return this.creatingLayerViews||this.layerViews.some(i=>i.updating)}_hasLayerViewVisibleOverrides(){return this.layerViews.some(i=>i._isOverridden("visible"))}_findLayerViewForLayer(i){return i&&this.layerViews.find(e=>e.layer===i)}_firstVisibleOnLayerOrder(){const i=this.layer.layers.find(i=>{const e=this._findLayerViewForLayer(i);return!!e?.visible});return i&&this._findLayerViewForLayer(i)}_applyExclusiveVisibility(i){null==i&&null==(i=this._firstVisibleOnLayerOrder())&&this.layerViews.length>0&&(i=this._findLayerViewForLayer(this.layer.layers.at(0))),this.layerViews.forEach(e=>{e.visible=e===i})}_layerViewsChangeHandler(i){this.removeHandles("grouplayerview:visible"),this.addHandles(this.layerViews.map(i=>t(()=>i.visible,e=>this._applyVisibility(()=>{e!==this.visible&&(i.visible=this.visible)},()=>this._applyExclusiveVisibility(e?i:null)),l)).toArray(),"grouplayerview:visible");const e=i.added[i.added.length-1];this._applyVisibility(()=>this._allLayerViewVisibility(this.visible),()=>this._applyExclusiveVisibility(e?.visible?e:null))}_applyVisibility(i,e){this._hasLayerViewVisibleOverrides()&&("inherited"===this.layer?.visibilityMode?i():"exclusive"===this.layer?.visibilityMode&&e())}};i([a({readOnly:!0})],h.prototype,"creatingLayerViews",null),i([a({cast:r})],h.prototype,"layerViews",null),i([a({readOnly:!0})],h.prototype,"updatingProgress",null),i([a()],h.prototype,"view",void 0),h=i([y("esri.views.layers.GroupLayerView")],h);export{h as default};
5
+ import{__decorate as i}from"tslib";import e from"../../core/Collection.js";import{referenceSetter as s,castForReferenceSetter as r}from"../../core/collectionUtils.js";import{watch as l,sync as t}from"../../core/reactiveUtils.js";import{property as a,subclass as y}from"../../core/accessorSupport/decorators.js";import o from"./LayerView.js";let h=class extends o{constructor(i){super(i),this.type="group",this.layerViews=new e}destroy(){this.layerViews.removeAll()}_allLayerViewVisibility(i){this.layerViews.forEach(e=>{e.visible=i})}initialize(){this.addHandles([this.layerViews.on("change",i=>this._layerViewsChangeHandler(i)),l(()=>this.layer?.visibilityMode,()=>{this.layer&&this._applyVisibility(()=>this._allLayerViewVisibility(this.visible),()=>this._applyExclusiveVisibility(null))},t),l(()=>this.visible,i=>{this._applyVisibility(()=>this._allLayerViewVisibility(i),()=>{})},t)],"grouplayerview"),this._layerViewsChangeHandler({target:null,added:this.layerViews.toArray(),removed:[],moved:[]})}get creatingLayerViews(){return this.view?.layerViewManager?.isCreatingLayerViewsForLayer(this.layer)??!1}set layerViews(i){this._set("layerViews",s(i,this._get("layerViews")))}get updatingProgress(){return 0===this.layerViews.length?1:this.layerViews.reduce((i,e)=>i+e.updatingProgress,0)/this.layerViews.length}isUpdating(){return this.creatingLayerViews||this.layerViews.some(i=>i.updating)}_hasLayerViewVisibleOverrides(){return this.layerViews.some(i=>i._isOverridden("visible"))}_findLayerViewForLayer(i){return i&&this.layerViews.find(e=>e.layer===i)}_firstVisibleOnLayerOrder(){const i=this.layer.layers.find(i=>{const e=this._findLayerViewForLayer(i);return!!e?.visible});return i&&this._findLayerViewForLayer(i)}_applyExclusiveVisibility(i){null==i&&null==(i=this._firstVisibleOnLayerOrder())&&this.layerViews.length>0&&(i=this._findLayerViewForLayer(this.layer.layers.at(0))),this.layerViews.forEach(e=>{e.visible=e===i})}_layerViewsChangeHandler(i){this.removeHandles("grouplayerview:visible"),this.addHandles(this.layerViews.map(i=>l(()=>i.visible,e=>this._applyVisibility(()=>{e!==this.visible&&(i.visible=this.visible)},()=>this._applyExclusiveVisibility(e?i:null)),t)).toArray(),"grouplayerview:visible");const e=i.added[i.added.length-1];this._applyVisibility(()=>this._allLayerViewVisibility(this.visible),()=>this._applyExclusiveVisibility(e?.visible?e:null))}_applyVisibility(i,e){this._hasLayerViewVisibleOverrides()&&("inherited"===this.layer?.visibilityMode?i():"exclusive"===this.layer?.visibilityMode&&e())}};i([a({readOnly:!0})],h.prototype,"creatingLayerViews",null),i([a({cast:r})],h.prototype,"layerViews",null),i([a({readOnly:!0})],h.prototype,"updatingProgress",null),i([a()],h.prototype,"view",void 0),h=i([y("esri.views.layers.GroupLayerView")],h);export{h as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{removeUnordered as e,filterInPlace as t}from"../../core/arrayUtils.js";import s from"../../core/Handles.js";import"../../core/has.js";import r from"../../core/Logger.js";import{removeMaybe as i}from"../../core/maybe.js";import{recordPerformance as a}from"../../core/performance.js";import n from"../../core/PerformanceSampler.js";import{isAborted as u,createAbortError as _,when as h,isPromiseLike as o,ignoreAbortErrors as E}from"../../core/promiseUtils.js";import{watch as d,initial as T,when as c}from"../../core/reactiveUtils.js";import{signal as m}from"../../core/signal.js";import{Milliseconds as l}from"../../core/time.js";import g from"./debugFlags.js";import{PromiseQueue as R}from"./PromiseQueue.js";import{Yield as I}from"./Yield.js";function f(){return new C}const p={RESOURCE_CONTROLLER_IMMEDIATE:"immediate",RESOURCE_CONTROLLER:"schedule",SLIDE:"slide",STREAM_DATA_LOADER:"stream loader",ELEVATION_QUERY:"elevation query",TERRAIN_SURFACE:"terrain",SURFACE_GEOMETRY_UPDATES:"surface geometry updates",LOD_RENDERER:"LoD renderer",GRAPHICS_CORE:"Graphics3D",I3S_CONTROLLER:"I3S",POINT_CLOUD_LAYER:"point cloud",FEATURE_TILE_FETCHER:"feature fetcher",STREAM_CONTROLLER:"stream controller",OVERLAY:"overlay",OVERLAY_RENDERER:"overlay renderer",STAGE:"stage",GRAPHICS_DECONFLICTOR:"graphics deconflictor",FILTER_VISIBILITY:"graphics filter visibility",SCALE_VISIBILITY:"graphics scale visibility",FRUSTUM_VISIBILITY:"graphics frustum visibility",POINT_OF_INTEREST_FREQUENT:"POI frequent",POINT_OF_INTEREST_INFREQUENT:"POI infrequent",LABELER:"labeler",FEATURE_QUERY_ENGINE:"feature query",FEATURE_TILE_TREE:"feature tile tree",FEATURE_TILE_TREE_ACTIVE:"fast feature tile tree",ELEVATION_ALIGNMENT:"elevation alignment",ELEVATION_ALIGNMENT_SCENE:"elevation alignment scene",TEXT_TEXTURE_ATLAS:"text texture atlas",TEXTURE_UNLOAD:"texture unload",LINE_OF_SIGHT_TOOL:"line of sight tool",LINE_OF_SIGHT_TOOL_INTERACTIVE:"interactive line of sight tool",ELEVATION_PROFILE:"elevation profile",SNAPPING:"snapping",SHADOW_ACCUMULATOR:"shadow accumulator",CLOUDS_GENERATOR:"clouds generator",FLOW_GENERATOR:"flow generator",MAPVIEW_FETCH_QUEUE:"mapview fetch queue",MAPVIEW_LAYERVIEW_UPDATE:"mapview layerview update",MAPVIEW_VECTOR_TILE_PARSING_QUEUE:"mapview vector tile parsing queue",NONE:0,TEST_PRIO:1},L=0,A=new Map([[p.RESOURCE_CONTROLLER_IMMEDIATE,L],[p.RESOURCE_CONTROLLER,4],[p.SLIDE,L],[p.STREAM_DATA_LOADER,L],[p.ELEVATION_QUERY,L],[p.TERRAIN_SURFACE,1],[p.SURFACE_GEOMETRY_UPDATES,1],[p.LOD_RENDERER,2],[p.GRAPHICS_CORE,2],[p.I3S_CONTROLLER,2],[p.POINT_CLOUD_LAYER,2],[p.FEATURE_TILE_FETCHER,2],[p.STREAM_CONTROLLER,2],[p.CLOUDS_GENERATOR,2],[p.OVERLAY,4],[p.OVERLAY_RENDERER,4],[p.STAGE,4],[p.GRAPHICS_DECONFLICTOR,4],[p.FILTER_VISIBILITY,4],[p.SCALE_VISIBILITY,4],[p.FRUSTUM_VISIBILITY,4],[p.POINT_OF_INTEREST_FREQUENT,6],[p.POINT_OF_INTEREST_INFREQUENT,30],[p.LABELER,8],[p.FEATURE_QUERY_ENGINE,8],[p.FEATURE_TILE_TREE,16],[p.FEATURE_TILE_TREE_ACTIVE,L],[p.ELEVATION_ALIGNMENT,12],[p.ELEVATION_ALIGNMENT_SCENE,14],[p.TEXT_TEXTURE_ATLAS,12],[p.TEXTURE_UNLOAD,12],[p.LINE_OF_SIGHT_TOOL,16],[p.LINE_OF_SIGHT_TOOL_INTERACTIVE,L],[p.SNAPPING,L],[p.SHADOW_ACCUMULATOR,30],[p.FLOW_GENERATOR,12],[p.MAPVIEW_FETCH_QUEUE,L],[p.MAPVIEW_LAYERVIEW_UPDATE,2],[p.MAPVIEW_VECTOR_TILE_PARSING_QUEUE,L]]);function O(e){return A.has(e)?A.get(e):"number"==typeof e?e:1}const N=l(6.5),b=l(1),k=l(30),S=l(1e3/30),P=l(100),U=.9;class C{get updating(){return this._updating.value}_updatingChanged(){this._updating.value=this._tasks.some(e=>e.needsUpdate)}constructor(){this._updating=m(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new n("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new y,this.state=1,this._tasks=new Array,this._runQueue=new Array,this._load=0,this._forceTask=!1,this._debug=!1,this._debugHandle=d(()=>g.SCHEDULER_LOG_SLOW_TASKS,e=>this._debug=e,T);for(const e of Object.keys(p))this.performanceInfo.tasks.set(p[e],new n(String(p[e])))}destroy(){this._tasks.forEach(e=>e.remove()),this._tasks.length=0,this._runQueue.length=0,i(this._debugHandle),this._microTaskQueued=!1,this._updatingChanged()}taskRunningChanged(e){this._updatingChanged(),e&&this._budget.remaining>0&&!this._microTaskQueued&&(this._microTaskQueued=!0,queueMicrotask(()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.remaining>0&&this._schedule()&&this._runFrame())}))}registerTask(e,t){const s=new F(this,e,t);return this._tasks.push(s),this._updatingChanged(),this.performanceInfo.tasks.has(e)||this.performanceInfo.tasks.set(e,new n(e)),s}get load(){return this._load}frame(e){if(this._startFrameTaskTimes(),this._updateBudget(e)){const e=this._budget.now();this._runFrame();const t=this._budget.now();this._recordFrameTaskTimes(t-e);const s=2===this.state?"Idle":1===this.state?"Interacting":"Animating";return a(`${s} Frame Tasks`,e,t,"Maps SDK","Scheduling"),!0}return this._recordFrameTaskTimes(0),!1}_updateBudget(e){this._test&&(this._test.usedBudget=0),++this._frameNumber;let t=N,s=e.frameDuration,r=b;switch(this.state){case 2:t=l(0),s=l(Math.max(P,e.frameDuration)),r=k;break;case 1:s=l(Math.max(S,e.frameDuration))}return s=l(s-e.elapsedFrameTime-t),2!==this.state&&s<b&&!this._forceTask?(this._forceTask=!0,!1):(s=l(Math.max(s,r)),this._budget.reset(s),this._updateLoad(),this._schedule())}_runFrame(){switch(this._forceTask=!1,this._microTaskQueued=!1,this.state){case 2:this._runIdle();break;case 1:this._runInteracting();break;default:this._runAnimating()}this._test&&(this._test.usedBudget=this._budget.elapsed)}stopFrame(){this._budget.reset(l(0)),this._budget.madeProgress()}removeTask(t){e(this._tasks,t),e(this._runQueue,t),this._updatingChanged()}_updateTask(e){this._tasks.forEach(t=>{t.name===e&&t.setPriority(e)})}_getState(e){if(this._runQueue.some(t=>t.name===e))return"s";let t="i";return this._tasks.forEach(s=>{s.name===e&&s.needsUpdate&&(s.schedulePriority<=1?t="r":"r"!==t&&(t="w"))}),t}_getRuntime(e){let t=0;return this._tasks.forEach(s=>{s.name===e&&(t+=s.runtime)}),t}_resetRuntimes(){this._tasks.forEach(e=>e.runtime=0)}_getRunning(){const e=new Map;if(this._tasks.forEach(t=>{t.needsUpdate&&e.set(t.name,(e.get(t.name)||0)+1)}),0===e.size)return null;let t="";return e.forEach((e,s)=>{t+=e>1?` ${e}x ${s}`:` ${s}`}),t}_runIdle(){this._run()}_runInteracting(){this._run()}_runAnimating(){this._run()}_updateLoad(){const e=this._tasks.reduce((e,t)=>t.needsUpdate?++e:e,0);this._load=this._load*U+e*(1-U)}_schedule(){for(t(this._runQueue,e=>!!e.needsUpdate||(e.schedulePriority=e.basePriority,!1)),this._tasks.forEach(e=>{e.basePriority===L&&e.needsUpdate&&!this._runQueue.includes(e)&&e.blockFrame!==this._frameNumber&&this._runQueue.unshift(e)});0===this._runQueue.length;){let e=!1,t=0;if(this._tasks.forEach(s=>{if(s.needsUpdate&&0!==s.schedulePriority&&s.basePriority!==L&&s.blockFrame!==this._frameNumber)if(e=!0,t=Math.max(t,s.basePriority),1===s.schedulePriority)s.schedulePriority=0,this._runQueue.push(s);else--s.schedulePriority}),!e)return this._updatingChanged(),!1}return this._updatingChanged(),!0}_run(){do{for(;this._runQueue.length>0;){const t=this._budget.now(),s=this._runQueue.pop();this._budget.resetProgress();try{s.task.runTask(this._budget)===I&&(s.blockFrame=this._frameNumber)}catch(e){r.getLogger("esri.views.support.Scheduler").error(`Exception in task "${s.name}"`,e),s.blockFrame=this._frameNumber}!this._budget.hasProgressed&&s.blockFrame!==this._frameNumber&&s.needsUpdate&&(s.name,p.I3S_CONTROLLER,s.blockFrame=this._frameNumber),s.schedulePriority=s.basePriority;const i=this._budget.now(),n=i-t;if(a(`${s.name}`,t,i,"Maps SDK","Scheduling"),s.runtime+=n,this._frameTaskTimes.set(s.priority,this._frameTaskTimes.get(s.priority)+n),this._budget.remaining<=0)return void this._updatingChanged()}}while(this._schedule());this._updatingChanged()}_startFrameTaskTimes(){for(const e of Object.keys(p))this._frameTaskTimes.set(p[e],0)}_recordFrameTaskTimes(e){this._frameTaskTimes.forEach((e,t)=>this.performanceInfo.tasks.get(t).push(e)),this.performanceInfo.total.push(e)}get test(){return this._test}}class F{get task(){return this._task.value}get readyToRun(){return this._queue.readyToRun}get updating(){return this._queue.updating}constructor(e,t,r){this._scheduler=e,this.name=t,this.blockFrame=0,this.runtime=0,this._queue=new R,this._handles=new s,this._basePriority=O(t),this.schedulePriority=this._basePriority,this._task=m(null!=r?r:this._queue),this._handles.add(c(()=>this.task.readyToRun,t=>e.taskRunningChanged(t)))}remove(){this.processQueue(w),this._scheduler.removeTask(this),this.schedule=Q.schedule,this.reschedule=Q.reschedule,this.scheduleGenerator=Q.scheduleGenerator,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(e){if(this.name===e)return;this.name=e;const t=O(e);this._basePriority!==L&&0===this.schedulePriority||(this.schedulePriority=t),this._basePriority=t}get priority(){return this.name}set priority(e){this.setPriority(e)}get needsUpdate(){return this.readyToRun||!this.task.destroyed&&this.task.readyToRun}schedule(e,t,s){return this._queue.push(e,t,s)}reschedule(e,t,s){return this._queue.unshift(e,t,s)}scheduleGenerator(e,t,s){return this._queue.pushGenerator(e,t,s)}processQueue(e){return this._queue.runTask(e)}}class y{constructor(){this._begin=performance?.now()??0,this._budget=0,this._done=!1,this._progressed=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e){this._begin=this.now(),this._budget=e,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return this.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}}const w=new y;function D(e){const t=new y;return t.reset(e),t}w.enabled=!1;class M{remove(){}processQueue(){}schedule(e,t,s){try{if(u(t)){const e=_();return s?Promise.resolve(s(e)):Promise.reject(e)}return h(e(w))}catch(r){return Promise.reject(r)}}reschedule(e,t,s){return this.schedule(e,t,s)}async scheduleGenerator(e,t,s){if(u(t)){const e=_();if(s)return s(e);throw e}const r=e(w);for(;;){const e=r.next(w),i=o(e)?await e:e;if(u(t)){const e=_();if(s){const t=s(e),i=r.return(null);return o(i)&&await E(i),t}const t=r.throw(e);throw o(t)&&await E(t),e}if(i.done)return i.value}}}const Q=new M;export{Q as ImmediateTask,p as TaskPriority,O as getTaskPriority,D as makeBudget,f as newScheduler,w as noBudget,A as taskPriorities};
5
+ import{removeUnordered as e,filterInPlace as t}from"../../core/arrayUtils.js";import s from"../../core/Handles.js";import"../../core/has.js";import r from"../../core/Logger.js";import{removeMaybe as i}from"../../core/maybe.js";import{recordPerformance as a}from"../../core/performance.js";import n from"../../core/PerformanceSampler.js";import{isAborted as u,createAbortError as _,when as h,isPromiseLike as o,ignoreAbortErrors as E}from"../../core/promiseUtils.js";import{watch as d,initial as T,when as c}from"../../core/reactiveUtils.js";import{signal as m}from"../../core/signal.js";import{Milliseconds as l}from"../../core/time.js";import R from"./debugFlags.js";import{PromiseQueue as g}from"./PromiseQueue.js";import{Yield as I}from"./Yield.js";function p(){return new C}const f={RESOURCE_CONTROLLER_IMMEDIATE:"immediate",RESOURCE_CONTROLLER:"schedule",SLIDE:"slide",STREAM_DATA_LOADER:"stream loader",ELEVATION_QUERY:"elevation query",TERRAIN_SURFACE:"terrain",SURFACE_GEOMETRY_UPDATES:"surface geometry updates",LOD_RENDERER:"LoD renderer",GRAPHICS_CORE:"Graphics3D",I3S_CONTROLLER:"I3S",POINT_CLOUD_LAYER:"point cloud",FEATURE_TILE_FETCHER:"feature fetcher",STREAM_CONTROLLER:"stream controller",OVERLAY:"overlay",OVERLAY_RENDERER:"overlay renderer",STAGE:"stage",GRAPHICS_DECONFLICTOR:"graphics deconflictor",FILTER_VISIBILITY:"graphics filter visibility",SCALE_VISIBILITY:"graphics scale visibility",FRUSTUM_VISIBILITY:"graphics frustum visibility",POINT_OF_INTEREST_FREQUENT:"POI frequent",POINT_OF_INTEREST_INFREQUENT:"POI infrequent",LABELER:"labeler",FEATURE_QUERY_ENGINE:"feature query",FEATURE_TILE_TREE:"feature tile tree",FEATURE_TILE_TREE_ACTIVE:"fast feature tile tree",ELEVATION_ALIGNMENT:"elevation alignment",ELEVATION_ALIGNMENT_SCENE:"elevation alignment scene",TEXT_TEXTURE_ATLAS:"text texture atlas",TEXTURE_UNLOAD:"texture unload",LINE_OF_SIGHT_TOOL:"line of sight tool",LINE_OF_SIGHT_TOOL_INTERACTIVE:"interactive line of sight tool",ELEVATION_PROFILE:"elevation profile",SNAPPING:"snapping",SHADOW_ACCUMULATOR:"shadow accumulator",CLOUDS_GENERATOR:"clouds generator",FLOW_GENERATOR:"flow generator",MAPVIEW_FETCH_QUEUE:"mapview fetch queue",MAPVIEW_LAYERVIEW_UPDATE:"mapview layerview update",MAPVIEW_VECTOR_TILE_PARSING_QUEUE:"mapview vector tile parsing queue",NONE:0,TEST_PRIO:1},L=0,O=new Map([[f.RESOURCE_CONTROLLER_IMMEDIATE,L],[f.RESOURCE_CONTROLLER,4],[f.SLIDE,L],[f.STREAM_DATA_LOADER,L],[f.ELEVATION_QUERY,L],[f.TERRAIN_SURFACE,1],[f.SURFACE_GEOMETRY_UPDATES,1],[f.LOD_RENDERER,2],[f.GRAPHICS_CORE,2],[f.I3S_CONTROLLER,2],[f.POINT_CLOUD_LAYER,2],[f.FEATURE_TILE_FETCHER,2],[f.STREAM_CONTROLLER,2],[f.CLOUDS_GENERATOR,2],[f.OVERLAY,4],[f.OVERLAY_RENDERER,4],[f.STAGE,4],[f.GRAPHICS_DECONFLICTOR,4],[f.FILTER_VISIBILITY,4],[f.SCALE_VISIBILITY,4],[f.FRUSTUM_VISIBILITY,4],[f.POINT_OF_INTEREST_FREQUENT,6],[f.POINT_OF_INTEREST_INFREQUENT,30],[f.LABELER,8],[f.FEATURE_QUERY_ENGINE,8],[f.FEATURE_TILE_TREE,16],[f.FEATURE_TILE_TREE_ACTIVE,L],[f.ELEVATION_ALIGNMENT,12],[f.ELEVATION_ALIGNMENT_SCENE,14],[f.TEXT_TEXTURE_ATLAS,12],[f.TEXTURE_UNLOAD,12],[f.LINE_OF_SIGHT_TOOL,16],[f.LINE_OF_SIGHT_TOOL_INTERACTIVE,L],[f.SNAPPING,L],[f.SHADOW_ACCUMULATOR,30],[f.FLOW_GENERATOR,12],[f.MAPVIEW_FETCH_QUEUE,L],[f.MAPVIEW_LAYERVIEW_UPDATE,2],[f.MAPVIEW_VECTOR_TILE_PARSING_QUEUE,L]]);function A(e){return O.has(e)?O.get(e):"number"==typeof e?e:1}const N=l(6.5),b=l(1),S=l(30),k=l(1e3/30),P=l(100),U=.9;class C{get updating(){return this._updating.value}_updatingChanged(){this._updating.value=this._tasks.some(e=>e.needsUpdate)}constructor(){this._updating=m(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new n("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new y,this.state=1,this._tasks=new Array,this._runQueue=new Array,this._load=0,this._forceTask=!1,this._debug=!1,this._debugHandle=d(()=>R.SCHEDULER_LOG_SLOW_TASKS,e=>this._debug=e,T);for(const e of Object.keys(f))this.performanceInfo.tasks.set(f[e],new n(String(f[e])))}destroy(){this._tasks.forEach(e=>e.remove()),this._tasks.length=0,this._runQueue.length=0,i(this._debugHandle),this._microTaskQueued=!1,this._updatingChanged()}taskRunningChanged(e){this._updatingChanged(),e&&this._budget.remaining>0&&!this._microTaskQueued&&(this._microTaskQueued=!0,queueMicrotask(()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.remaining>0&&this._schedule()&&this._runFrame())}))}registerTask(e,t){const s=new F(this,e,t);return this._tasks.push(s),this._updatingChanged(),this.performanceInfo.tasks.has(e)||this.performanceInfo.tasks.set(e,new n(e)),s}get load(){return this._load}frame(e){if(this._startFrameTaskTimes(),this._updateBudget(e)){const e=this._budget.now();this._runFrame();const t=this._budget.now();this._recordFrameTaskTimes(t-e);const s=2===this.state?"Idle":1===this.state?"Interacting":"Animating";return a(`${s} Frame Tasks`,e,t,"Maps SDK","Scheduling"),!0}return this._recordFrameTaskTimes(0),!1}_updateBudget(e){this._test&&(this._test.usedBudget=0),++this._frameNumber;let t=N,s=e.frameDuration,r=b;switch(this.state){case 2:t=l(0),s=l(Math.max(P,e.frameDuration)),r=S;break;case 1:s=l(Math.max(k,e.frameDuration))}return s=l(s-e.elapsedFrameTime-t),2!==this.state&&s<b&&!this._forceTask?(this._forceTask=!0,!1):(s=l(Math.max(s,r)),this._budget.reset(s),this._updateLoad(),this._schedule())}_runFrame(){this._forceTask=!1,this._microTaskQueued=!1,this._run(),this._test&&(this._test.usedBudget=this._budget.elapsed)}stopFrame(){this._budget.reset(l(0)),this._budget.madeProgress()}removeTask(t){e(this._tasks,t),e(this._runQueue,t),this._updatingChanged()}_updateTask(e){this._tasks.forEach(t=>{t.name===e&&t.setPriority(e)})}_getState(e){if(this._runQueue.some(t=>t.name===e))return"s";let t="i";return this._tasks.forEach(s=>{s.name===e&&s.needsUpdate&&(s.schedulePriority<=1?t="r":"r"!==t&&(t="w"))}),t}_getRuntime(e){let t=0;return this._tasks.forEach(s=>{s.name===e&&(t+=s.runtime)}),t}_resetRuntimes(){this._tasks.forEach(e=>e.runtime=0)}_getRunning(){const e=new Map;if(this._tasks.forEach(t=>{t.needsUpdate&&e.set(t.name,(e.get(t.name)||0)+1)}),0===e.size)return null;let t="";return e.forEach((e,s)=>{t+=e>1?` ${e}x ${s}`:` ${s}`}),t}_updateLoad(){const e=this._tasks.reduce((e,t)=>t.needsUpdate?++e:e,0);this._load=this._load*U+e*(1-U)}_schedule(){for(t(this._runQueue,e=>!!e.needsUpdate||(e.schedulePriority=e.basePriority,!1)),this._tasks.forEach(e=>{e.basePriority===L&&e.needsUpdate&&!this._runQueue.includes(e)&&e.blockFrame!==this._frameNumber&&this._runQueue.unshift(e)});0===this._runQueue.length;){let e=!1,t=0;if(this._tasks.forEach(s=>{if(s.needsUpdate&&0!==s.schedulePriority&&s.basePriority!==L&&s.blockFrame!==this._frameNumber)if(e=!0,t=Math.max(t,s.basePriority),1===s.schedulePriority)s.schedulePriority=0,this._runQueue.push(s);else--s.schedulePriority}),!e)return this._updatingChanged(),!1}return this._updatingChanged(),!0}_run(){do{for(;this._runQueue.length>0;){const t=this._budget.now(),s=this._runQueue.pop();this._budget.resetProgress();try{s.task.runTask(this._budget)===I&&(s.blockFrame=this._frameNumber)}catch(e){r.getLogger("esri.views.support.Scheduler").error(`Exception in task "${s.name}"`,e),s.blockFrame=this._frameNumber}!this._budget.hasProgressed&&s.blockFrame!==this._frameNumber&&s.needsUpdate&&(s.name,f.I3S_CONTROLLER,s.blockFrame=this._frameNumber),s.schedulePriority=s.basePriority;const i=this._budget.now(),n=i-t;if(a(`${s.name}`,t,i,"Maps SDK","Scheduling"),s.runtime+=n,this._frameTaskTimes.set(s.priority,this._frameTaskTimes.get(s.priority)+n),this._budget.remaining<=0)return void this._updatingChanged()}}while(this._schedule());this._updatingChanged()}_startFrameTaskTimes(){for(const e of Object.keys(f))this._frameTaskTimes.set(f[e],0)}_recordFrameTaskTimes(e){this._frameTaskTimes.forEach((e,t)=>this.performanceInfo.tasks.get(t).push(e)),this.performanceInfo.total.push(e)}get test(){return this._test}}class F{get task(){return this._task.value}get readyToRun(){return this._queue.readyToRun}get updating(){return this._queue.updating}constructor(e,t,r){this._scheduler=e,this.name=t,this.blockFrame=0,this.runtime=0,this._queue=new g,this._handles=new s,this._basePriority=A(t),this.schedulePriority=this._basePriority,this._task=m(null!=r?r:this._queue),this._handles.add(c(()=>this.task.readyToRun,t=>e.taskRunningChanged(t)))}remove(){this.processQueue(w),this._scheduler.removeTask(this),this.schedule=Q.schedule,this.reschedule=Q.reschedule,this.scheduleGenerator=Q.scheduleGenerator,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(e){if(this.name===e)return;this.name=e;const t=A(e);this._basePriority!==L&&0===this.schedulePriority||(this.schedulePriority=t),this._basePriority=t}get priority(){return this.name}set priority(e){this.setPriority(e)}get needsUpdate(){return this.readyToRun||!this.task.destroyed&&this.task.readyToRun}schedule(e,t,s){return this._queue.push(e,t,s)}reschedule(e,t,s){return this._queue.unshift(e,t,s)}scheduleGenerator(e,t,s){return this._queue.pushGenerator(e,t,s)}processQueue(e){return this._queue.runTask(e)}}class y{constructor(){this._begin=performance?.now()??0,this._budget=0,this._done=!1,this._progressed=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e){this._begin=this.now(),this._budget=e,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return this.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}}const w=new y;function D(e){const t=new y;return t.reset(e),t}w.enabled=!1;class M{remove(){}processQueue(){}schedule(e,t,s){try{if(u(t)){const e=_();return s?Promise.resolve(s(e)):Promise.reject(e)}return h(e(w))}catch(r){return Promise.reject(r)}}reschedule(e,t,s){return this.schedule(e,t,s)}async scheduleGenerator(e,t,s){if(u(t)){const e=_();if(s)return s(e);throw e}const r=e(w);for(;;){const e=r.next(w),i=o(e)?await e:e;if(u(t)){const e=_();if(s){const t=s(e),i=r.return(null);return o(i)&&await E(i),t}const t=r.throw(e);throw o(t)&&await E(t),e}if(i.done)return i.value}}}const Q=new M;export{Q as ImmediateTask,f as TaskPriority,A as getTaskPriority,D as makeBudget,p as newScheduler,w as noBudget,O as taskPriorities};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import{IdentifiableMixin as s}from"../../../core/Identifiable.js";import{watch as a,syncAndInitial as i,on as o}from"../../../core/reactiveUtils.js";import{property as r,subclass as l}from"../../../core/accessorSupport/decorators.js";import{isEditableLayer as n}from"../../../layers/support/editableLayers.js";import c from"../../../support/actions/ActionToggle.js";import d from"../../Widget.js";import{css as h}from"../css.js";import{isValidDataCaptureLayer as p}from"../dataCaptureUtils.js";import m from"./OverlayLayersList.js";import{loadCalciteComponents as u}from"../../support/componentsUtils.js";import{globalCss as y}from"../../support/globalCss.js";import{tsx as g}from"../../support/widget.js";let L=class extends(s(d)){constructor(e){super(e),this._previousAction=null,this.closed=!1,this.dataCaptureEnabled=!1,this.dataCaptureLayer=null,this.imageGeometryField=null,this.imageReferenceField=null,this.layerList=new m({selectionMode:"multiple"}),this.messages=null,this.overlayedLayers=new t,this.showCameraLocations=!1,this.showMapFeatures=!1,this._createSelectedItemsHandle=()=>{this.removeHandles("selected-items"),this.addHandles(this._trackLayerSelectionChanges(),"selected-items")},this._createDataCaptureLayerHandle=()=>a(()=>({dataCaptureLayer:this.dataCaptureLayer,operationalItems:this.layerList.operationalItems}),({dataCaptureLayer:e,operationalItems:t},s)=>{if(!e&&s?.dataCaptureLayer){const e=t.find(e=>e.layer===s.dataCaptureLayer);e&&e.actionsSections?.items.forEach(e=>{e.items.forEach(e=>{"create-features"===e.id&&(e.value=!1)})})}},i),this._handleSelectedItemsChange=({added:e,removed:t})=>{e.forEach(e=>{this.overlayedLayers.includes(e.layer)||this.onLayerSelected?.(e)}),t.forEach(e=>{this.overlayedLayers.includes(e.layer)&&this.onLayerDeselected?.(e)}),this.overlayedLayers.removeAll(),this.overlayedLayers.addMany(this.layerList.selectedItems.items.map(e=>e.layer))},this._layerListTriggerActionHandle=()=>o(()=>this.layerList,"trigger-action",e=>{const{action:t,item:{layer:s}}=e;switch(this._resetPreviousAction(t),t.id){case"create-features":this._toggleDataCaptureLayer(t,s);break;case"show-all-features":{const e=s?.id;e&&this.onFilterCapturedFeatures?.(e);break}}}),this._resetPreviousAction=e=>{"toggle"===this._previousAction?.type&&this._previousAction!==e&&(this._previousAction.value=!1,this._previousAction=null)},this._toggleDataCaptureLayer=(e,t)=>{this._previousAction=e;const s=e.value;this.dataCaptureLayer=s?t:null,this.onDataCaptureLayerChanged?.(this.dataCaptureLayer)},this._trackLayerSelectionChanges=()=>o(()=>this.layerList.selectedItems,"change",this._handleSelectedItemsChange),this._watchLayerListForListItemCreatedFunction=()=>a(()=>({layerList:this.layerList,listItemCreatedFunction:this._listItemCreatedFunction}),()=>{this.layerList.listItemCreatedFunction=this._listItemCreatedFunction},i),this._watchSelectedItems=()=>a(()=>this.layerList.selectedItems,this._createSelectedItemsHandle,i)}initialize(){this.addHandles([this._watchSelectedItems(),this._layerListTriggerActionHandle(),this._watchLayerListForListItemCreatedFunction(),this._createDataCaptureLayerHandle()])}loadDependencies(){return u({list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}get _listItemCreatedFunction(){const{dataCaptureEnabled:e,imageGeometryField:t,imageReferenceField:s}=this;return e&&t&&s?async e=>{const{item:a}=e,i=a.layer,{dataCaptureLayer:o,overlayedLayers:r,messages:{createFeaturesFromImage:l,showFeatures:c},layerList:d}=this,h=r.includes(i),{selectedItems:m}=d;if(C(h,m,a),await(i?.load()),!i||!p(i,t,s)||!n(i))return;const u=o===i,y=_([l,c],a,m,u);u&&(this._previousAction=y)}:null}get view(){return this.layerList?.view}set view(e){this.layerList.view=e}_renderCameraLocationsSwitch(e){return g("calcite-list-item",{bind:this,label:this.messages.overlayCameraLocations,onclick:this._toggleShowCameraLocations},g("calcite-switch",{bind:this,checked:e,class:h.overlaysSwitch,onchange:this._toggleShowCameraLocations,scale:"s",slot:"actions-end"}))}_renderOverlayMapFeatures(e){return g("calcite-list-item",{bind:this,label:this.messages?.overlayMapFeatures,onclick:this._toggleShowMapFeatures},g("calcite-switch",{bind:this,checked:e,class:h.overlaysSwitch,onchange:this._toggleShowMapFeatures,scale:"s",slot:"actions-end"}))}_renderList(e){return e?g("div",{class:h.imageOverlaysLayerList},this.layerList.render()):null}_renderPanel(){const{closed:e,messages:t,showCameraLocations:s,showMapFeatures:a}=this;return g("calcite-panel",{bind:this,closable:!0,closed:e,heading:t.imageOverlays,onCalcitePanelClose:this.onImageOverlaysClosed},g("calcite-list",{label:t.imageOverlays},this._renderCameraLocationsSwitch(s),this._renderOverlayMapFeatures(a)),this._renderList(a))}_toggleShowCameraLocations(e){e.stopPropagation(),this.showCameraLocations=!this.showCameraLocations,this.onShowCameraLocationsChanged?.(this.showCameraLocations)}_toggleShowMapFeatures(e){e.stopPropagation(),this.showMapFeatures=!this.showMapFeatures,this.onShowMapFeaturesChanged?.(this.showMapFeatures)}render(){const e=this.layerList.operationalItems.items.length,t=this.showMapFeatures&&0===e,s=this.showMapFeatures&&e>0,a={[y.widget]:!0,[h.imageOverlaysNoResult]:t,[h.imageOverlaysIncreasedHeight]:s,[h.imageOverlays]:!t&&!s};return g("div",{class:this.classes(a)},this._renderPanel())}};e([r()],L.prototype,"_previousAction",void 0),e([r()],L.prototype,"_listItemCreatedFunction",null),e([r()],L.prototype,"closed",void 0),e([r()],L.prototype,"dataCaptureEnabled",void 0),e([r()],L.prototype,"dataCaptureLayer",void 0),e([r()],L.prototype,"imageGeometryField",void 0),e([r()],L.prototype,"imageReferenceField",void 0),e([r()],L.prototype,"layerList",void 0),e([r()],L.prototype,"messages",void 0),e([r()],L.prototype,"onDataCaptureLayerChanged",void 0),e([r()],L.prototype,"onFilterCapturedFeatures",void 0),e([r()],L.prototype,"onImageOverlaysClosed",void 0),e([r()],L.prototype,"onLayerDeselected",void 0),e([r()],L.prototype,"onLayerSelected",void 0),e([r()],L.prototype,"onShowCameraLocationsChanged",void 0),e([r()],L.prototype,"onShowMapFeaturesChanged",void 0),e([r()],L.prototype,"overlayedLayers",void 0),e([r()],L.prototype,"showCameraLocations",void 0),e([r()],L.prototype,"showMapFeatures",void 0),e([r()],L.prototype,"view",null),L=e([l("esri.widgets.OrientedImageryViewer.components.ImageOverlays")],L);const v=L;function C(e,t,s){e&&t.items.push(s)}function w(e,s){const a=new t;a.add(e[0]),a.add(e[1]),s.actionsSections=new t([a])}function _(e,t,s,o=!1){const r=new c({icon:"pencil",id:"create-features",title:e[0],value:o}),l=new c({icon:"list-show-all",id:"show-all-features",title:e[1],value:o});return t.addHandles(a(()=>s.includes(t),e=>{r.visible=e,l.visible=e},i)),w([r,l],t),r}export{v as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import{IdentifiableMixin as s}from"../../../core/Identifiable.js";import{watch as a,syncAndInitial as i,on as o}from"../../../core/reactiveUtils.js";import{property as r,subclass as l}from"../../../core/accessorSupport/decorators.js";import{isEditableLayer as n}from"../../../layers/support/editableLayers.js";import c from"../../../support/actions/ActionToggle.js";import d from"../../Widget.js";import{css as h}from"../css.js";import{isValidDataCaptureLayer as p}from"../dataCaptureUtils.js";import m from"./OverlayLayersList.js";import{loadCalciteComponents as u}from"../../support/componentsUtils.js";import{globalCss as y}from"../../support/globalCss.js";import{tsx as g}from"../../support/widget.js";let L=class extends(s(d)){constructor(e){super(e),this._previousAction=null,this.closed=!1,this.dataCaptureEnabled=!1,this.dataCaptureLayer=null,this.imageGeometryField=null,this.imageReferenceField=null,this.layerList=new m({selectionMode:"multiple"}),this.messages=null,this.overlayedLayers=new t,this.showCameraLocations=!1,this.showMapFeatures=!1,this._createSelectedItemsHandle=()=>{this.removeHandles("selected-items"),this.addHandles(this._trackLayerSelectionChanges(),"selected-items")},this._createDataCaptureLayerHandle=()=>a(()=>({dataCaptureLayer:this.dataCaptureLayer,operationalItems:this.layerList.operationalItems}),({dataCaptureLayer:e,operationalItems:t},s)=>{if(!e&&s?.dataCaptureLayer){const e=t.find(e=>e.layer===s.dataCaptureLayer);e&&e.actionsSections?.items.forEach(e=>{e.items.forEach(e=>{"create-features"===e.id&&(e.value=!1)})})}},i),this._handleSelectedItemsChange=({added:e,removed:t})=>{e.forEach(e=>{this.overlayedLayers.includes(e.layer)||this.onLayerSelected?.(e)}),t.forEach(e=>{this.overlayedLayers.includes(e.layer)&&this.onLayerDeselected?.(e)}),this.overlayedLayers.removeAll(),this.overlayedLayers.addMany(this.layerList.selectedItems.items.map(e=>e.layer))},this._layerListTriggerActionHandle=()=>o(()=>this.layerList,"trigger-action",e=>{const{action:t,item:{layer:s}}=e;switch(this._resetPreviousAction(t),t.id){case"create-features":this._toggleDataCaptureLayer(t,s);break;case"show-all-features":{const e=s?.id;e&&this.onFilterCapturedFeatures?.(e);break}}}),this._resetPreviousAction=e=>{"toggle"===this._previousAction?.type&&this._previousAction!==e&&(this._previousAction.value=!1,this._previousAction=null)},this._toggleDataCaptureLayer=(e,t)=>{this._previousAction=e;const s=e.value;this.dataCaptureLayer=s?t:null,this.onDataCaptureLayerChanged?.(this.dataCaptureLayer)},this._trackLayerSelectionChanges=()=>o(()=>this.layerList.selectedItems,"change",this._handleSelectedItemsChange),this._watchLayerListForListItemCreatedFunction=()=>a(()=>({layerList:this.layerList,listItemCreatedFunction:this._listItemCreatedFunction}),()=>{this.layerList.listItemCreatedFunction=this._listItemCreatedFunction},i),this._watchSelectedItems=()=>a(()=>this.layerList.selectedItems,this._createSelectedItemsHandle,i)}initialize(){this.addHandles([this._watchSelectedItems(),this._layerListTriggerActionHandle(),this._watchLayerListForListItemCreatedFunction(),this._createDataCaptureLayerHandle()])}loadDependencies(){return u({list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}get _listItemCreatedFunction(){const{dataCaptureEnabled:e,imageGeometryField:t,imageReferenceField:s}=this;return e&&t&&s?async e=>{const{item:a}=e,i=a.layer,{dataCaptureLayer:o,overlayedLayers:r,messages:{createFeaturesFromImage:l,showFeatures:c},layerList:d}=this,h=r.includes(i),{selectedItems:m}=d;if(C(h,m,a),await(i?.load()),!i||!p(i,t,s)||!n(i))return;const u=o===i,y=_([l,c],a,m,u);u&&(this._previousAction=y)}:null}get view(){return this.layerList?.view}set view(e){this.layerList.view=e}_renderCameraLocationsSwitch(e){return g("calcite-list-item",{bind:this,label:this.messages.overlayCameraLocations,onclick:this._toggleShowCameraLocations},g("calcite-switch",{bind:this,checked:e,class:h.overlaysSwitch,onchange:this._toggleShowCameraLocations,scale:"s",slot:"actions-end"}))}_renderOverlayMapFeatures(e){return g("calcite-list-item",{bind:this,label:this.messages?.overlayMapFeatures,onclick:this._toggleShowMapFeatures},g("calcite-switch",{bind:this,checked:e,class:h.overlaysSwitch,onchange:this._toggleShowMapFeatures,scale:"s",slot:"actions-end"}))}_renderList(e){return e?g("div",{class:h.imageOverlaysLayerList},this.layerList.render()):null}_renderPanel(){const{closed:e,messages:t,showCameraLocations:s,showMapFeatures:a}=this;return g("calcite-panel",{bind:this,closable:!0,closed:e,heading:t.imageOverlays,onCalcitePanelClose:this.onImageOverlaysClosed},g("calcite-list",{label:t.imageOverlays},this._renderCameraLocationsSwitch(s),this._renderOverlayMapFeatures(a)),this._renderList(a))}_toggleShowCameraLocations(e){e.stopPropagation(),this.showCameraLocations=!this.showCameraLocations,this.onShowCameraLocationsChanged?.(this.showCameraLocations)}_toggleShowMapFeatures(e){e.stopPropagation(),this.showMapFeatures=!this.showMapFeatures,this.onShowMapFeaturesChanged?.(this.showMapFeatures)}render(){const e=this.layerList.operationalItems.items.length,t=this.showMapFeatures&&0===e,s=this.showMapFeatures&&e>0,a={[y.widget]:!0,[h.imageOverlaysNoResult]:t,[h.imageOverlaysIncreasedHeight]:s,[h.imageOverlays]:!t&&!s};return g("div",{class:this.classes(a)},this._renderPanel())}};e([r()],L.prototype,"_previousAction",void 0),e([r()],L.prototype,"_listItemCreatedFunction",null),e([r()],L.prototype,"closed",void 0),e([r()],L.prototype,"dataCaptureEnabled",void 0),e([r()],L.prototype,"dataCaptureLayer",void 0),e([r()],L.prototype,"imageGeometryField",void 0),e([r()],L.prototype,"imageReferenceField",void 0),e([r()],L.prototype,"layerList",void 0),e([r()],L.prototype,"messages",void 0),e([r()],L.prototype,"onDataCaptureLayerChanged",void 0),e([r()],L.prototype,"onFilterCapturedFeatures",void 0),e([r()],L.prototype,"onImageOverlaysClosed",void 0),e([r()],L.prototype,"onLayerDeselected",void 0),e([r()],L.prototype,"onLayerSelected",void 0),e([r()],L.prototype,"onShowCameraLocationsChanged",void 0),e([r()],L.prototype,"onShowMapFeaturesChanged",void 0),e([r()],L.prototype,"overlayedLayers",void 0),e([r()],L.prototype,"showCameraLocations",void 0),e([r()],L.prototype,"showMapFeatures",void 0),e([r()],L.prototype,"view",null),L=e([l("esri.widgets.OrientedImageryViewer.components.ImageOverlays")],L);const v=L;function C(e,t,s){e&&t.push(s)}function w(e,s){const a=new t;a.add(e[0]),a.add(e[1]),s.actionsSections=new t([a])}function _(e,t,s,o=!1){const r=new c({icon:"pencil",id:"create-features",title:e[0],value:o}),l=new c({icon:"list-show-all",id:"show-all-features",title:e[1],value:o});return t.addHandles(a(()=>s.includes(t),e=>{r.visible=e,l.visible=e},i)),w([r,l],t),r}export{v as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{formatNumber as t,substitute as i}from"../intl.js";import{on as l}from"../core/events.js";import{destroyMaybe as a}from"../core/maybe.js";import{watch as s,when as n,initial as o}from"../core/reactiveUtils.js";import{property as r,cast as c,subclass as d}from"../core/accessorSupport/decorators.js";import m from"./Slider.js";import u from"./Widget.js";import{css as p}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as v,getScalePreviewSpriteBackgroundPosition as h}from"./ScaleRangeSlider/scalePreviewUtils.js";import S from"./ScaleRangeSlider/ScaleRanges.js";import M from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as g}from"./support/globalCss.js";import{messageBundle as _,tsx as w}from"./support/widget.js";import{storeNode as f,setFocus as y}from"./support/widgetUtils.js";const x={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},I={maximumFractionDigits:0},L="1:",T=16;let C=class extends u{constructor(e,t){super(e,t),this._activeMenu=null,this._activeThumb=null,this._customInput=null,this._maxThumbNode=null,this._minThumbNode=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._slider=new m({thumbCreatedFunction:(e,t,i)=>{0===e?this._minThumbNode=i:1===e&&(this._maxThumbNode=i),this.addHandles([l(i,"mouseenter",()=>{this._activeThumb=e,this.scheduleRender()}),l(i,"mouseleave",()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())})])}}),this.disabled=!1,this.messages=null,this.region="US",this.showWorldValue=!1,this.viewModel=new M,this.visibleElements=x,this._afterInputNumberCreate=e=>{"value"in e&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._customInput=e},this._handleCustomScaleInputChange=(e,t)=>{const{viewModel:{scaleRanges:i}}=this,l=Number.parseFloat(t.value);Number.isNaN(l)?t.value=e:this._setScale(i.clampScale(l))}}loadDependencies(){return b({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}initialize(){this.addHandles([s(()=>this.viewModel,e=>this._slider.viewModel=e?.sliderViewModel??null,o),s(()=>this._interactive,e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)},o),this._slider.on("thumb-drag",({index:e})=>{this._activeThumb=e,clearTimeout(this._previewAutoCloseTimeoutId);const t=250;this._previewAutoCloseTimeoutId=setTimeout(()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null},t)}),n(()=>!0===this.view?.stationary,()=>this.scheduleRender())])}destroy(){this._slider=a(this._slider)}get _maxScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.maxScaleMenu}get _minScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.minScaleMenu}get _interactive(){return"disabled"!==this.viewModel?.state&&!this.disabled}get effectiveMaxScale(){return this.viewModel.effectiveMaxScale}get effectiveMinScale(){return this.viewModel.effectiveMinScale}get effectiveMaxScaleLimit(){return this.viewModel.effectiveMaxScaleLimit}get effectiveMinScaleLimit(){return this.viewModel.effectiveMinScaleLimit}get icon(){return"actual-size"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxScale(){return this.viewModel.maxScale}set maxScale(e){this.viewModel.maxScale=e}get maxScaleLimit(){return this.viewModel.maxScaleLimit}set maxScaleLimit(e){this.viewModel.maxScaleLimit=e}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}get minScale(){return this.viewModel.minScale}set minScale(e){this.viewModel.minScale=e}get minScaleLimit(){return this.viewModel.minScaleLimit}set minScaleLimit(e){this.viewModel.minScaleLimit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...x,...e,scaleMenus:"boolean"==typeof e?.scaleMenus?e.scaleMenus:{...x.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`${L}${t(e,I)}`}render(){const{_interactive:e,_slider:t,label:i,view:l,viewModel:{state:a}}=this,s=this._getLabel("min"),n=this._getLabel("max"),{segmentElements:o}=t,r=o.at("min-scale-only"===this.mode?-1:-2);return r&&r.classList.add(p.segmentElementActive),w("div",{"aria-label":i,class:this.classes(p.base,g.widget,e?null:g.disabled)},w("div",{class:p.scaleIndicatorWrapper,dir:"ltr"},"ready"===a&&l?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),w("div",{class:p.scaleMenuContainer},this._minScaleMenuEnabled&&s?this._renderScaleMenuToggle("min",s):null,w("div",{class:p.scaleMenuSeparator}),this._maxScaleMenuEnabled&&n?this._renderScaleMenuToggle("max",n):null))}_renderPreviewPopover(){const{_activeThumb:e}=this,t=null!=e&&this.visibleElements.preview,i=t?0===e?this._minThumbNode:this._maxThumbNode:"";return w("calcite-popover",{afterCreate:f,afterUpdate:()=>this._previewPopover?.reposition(),bind:this,"data-node-ref":"_previewPopover",label:this.messages.preview,offsetDistance:T,open:t,overlayPositioning:"fixed",placement:"top",referenceElement:i,triggerDisabled:!0},this._renderScalePreview())}_renderScalePreview(){const{_activeThumb:e,_slider:t,region:i,viewModel:{scaleRanges:l}}=this,a=0===e||"range"!==this.mode?t.values[0]:t.values[1],s=Object.keys(S.RecommendedScales).indexOf(l.findScaleRangeByIndex(a).id),n={backgroundImage:v(i),backgroundPosition:h(s)};return w("div",{class:p.scalePreview},w("div",{class:p.scalePreviewThumbnail,styles:n}))}_getLabel(e){const{_slider:t,messages:i,mode:l,viewModel:{scaleRanges:a}}=this,[s,n]=t.values,o="min"===e||"range"!==l?s:n,r=i.scaleRangeLabels[a.findScaleRangeByIndex(o).id];switch(l){case"range":return r;case"max-scale-only":return"min"===e?null:r;case"min-scale-only":return"min"===e?r:null}}_renderScaleMenuToggle(e,t){const{_activeMenu:i,_interactive:l}=this,a=i===e;return[w("calcite-dropdown",{closeOnSelectDisabled:!0,"data-type":e,open:a,overlayPositioning:"fixed",placement:"max"===e?"bottom-end":"bottom-start",scale:"s",onCalciteDropdownClose:({currentTarget:t})=>{this._activeMenu===e&&this._setActiveMenu(null),y(t.querySelector("calcite-button"))},onCalciteDropdownOpen:()=>this._setActiveMenu(e)},w("calcite-button",{appearance:a?"outline":"transparent","aria-pressed":a.toString(),class:p.scaleMenuToggle,disabled:!l,iconEnd:"chevron-down",scale:"s",slot:"trigger"},t),a&&"max"===e?this._renderMaxScaleMenu():null,a&&"min"===e?this._renderMinScaleMenu():null)]}_renderMinScaleMenu(){const{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,a=i?i.scale:void 0;return this._renderScaleMenu({type:"min",min:t,max:l.findScaleRange(e).minScale,viewScale:a})}_renderMaxScaleMenu(){const{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,a=i?i.scale:void 0;return this._renderScaleMenu({type:"max",min:l.findScaleRange(e).maxScale,max:t,viewScale:a})}_renderScaleMenu({viewScale:e,min:t,max:i,type:l}){const{effectiveMaxScale:a,effectiveMinScale:s,messages:n,showWorldValue:o}=this,r="max"===l?a:s,c=S.fromScaleRange({minScale:t,maxScale:i}),d=this.messages.featuredScaleLabels,m=S.RecommendedScales,u=Object.keys(m).filter(e=>c.contains(m[e])).map(e=>this._renderScaleMenuItem({scaleLabel:d[e],scaleValue:m[e],isSelected:r===m[e],valueVisible:"world"!==e||o}));return w("calcite-dropdown-group",{key:`${this.id}__scale-menu--${l}`},this._renderCustomScaleValue({currentScale:r}),null!=e?this._renderScaleMenuItem({scaleValue:e,scaleLabel:n.featuredScaleLabels.current,isSelected:r===e,valueVisible:!0}):null,u)}_renderCustomScaleValue({currentScale:e}){const{messages:t}=this,i=Math.round(e).toString();return w("calcite-dropdown-item",{afterCreate:e=>{y(e)},key:"custom-scale",label:t.featuredScaleLabels.custom,onCalciteDropdownItemSelect:()=>{y(this._customInput)}},w("calcite-label",{scale:"s"},w("span",null,t.featuredScaleLabels.custom),w("calcite-input-number",{afterCreate:this._afterInputNumberCreate,groupSeparator:!0,inputMode:"numeric",max:S.RecommendedScales.world,min:0,numberButtonType:"none",placeholder:t.customScaleInputTooltip,prefixText:L,scale:"s",step:1,value:i,onCalciteInputNumberChange:({currentTarget:e})=>this._handleCustomScaleInputChange(i,e)})))}_renderScaleMenuItem(e){const{scaleValue:t,scaleLabel:i,valueVisible:l,isSelected:a}=e;return w("calcite-dropdown-item",{key:i,label:i,selected:a,onCalciteDropdownItemSelect:this._setScale.bind(this,t)},i,l?w("div",{class:p.scaleMenuSubLabel},this.formatScale(t)):void 0)}_renderCurrentScaleIndicator(){const{_slider:e,messages:t,view:l,viewModel:{scaleRanges:a}}=this,s=a.clampScale(l.scale),n=this.viewModel.mapScaleToSlider(s),o=n/e.max,r=t.scaleRangeLabels[a.findScaleRangeByIndex(n).id],c=i(t.currentScaleTooltip,{scaleLabel:r});return w("div",{class:p.scaleIndicatorContainer,key:"scale-indicator"},w("div",{"aria-label":c,class:p.scaleIndicator,styles:{left:100*o+"%"},title:c},this.renderCurrentScaleIndicatorIcon()))}renderCurrentScaleIndicatorIcon(){return w("calcite-icon",{class:p.scaleIndicatorIcon,icon:"caret-up",scale:"s"})}_setScale(e){"max"===this._activeMenu?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null)}_setActiveMenu(e){this._activeMenu=e}};e([r()],C.prototype,"_activeMenu",void 0),e([r()],C.prototype,"_activeThumb",void 0),e([r()],C.prototype,"_customInput",void 0),e([r()],C.prototype,"_maxScaleMenuEnabled",null),e([r()],C.prototype,"_minScaleMenuEnabled",null),e([r()],C.prototype,"_slider",void 0),e([r({readOnly:!0})],C.prototype,"_interactive",null),e([r()],C.prototype,"disabled",void 0),e([r()],C.prototype,"effectiveMaxScale",null),e([r()],C.prototype,"effectiveMinScale",null),e([r()],C.prototype,"effectiveMaxScaleLimit",null),e([r()],C.prototype,"effectiveMinScaleLimit",null),e([r()],C.prototype,"icon",null),e([r()],C.prototype,"label",null),e([r()],C.prototype,"layer",null),e([r()],C.prototype,"maxScale",null),e([r()],C.prototype,"maxScaleLimit",null),e([r(),_("esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider")],C.prototype,"messages",void 0),e([r()],C.prototype,"mode",null),e([r()],C.prototype,"minScale",null),e([r()],C.prototype,"minScaleLimit",null),e([r()],C.prototype,"region",void 0),e([r()],C.prototype,"showWorldValue",void 0),e([r()],C.prototype,"view",null),e([r()],C.prototype,"viewModel",void 0),e([r()],C.prototype,"visibleElements",void 0),e([c("visibleElements")],C.prototype,"castVisibleElements",null),C=e([d("esri.widgets.ScaleRangeSlider")],C);const R=C;export{R as default};
5
+ import{__decorate as e}from"tslib";import{formatNumber as t,substitute as i}from"../intl.js";import{on as l}from"../core/events.js";import{destroyMaybe as a}from"../core/maybe.js";import{watch as s,when as n,initial as o}from"../core/reactiveUtils.js";import{property as r,cast as c,subclass as d}from"../core/accessorSupport/decorators.js";import m from"./Slider.js";import u from"./Widget.js";import{css as p}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as v,getScalePreviewSpriteBackgroundPosition as h}from"./ScaleRangeSlider/scalePreviewUtils.js";import S from"./ScaleRangeSlider/ScaleRanges.js";import M from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as g}from"./support/globalCss.js";import{messageBundle as _,tsx as w}from"./support/widget.js";import{storeNode as f,setFocus as y}from"./support/widgetUtils.js";const x={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},I={maximumFractionDigits:0},L="1:",T=16;let C=class extends u{constructor(e,t){super(e,t),this._activeMenu=null,this._activeThumb=null,this._customInput=null,this._maxThumbNode=null,this._minThumbNode=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._slider=new m({thumbCreatedFunction:(e,t,i)=>{0===e?this._minThumbNode=i:1===e&&(this._maxThumbNode=i),this.addHandles([l(i,"mouseenter",()=>{this._activeThumb=e,this.scheduleRender()}),l(i,"mouseleave",()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())})])}}),this.disabled=!1,this.messages=null,this.region="US",this.showWorldValue=!1,this.viewModel=new M,this.visibleElements=x,this._afterInputNumberCreate=e=>{"value"in e&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._customInput=e},this._handleCustomScaleInputChange=(e,t)=>{const{viewModel:{scaleRanges:i}}=this,l=Number.parseFloat(t.value);Number.isNaN(l)?t.value=e:this._setScale(i.clampScale(l))}}loadDependencies(){return b({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}initialize(){this.addHandles([s(()=>this.viewModel,e=>this._slider.viewModel=e?.sliderViewModel??null,o),s(()=>this._interactive,e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)},o),this._slider.on("thumb-drag",({index:e})=>{this._activeThumb=e,clearTimeout(this._previewAutoCloseTimeoutId);const t=250;this._previewAutoCloseTimeoutId=setTimeout(()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null},t)}),n(()=>!0===this.view?.stationary,()=>this.scheduleRender())])}destroy(){this._slider=a(this._slider)}get _maxScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&!0===e?.maxScaleMenu}get _minScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&!0===e?.minScaleMenu}get _interactive(){return"disabled"!==this.viewModel?.state&&!this.disabled}get effectiveMaxScale(){return this.viewModel.effectiveMaxScale}get effectiveMinScale(){return this.viewModel.effectiveMinScale}get effectiveMaxScaleLimit(){return this.viewModel.effectiveMaxScaleLimit}get effectiveMinScaleLimit(){return this.viewModel.effectiveMinScaleLimit}get icon(){return"actual-size"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxScale(){return this.viewModel.maxScale}set maxScale(e){this.viewModel.maxScale=e}get maxScaleLimit(){return this.viewModel.maxScaleLimit}set maxScaleLimit(e){this.viewModel.maxScaleLimit=e}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}get minScale(){return this.viewModel.minScale}set minScale(e){this.viewModel.minScale=e}get minScaleLimit(){return this.viewModel.minScaleLimit}set minScaleLimit(e){this.viewModel.minScaleLimit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...x,...e,scaleMenus:"boolean"==typeof e?.scaleMenus?e.scaleMenus:{...x.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`${L}${t(e,I)}`}render(){const{_interactive:e,_slider:t,label:i,view:l,viewModel:{state:a}}=this,s=this._getLabel("min"),n=this._getLabel("max"),{segmentElements:o}=t,r=o.at("min-scale-only"===this.mode?-1:-2);return r&&r.classList.add(p.segmentElementActive),w("div",{"aria-label":i,class:this.classes(p.base,g.widget,e?null:g.disabled)},w("div",{class:p.scaleIndicatorWrapper,dir:"ltr"},"ready"===a&&l?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),w("div",{class:p.scaleMenuContainer},this._minScaleMenuEnabled&&s?this._renderScaleMenuToggle("min",s):null,w("div",{class:p.scaleMenuSeparator}),this._maxScaleMenuEnabled&&n?this._renderScaleMenuToggle("max",n):null))}_renderPreviewPopover(){const{_activeThumb:e}=this,t=null!=e&&this.visibleElements.preview,i=t?0===e?this._minThumbNode:this._maxThumbNode:"";return w("calcite-popover",{afterCreate:f,afterUpdate:()=>this._previewPopover?.reposition(),bind:this,"data-node-ref":"_previewPopover",label:this.messages.preview,offsetDistance:T,open:t,overlayPositioning:"fixed",placement:"top",referenceElement:i,triggerDisabled:!0},this._renderScalePreview())}_renderScalePreview(){const{_activeThumb:e,_slider:t,region:i,viewModel:{scaleRanges:l}}=this,a=0===e||"range"!==this.mode?t.values[0]:t.values[1],s=Object.keys(S.RecommendedScales).indexOf(l.findScaleRangeByIndex(a).id),n={backgroundImage:v(i),backgroundPosition:h(s)};return w("div",{class:p.scalePreview},w("div",{class:p.scalePreviewThumbnail,styles:n}))}_getLabel(e){const{_slider:t,messages:i,mode:l,viewModel:{scaleRanges:a}}=this,[s,n]=t.values,o="min"===e||"range"!==l?s:n,r=i.scaleRangeLabels[a.findScaleRangeByIndex(o).id];switch(l){case"range":return r;case"max-scale-only":return"min"===e?null:r;case"min-scale-only":return"min"===e?r:null}}_renderScaleMenuToggle(e,t){const{_activeMenu:i,_interactive:l}=this,a=i===e;return[w("calcite-dropdown",{closeOnSelectDisabled:!0,"data-type":e,open:a,overlayPositioning:"fixed",placement:"max"===e?"bottom-end":"bottom-start",scale:"s",onCalciteDropdownClose:({currentTarget:t})=>{this._activeMenu===e&&this._setActiveMenu(null),y(t.querySelector("calcite-button"))},onCalciteDropdownOpen:()=>this._setActiveMenu(e)},w("calcite-button",{appearance:a?"outline":"transparent","aria-pressed":a.toString(),class:p.scaleMenuToggle,disabled:!l,iconEnd:"chevron-down",scale:"s",slot:"trigger"},t),a&&"max"===e?this._renderMaxScaleMenu():null,a&&"min"===e?this._renderMinScaleMenu():null)]}_renderMinScaleMenu(){const{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,a=i?i.scale:void 0;return this._renderScaleMenu({type:"min",min:t,max:l.findScaleRange(e).minScale,viewScale:a})}_renderMaxScaleMenu(){const{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,a=i?i.scale:void 0;return this._renderScaleMenu({type:"max",min:l.findScaleRange(e).maxScale,max:t,viewScale:a})}_renderScaleMenu({viewScale:e,min:t,max:i,type:l}){const{effectiveMaxScale:a,effectiveMinScale:s,messages:n,showWorldValue:o}=this,r="max"===l?a:s,c=S.fromScaleRange({minScale:t,maxScale:i}),d=this.messages.featuredScaleLabels,m=S.RecommendedScales,u=Object.keys(m).filter(e=>c.contains(m[e])).map(e=>this._renderScaleMenuItem({scaleLabel:d[e],scaleValue:m[e],isSelected:r===m[e],valueVisible:"world"!==e||o}));return w("calcite-dropdown-group",{key:`${this.id}__scale-menu--${l}`},this._renderCustomScaleValue({currentScale:r}),null!=e?this._renderScaleMenuItem({scaleValue:e,scaleLabel:n.featuredScaleLabels.current,isSelected:r===e,valueVisible:!0}):null,u)}_renderCustomScaleValue({currentScale:e}){const{messages:t}=this,i=Math.round(e).toString();return w("calcite-dropdown-item",{afterCreate:e=>{y(e)},key:"custom-scale",label:t.featuredScaleLabels.custom,onCalciteDropdownItemSelect:()=>{y(this._customInput)}},w("calcite-label",{scale:"s"},w("span",null,t.featuredScaleLabels.custom),w("calcite-input-number",{afterCreate:this._afterInputNumberCreate,groupSeparator:!0,inputMode:"numeric",max:S.RecommendedScales.world,min:0,numberButtonType:"none",placeholder:t.customScaleInputTooltip,prefixText:L,scale:"s",step:1,value:i,onCalciteInputNumberChange:({currentTarget:e})=>this._handleCustomScaleInputChange(i,e)})))}_renderScaleMenuItem(e){const{scaleValue:t,scaleLabel:i,valueVisible:l,isSelected:a}=e;return w("calcite-dropdown-item",{key:i,label:i,selected:a,onCalciteDropdownItemSelect:this._setScale.bind(this,t)},i,l?w("div",{class:p.scaleMenuSubLabel},this.formatScale(t)):void 0)}_renderCurrentScaleIndicator(){const{_slider:e,messages:t,view:l,viewModel:{scaleRanges:a}}=this,s=a.clampScale(l.scale),n=this.viewModel.mapScaleToSlider(s),o=n/e.max,r=t.scaleRangeLabels[a.findScaleRangeByIndex(n).id],c=i(t.currentScaleTooltip,{scaleLabel:r});return w("div",{class:p.scaleIndicatorContainer,key:"scale-indicator"},w("div",{"aria-label":c,class:p.scaleIndicator,styles:{left:100*o+"%"},title:c},this.renderCurrentScaleIndicatorIcon()))}renderCurrentScaleIndicatorIcon(){return w("calcite-icon",{class:p.scaleIndicatorIcon,icon:"caret-up",scale:"s"})}_setScale(e){"max"===this._activeMenu?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null)}_setActiveMenu(e){this._activeMenu=e}};e([r()],C.prototype,"_activeMenu",void 0),e([r()],C.prototype,"_activeThumb",void 0),e([r()],C.prototype,"_customInput",void 0),e([r()],C.prototype,"_maxScaleMenuEnabled",null),e([r()],C.prototype,"_minScaleMenuEnabled",null),e([r()],C.prototype,"_slider",void 0),e([r({readOnly:!0})],C.prototype,"_interactive",null),e([r()],C.prototype,"disabled",void 0),e([r()],C.prototype,"effectiveMaxScale",null),e([r()],C.prototype,"effectiveMinScale",null),e([r()],C.prototype,"effectiveMaxScaleLimit",null),e([r()],C.prototype,"effectiveMinScaleLimit",null),e([r()],C.prototype,"icon",null),e([r()],C.prototype,"label",null),e([r()],C.prototype,"layer",null),e([r()],C.prototype,"maxScale",null),e([r()],C.prototype,"maxScaleLimit",null),e([r(),_("esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider")],C.prototype,"messages",void 0),e([r()],C.prototype,"mode",null),e([r()],C.prototype,"minScale",null),e([r()],C.prototype,"minScaleLimit",null),e([r()],C.prototype,"region",void 0),e([r()],C.prototype,"showWorldValue",void 0),e([r()],C.prototype,"view",null),e([r()],C.prototype,"viewModel",void 0),e([r()],C.prototype,"visibleElements",void 0),e([c("visibleElements")],C.prototype,"castVisibleElements",null),C=e([d("esri.widgets.ScaleRangeSlider")],C);const R=C;export{R as default};