@arcgis/core 6.0.0-next.29 → 6.0.0-next.30

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 (122) hide show
  1. package/WebDocument2D.js +1 -1
  2. package/WebMap.d.ts +3 -19
  3. package/WebMap.js +1 -1
  4. package/WebScene.js +1 -1
  5. package/arcgisGlobal.d.ts +1 -0
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/039d9bc5b5015012f811.js +1 -0
  8. package/assets/esri/core/workers/chunks/{b01688ccc29d33bfc82d.js → 28a821de9dbf10324033.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{d3c3fb079ad97970f834.js → 4fb2fcc95f852bf8f86c.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{84940d8e14caf5a27e04.js → 64b360625c68cb863a08.js} +1 -1
  11. package/assets/esri/core/workers/chunks/71f792a20077aa739f87.js +1 -0
  12. package/assets/esri/core/workers/chunks/{e480e7d5f40049a2053b.js → 7af4edc6e87d27b9d467.js} +1 -1
  13. package/assets/esri/core/workers/chunks/90c1d10eae7ae71889b0.js +1 -0
  14. package/assets/esri/core/workers/chunks/{8a485130781b49dbf608.js → 9d40786c5ceface786ba.js} +1 -1
  15. package/assets/esri/core/workers/chunks/aba259a70bee68d2edb7.js +1 -0
  16. package/assets/esri/core/workers/chunks/c33a9635c294c8774977.js +1 -0
  17. package/assets/esri/views/3d/environment/resources/milkyway-band.avif +0 -0
  18. package/chunks/GlobalIllumination.glsl.js +16 -10
  19. package/chunks/GlobalIlluminationBlur.glsl.js +14 -14
  20. package/chunks/GlobalIlluminationUpscale.glsl.js +4 -4
  21. package/chunks/RibbonLine.glsl.js +78 -75
  22. package/config.js +1 -1
  23. package/core/workers/WorkerHandle.js +1 -1
  24. package/kernel.js +1 -1
  25. package/layers/WMTSLayer.d.ts +1 -1
  26. package/layers/WMTSLayer.js +1 -1
  27. package/layers/mixins/TiledImagery.d.ts +7 -0
  28. package/layers/support/WMTSSublayer.d.ts +5 -5
  29. package/networks/Network.js +1 -1
  30. package/networks/support/TopologyValidationJobInfo.js +1 -1
  31. package/package.json +2 -2
  32. package/rest/networks/support/ValidateNetworkTopologyResult.js +1 -1
  33. package/support/timeUtils.js +1 -1
  34. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  35. package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
  36. package/views/2d/layers/SketchLayerView2D.js +1 -1
  37. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  38. package/views/2d/types.d.ts +2 -1
  39. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  40. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  41. package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
  42. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  43. package/views/3d/interactive/visualElements/StageObjectVisualElement.js +2 -0
  44. package/views/3d/layers/WMTSLayerView3D.js +1 -1
  45. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  46. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  47. package/views/3d/layers/graphics/Graphics3DBufferGraphicLayer.js +1 -1
  48. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  49. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  50. package/views/3d/layers/graphics/Graphics3DPathSymbolLayerConstants.js +1 -1
  51. package/views/3d/layers/graphics/Graphics3DStageObjectGraphicLayer.js +1 -1
  52. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  53. package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
  54. package/views/3d/layers/graphics/pointUtils.js +1 -1
  55. package/views/3d/terrain/ExtentHelper.js +1 -1
  56. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  57. package/views/3d/terrain/PatchRenderData.js +1 -1
  58. package/views/3d/terrain/SphericalPatch.js +1 -1
  59. package/views/3d/terrain/TerrainRenderer.js +1 -1
  60. package/views/3d/terrain/TerrainSurface.js +1 -1
  61. package/views/3d/terrain/Tile.js +1 -1
  62. package/views/3d/terrain/tileUtils.js +1 -1
  63. package/views/3d/types.d.ts +2 -1
  64. package/views/3d/webgl-engine/Stage.js +1 -1
  65. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexInfo.glsl.js +10 -11
  66. package/views/3d/webgl-engine/core/shaderLibrary/util/PackedUint32.glsl.js +2 -0
  67. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  68. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  69. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
  70. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscale.glsl.js +1 -1
  71. package/views/3d/webgl-engine/effects/globalIllumination/globalIlluminationUniforms.js +2 -0
  72. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  73. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  74. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  75. package/views/3d/webgl-engine/lib/PackedUint32.js +2 -0
  76. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  77. package/views/3d/webgl-engine/lib/PathVertexInfo.js +1 -1
  78. package/views/3d/webgl-engine/lib/RibbonLineVertexInfo.js +2 -0
  79. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  80. package/views/3d/webgl-engine/materials/HUDMaterialBaseInstance.js +1 -1
  81. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  82. package/views/3d/webgl-engine/materials/LineCalloutMaterialBaseInstance.js +1 -1
  83. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  84. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  85. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  86. package/views/3d/webgl-engine/parts/Model.js +1 -1
  87. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  88. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
  89. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  90. package/views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js +1 -1
  91. package/views/SelectionManager.d.ts +5 -5
  92. package/views/SelectionManager.js +1 -1
  93. package/views/input/InputManager.js +1 -1
  94. package/views/layers/WMTSLayerView.d.ts +16 -0
  95. package/views/layers/WMTSLayerView.js +2 -0
  96. package/views/layers/support/highlightUtils.js +1 -1
  97. package/views/selection/SelectionOperation.js +1 -1
  98. package/views/selection/types.d.ts +3 -3
  99. package/views/support/GeometryWorker.js +1 -1
  100. package/views/support/GeometryWorkerHandle.js +1 -1
  101. package/views/support/selectionUtils.js +1 -1
  102. package/webdoc/support/webdocLoadUtils.js +1 -1
  103. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
  104. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  105. package/widgets/FeatureTable/RelationshipColumn.js +1 -1
  106. package/widgets/OrientedImageryViewer/imageMeasurementWorkerUtils.js +1 -1
  107. package/widgets/support/SelectionList/GroupLayerItem.d.ts +5 -5
  108. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  109. package/widgets/support/SelectionList/ItemBase.d.ts +3 -3
  110. package/widgets/support/SelectionList/LayerItem.js +1 -1
  111. package/widgets/support/SelectionList/SelectionListViewModel.d.ts +5 -6
  112. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  113. package/widgets/support/SelectionList/types.d.ts +3 -1
  114. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  115. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  116. package/widgets/support/symbolPreviewUtils.js +1 -1
  117. package/assets/esri/core/workers/chunks/2de4296590bf9f9e9add.js +0 -1
  118. package/assets/esri/core/workers/chunks/4976f5567fc7f1b63d10.js +0 -1
  119. package/assets/esri/core/workers/chunks/53c7510df09b71ab5646.js +0 -1
  120. package/assets/esri/core/workers/chunks/66c2a28a851130b87c04.js +0 -1
  121. package/assets/esri/core/workers/chunks/e7aaf7579592b79d6dd7.js +0 -1
  122. package/layers/geospatialPDF/CIM2DLayerview.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Graphic.js";import n from"../request.js";import r from"../core/Error.js";import{Loadable as i}from"../core/Loadable.js";import a from"../core/Logger.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{isAbortError as s}from"../core/promiseUtils.js";import{urlToObject as c}from"../core/urlUtils.js";import{generateUUID as l}from"../core/uuid.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import f from"../geometry/Extent.js";import p from"../geometry/SpatialReference.js";import{fromJSON as m}from"../geometry/support/jsonUtils.js";import{versionMatches as h,onApplyEditsEvent as g,onUpdateMomentEvent as _,emitApplyEditsEvent as v}from"../layers/mixins/EditBusLayer.js";import{parse as y}from"../layers/support/arcgisLayerUrl.js";import b from"./support/TopologyValidationJobInfo.js";import{networkFromPortalItem as x}from"./support/utils.js";import{isVersionInEditSession as S,currentSessionId as C,isSafeToEditVersion as w}from"../versionManagement/support/versionManagementUtils.js";let T=class extends o(i){static fromPortalItem(e){return x(e)}constructor(e){super(e),this.id=l(),this.title=null,this.layerUrl=null,this.dataElement=null,this.fullExtent=null,this.spatialReference=null,this.type=null,this.sourceJSON=null,this._historicMoment=null,this._gdbVersion=null,this._sourceIdByLayerId=new Map,this._layerIdBySourceId=new Map,this._applyEditsHandler=e=>{let{serviceUrl:t,gdbVersion:n,result:r}=e,i=t===this.featureServiceUrl,a=h(t,n,this.gdbVersion);i&&a&&r.then(e=>{S(t,n)&&(this.historicMoment=e.historicMoment)})},this._updateMomentHandler=e=>{let{serviceUrl:t,gdbVersion:n,moment:r}=e,i=t===this.featureServiceUrl,a=h(t,n,this.gdbVersion);i&&a&&(this.historicMoment=r)},this.when().then(()=>{this.addHandles([g(this._applyEditsHandler),_(this._updateMomentHandler)])},()=>{})}initialize(){this.when().catch(e=>{s(e)||a.getLogger(this).error(`#load()`,`Failed to load layer (title: '${this.title??`no title`}', id: '${this.id??`no id`}')`,{error:e})})}get loaded(){return super.loaded}get datasetName(){return this.dataElement?.name??null}get owner(){return this.dataElement?.userIdentity??null}get schemaGeneration(){return this.dataElement?.schemaGeneration??null}get parsedUrl(){return c(this.layerUrl)}get featureServiceUrl(){return y(this.parsedUrl.path).url.path}get networkServiceUrl(){return this.featureServiceUrl.replace(/\/FeatureServer/i,`/UtilityNetworkServer`)}get layerId(){return y(this.parsedUrl.path).sublayer}get networkSystemLayers(){return null}get gdbVersion(){return this._gdbVersion}set gdbVersion(e){this._gdbVersion=e}get historicMoment(){return this._historicMoment}set historicMoment(e){this._historicMoment=e}async load(e){return this.addResolvingPromise(this._load(e)),this}async _load(e){await Promise.all([this._fetchDataElement(this.featureServiceUrl,this.layerId.toString(),e),this._fetchLayerMetaData(this.layerUrl,e)])}getLayerIdBySourceId(e){if(!this.dataElement)return null;let t=this._layerIdBySourceId.get(e);if(t!=null)return t;let n=this.dataElement.domainNetworks,r=this._traverseNetworkSources(n,this._layerIdBySourceId,`sourceId`,`layerId`,e);return r>=0?r:null}getSourceIdByLayerId(e){if(!this.dataElement)return null;let t=this._sourceIdByLayerId.get(e);if(t!=null)return t;let n=this.dataElement.domainNetworks,r=this._traverseNetworkSources(n,this._sourceIdByLayerId,`layerId`,`sourceId`,e);return r>=0?r:null}getObjectIdsFromElements(e){let t=[],n=new Map;for(let t of e){let e=this.getLayerIdBySourceId(t.networkSourceId);if(e==null)continue;let r=n.get(e);r===void 0&&(r=[]),r.push(t.objectId),n.set(e,r)}let r=this.featureServiceUrl;return n.forEach((e,n)=>t.push({layerUrl:`${r}/${n}`,objectIds:e})),t}async queryNamedTraceConfigurations(e,t){let[{queryNamedTraceConfigurations:n},{default:r}]=await Promise.all([import(`../rest/networks/queryNamedTraceConfigurations.js`),import(`../rest/networks/support/QueryNamedTraceConfigurationsParameters.js`)]),i=this.networkServiceUrl;return(await n(i,r.from(e),{...t}))?.namedTraceConfigurations}async validateTopology(e,t){if(!e.validateArea)throw new r(`network:undefined-validateArea`,`the network must have validateArea defined in the validate network topology parameters.`);let[{validateNetworkTopology:n},{default:i}]=await Promise.all([import(`../rest/networks/validateNetworkTopology.js`),import(`../rest/networks/support/ValidateNetworkTopologyParameters.js`)]),a=i.from(e);S(this.featureServiceUrl,this.gdbVersion||null)?(a.sessionID=C,await w(this.featureServiceUrl,this.gdbVersion,!0)):a.sessionID=null,a.gdbVersion=this.gdbVersion;let o=this.networkServiceUrl,s=this.featureServiceUrl,c=v(s,null,this.gdbVersion,!0),l=await n(o,a,{...t});if(l?.serviceEdits){let e=[];for(let t of l.serviceEdits){let{editedFeatures:n}=t,r=n?.spatialReference?new p(n.spatialReference):null;e.push({layerId:t.layerId,editedFeatures:{adds:n?.adds?.map(e=>E(e,r))||[],updates:n?.updates?.map(e=>({original:E(e[0],r),current:E(e[1],r)}))||[],deletes:n?.deletes?.map(e=>E(e,r))||[],spatialReference:r}})}c.resolve({edits:null,addedFeatures:[],updatedFeatures:[],deletedFeatures:[],addedAttachments:[],updatedAttachments:[],deletedAttachments:[],editedFeatures:e,exceededTransferLimit:!1,historicMoment:l.moment})}return l}async submitTopologyValidationJob(e,t){let i=null;if(!e.validateArea)throw new r(`network:undefined-validateArea`,`the network must have validateArea defined in the validate network topology parameters.`);if(!this.gdbVersion){let e=this.layerUrl.replace(/\/FeatureServer/i,`/VersionManagementServer`).replace(/\/\d*$/,``);i=(await n(e,{responseType:`json`,query:{f:`json`}})).data.defaultVersionName}let[{submitValidateNetworkTopologyJob:a},{default:o}]=await Promise.all([import(`../rest/networks/validateNetworkTopology.js`),import(`../rest/networks/support/ValidateNetworkTopologyParameters.js`)]),s=o.from(e);S(this.featureServiceUrl,this.gdbVersion||null)?(s.sessionID=C,await w(this.featureServiceUrl,this.gdbVersion,!0)):s.sessionID=null,s.gdbVersion=this.gdbVersion||i;let c=this.networkServiceUrl,l=this.featureServiceUrl?v(this.featureServiceUrl,null,this.gdbVersion,!0):void 0,u=await a(c,s,{...t});return new b({statusUrl:u,editsResolver:l})}getSourceTypeById(e){if(!this.dataElement)return null;for(let t of this.dataElement.domainNetworks)for(let n of[t.edgeSources??[],t.junctionSources??[]])for(let r of n)if(r.sourceId===e)return n===t.edgeSources?`edge`:`junction`;return null}_traverseNetworkSources(e,t,n,r,i){for(let a of e)for(let e of[a.edgeSources??[],a.junctionSources??[]])for(let a of e)if(a[n]===i)return t.set(i,a[r]),a[r];return-1}async _fetchLayerMetaData(e,t){let{data:r}=await n(e,{responseType:`json`,query:{f:`json`},...t});this.sourceJSON=r,this.read(r,{origin:`service`})}async _fetchDataElement(e,t,i){if(this.dataElement)return;let a=(await n(`${e}/queryDataElements`,{responseType:`json`,query:{layers:JSON.stringify([t]),f:`json`},...i})).data.layerDataElements?.[0];if(!(a&&typeof a==`object`&&`dataElement`in a&&a.dataElement&&typeof a.dataElement==`object`))throw new r(`network:invalid-data-element`,`No data element was found for layer ${t}.`);this.read(a,{origin:`service`})}};e([u({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}}},read:!1}})],T.prototype,`id`,void 0),e([u({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:{source:`name`}}},read:!1}})],T.prototype,`title`,void 0),e([u({type:String,nonNullable:!0,json:{origins:{"web-map":{read:{source:`url`},write:{target:`url`,isRequired:!0}}},read:!1}})],T.prototype,`layerUrl`,void 0),e([u({type:Object,json:{origins:{service:{read:!0}},read:!1}})],T.prototype,`dataElement`,void 0),e([u({type:f,json:{origins:{service:{read:{source:`extent`}}},read:!1}})],T.prototype,`fullExtent`,void 0),e([u({type:p,json:{origins:{service:{read:{source:`extent.spatialReference`}}},read:!1}})],T.prototype,`spatialReference`,void 0),e([u({type:[`utility`,`trace`],readOnly:!0,json:{read:!1,write:!1}})],T.prototype,`type`,void 0),e([u({readOnly:!0})],T.prototype,`datasetName`,null),e([u({readOnly:!0})],T.prototype,`owner`,null),e([u({readOnly:!0})],T.prototype,`schemaGeneration`,null),e([u({readOnly:!0})],T.prototype,`parsedUrl`,null),e([u({readOnly:!0})],T.prototype,`featureServiceUrl`,null),e([u({readOnly:!0})],T.prototype,`networkServiceUrl`,null),e([u({readOnly:!0})],T.prototype,`layerId`,null),e([u()],T.prototype,`sourceJSON`,void 0),e([u({readOnly:!0})],T.prototype,`networkSystemLayers`,null),e([u({type:String})],T.prototype,`gdbVersion`,null),e([u({type:Date})],T.prototype,`historicMoment`,null),e([u()],T.prototype,`_historicMoment`,void 0),e([u()],T.prototype,`_gdbVersion`,void 0),T=e([d(`esri.networks.Network`)],T);function E(e,n){return new t({attributes:e.attributes,geometry:m({...e.geometry,spatialReference:n})})}const D=T;export{D as default};
2
+ import{__decorate as e}from"tslib";import t from"../Graphic.js";import n from"../request.js";import r from"../core/Error.js";import{Loadable as i}from"../core/Loadable.js";import a from"../core/Logger.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{isAbortError as s}from"../core/promiseUtils.js";import{urlToObject as c}from"../core/urlUtils.js";import{generateUUID as l}from"../core/uuid.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import f from"../geometry/Extent.js";import p from"../geometry/SpatialReference.js";import{fromJSON as m}from"../geometry/support/jsonUtils.js";import{versionMatches as h,onApplyEditsEvent as g,onUpdateMomentEvent as _,emitApplyEditsEvent as v}from"../layers/mixins/EditBusLayer.js";import{parse as y}from"../layers/support/arcgisLayerUrl.js";import b from"./support/TopologyValidationJobInfo.js";import{networkFromPortalItem as x}from"./support/utils.js";import{isVersionInEditSession as S,currentSessionId as C,isSafeToEditVersion as w}from"../versionManagement/support/versionManagementUtils.js";let T=class extends o(i){static fromPortalItem(e){return x(e)}constructor(e){super(e),this.id=l(),this.title=null,this.layerUrl=null,this.dataElement=null,this.fullExtent=null,this.spatialReference=null,this.type=null,this.sourceJSON=null,this._historicMoment=null,this._gdbVersion=null,this._sourceIdByLayerId=new Map,this._layerIdBySourceId=new Map,this._applyEditsHandler=e=>{let{serviceUrl:t,gdbVersion:n,result:r}=e,i=t===this.featureServiceUrl,a=h(t,n,this.gdbVersion);i&&a&&r.then(e=>{S(t,n)&&(this.historicMoment=e.historicMoment)})},this._updateMomentHandler=e=>{let{serviceUrl:t,gdbVersion:n,moment:r}=e,i=t===this.featureServiceUrl,a=h(t,n,this.gdbVersion);i&&a&&(this.historicMoment=r)},this.when().then(()=>{this.addHandles([g(this._applyEditsHandler),_(this._updateMomentHandler)])},()=>{})}initialize(){this.when().catch(e=>{s(e)||a.getLogger(this).error(`#load()`,`Failed to load layer (title: '${this.title??`no title`}', id: '${this.id??`no id`}')`,{error:e})})}get loaded(){return super.loaded}get datasetName(){return this.dataElement?.name??null}get owner(){return this.dataElement?.userIdentity??null}get schemaGeneration(){return this.dataElement?.schemaGeneration??null}get parsedUrl(){return c(this.layerUrl)}get featureServiceUrl(){return y(this.parsedUrl.path).url.path}get networkServiceUrl(){return this.featureServiceUrl.replace(/\/FeatureServer/i,`/UtilityNetworkServer`)}get layerId(){return y(this.parsedUrl.path).sublayer}get networkSystemLayers(){return null}get gdbVersion(){return this._gdbVersion}set gdbVersion(e){this._gdbVersion=e}get historicMoment(){return this._historicMoment}set historicMoment(e){this._historicMoment=e}async load(e){return this.addResolvingPromise(this._load(e)),this}async _load(e){await Promise.all([this._fetchDataElement(this.featureServiceUrl,this.layerId.toString(),e),this._fetchLayerMetaData(this.layerUrl,e)])}getLayerIdBySourceId(e){if(!this.dataElement)return null;let t=this._layerIdBySourceId.get(e);if(t!=null)return t;let n=this.dataElement.domainNetworks,r=this._traverseNetworkSources(n,this._layerIdBySourceId,`sourceId`,`layerId`,e);return r>=0?r:null}getSourceIdByLayerId(e){if(!this.dataElement)return null;let t=this._sourceIdByLayerId.get(e);if(t!=null)return t;let n=this.dataElement.domainNetworks,r=this._traverseNetworkSources(n,this._sourceIdByLayerId,`layerId`,`sourceId`,e);return r>=0?r:null}getObjectIdsFromElements(e){let t=[],n=new Map;for(let t of e){let e=this.getLayerIdBySourceId(t.networkSourceId);if(e==null)continue;let r=n.get(e);r===void 0&&(r=[]),r.push(t.objectId),n.set(e,r)}let r=this.featureServiceUrl;return n.forEach((e,n)=>t.push({layerUrl:`${r}/${n}`,objectIds:e})),t}async queryNamedTraceConfigurations(e,t){let[{queryNamedTraceConfigurations:n},{default:r}]=await Promise.all([import(`../rest/networks/queryNamedTraceConfigurations.js`),import(`../rest/networks/support/QueryNamedTraceConfigurationsParameters.js`)]),i=this.networkServiceUrl;return(await n(i,r.from(e),{...t}))?.namedTraceConfigurations}async validateTopology(e,t){if(!e.validateArea)throw new r(`network:undefined-validateArea`,`the network must have validateArea defined in the validate network topology parameters.`);let[{validateNetworkTopology:n},{default:i}]=await Promise.all([import(`../rest/networks/validateNetworkTopology.js`),import(`../rest/networks/support/ValidateNetworkTopologyParameters.js`)]),a=i.from(e);S(this.featureServiceUrl,this.gdbVersion||null)?(a.sessionID=C,await w(this.featureServiceUrl,this.gdbVersion,!0)):a.sessionID=null,a.gdbVersion=this.gdbVersion;let o=this.networkServiceUrl,s=this.featureServiceUrl,c=v(s,null,this.gdbVersion,!0),l=await n(o,a,{...t});if(l?.serviceEdits){let e=[];for(let t of l.serviceEdits){let{editedFeatures:n}=t,r=n?.spatialReference?new p(n.spatialReference):null;e.push({layerId:t.layerId,editedFeatures:{adds:n?.adds?.map(e=>E(e,r))||[],updates:n?.updates?.map(e=>({original:E(e[0],r),current:E(e[1],r)}))||[],deletes:n?.deletes?.map(e=>E(e,r))||[],spatialReference:r}})}c.resolve({edits:null,addedFeatures:[],updatedFeatures:[],deletedFeatures:[],addedAttachments:[],updatedAttachments:[],deletedAttachments:[],editedFeatures:e,exceededTransferLimit:!1,historicMoment:l.moment})}return l}async submitTopologyValidationJob(e,t){let i=null;if(!e.validateArea)throw new r(`network:undefined-validateArea`,`the network must have validateArea defined in the validate network topology parameters.`);if(!this.gdbVersion){let e=this.layerUrl.replace(/\/FeatureServer/i,`/VersionManagementServer`).replace(/\/\d*$/,``);i=(await n(e,{responseType:`json`,query:{f:`json`}})).data.defaultVersionName}let[{submitValidateNetworkTopologyJob:a},{default:o}]=await Promise.all([import(`../rest/networks/validateNetworkTopology.js`),import(`../rest/networks/support/ValidateNetworkTopologyParameters.js`)]),s=o.from(e);S(this.featureServiceUrl,this.gdbVersion||null)?(s.sessionID=C,await w(this.featureServiceUrl,this.gdbVersion,!0)):s.sessionID=null,s.gdbVersion=this.gdbVersion||i;let c=this.networkServiceUrl,l=this.featureServiceUrl?v(this.featureServiceUrl,null,this.gdbVersion,!0):void 0,u=await a(c,s,{...t});return new b({statusUrl:u,editsResolver:l})}getSourceTypeById(e){if(!this.dataElement)return null;for(let t of this.dataElement.domainNetworks)for(let n of[t.edgeSources??[],t.junctionSources??[]])for(let r of n)if(r.sourceId===e)return n===t.edgeSources?`edge`:`junction`;return null}_traverseNetworkSources(e,t,n,r,i){for(let a of e)for(let e of[a.edgeSources??[],a.junctionSources??[]])for(let a of e)if(a[n]===i)return t.set(i,a[r]),a[r];return-1}async _fetchLayerMetaData(e,t){let{data:r}=await n(e,{responseType:`json`,query:{f:`json`},...t});this.sourceJSON=r,this.read(r,{origin:`service`})}async _fetchDataElement(e,t,i){if(this.dataElement)return;let a=(await n(`${e}/queryDataElements`,{responseType:`json`,query:{layers:JSON.stringify([t]),f:`json`},...i})).data.layerDataElements?.[0];if(!(a&&typeof a==`object`&&`dataElement`in a&&a.dataElement&&typeof a.dataElement==`object`))throw new r(`network:invalid-data-element`,`No data element was found for layer ${t}.`);this.read(a,{origin:`service`})}};e([u({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}}},read:!1}})],T.prototype,`id`,void 0),e([u({type:String,nonNullable:!0,json:{origins:{"web-map":{read:!0,write:{isRequired:!0}},service:{read:{source:`name`}}},read:!1}})],T.prototype,`title`,void 0),e([u({type:String,nonNullable:!0,json:{origins:{"web-map":{read:{source:`url`},write:{target:`url`,isRequired:!0}}},read:!1}})],T.prototype,`layerUrl`,void 0),e([u({type:Object,json:{origins:{service:{read:!0}},read:!1}})],T.prototype,`dataElement`,void 0),e([u({type:f,json:{origins:{service:{read:{source:`extent`}}},read:!1}})],T.prototype,`fullExtent`,void 0),e([u({type:p,json:{origins:{service:{read:{source:`extent.spatialReference`}}},read:!1}})],T.prototype,`spatialReference`,void 0),e([u({type:[`utility`,`trace`],readOnly:!0,json:{read:!1,write:!1}})],T.prototype,`type`,void 0),e([u({readOnly:!0})],T.prototype,`datasetName`,null),e([u({readOnly:!0})],T.prototype,`owner`,null),e([u({readOnly:!0})],T.prototype,`schemaGeneration`,null),e([u({readOnly:!0})],T.prototype,`parsedUrl`,null),e([u({readOnly:!0})],T.prototype,`featureServiceUrl`,null),e([u({readOnly:!0})],T.prototype,`networkServiceUrl`,null),e([u({readOnly:!0})],T.prototype,`layerId`,null),e([u()],T.prototype,`sourceJSON`,void 0),e([u({readOnly:!0})],T.prototype,`networkSystemLayers`,null),e([u({type:String})],T.prototype,`gdbVersion`,null),e([u({type:Date})],T.prototype,`historicMoment`,null),e([u()],T.prototype,`_historicMoment`,void 0),e([u()],T.prototype,`_gdbVersion`,void 0),T=e([d(`esri.networks.Network`)],T);function E(e,n){return new t({attributes:e.attributes,geometry:m({...e.geometry,spatialReference:n})})}export{T as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../request.js";import{strict as n}from"../../core/jsonMap.js";import{createAbortError as r}from"../../core/promiseUtils.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import o from"../../rest/networks/support/ValidateNetworkTopologyResult.js";import{enumeration as s}from"../../core/accessorSupport/decorators/enumeration.js";const c=n()({Pending:`job-waiting`,InProgress:`job-executing`,Completed:`job-succeeded`});let l=class extends o{constructor(e){super(e),this.statusUrl=null,this.status=null,this.submissionTime=null,this.lastUpdatedTime=null,this._timer=void 0}destroy(){clearInterval(this._timer)}async checkJobStatus(e){let n={...e,query:{f:`json`}},{data:r}=await t(this.statusUrl,n);return this.read(r),this.editsResolver&&this.editsResolver.resolve({edits:null,addedFeatures:[],updatedFeatures:[],deletedFeatures:[],addedAttachments:[],updatedAttachments:[],deletedAttachments:[],exceededTransferLimit:!0,historicMoment:null}),this}async waitForJobCompletion(e={}){let{interval:t=1e3,statusCallback:n}=e;return new Promise((e,i)=>{this._clearTimer();let a=setInterval(()=>{this._timer||i(r()),this.checkJobStatus().then(t=>{let{status:r}=t;switch(this.status=r,r){case`job-succeeded`:this._clearTimer(),e(this);break;case`job-waiting`:case`job-executing`:n&&n(this)}},e=>{this._clearTimer(),i(e)})},t);this._timer=a})}_clearTimer(){clearInterval(this._timer),this._timer=void 0}};e([i()],l.prototype,`editsResolver`,void 0),e([i({type:String,json:{write:!0}})],l.prototype,`statusUrl`,void 0),e([s(c)],l.prototype,`status`,void 0),e([i({type:Date,json:{type:Number,write:{writer:(e,t)=>{t.submissionTime=e?e.getTime():null}}}})],l.prototype,`submissionTime`,void 0),e([i({type:Date,json:{type:Number,write:{writer:(e,t)=>{t.lastUpdatedTime=e?e.getTime():null}}}})],l.prototype,`lastUpdatedTime`,void 0),l=e([a(`esri.networks.support.TopologyValidationJobInfo`)],l);const u=l;export{u as default};
2
+ import{__decorate as e}from"tslib";import t from"../../request.js";import{strict as n}from"../../core/jsonMap.js";import{createAbortError as r}from"../../core/promiseUtils.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import o from"../../rest/networks/support/ValidateNetworkTopologyResult.js";import{enumeration as s}from"../../core/accessorSupport/decorators/enumeration.js";const c=n()({Pending:`job-waiting`,InProgress:`job-executing`,Completed:`job-succeeded`});let l=class extends o{constructor(e){super(e),this.statusUrl=null,this.status=null,this.submissionTime=null,this.lastUpdatedTime=null,this._timer=void 0}destroy(){clearInterval(this._timer)}async checkJobStatus(e){let n={...e,query:{f:`json`}},{data:r}=await t(this.statusUrl,n);return this.read(r),this.editsResolver&&this.editsResolver.resolve({edits:null,addedFeatures:[],updatedFeatures:[],deletedFeatures:[],addedAttachments:[],updatedAttachments:[],deletedAttachments:[],exceededTransferLimit:!0,historicMoment:null}),this}async waitForJobCompletion(e={}){let{interval:t=1e3,statusCallback:n}=e;return new Promise((e,i)=>{this._clearTimer();let a=setInterval(()=>{this._timer||i(r()),this.checkJobStatus().then(t=>{let{status:r}=t;switch(this.status=r,r){case`job-succeeded`:this._clearTimer(),e(this);break;case`job-waiting`:case`job-executing`:n&&n(this)}},e=>{this._clearTimer(),i(e)})},t);this._timer=a})}_clearTimer(){clearInterval(this._timer),this._timer=void 0}};e([i()],l.prototype,`editsResolver`,void 0),e([i({type:String,json:{write:!0}})],l.prototype,`statusUrl`,void 0),e([s(c)],l.prototype,`status`,void 0),e([i({type:Date,json:{type:Number,write:{writer:(e,t)=>{t.submissionTime=e?e.getTime():null}}}})],l.prototype,`submissionTime`,void 0),e([i({type:Date,json:{type:Number,write:{writer:(e,t)=>{t.lastUpdatedTime=e?e.getTime():null}}}})],l.prototype,`lastUpdatedTime`,void 0),l=e([a(`esri.networks.support.TopologyValidationJobInfo`)],l);export{l as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "6.0.0-next.29",
3
+ "version": "6.0.0-next.30",
4
4
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
5
5
  "keywords": [
6
6
  "ArcGIS",
@@ -20,7 +20,7 @@
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
22
  "@amcharts/amcharts5": "~5.21.5",
23
- "@arcgis/toolkit": "6.0.0-next.29",
23
+ "@arcgis/toolkit": "6.0.0-next.30",
24
24
  "@esri/arcgis-html-sanitizer": "~4.2.0-next.2",
25
25
  "@esri/calcite-components": "^5.2.0",
26
26
  "@vaadin/grid": "~25.3.5",
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{JSONSupport as t}from"../../../core/JSONSupport.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";let i=class extends t{constructor(e){super(e),this.moment=null,this.fullUpdate=!1,this.validateErrorsCreated=!1,this.exceededTransferLimit=null,this.serviceEdits=null,this.discoveredSubnetworks=null}};e([n({type:Date,json:{type:Number,write:{writer:(e,t)=>{t.moment=e?e.getTime():null}}}})],i.prototype,`moment`,void 0),e([n({type:Boolean,json:{write:!0}})],i.prototype,`fullUpdate`,void 0),e([n({type:Boolean,json:{write:!0}})],i.prototype,`validateErrorsCreated`,void 0),e([n({type:Boolean,json:{write:!0}})],i.prototype,`exceededTransferLimit`,void 0),e([n({type:[Object],json:{write:!0}})],i.prototype,`serviceEdits`,void 0),e([n({type:[Object],json:{write:!0}})],i.prototype,`discoveredSubnetworks`,void 0),i=e([r(`esri.rest.networks.support.ValidateNetworkTopologyResult`)],i);const a=i;export{a as default};
2
+ import{__decorate as e}from"tslib";import{JSONSupport as t}from"../../../core/JSONSupport.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";let i=class extends t{constructor(e){super(e),this.moment=null,this.fullUpdate=!1,this.validateErrorsCreated=!1,this.exceededTransferLimit=null,this.serviceEdits=null,this.discoveredSubnetworks=null}};e([n({type:Date,json:{type:Number,write:{writer:(e,t)=>{t.moment=e?e.getTime():null}}}})],i.prototype,`moment`,void 0),e([n({type:Boolean,json:{write:!0}})],i.prototype,`fullUpdate`,void 0),e([n({type:Boolean,json:{write:!0}})],i.prototype,`validateErrorsCreated`,void 0),e([n({type:Boolean,json:{write:!0}})],i.prototype,`exceededTransferLimit`,void 0),e([n({type:[Object],json:{write:!0}})],i.prototype,`serviceEdits`,void 0),e([n({type:[Object],json:{write:!0}})],i.prototype,`discoveredSubnetworks`,void 0),i=e([r(`esri.rest.networks.support.ValidateNetworkTopologyResult`)],i);export{i as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e}from"../core/arrayUtils.js";import{clone as t}from"../core/lang.js";import{offsetDate as n}from"../core/timeUtils.js";import r from"../time/TimeExtent.js";import{isWebMap as i}from"../webmap/utils.js";import{isWebScene as a}from"../webscene/utils.js";function o(e){return e.timeInfo!==void 0}async function s(e,t){return e.widgets?.timeSlider?.fullTimeExtent??u(e.allLayers,t)}function c(e){let t=e.numThumbs??2,n=e.currentTimeExtent;if(n){let{start:e,end:r}=n;return e!=null&&r!=null&&e.getTime()===r.getTime()?`instant`:t===2?`time-window`:e==null||e.getTime()===0?`cumulative-from-start`:`cumulative-from-end`}return t===2?`time-window`:`cumulative-from-start`}function l(e){let{numStops:n,stopInterval:r,stops:i}=e;return i?{dates:t(i)}:r?{interval:r.clone()}:{count:n??5}}async function u(t,n){if(t.length===0)return r.allTime;await Promise.all(t.map(e=>e.load({signal:n})));let i=t.filter(o),a=t.filter(e=>!o(e)&&e.visibilityTimeExtent!=null);if(i.length===0&&a.length===0)return r.allTime;let s=[],c=[];for(let e of i)(e?.type===`feature`||e?.type===`map-image`)&&e.timeInfo?.hasLiveData?s.push(e):c.push(e);let l=e=>e==null||e.isAllTime,u=[...c.map(e=>{let t=e.timeInfo?.fullTimeExtent,{visibilityTimeExtent:n}=e;return t?.intersection(n)??n}),...a.map(e=>e.visibilityTimeExtent)];if(u.some(l))return r.allTime;let d=s.map(async e=>{let t=(await e.fetchRecomputedExtents({signal:n}))?.timeExtent??e.timeInfo?.fullTimeExtent,{visibilityTimeExtent:r}=e;return t?.intersection(r)??r}),f=(await Promise.allSettled(d)).map(e=>e.status===`fulfilled`?e.value:null);if(f.some(l))return r.allTime;let p=[...f,...u].filter(e);return p.length===0?r.allTime:p.reduce((e,t)=>e.union(t))}function d(e,t){let n=e.currentTimeExtent;if(!n)return null;let{start:i,end:a}=n,o=i??a??null;switch(t){case`time-window`:return new r({start:i,end:a});case`cumulative-from-start`:return new r({start:null,end:o});case`cumulative-from-end`:return new r({start:o,end:null});case`instant`:return new r({start:o,end:o})}}async function f(e,t){if(!(i(e)||a(e)))return null;await e.load({signal:t});let n=e?.widgets?.timeSlider;if(!n)return null;let r=await s(e,t),{loop:o}=n,u=c(n);return{fullTimeExtent:r,loop:o,mode:u,playRate:n.stopDelay??2e3,stops:l(n),timeExtent:d(n,u)}}function p(e){if(!e)return e;let{start:t,end:i}=e;return new r({start:t==null?t:n(t,-t.getTimezoneOffset(),`minutes`),end:i==null?i:n(i,-i.getTimezoneOffset(),`minutes`)})}function m(e){if(!e)return e;let{start:t,end:i}=e;return new r({start:t==null?t:n(t,t.getTimezoneOffset(),`minutes`),end:i==null?i:n(i,i.getTimezoneOffset(),`minutes`)})}export{u as getTimeExtentFromLayers,f as getTimeSliderSettingsFromWebDocument,m as toLocalTimeExtent,p as toUTCTimeExtent};
2
+ import{isSome as e}from"../core/arrayUtils.js";import{clone as t}from"../core/lang.js";import{offsetDate as n}from"../core/timeUtils.js";import r from"../rest/support/StatisticDefinition.js";import i from"../time/TimeExtent.js";import{isWebMap as a}from"../webmap/utils.js";import{isWebScene as o}from"../webscene/utils.js";function s(e){return e.timeInfo!==void 0}async function c(t,n){if(!t.timeInfo||!t.timeInfo.startField&&!t.timeInfo.endField)return null;let{startField:a,endField:o}=t.timeInfo,s=t.createQuery();s.outStatistics=[],a&&s.outStatistics.push(new r({onStatisticField:a,outStatisticFieldName:`minStart`,statisticType:`min`}),new r({onStatisticField:a,outStatisticFieldName:`maxStart`,statisticType:`max`})),o&&s.outStatistics.push(new r({onStatisticField:o,outStatisticFieldName:`minEnd`,statisticType:`min`}),new r({onStatisticField:o,outStatisticFieldName:`maxEnd`,statisticType:`max`}));let{features:c}=await t.queryFeatures(s,{signal:n}),l=c.at(0),u=[l?.getAttribute(`minStart`),l?.getAttribute(`maxStart`),l?.getAttribute(`minEnd`),l?.getAttribute(`maxEnd`)].filter(e).map(e=>typeof e==`string`?Date.parse(e):e);if(!u.length)return null;let d=new Date(Math.min(...u)),f=new Date(Math.max(...u)),p=new i({start:d,end:f}),{visibilityTimeExtent:m}=t;return p?.intersection(m)??m}async function l(e,t){return e.widgets?.timeSlider?.fullTimeExtent??f(e.allLayers,t)}function u(e){let t=e.numThumbs??2,n=e.currentTimeExtent;if(n){let{start:e,end:r}=n;return e!=null&&r!=null&&e.getTime()===r.getTime()?`instant`:t===2?`time-window`:e==null||e.getTime()===0?`cumulative-from-start`:`cumulative-from-end`}return t===2?`time-window`:`cumulative-from-start`}function d(e){let{numStops:n,stopInterval:r,stops:i}=e;return i?{dates:t(i)}:r?{interval:r.clone()}:{count:n??5}}async function f(t,n){if(t.length===0)return i.allTime;await Promise.all(t.map(e=>e.load({signal:n})));let r=t.filter(s),a=t.filter(e=>!s(e)&&e.visibilityTimeExtent!=null);if(r.length===0&&a.length===0)return i.allTime;let o=[],l=[],u=[];for(let e of r)e.type===`feature`&&h(e)?o.push(e):(e.type===`feature`||e.type===`map-image`)&&e.timeInfo?.hasLiveData?l.push(e):u.push(e);let d=e=>e==null||e.isAllTime,f=[...u.map(e=>{let t=e.timeInfo?.fullTimeExtent,{visibilityTimeExtent:n}=e;return t?.intersection(n)??n}),...a.map(e=>e.visibilityTimeExtent)];if(f.some(d))return i.allTime;let p=l.map(async e=>{let t=(await e.fetchRecomputedExtents({signal:n}))?.timeExtent??e.timeInfo?.fullTimeExtent,{visibilityTimeExtent:r}=e;return t?.intersection(r)??r}),m=(await Promise.allSettled(p)).map(e=>e.status===`fulfilled`?e.value:null);if(m.some(d))return i.allTime;let g=o.map(e=>c(e,n)),_=(await Promise.allSettled(g)).filter(e=>e.status===`fulfilled`).map(e=>e.value),v=[...m,...f,..._].filter(e);return v.length===0?i.allTime:v.reduce((e,t)=>e.union(t))}function p(e,t){let n=e.currentTimeExtent;if(!n)return null;let{start:r,end:a}=n,o=r??a??null;switch(t){case`time-window`:return new i({start:r,end:a});case`cumulative-from-start`:return new i({start:null,end:o});case`cumulative-from-end`:return new i({start:o,end:null});case`instant`:return new i({start:o,end:o})}}async function m(e,t){if(!(a(e)||o(e)))return null;await e.load({signal:t});let n=e?.widgets?.timeSlider;if(!n)return null;let r=await l(e,t),{loop:i}=n,s=u(n);return{fullTimeExtent:r,loop:i,mode:s,playRate:n.stopDelay??2e3,stops:d(n),timeExtent:p(n,s)}}function h(e){if(!e.url)return!1;let t=e.timeInfo,n=e.getAtOrigin(`timeInfo`,`service`);return n?!(!t||t===n||(t.startField===n.startField||!t.startField&&!n.startField)&&(t.endField===n.endField||!t.endField&&!n.endField)):!!t}function g(e){if(!e)return e;let{start:t,end:r}=e;return new i({start:t==null?t:n(t,-t.getTimezoneOffset(),`minutes`),end:r==null?r:n(r,-r.getTimezoneOffset(),`minutes`)})}function _(e){if(!e)return e;let{start:t,end:r}=e;return new i({start:t==null?t:n(t,t.getTimezoneOffset(),`minutes`),end:r==null?r:n(r,r.getTimezoneOffset(),`minutes`)})}export{c as fetchTimeExtent,f as getTimeExtentFromLayers,m as getTimeSliderSettingsFromWebDocument,h as requireFetchTimeExtent,_ as toLocalTimeExtent,g as toUTCTimeExtent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{onePointInPixels as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{getUprightAngle as n}from"../../../../../../../symbols/cim/CIMCursor.js";import{maxTileCoordValue as r}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as i}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{spritePadding as a,tileSize as o}from"../../../definitions.js";import{AAnimatedMeshWriter as s}from"./AnimatedMeshWriter.js";import{angle as c,sizing as l,animationPointerAndBaseSizeAndReferenceSize as u,uv as d,offset as f,pos as p,bitset as m,id as h,lineLength as g,value1Position2Value2 as _,zoomRange as v}from"./attributes.js";import{clipWithVertexInterpolation as y}from"./clipping.js";import{createComputedAnimatedMeshParams as b}from"./ComputedAnimatedParams.js";function x(e,t){let n=[],r=0,i=0;for(;e.nextPath();){i=t?0:r,e.nextPoint();let{x:a,y:o}=e,s=[{x:a,y:o,attributes:[i]}];for(;e.nextPoint();){let{x:t,y:n}=e,r=t-a,c=n-o,l=Math.sqrt(r*r+c*c);i+=l,s.push({x:t,y:n,attributes:[i]}),a=t,o=n}s.length>1&&n.push(s),r=i}return{lineData:n,totalDistance:r}}class S extends s{get vertexSpec(){return{createComputedParams:b,optionalAttributes:{zoomRange:v,value1Position2Value2:_,lineLength:g},attributes:{id:h,bitset:m,pos:p,offset:f.marker,uv:d.marker,animationPointerAndBaseSizeAndReferenceSize:u,sizing:l,angle:c}}}_write(e,{target:n,effect:r}){let i=r?.geometry,{textureBinding:a}=this.evaluatedMeshParams.sprite;e.recordStart(this.instanceId,this.attributeLayout,a);let o=n.getDisplayId();if(this.shift&&n.geometryType===`esriGeometryPolyline`){if(!i){let r=t.fromFeatureSetReaderCIM(n);r&&this._writeParticles(e,n,r)}}else if(this.evaluatedMeshParams.placement!=null)this._writePlacedMarkers(e,n);else if(n.geometryType===`esriGeometryPolygon`){let t=n.readCentroidForDisplay();if(!t)return;let[r,i]=t.coords;this._writeQuad(e,o,r,i)}else if(n.geometryType===`esriGeometryPoint`){let t=n.readXForDisplay(),r=n.readYForDisplay();this._writeQuad(e,o,t,r)}else{let t=n.readGeometryForDisplay();t&&t.forEachVertex((t,n)=>{this._writeQuad(e,o,t,n)})}e.recordEnd()}_writePlacedMarkers(n,a){let o=t.fromFeatureSetReaderCIM(a)?.clone();if(!o)return;let s=i.getPlacement(o,-1,this.evaluatedMeshParams.placement,e,n.id);if(!s)return;let c=a.getDisplayId(),l=s.next(),u=null;for(;l!=null;){let e=l.tx,t=-l.ty;if(Math.abs(e)>r||Math.abs(t)>r){l=s.next();continue}let i=-l.getAngle();n.recordBounds(e,t,64,64),this.shift?u&&this._writeQuad(n,c,u[0],u[1],void 0,i):this._writeQuad(n,c,e,t,void 0,i),u=[e,t],l=s.next()}}_writeParticles(e,t,r){let i=t.getDisplayId(),{placement:a}=this.evaluatedMeshParams,s=a?.placePerPart??!1,c=this.evaluatedMeshParams.angleToLine&&a!=null&&`keepUpright`in a&&a.keepUpright,{lineData:l,totalDistance:u}=x(r,s);if(l.length===0)return;let d=this.evaluatedMeshParams.baseSize,f={x:-d,y:-d,width:o+2*d,height:o+2*d},p=l.flatMap(e=>{let t=s?e[e.length-1].attributes[0]:u;return C(y(e,f),t)});for(let{particles:t,lineLength:r}of p){let o=a=>{for(let o of t){let{a:t,b:s}=o,l=this.evaluatedMeshParams.angleToLine?Math.atan2(t.direction[1],t.direction[0]):0,u=c?n(l):null;this._writeQuad(e,i,t.position[0],t.position[1],[t.distance-a,s.position[0],s.position[1],s.distance-a],u??l,r,!0)}};if(!a||`placementTemplate`in a||a.type===`CIMMarkerPlacementOnVertices`){let e;if(a&&a.type!==`CIMMarkerPlacementOnVertices`)e=a.placementTemplate;else{e=[0];for(let n of t){let{a:t,b:r}=n,i=t.position[0]-r.position[0],a=t.position[1]-r.position[1],o=Math.sqrt(i*i+a*a);e.push(o)}}let n=-1*r;for(;n<2*r;)for(let t of e)n+=t,o(n)}else a.type===`CIMMarkerPlacementAtExtremities`?a.extremityPlacement===`JustBegin`?o(1):a.extremityPlacement===`JustEnd`?(o(r-1),o(-1)):a.extremityPlacement===`Both`&&(o(1),o(r-1)):a.type===`CIMMarkerPlacementOnLine`&&(a.relativeTo===`LineBeginning`?o(1):a.relativeTo===`LineEnd`?(o(r-1),o(-1)):a.relativeTo===`LineMiddle`&&o(r/2))}}_writeQuad(e,t,n,r,i,o=0,s=0,c=!1){let{rect:l}=this.evaluatedMeshParams.sprite,u=l.x+a,d=l.y+a,f=l.x+l.width-a,p=l.y+l.height-a,m=e.vertexCount();c||e.recordBounds(n,r,64,64);let h={texXmin:u,texYmin:d,texXmax:f,texYmax:p,value1Position2Value2:i,angle:o,lineLength:s};for(let i=0;i<4;i++)this._writeVertex(e,t,n,r,h);e.indexEnsureSize(6),e.indexWrite(m),e.indexWrite(m+1),e.indexWrite(m+2),e.indexWrite(m+1),e.indexWrite(m+3),e.indexWrite(m+2)}}function C(e,t){let n=[];for(let r of e){let e=[],{x:i,y:a}=r[0],o=r[0].attributes[0];for(let t=1;t<r.length;t++){let{x:n,y:s}=r[t],c=r[t].attributes[0],l=n-i,u=s-a,d=Math.sqrt(l*l+u*u);if(d>0)l/=d,u/=d;else continue;e.push({a:{position:[i,a],distance:o,direction:[l,u]},b:{position:[n,s],distance:c,direction:[l,u]}}),i=n,a=s,o=c}n.push({particles:e,lineLength:t})}return n}class w extends S{constructor(){super(...arguments),this.shift=!1}}class T extends S{constructor(){super(...arguments),this.shift=!0}}export{w as AnimatedMarkerMeshWriter,T as AnimatedMarkerShiftMeshWriter,x as convertToLineData};
2
+ import{onePointInPixels as e,pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as n}from"../../../../../../../geometry/GeometryCursor.js";import{getUprightAngle as r}from"../../../../../../../symbols/cim/CIMCursor.js";import{maxTileCoordValue as i}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as a}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{spritePadding as o,tileSize as s}from"../../../definitions.js";import{AAnimatedMeshWriter as c}from"./AnimatedMeshWriter.js";import{angle as l,sizing as u,animationPointerAndBaseSizeAndReferenceSize as d,uv as f,offset as p,pos as m,bitset as h,id as g,lineLength as _,value1Position2Value2 as v,zoomRange as y}from"./attributes.js";import{clipWithVertexInterpolation as b}from"./clipping.js";import{createComputedAnimatedMeshParams as x}from"./ComputedAnimatedParams.js";function S(e,t){let n=[],r=0,i=0;for(;e.nextPath();){i=t?0:r,e.nextPoint();let{x:a,y:o}=e,s=[{x:a,y:o,attributes:[i]}];for(;e.nextPoint();){let{x:t,y:n}=e,r=t-a,c=n-o,l=Math.sqrt(r*r+c*c);i+=l,s.push({x:t,y:n,attributes:[i]}),a=t,o=n}s.length>1&&n.push(s),r=i}return{lineData:n,totalDistance:r}}class C extends c{get vertexSpec(){return{createComputedParams:x,optionalAttributes:{zoomRange:y,value1Position2Value2:v,lineLength:_},attributes:{id:g,bitset:h,pos:m,offset:p.marker,uv:f.marker,animationPointerAndBaseSizeAndReferenceSize:d,sizing:u,angle:l}}}_write(e,{target:t,effect:r}){let i=r?.geometry,{textureBinding:a}=this.evaluatedMeshParams.sprite;e.recordStart(this.instanceId,this.attributeLayout,a);let o=t.getDisplayId();if(this.shift&&t.geometryType===`esriGeometryPolyline`){if(!i){let r=n.fromFeatureSetReaderCIM(t);r&&this._writeParticles(e,t,r)}}else if(this.evaluatedMeshParams.placement!=null)this._writePlacedMarkers(e,t);else if(t.geometryType===`esriGeometryPolygon`){let n=t.readCentroidForDisplay();if(!n)return;let[r,i]=n.coords;this._writeQuad(e,o,r,i)}else if(t.geometryType===`esriGeometryPoint`){let n=t.readXForDisplay(),r=t.readYForDisplay();this._writeQuad(e,o,n,r)}else{let n=t.readGeometryForDisplay();n&&n.forEachVertex((t,n)=>{this._writeQuad(e,o,t,n)})}e.recordEnd()}_writePlacedMarkers(t,r){let o=n.fromFeatureSetReaderCIM(r)?.clone();if(!o)return;let s=a.getPlacement(o,-1,this.evaluatedMeshParams.placement,e,t.id);if(!s)return;let c=r.getDisplayId(),l=s.next(),u=null;for(;l!=null;){let e=l.tx,n=-l.ty;if(Math.abs(e)>i||Math.abs(n)>i){l=s.next();continue}let r=-l.getAngle();t.recordBounds(e,n,64,64),this.shift?u&&this._writeQuad(t,c,u[0],u[1],void 0,r):this._writeQuad(t,c,e,n,void 0,r),u=[e,n],l=s.next()}}_writeParticles(e,t,n){let i=t.getDisplayId(),{placement:a}=this.evaluatedMeshParams,o=a?.placePerPart??!1,c=this.evaluatedMeshParams.angleToLine&&a!=null&&`keepUpright`in a&&a.keepUpright,{lineData:l,totalDistance:u}=S(n,o);if(l.length===0)return;let d=this.evaluatedMeshParams.baseSize,f={x:-d,y:-d,width:s+2*d,height:s+2*d},p=a==null?0:`offset`in a?a.offset??0:0,m=l.flatMap(e=>{let t=o?e[e.length-1].attributes[0]:u;return w(b(e,f),t,p)});for(let{particles:t,lineLength:n}of m){let o=a=>{for(let o of t){let{a:t,b:s}=o,l=this.evaluatedMeshParams.angleToLine?Math.atan2(t.direction[1],t.direction[0]):0,u=c?r(l):null;this._writeQuad(e,i,t.position[0],t.position[1],[t.distance-a,s.position[0],s.position[1],s.distance-a],u??l,n,!0)}};if(!a||`placementTemplate`in a||a.type===`CIMMarkerPlacementOnVertices`){let e;if(a&&a.type!==`CIMMarkerPlacementOnVertices`)e=a.placementTemplate;else{e=[0];for(let n of t){let{a:t,b:r}=n,i=t.position[0]-r.position[0],a=t.position[1]-r.position[1],o=Math.sqrt(i*i+a*a);e.push(o)}}let r=-1*n;for(;r<2*n;)for(let t of e)r+=t,o(r)}else a.type===`CIMMarkerPlacementAtExtremities`?a.extremityPlacement===`JustBegin`?o(1):a.extremityPlacement===`JustEnd`?(o(n-1),o(-1)):a.extremityPlacement===`Both`&&(o(1),o(n-1)):a.type===`CIMMarkerPlacementOnLine`&&(a.relativeTo===`LineBeginning`?o(1):a.relativeTo===`LineEnd`?(o(n-1),o(-1)):a.relativeTo===`LineMiddle`&&o(n/2))}}_writeQuad(e,t,n,r,i,a=0,s=0,c=!1){let{rect:l}=this.evaluatedMeshParams.sprite,u=l.x+o,d=l.y+o,f=l.x+l.width-o,p=l.y+l.height-o,m=e.vertexCount();c||e.recordBounds(n,r,64,64);let h={texXmin:u,texYmin:d,texXmax:f,texYmax:p,value1Position2Value2:i,angle:a,lineLength:s};for(let i=0;i<4;i++)this._writeVertex(e,t,n,r,h);e.indexEnsureSize(6),e.indexWrite(m),e.indexWrite(m+1),e.indexWrite(m+2),e.indexWrite(m+1),e.indexWrite(m+3),e.indexWrite(m+2)}}function w(e,n,r){let i=[];for(let a of e){let e=[],{x:o,y:s}=a[0],c=a[0].attributes[0];for(let n=1;n<a.length;n++){let{x:i,y:l}=a[n],u=a[n].attributes[0],d=i-o,f=l-s,p=Math.sqrt(d*d+f*f);if(p>0)d/=p,f/=p;else continue;let m=0,h=0;if(r!==0){let e=t(r),n=f,i=-d;m=n*e,h=i*e}e.push({a:{position:[o+m,s+h],distance:c,direction:[d,f]},b:{position:[i+m,l+h],distance:u,direction:[d,f]}}),o=i,s=l,c=u}i.push({particles:e,lineLength:n})}return i}class T extends C{constructor(){super(...arguments),this.shift=!1}}class E extends C{constructor(){super(...arguments),this.shift=!0}}export{T as AnimatedMarkerMeshWriter,E as AnimatedMarkerShiftMeshWriter,S as convertToLineData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Collection.js";import{makeHandle as r}from"../../../core/handleUtils.js";import i from"../../../core/Logger.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{watch as s,whenOnce as c}from"../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{LAYERVIEW_2D_SYMBOL as d}from"../../../layers/geospatialPDF/CIM2DLayerview.js";import"../engine/Stage.js";import"../../../Color.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../geometry/Point.js";import"../../../chunks/pe.js";import"../../../core/has.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../core/RandomLCG.js";import"../../../core/Accessor.js";import"../engine/transitions/FadeTransition.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Program.js";import"../../webgl/Renderbuffer.js";import"../../webgl/Texture.js";import"../../../core/memoryEstimations.js";import"../../webgl/enums.js";import"../../webgl/Util.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import f from"./graphics/GraphicsView2D.js";import p from"./graphics/GraphicContainer.js";import"../navigation/MapViewNavigation.js";import"../../../request.js";import"../../../core/asyncUtils.js";import"../../../core/support/UpdatingHandles.js";import"../../../core/mathUtils.js";import"../../../core/urlUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../../../geometry/support/normalizeUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import{LayerView2D as m}from"./LayerView2D.js";import h from"./imagery/ImageryTileView2D.js";import g from"../../layers/ImageryTileLayerView.js";import{RefreshableLayerView as _}from"../../layers/RefreshableLayerView.js";let v=class extends _(m(g)){constructor(){super(...arguments),this._graphics=new n,this._graphicsView=null,this.subview=null}get displayParameters(){let{layer:e}=this,t=this._get(`displayParameters`);return e.visible?{clipToNeatline:e.clippedToNeatline}:t}update(e){this.subview?.update(e),this._graphicsView?.processUpdate(e),this.notifyChange(`updating`)}isUpdating(){return!this.subview||this.subview.updating}attach(){this.layer.increaseRasterJobHandlerUsage();let e=new h({layer:this.layer,layerView:this,scheduler:this.scheduler});e.useWebGLForProcessing=!0,e.useProgressiveUpdate=!0,this.subview=e;let t=new n,a=new p(this.view.featuresTilingScheme),l=new f({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:t,container:a});this._graphicsView=l;let u=new AbortController;y(this.layer,t,this.view.spatialReference);let d=r(()=>{u.abort(),this.container.removeChild(l.container),this._graphicsView===l&&(this._graphicsView=null),l.destroy(),a.destroy(),t.destroy()});this.addAttachHandles([d,s(()=>this.layer.clippedToNeatline,()=>{let t=e.redrawOrRefetch({refetch:!0,reprocess:!1}).catch(e=>{o(e)||i.getLogger(this).error(e)});this._updatingHandles.addPromise(t)})]),this._attachSubview(e),this.container.addChild(a),c(()=>!e.updating&&e.container.children.some(e=>e.bitmap?.rawPixelData?.pixelBlock!=null),u.signal).then(()=>d.remove()).catch(e=>{o(e)||i.getLogger(this).error(e)}),this.requestUpdate()}detach(){this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null,this._graphicsView&&=(this.container.removeChild(this._graphicsView.container),a(this._graphicsView)??null),this._graphics.removeAll(),this.layer.decreaseRasterJobHandlerUsage()}viewChange(){this._graphicsView?.viewChange(),this.requestUpdate()}moveEnd(){this.subview.moveEnd()}doRefresh(){return this.subview?this.subview.doRefresh():Promise.resolve()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0))}_detachSubview(e){e?.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}};e([l()],v.prototype,`subview`,void 0),e([l({readOnly:!0})],v.prototype,`displayParameters`,null),v=e([u(`esri.views.2d.layers.GeospatialPDFLayerView2D`)],v);function y(e,n,r){let i=e.createNeatline(r),a=new t({geometry:i,symbol:d});n.add(a)}const b=v;export{b as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Collection.js";import{makeHandle as r}from"../../../core/handleUtils.js";import i from"../../../core/Logger.js";import{destroyMaybe as a}from"../../../core/maybe.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{watch as s,whenOnce as c}from"../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import d from"../../../symbols/CIMSymbol.js";import"../engine/Stage.js";import"../../../Color.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../geometry/Point.js";import"../../../chunks/pe.js";import"../../../core/has.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../core/RandomLCG.js";import"../../../core/Accessor.js";import"../engine/transitions/FadeTransition.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Program.js";import"../../webgl/Renderbuffer.js";import"../../webgl/Texture.js";import"../../../core/memoryEstimations.js";import"../../webgl/enums.js";import"../../webgl/Util.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import f from"./graphics/GraphicsView2D.js";import p from"./graphics/GraphicContainer.js";import"../navigation/MapViewNavigation.js";import"../../../request.js";import"../../../core/asyncUtils.js";import"../../../core/support/UpdatingHandles.js";import"../../../core/mathUtils.js";import"../../../core/urlUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../../../geometry/Extent.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../../../geometry/support/normalizeUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import{LayerView2D as m}from"./LayerView2D.js";import h from"./imagery/ImageryTileView2D.js";import g from"../../layers/ImageryTileLayerView.js";import{RefreshableLayerView as _}from"../../layers/RefreshableLayerView.js";let v=class extends _(m(g)){constructor(){super(...arguments),this._graphicsView=null,this.subview=null}get displayParameters(){let{layer:e}=this,t=this._get(`displayParameters`);return e.visible?{clipToNeatline:e.clippedToNeatline}:t}update(e){this.subview?.update(e),this._graphicsView?.processUpdate(e),this.notifyChange(`updating`)}isUpdating(){return!this.subview||this.subview.updating}attach(){this.layer.increaseRasterJobHandlerUsage();let e=this.subview=new h({layer:this.layer,layerView:this,scheduler:this.scheduler});e.useWebGLForProcessing=!0,e.useProgressiveUpdate=!0;let t=this._graphicsView=new f({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:new n,container:new p(this.view.featuresTilingScheme)}),l=new AbortController;y(this.layer,this._graphicsView.graphics,this.view.spatialReference);let u=r(()=>{l.abort(),this.container.removeChild(t.container),this._graphicsView=a(this._graphicsView)}),d=r(()=>{e.attached&&=(this.container.removeChild(e.container),e.detach(),!1),this.subview=a(this.subview),this.layer.decreaseRasterJobHandlerUsage()});this.addAttachHandles([u,d,s(()=>this.layer.clippedToNeatline,()=>{let t=e.redrawOrRefetch({refetch:!0,reprocess:!1}).catch(e=>{o(e)||i.getLogger(this).error(e)});this._updatingHandles.addPromise(t)})]),this.container.addChild(t.container),e.attach(),e.attached=!0,this.container.addChild(e.container),c(()=>!e.updating&&e.container.children.some(e=>e.bitmap?.rawPixelData?.pixelBlock!=null),l.signal).then(()=>u.remove()).catch(e=>{o(e)||i.getLogger(this).error(e)}),this.requestUpdate()}detach(){}viewChange(){this._graphicsView?.viewChange(),this.requestUpdate()}moveEnd(){this.subview.moveEnd()}doRefresh(){return this.subview?this.subview.doRefresh():Promise.resolve()}};e([l()],v.prototype,`subview`,void 0),e([l({readOnly:!0})],v.prototype,`displayParameters`,null),v=e([u(`esri.views.2d.layers.GeospatialPDFLayerView2D`)],v);function y(e,n,r){let i=e.createNeatline(r),a=new t({geometry:i,symbol:b()});n.add(a)}function b(){return new d({data:{type:`CIMSymbolReference`,symbol:{type:`CIMPolygonSymbol`,symbolLayers:[{type:`CIMSolidStroke`,color:[80,170,205,255],enable:!0,joinStyle:`Miter`,width:4,effects:[{type:`CIMGeometricEffectOffset`,method:`Square`,offset:-4}]},{type:`CIMSolidFill`,effects:[{type:`CIMGeometricEffectBuffer`,size:-4}],animations:[{type:`CIMSymbolAnimationColor`,animatedSymbolProperties:{type:`CIMAnimatedSymbolProperties`,duration:3,easing:`EaseInOut`,playAnimation:!0,randomizeStartTime:!1,repeatType:`Oscillate`},toColor:[145,215,235,50]}],color:[145,215,235,100],enable:!0}]}}})}const x=v;export{x as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as n}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import{makeHandle as i}from"../../../core/handleUtils.js";import{watch as a,initial as o}from"../../../core/reactiveUtils.js";import{isScreenRect as s}from"../../../core/screenUtils.js";import{subclass as c}from"../../../core/accessorSupport/decorators.js";import l from"../../../layers/support/FeatureFilter.js";import{LayerView2D as u}from"./LayerView2D.js";import d from"./graphics/GraphicContainer.js";import f from"./graphics/GraphicsView2D.js";import p from"../../layers/SketchLayerView.js";import{getHighlightName as m}from"../../support/highlightOptionsUtils.js";const h=`layerView`;let g=class extends u(p){*graphicsViews(){this._graphicsViewsFeatureCollectionMap==null?this._graphicsViews==null?yield*[]:yield*this._graphicsViews:yield*this._graphicsViewsFeatureCollectionMap.keys()}queryGraphics(){if(this._graphicsViewsFeatureCollectionMap!=null){let e=new r;for(let t of this.graphicsViews())e.addMany(t.graphics);return Promise.resolve(e)}return Promise.resolve(this.layer.graphics)}async hitTest(e,t){return Array.from(this.graphicsViews(),e=>{let n=e.hitTest(this.view,t);if(this._graphicsViewsFeatureCollectionMap!=null){let t=this._graphicsViewsFeatureCollectionMap.get(e);for(let e of n)!e.popupTemplate&&t.popupTemplate&&(e.popupTemplate=t.popupTemplate),e.sourceLayer=e.layer=this.layer}return n}).flat().map(n=>({type:`graphic`,graphic:n,layer:this.layer,mapPoint:s(t)?null:e}))}highlight(e,a){let o;typeof e==`number`?o=[e]:e instanceof t?o=[e.uid]:Array.isArray(e)&&e.length>0?o=typeof e[0]==`number`?e:e.map(e=>e&&e.uid):r.isCollection(e)&&(o=e.map(e=>e&&e.uid).toArray());let s=o?.filter(n);if(!s?.length)return i();let c=m(a),u=this._addHighlightFilter(new l({objectIds:s}),c);return i(()=>this._removeHighlight(u))}update(e){for(let t of this.graphicsViews())t.processUpdate(e)}attach(){let e=this.view,t=()=>this.requestUpdate(),n=this.layer.featureCollections;if(n!=null&&n.length){this._graphicsViewsFeatureCollectionMap=new Map;for(let r of n){let n=new d(this.view.featuresTilingScheme),i=new f({view:e,graphics:r.source,renderer:r.renderer,requestUpdateCallback:t,container:n});this._graphicsViewsFeatureCollectionMap.set(i,r),this.container.addChild(i.container),this.addHandles([a(()=>r.visible,e=>i.container.visible=e,o),a(()=>i.updating,()=>this.notifyChange(`updating`),o)],h)}this._onHighlightChange()}else this._createGraphicsViews()}detach(){this._destroyGraphicsViews()}moveEnd(){}viewChange(){for(let e of this.graphicsViews())e.viewChange()}isUpdating(){for(let e of this.graphicsViews())if(e.updating)return!0;return!1}_destroyGraphicsViews(){this.container.removeAllChildren(),this.removeHandles(h);for(let e of this.graphicsViews())e.destroy();this._graphicsViews=null,this._graphicsViewsFeatureCollectionMap=null}_createGraphicsViews(){this._destroyGraphicsViews();let e=this.view,t=()=>this.requestUpdate(),n=new d(this.view.featuresTilingScheme);n.fadeTransitionEnabled=!0;let r=new f({view:e,graphics:this.layer.graphics,requestUpdateCallback:t,container:n,layerId:this.layer.id});this.addHandles([this.layer.on(`graphic-update`,r.graphicUpdateHandler),a(()=>this.layer.visible,t=>{r.container.visible=t,t&&(r.update({state:e.state}),r.pushUpdate())},o),a(()=>r.updating,()=>this.notifyChange(`updating`),o)],h),this.container.addChild(r.container),this._graphicsViews=[r],this._onHighlightChange()}_onHighlightChange(){let e=this._getHighlightFilterGroups();for(let t of this._graphicsViews||[])t.setHighlightFilters(e);this._graphicsViewsFeatureCollectionMap?.forEach((t,n)=>{n.setHighlightFilters(e)})}};g=e([c(`esri.views.2d.layers.SketchLayerView2D`)],g);const _=g;export{_ as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as n}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import{makeHandle as i}from"../../../core/handleUtils.js";import{watch as a,initial as o}from"../../../core/reactiveUtils.js";import{isScreenRect as s}from"../../../core/screenUtils.js";import{subclass as c}from"../../../core/accessorSupport/decorators.js";import l from"../../../layers/support/FeatureFilter.js";import{LayerView2D as u}from"./LayerView2D.js";import d from"./graphics/GraphicContainer.js";import f from"./graphics/GraphicsView2D.js";import p from"../../layers/SketchLayerView.js";import{getHighlightName as m}from"../../support/highlightOptionsUtils.js";const h=`layerView`;let g=class extends u(p){*graphicsViews(){this._graphicsViewsFeatureCollectionMap==null?this._graphicsViews==null?yield*[]:yield*this._graphicsViews:yield*this._graphicsViewsFeatureCollectionMap.keys()}queryGraphics(){if(this._graphicsViewsFeatureCollectionMap!=null){let e=new r;for(let t of this.graphicsViews())e.addMany(t.graphics);return Promise.resolve(e)}return Promise.resolve(this.layer.graphics)}async hitTest(e,t){return Array.from(this.graphicsViews(),e=>{let n=e.hitTest(this.view,t);if(this._graphicsViewsFeatureCollectionMap!=null){let t=this._graphicsViewsFeatureCollectionMap.get(e);for(let e of n)!e.popupTemplate&&t.popupTemplate&&(e.popupTemplate=t.popupTemplate),e.sourceLayer=e.layer=this.layer}return n}).flat().map(n=>({type:`graphic`,graphic:n,layer:this.layer,mapPoint:s(t)?null:e}))}highlight(e,a){let o;typeof e==`number`?o=[e]:e instanceof t?o=[e.uid]:Array.isArray(e)&&e.length>0?o=typeof e[0]==`number`?e:e.map(e=>e&&e.uid):r.isCollection(e)&&(o=e.map(e=>e&&e.uid).toArray());let s=o?.filter(n);if(!s?.length)return i();let c=m(a),u=this._addHighlightFilter(new l({objectIds:s}),c);return i(()=>this._removeHighlight(u))}update(e){for(let t of this.graphicsViews())t.processUpdate(e)}attach(){let e=this.view,t=()=>this.requestUpdate(),n=this.layer.featureCollections;if(n!=null&&n.length){this._graphicsViewsFeatureCollectionMap=new Map;for(let r of n){let n=new d(this.view.featuresTilingScheme),i=new f({view:e,graphics:r.source,renderer:r.renderer,requestUpdateCallback:t,container:n});this._graphicsViewsFeatureCollectionMap.set(i,r),this.container.addChild(i.container),this.addHandles([a(()=>r.visible,e=>i.container.visible=e,o),a(()=>i.updating,()=>this.notifyChange(`updating`),o)],h)}this._onHighlightChange()}else this._createGraphicsViews()}detach(){this._destroyGraphicsViews()}moveEnd(){}viewChange(){for(let e of this.graphicsViews())e.viewChange()}async updateLayer(){await this.layer.updateFrom(this)}isUpdating(){for(let e of this.graphicsViews())if(e.updating)return!0;return!1}_destroyGraphicsViews(){this.container.removeAllChildren(),this.removeHandles(h);for(let e of this.graphicsViews())e.destroy();this._graphicsViews=null,this._graphicsViewsFeatureCollectionMap=null}_createGraphicsViews(){this._destroyGraphicsViews();let e=this.view,t=()=>this.requestUpdate(),n=new d(this.view.featuresTilingScheme);n.fadeTransitionEnabled=!0;let r=new f({view:e,graphics:this.layer.graphics,requestUpdateCallback:t,container:n,layerId:this.layer.id});this.addHandles([this.layer.on(`graphic-update`,r.graphicUpdateHandler),a(()=>this.layer.visible,t=>{r.container.visible=t,t&&(r.update({state:e.state}),r.pushUpdate())},o),a(()=>r.updating,()=>this.notifyChange(`updating`),o)],h),this.container.addChild(r.container),this._graphicsViews=[r],this._onHighlightChange()}_onHighlightChange(){let e=this._getHighlightFilterGroups();for(let t of this._graphicsViews||[])t.setHighlightFilters(e);this._graphicsViewsFeatureCollectionMap?.forEach((t,n)=>{n.setHighlightFilters(e)})}};g=e([c(`esri.views.2d.layers.SketchLayerView2D`)],g);const _=g;export{_ as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Logger.js";import{isAbortError as n}from"../../../core/promiseUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{equals as a}from"../../../geometry/support/spatialReferenceUtils.js";import{BitmapTileLayerView2D as o}from"./BitmapTileLayerView2D.js";import{LayerView2D as s}from"./LayerView2D.js";import{resampleImage as c}from"./support/imageUtils.js";import l from"../tiling/TileInfoView.js";import u from"../tiling/TileKey.js";import d from"../tiling/TileQueue.js";import f from"../tiling/TileStrategy.js";import p from"../../layers/LayerView.js";import{RefreshableLayerView as m}from"../../layers/RefreshableLayerView.js";import{TaskPriority as h}from"../../support/Scheduler.js";const g=[0,0];let _=class extends m(o(s(p))){constructor(){super(...arguments),this._tileStrategy=null,this._fetchQueue=null,this.layer=null}get tileMatrixSet(){let{activeLayer:e}=this.layer,{tileMatrixSet:t}=e;if(t&&a(t.tileInfo?.spatialReference,this.view.spatialReference))return t;let n=this._getTileMatrixSetBySpatialReference(e);return n&&n.id!==e.tileMatrixSetId?(e.tileMatrixSetId=n.id,n):null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume()}attach(){let e=this.tileMatrixSet?.tileInfo;e&&(this._tileInfoView=new l(e),this._fetchQueue=new d({tileInfoView:this._tileInfoView,concurrency:16,process:(e,t)=>this.fetchTile(e,t),scheduler:this.scheduler,priority:h.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new f({cachePolicy:`keep`,resampling:!0,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),this.addAttachHandles(this._updatingHandles.add(()=>[this.layer?.activeLayer?.styleId,this.tileMatrixSet],()=>this.doRefresh())),super.attach())}detach(){super.detach(),this._tileStrategy?.destroy(),this._fetchQueue?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return this.layer.activeLayer.tileMatrixSets?.some(t=>a(t.tileInfo?.spatialReference,e))??!1}async doRefresh(){this.attached&&(this.suspended?(this._tileStrategy.clear(),this.requestUpdate()):(this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))))}acquireTile(e){let t=this._bitmapView.createTile(e),n=t.bitmap;return[n.x,n.y]=this._tileInfoView.getTileCoords(g,t.key),n.resolution=this._tileInfoView.getTileResolution(t.key),[n.width,n.height]=this._tileInfoView.size,this._updatingHandles.consumePromise(this._enqueueTileFetch(t)),this._bitmapView.addChild(t),this.requestUpdate(),t}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once(`detach`,()=>e.destroy()),this.requestUpdate()}async fetchTile(e,t={}){let r=`tilemapCache`in this.layer?this.layer.tilemapCache:null,{signal:i,resamplingLevel:a=0}=t;if(!r)return this._fetchImage(e,i);let o=new u(0,0,0,0),s;try{await r.fetchAvailabilityUpsample(e.level,e.row,e.col,o,{signal:i}),s=await this._fetchImage(o,i)}catch(r){if(n(r))throw r;if(a<3){let n=this._tileInfoView.getTileParentId(e.id);if(n){let r=new u(n),i=await this.fetchTile(r,{...t,resamplingLevel:a+1});return c(this._tileInfoView,i,r,e)}}throw r}return c(this._tileInfoView,s,o,e)}canResume(){return super.canResume()&&this.tileMatrixSet!==null}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{let t=await this._fetchQueue.push(e.key);e.bitmap.source=t,e.bitmap.width=this._tileInfoView.size[0],e.bitmap.height=this._tileInfoView.size[1],e.once(`attach`,()=>this.requestUpdate())}catch(e){n(e)||t.getLogger(this).error(e)}this.requestUpdate()}}async _fetchImage(e,t){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:t}).then(({bitmap:e})=>e)}_getTileMatrixSetBySpatialReference(e){return e.tileMatrixSets?.find(e=>a(e.tileInfo?.spatialReference,this.view.spatialReference))}};e([r({readOnly:!0})],_.prototype,`tileMatrixSet`,null),_=e([i(`esri.views.2d.layers.WMTSLayerView2D`)],_);const v=_;export{v as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Logger.js";import{isAbortError as n}from"../../../core/promiseUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{equals as a}from"../../../geometry/support/spatialReferenceUtils.js";import o from"../../../layers/support/TileInfoTilemapCache.js";import{BitmapTileLayerView2D as s}from"./BitmapTileLayerView2D.js";import{LayerView2D as c}from"./LayerView2D.js";import{resampleImage as l}from"./support/imageUtils.js";import u from"../tiling/TileInfoView.js";import d from"../tiling/TileKey.js";import f from"../tiling/TileQueue.js";import p from"../tiling/TileStrategy.js";import{RefreshableLayerView as m}from"../../layers/RefreshableLayerView.js";import h from"../../layers/WMTSLayerView.js";import{TaskPriority as g}from"../../support/Scheduler.js";const _=[0,0];let v=class extends m(s(c(h))){constructor(){super(...arguments),this._tileStrategy=null,this._fetchQueue=null,this.layer=null}get tileMatrixSet(){let{activeLayer:e}=this.layer,{tileMatrixSet:t}=e;return t&&a(t.tileInfo?.spatialReference,this.view.spatialReference)?t:this._getTileMatrixSetBySpatialReference(e)??null}get tilemapCache(){let e=this.tileMatrixSet?.tileInfo;return e?new o(e):null}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume()}attach(){let e=this.tileMatrixSet?.tileInfo;e&&(this._tileInfoView=new u(e),this._fetchQueue=new f({tileInfoView:this._tileInfoView,concurrency:16,process:(e,t)=>this.fetchTile(e,t),scheduler:this.scheduler,priority:g.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new p({cachePolicy:`keep`,resampling:!0,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),this.addAttachHandles(this._updatingHandles.add(()=>[this.layer?.activeLayer?.styleId,this.tileMatrixSet],()=>this.doRefresh())),super.attach())}detach(){super.detach(),this._tileStrategy?.destroy(),this._fetchQueue?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return this.layer.activeLayer.tileMatrixSets?.some(t=>a(t.tileInfo?.spatialReference,e))??!1}async doRefresh(){this.attached&&(this.suspended?(this._tileStrategy.clear(),this.requestUpdate()):(this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updatingHandles.addPromise(this._enqueueTileFetch(e)))))}acquireTile(e){let t=this._bitmapView.createTile(e),n=t.bitmap;return[n.x,n.y]=this._tileInfoView.getTileCoords(_,t.key),n.resolution=this._tileInfoView.getTileResolution(t.key),[n.width,n.height]=this._tileInfoView.size,this._updatingHandles.consumePromise(this._enqueueTileFetch(t)),this._bitmapView.addChild(t),this.requestUpdate(),t}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once(`detach`,()=>e.destroy()),this.requestUpdate()}async fetchTile(e,t={}){let{tilemapCache:r}=this,{signal:i,resamplingLevel:a=0}=t;if(!r)return this._fetchImage(e,i);let o=new d(0,0,0,0),s;try{await r.fetchAvailabilityUpsample(e.level,e.row,e.col,o,{signal:i}),s=await this._fetchImage(o,i)}catch(r){if(n(r))throw r;if(a<3){let n=this._tileInfoView.getTileParentId(e.id);if(n){let r=new d(n),i=await this.fetchTile(r,{...t,resamplingLevel:a+1});return l(this._tileInfoView,i,r,e)}}throw r}return l(this._tileInfoView,s,o,e)}canResume(){return super.canResume()&&this.tileMatrixSet!==null}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{let t=await this._fetchQueue.push(e.key);e.bitmap.source=t,e.bitmap.width=this._tileInfoView.size[0],e.bitmap.height=this._tileInfoView.size[1],e.once(`attach`,()=>this.requestUpdate())}catch(e){n(e)||t.getLogger(this).error(e)}this.requestUpdate()}}async _fetchImage(e,t){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:t,tileMatrixSetId:this.tileMatrixSet?.id}).then(({bitmap:e})=>e)}_getTileMatrixSetBySpatialReference(e){return e.tileMatrixSets?.find(e=>a(e.tileInfo?.spatialReference,this.view.spatialReference))}};e([r()],v.prototype,`tileMatrixSet`,null),e([r()],v.prototype,`tilemapCache`,null),v=e([i(`esri.views.2d.layers.WMTSLayerView2D`)],v);const y=v;export{y as default};
@@ -18,6 +18,7 @@ import type SketchLayerView from "../layers/SketchLayerView.js";
18
18
  import type StreamLayerView from "../layers/StreamLayerView.js";
19
19
  import type VectorTileLayerView from "../layers/VectorTileLayerView.js";
20
20
  import type WFSLayerView from "../layers/WFSLayerView.js";
21
+ import type WMTSLayerView from "../layers/WMTSLayerView.js";
21
22
 
22
23
  /** @since 5.0 */
23
24
  export interface LayerView2DMap {
@@ -98,7 +99,7 @@ export interface LayerView2DMap {
98
99
  /** @since 5.0 */
99
100
  wms: never;
100
101
  /** @since 5.0 */
101
- wmts: never;
102
+ wmts: WMTSLayerView;
102
103
  /** @since 5.0 */
103
104
  "base-elevation": never;
104
105
  /** @since 5.0 */
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import n from"../../../../../core/Collection.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{debounce as o}from"../../../../../core/promiseUtils.js";import{scale as s,zeroMeters as c}from"../../../../../core/quantity.js";import{watch as l,initial as u,syncAndInitial as d}from"../../../../../core/reactiveUtils.js";import{property as f,subclass as p}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as m}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as ee}from"../../../../../core/support/UpdatingHandles.js";import te from"../../../../../geometry/Point.js";import{makeDehydratedPoint as h}from"../../../../../layers/graphics/dehydratedPoint.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{orientation as _}from"../geometryUtils.js";import{manipulatedObjectGeometry as v,supportsElevationMode as y}from"../manipulatedObjectUtils.js";import{canMoveZOperations as b}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as x}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as S}from"../tooltipUtils3D.js";import{createVisualElements as C}from"../visualElementUtils.js";import{discRadius as ne}from"../manipulations/config.js";import{MoveManipulation as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as T}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as E}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as D}from"./isSupportedObject.js";import{OutlineVisualElement as O}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as k}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as A,resetManipulatedObjectMany as j}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as M}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as N}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import P from"../../../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as F}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as I}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as L,enterInputModeIfAvailable as R}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as z}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as B}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as V}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as H}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as U}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as W}from"../../../../support/GeometryWorkerHandle.js";class G{constructor(e){this.objects=e,this.type=`move-start`}}class K{constructor(e,t,n){this.dx=e,this.dy=t,this.objects=n,this.type=`move`}}class q{constructor(e){this.objects=e,this.type=`move-stop`}}class J{constructor(e){this.objects=e,this.type=`hold`}}const Y=Symbol(`manipulators`),X=Symbol(`tooltips`),Z=Symbol(`move-manipulator-display`);let Q=class extends M{get _infos(){return Array.from(this._infosByType.values())}constructor(e){super(e),this._infosByType=new Map,this.events=new r,this.objects=new n,this.enableVisualElements=!0,this.enableZ=!0,this.manipulatorRadius=null,this.toolOptions=new P,this.type=`move-3d`,this._measurementWorker=new W({preloadGeodetic:!0}),this._ownedTooltip=null,this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new ee,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=o(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){let{view:e}=this;this.tooltip??=this._ownedTooltip=L(()=>({view:e,options:this.toolOptions.tooltips})),this.addHandles(this._updatingHandles.addOnCollectionChange(()=>this.objects,e=>{e.removed.forEach(e=>this.removeHandles(e)),this._updateObjectInfos(e),this._setupObjectUpdateHandles(e.added),this._refreshManipulators(),this._connectTooltips()}));let t=this.objects.toArray();this._updateObjectInfos({added:t,removed:[]}),this._setupObjectUpdateHandles(t),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this._ownedTooltip=a(this._ownedTooltip),this._moveManipulation=a(this._moveManipulation),this._set(`view`,null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(e){if(this.destroyed||R(e,this.tooltip))return;let t=this.firstGrabbedManipulator;if(e.type===`hold`&&t!=null){let e=this._getActiveObjectInfos(this._infos,t).map(({object:e})=>e);this.events.emit(`hold`,new J(e))}return super.onInputEvent(e)}get updating(){return this._updatingHandles.updating||!!this.snappingManager?.updating}get _shouldShowMovePointTooltip(){let{objects:e}=this;if(e.length!==1)return!1;let t=v(e.at(0))?.type;return t===`point`||t===`mesh`}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:e,removed:t}){for(let t of e){if(D(t)!==0)continue;let e=new re(t);this._infosByType.set(t,e)}for(let e of t)this._infosByType.delete(e)}_setupObjectUpdateHandles(e){for(let t of e){let e=this._infosByType.get(t);this.addHandles(x(e.object),t),y(t)&&this.addHandles(l(()=>{let{mode:e,unit:n,offset:r}=t.elevationInfo;return[e,n,r]},()=>this._refreshManipulators()),t)}}_refreshManipulators(){if(this.removeHandles(Y),this.removeHandles(Z),this._moveManipulation=a(this._moveManipulation),this.manipulators.removeAll(),this._infosByType.size===0)return;let e=this._infos;this._createManipulators(e),this._createVisualElements(e),this._updateMoveManipulation(e)}_createManipulators(e){for(let t of e){let n=t.object;t.manipulationXY=new E({tool:this,view:this.view,object:n}),t.manipulationXY.forEachManipulator(e=>{this.addHandles([e.events.on(`immediate-click`,e=>{this.events.emit(`immediate-click`,{...e,object:n}),e.stopPropagation()}),e.events.on(`grab-changed`,({action:e})=>{e===`start`?this._showTooltip(0):this._hideTooltip(),this._updateMoveManipulatorDisplay()})],Y)}),this.addHandles(t.manipulationXY.createDragPipeline((t,n,r,i)=>this._buildDragEventPipeline(e,0,t,n,r,i)),Y)}this._createMoveManipulation(e)}_updateMoveManipulatorDisplay(){let e=this._infos.some(e=>e.manipulationXY?.grabbing);this._moveManipulation&&(this._moveManipulation.interactive=!e),this.removeHandles(Z),e&&this._moveManipulation&&this.addHandles(this._moveManipulation.hideManipulators(),Z)}_createMoveManipulation(e){let t=new w({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:this.manipulatorRadius??(e.length===1?w.radiusForSymbol(e[0].object.graphic?.symbol):ne)});this._moveManipulation=t,t.elevationInfo={mode:`absolute-height`,offset:0},t.forEachManipulator(e=>{this.addHandles(e.events.on(`immediate-click`,n=>{let r=this.objects.at(0);!t.zManipulation.hasManipulator(e)&&this.objects.length===1&&r&&this.events.emit(`immediate-click`,{...n,object:r}),n.stopPropagation()}),Y)});let n=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._showTooltip(e):this._hideTooltip()}),t.events.on(`grab-changed`,()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=c)})],Y)};this._moveManipulation.xyManipulation.forEachManipulator(n(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(n(1)),this._moveManipulation.zManipulation.forEachManipulator(n(2));let r=()=>this._updateMoveManipulation(e);for(let t of e){this.addHandles([t.object.on(`committed`,r),this._updatingHandles.add(()=>t.object.visible,r)],Y);let n=Symbol();this.addHandles(this._updatingHandles.add(()=>t.object.isDraped,r=>{this._updateMoveManipulation(e),this.removeHandles(n),r&&this.addHandles(k({view:this.view,geometry:()=>t.object.graphic?.geometry,elevationInfo:t.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(e)}),n)},u),Y),this.addHandles(i(()=>this.removeHandles(n)),Y)}let a=e[e.length-1];this.addHandles(a.object.on(`committed`,()=>this._updateMoveManipulationAngle(a)),Y);let{object:o}=a,{operations:s}=o;if(s){let n=o.graphic;this.addHandles(t.createDragPipeline((t,n,r,i,a)=>this._buildDragEventPipeline(e,t,n,r,i,a),o.elevationInfo,s.data.spatialReference,n),Y)}this._updateMoveManipulationAngle(a)}_createVisualElements(e){if(this.enableVisualElements)for(let t of e){let n=t.object,r=C({view:this.view,object:n,forEachManipulator:e=>{t.manipulationXY?.forEachManipulator(e),this._moveManipulation?.forEachManipulator(e)},onManipulatorsChanged:()=>i()});r!=null&&(t.geometryRepresentation=r.visualElement,t.geometryRepresentation instanceof O&&this.addHandles([t.geometryRepresentation.events.on(`attachment-origin-changed`,()=>{t.object.isDraped||this._updateMoveManipulation(e)}),this._updatingHandles.add(()=>t.object.isDraped,()=>this._updateMoveManipulation(e))],Y),this.addHandles(r,Y))}}_updateMoveManipulationAngle(e){this._moveManipulation&&(this._moveManipulation.angle=_(v(e.object)))}_updateMoveManipulation(e){let t=h(0,0,0,this.view.spatialReference),n=0,r=!1,i=this._moveManipulation;if(i){for(let i of e){if(!i.object.visible)continue;this.enableZ&&b(i.object.operations,i.object.elevationInfo)&&(r=!0);let e=i.geometryRepresentation instanceof O&&!i.object.isDraped?i.geometryRepresentation.attachmentOrigin:i.object.origin;if(e!=null){let{x:r,y:i,z:a}=e;t.x+=r,t.y+=i,a&&(t.z??=0,t.z+=a),n++}}n>0?(t.x/=n,t.y/=n,t.z??=0,t.z/=n,i.location=t,i.xyManipulation.available=!0,i.xyAxisManipulation.available=!0,i.zManipulation.available=r):i.available=!1}}_buildDragEventPipeline(e,t,n,r,i,a){let o=[],s=[],c=null,l=null,u=()=>{for(let e of o)e.dragging=!1;o.length=0,s.length=0,c=null,l=null,this._updateMoveManipulatorDisplay()};if(e.length===1&&t===0){let t=e[0].object;({steps:r,cancel:i}=this._buildSnappingPipelineSteps(t,t.elevationInfo,r,i,a))}return i=i.next(e=>l?.(e)).next(()=>(s.length&&this.events.emit(`move-stop`,new q(s)),this.destroyed||u(),null)),r=r.next(t=>{if(t.action===`start`){o.length=0,s.length=0;for(let t of this._getActiveObjectInfos(e,n))o.push(t),s.push(t.object),t.dragging=!0;if(s.length!==0&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),c=A(s),l=j(s),this._emitRecordUndo(),this.events.emit(`move-start`,new G(s)),this.destroyed))return null}return s.length===0?null:t}).next(e=>c?.(e)).next(e=>(this._updateMoveTooltip(t,e),e)).next(e=>{switch(e.action){case`start`:case`update`:if(e.translationX||e.translationY||e.translationZ){let t=this.view.toScreen(e.mapStart),n=this.view.toScreen(e.mapEnd);if(!t||!n)return null;let r=n.x-t.x,i=n.y-t.y;if(this.events.emit(`move`,new K(r,i,s)),this.destroyed)return null}break;case`end`:if(this.events.emit(`move-stop`,new q(s)),this.destroyed)return null;u()}return null}),{steps:r,cancel:i}}_getActiveObjectInfos(e,t){return e.filter(e=>!e.dragging&&(e.manipulationXY?.hasManipulator(t)||!e.manipulationXY?.grabbing))}_connectTooltips(){this.removeHandles(X),this._latestTooltipInfo=null;let e;if(this._shouldShowMovePointTooltip){let t=this.objects.at(0),{events:n}=this;this._movePointTooltipInfo??=new z({viewType:this.view.type,toolOptions:this.toolOptions});let r={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),n.emit(`move-start`,new G([t]))},onMove:()=>n.emit(`move`,new K(0,0,[t])),onMoveStop:()=>n.emit(`move-stop`,new q([t])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};e=S(this.tooltip,t,()=>({toolOptions:this.toolOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:r,onRecordUndo:e=>n.emit(`record-undo`,{updates:[e]})}))}else e=this._updatingHandles.add(()=>this.toolOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,e=>{this.tooltip.info=e},d);this.addHandles(e,X)}_showTooltip(e){this._shouldShowMovePointTooltip||this._updateMoveTooltip(e)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(e,t){if(this._shouldShowMovePointTooltip||this.objects.length===0)return;let{toolOptions:n}=this;switch(e){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new B({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,(e,t)=>this._measurementWorker.autoDistance2DBetweenPoints($(e),$(t))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new V({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,async(e,n)=>s(await this._measurementWorker.autoDistance2DBetweenPoints($(e),$(n)),T(t))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new H({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,U))}this._latestTooltipInfo.toolOptions=n}async _updateMoveTooltipDistanceAsync(e,t,n){if(t!=null&&t.action!==`end`){let{mapStart:r,mapEnd:i}=t;e.distance=await n(r,i)??c}else e.distance=c}_emitRecordUndo(){let e=this.objects.toArray().map(e=>e.createUndoRecord?.()).filter(t);e.length>0&&this.events.emit(`record-undo`,{updates:e})}_buildSnappingPipelineSteps(e,t,n,r,i){let a=v(e);if(a==null||a.type!==`point`&&a.type!==`mesh`)return{steps:n,cancel:r};let o=(a.type===`point`?a:a.origin).clone(),s=new F({elevationInfo:t,pointer:i,editGeometryOperations:N.fromGeometry(o,this.view.state.viewingMode),visualizer:new g,excludeFeature:e.graphic}),c=this.snappingManager,{snappingStep:l,cancelSnapping:u}=I({snappingContext:s,snappingManager:c,updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(u),n=n.next(e=>{let t=s.coordinateHelper.pointToVector(o);return{...e,snapOrigin:t}}).next(...l),{steps:n,cancel:r}}get test(){}};e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`view`,void 0),e([f()],Q.prototype,`objects`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableVisualElements`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableZ`,void 0),e([f({constructOnly:!0})],Q.prototype,`manipulatorRadius`,void 0),e([f({constructOnly:!0,type:P})],Q.prototype,`toolOptions`,void 0),e([f({constructOnly:!0})],Q.prototype,`snappingManager`,void 0),e([f()],Q.prototype,`type`,void 0),e([f()],Q.prototype,`updating`,null),e([f()],Q.prototype,`tooltip`,void 0),e([f()],Q.prototype,`_ownedTooltip`,void 0),e([f()],Q.prototype,`_latestTooltipInfo`,void 0),e([f()],Q.prototype,`_shouldShowMovePointTooltip`,null),e([f()],Q.prototype,`activeTooltipInfo`,null),Q=e([p(`esri.views.3d.interactive.editingTools.move.MoveTool3D`)],Q);const $=m(te);class re{constructor(e){this.object=e,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{J as HoldEvent,K as MoveEvent,G as MoveStartEvent,q as MoveStopEvent,Q as MoveTool3D};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import n from"../../../../../core/Collection.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{debounce as o}from"../../../../../core/promiseUtils.js";import{scale as s,zeroMeters as c}from"../../../../../core/quantity.js";import{watch as l,initial as u,syncAndInitial as d}from"../../../../../core/reactiveUtils.js";import{property as f,subclass as p}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as m}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as ee}from"../../../../../core/support/UpdatingHandles.js";import te from"../../../../../geometry/Point.js";import{makeDehydratedPoint as h}from"../../../../../layers/graphics/dehydratedPoint.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{orientation as _}from"../geometryUtils.js";import{manipulatedObjectGeometry as v,supportsElevationMode as y}from"../manipulatedObjectUtils.js";import{canMoveZOperations as b}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as x}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as S}from"../tooltipUtils3D.js";import{createVisualElements as C}from"../visualElementUtils.js";import{discRadius as ne}from"../manipulations/config.js";import{MoveManipulation as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as T}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as E}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as D}from"./isSupportedObject.js";import{OutlineVisualElement as O}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as k}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as A,resetManipulatedObjectMany as j,sceneSnappingAtProjectedLocation as M}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as N}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as P}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import F from"../../../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as I}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as L}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as R,enterInputModeIfAvailable as re}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as z}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as B}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as V}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as H}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as U}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as W}from"../../../../support/GeometryWorkerHandle.js";class G{constructor(e){this.objects=e,this.type=`move-start`}}class K{constructor(e,t,n){this.dx=e,this.dy=t,this.objects=n,this.type=`move`}}class q{constructor(e){this.objects=e,this.type=`move-stop`}}class J{constructor(e){this.objects=e,this.type=`hold`}}const Y=Symbol(`manipulators`),X=Symbol(`tooltips`),Z=Symbol(`move-manipulator-display`);let Q=class extends N{get _infos(){return Array.from(this._infosByType.values())}constructor(e){super(e),this._infosByType=new Map,this.events=new r,this.objects=new n,this.enableVisualElements=!0,this.enableZ=!0,this.manipulatorRadius=null,this.toolOptions=new F,this.type=`move-3d`,this._measurementWorker=new W({preloadGeodetic:!0}),this._ownedTooltip=null,this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new ee,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=o(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){let{view:e}=this;this.tooltip??=this._ownedTooltip=R(()=>({view:e,options:this.toolOptions.tooltips})),this.addHandles(this._updatingHandles.addOnCollectionChange(()=>this.objects,e=>{e.removed.forEach(e=>this.removeHandles(e)),this._updateObjectInfos(e),this._setupObjectUpdateHandles(e.added),this._refreshManipulators(),this._connectTooltips()}));let t=this.objects.toArray();this._updateObjectInfos({added:t,removed:[]}),this._setupObjectUpdateHandles(t),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this._ownedTooltip=a(this._ownedTooltip),this._moveManipulation=a(this._moveManipulation),this._set(`view`,null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(e){if(this.destroyed||re(e,this.tooltip))return;let t=this.firstGrabbedManipulator;if(e.type===`hold`&&t!=null){let e=this._getActiveObjectInfos(this._infos,t).map(({object:e})=>e);this.events.emit(`hold`,new J(e))}return super.onInputEvent(e)}get updating(){return this._updatingHandles.updating||!!this.snappingManager?.updating}get _shouldShowMovePointTooltip(){let{objects:e}=this;if(e.length!==1)return!1;let t=v(e.at(0))?.type;return t===`point`||t===`mesh`}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:e,removed:t}){for(let t of e){if(D(t)!==0)continue;let e=new ie(t);this._infosByType.set(t,e)}for(let e of t)this._infosByType.delete(e)}_setupObjectUpdateHandles(e){for(let t of e){let e=this._infosByType.get(t);this.addHandles(x(e.object),t),y(t)&&this.addHandles(l(()=>{let{mode:e,unit:n,offset:r}=t.elevationInfo;return[e,n,r]},()=>this._refreshManipulators()),t)}}_refreshManipulators(){if(this.removeHandles(Y),this.removeHandles(Z),this._moveManipulation=a(this._moveManipulation),this.manipulators.removeAll(),this._infosByType.size===0)return;let e=this._infos;this._createManipulators(e),this._createVisualElements(e),this._updateMoveManipulation(e)}_createManipulators(e){for(let t of e){let n=t.object;t.manipulationXY=new E({tool:this,view:this.view,object:n}),t.manipulationXY.forEachManipulator(e=>{this.addHandles([e.events.on(`immediate-click`,e=>{this.events.emit(`immediate-click`,{...e,object:n}),e.stopPropagation()}),e.events.on(`grab-changed`,({action:e})=>{e===`start`?this._showTooltip(0):this._hideTooltip(),this._updateMoveManipulatorDisplay()})],Y)}),this.addHandles(t.manipulationXY.createDragPipeline((t,n,r,i)=>this._buildDragEventPipeline(e,0,t,n,r,i)),Y)}this._createMoveManipulation(e)}_updateMoveManipulatorDisplay(){let e=this._infos.some(e=>e.manipulationXY?.grabbing);this._moveManipulation&&(this._moveManipulation.interactive=!e),this.removeHandles(Z),e&&this._moveManipulation&&this.addHandles(this._moveManipulation.hideManipulators(),Z)}_createMoveManipulation(e){let t=new w({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:this.manipulatorRadius??(e.length===1?w.radiusForSymbol(e[0].object.graphic?.symbol):ne)});this._moveManipulation=t,t.elevationInfo={mode:`absolute-height`,offset:0},t.forEachManipulator(e=>{this.addHandles(e.events.on(`immediate-click`,n=>{let r=this.objects.at(0);!t.zManipulation.hasManipulator(e)&&this.objects.length===1&&r&&this.events.emit(`immediate-click`,{...n,object:r}),n.stopPropagation()}),Y)});let n=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._showTooltip(e):this._hideTooltip()}),t.events.on(`grab-changed`,()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=c)})],Y)};this._moveManipulation.xyManipulation.forEachManipulator(n(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(n(1)),this._moveManipulation.zManipulation.forEachManipulator(n(2));let r=()=>this._updateMoveManipulation(e);for(let t of e){this.addHandles([t.object.on(`committed`,r),this._updatingHandles.add(()=>t.object.visible,r)],Y);let n=Symbol();this.addHandles(this._updatingHandles.add(()=>t.object.isDraped,r=>{this._updateMoveManipulation(e),this.removeHandles(n),r&&this.addHandles(k({view:this.view,geometry:()=>t.object.graphic?.geometry,elevationInfo:t.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(e)}),n)},u),Y),this.addHandles(i(()=>this.removeHandles(n)),Y)}let a=e[e.length-1];this.addHandles(a.object.on(`committed`,()=>this._updateMoveManipulationAngle(a)),Y);let{object:o}=a,{operations:s}=o;if(s){let n=o.graphic;this.addHandles(t.createDragPipeline((t,n,r,i,a)=>this._buildDragEventPipeline(e,t,n,r,i,a),o.elevationInfo,s.data.spatialReference,n),Y)}this._updateMoveManipulationAngle(a)}_createVisualElements(e){if(this.enableVisualElements)for(let t of e){let n=t.object,r=C({view:this.view,object:n,forEachManipulator:e=>{t.manipulationXY?.forEachManipulator(e),this._moveManipulation?.forEachManipulator(e)},onManipulatorsChanged:()=>i()});r!=null&&(t.geometryRepresentation=r.visualElement,t.geometryRepresentation instanceof O&&this.addHandles([t.geometryRepresentation.events.on(`attachment-origin-changed`,()=>{t.object.isDraped||this._updateMoveManipulation(e)}),this._updatingHandles.add(()=>t.object.isDraped,()=>this._updateMoveManipulation(e))],Y),this.addHandles(r,Y))}}_updateMoveManipulationAngle(e){this._moveManipulation&&(this._moveManipulation.angle=_(v(e.object)))}_updateMoveManipulation(e){let t=h(0,0,0,this.view.spatialReference),n=0,r=!1,i=this._moveManipulation;if(i){for(let i of e){if(!i.object.visible)continue;this.enableZ&&b(i.object.operations,i.object.elevationInfo)&&(r=!0);let e=i.geometryRepresentation instanceof O&&!i.object.isDraped?i.geometryRepresentation.attachmentOrigin:i.object.origin;if(e!=null){let{x:r,y:i,z:a}=e;t.x+=r,t.y+=i,a&&(t.z??=0,t.z+=a),n++}}n>0?(t.x/=n,t.y/=n,t.z??=0,t.z/=n,i.location=t,i.xyManipulation.available=!0,i.xyAxisManipulation.available=!0,i.zManipulation.available=r):i.available=!1}}_buildDragEventPipeline(e,t,n,r,i,a){let o=[],s=[],c=null,l=null,u=()=>{for(let e of o)e.dragging=!1;o.length=0,s.length=0,c=null,l=null,this._updateMoveManipulatorDisplay()};if(e.length===1&&t===0){let t=e[0].object;({steps:r,cancel:i}=this._buildSnappingPipelineSteps(t,t.elevationInfo,r,i,a))}return i=i.next(e=>l?.(e)).next(()=>(s.length&&this.events.emit(`move-stop`,new q(s)),this.destroyed||u(),null)),r=r.next(t=>{if(t.action===`start`){o.length=0,s.length=0;for(let t of this._getActiveObjectInfos(e,n))o.push(t),s.push(t.object),t.dragging=!0;if(s.length!==0&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),c=A(s),l=j(s),this._emitRecordUndo(),this.events.emit(`move-start`,new G(s)),this.destroyed))return null}return s.length===0?null:t}).next(e=>c?.(e)).next(e=>(this._updateMoveTooltip(t,e),e)).next(e=>{switch(e.action){case`start`:case`update`:if(e.translationX||e.translationY||e.translationZ){let t=this.view.toScreen(e.mapStart),n=this.view.toScreen(e.mapEnd);if(!t||!n)return null;let r=n.x-t.x,i=n.y-t.y;if(this.events.emit(`move`,new K(r,i,s)),this.destroyed)return null}break;case`end`:if(this.events.emit(`move-stop`,new q(s)),this.destroyed)return null;u()}return null}),{steps:r,cancel:i}}_getActiveObjectInfos(e,t){return e.filter(e=>!e.dragging&&(e.manipulationXY?.hasManipulator(t)||!e.manipulationXY?.grabbing))}_connectTooltips(){this.removeHandles(X),this._latestTooltipInfo=null;let e;if(this._shouldShowMovePointTooltip){let t=this.objects.at(0),{events:n}=this;this._movePointTooltipInfo??=new z({viewType:this.view.type,toolOptions:this.toolOptions});let r={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),n.emit(`move-start`,new G([t]))},onMove:()=>n.emit(`move`,new K(0,0,[t])),onMoveStop:()=>n.emit(`move-stop`,new q([t])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};e=S(this.tooltip,t,()=>({toolOptions:this.toolOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:r,onRecordUndo:e=>n.emit(`record-undo`,{updates:[e]})}))}else e=this._updatingHandles.add(()=>this.toolOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,e=>{this.tooltip.info=e},d);this.addHandles(e,X)}_showTooltip(e){this._shouldShowMovePointTooltip||this._updateMoveTooltip(e)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(e,t){if(this._shouldShowMovePointTooltip||this.objects.length===0)return;let{toolOptions:n}=this;switch(e){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new B({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,(e,t)=>this._measurementWorker.autoDistance2DBetweenPoints($(e),$(t))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new V({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,async(e,n)=>s(await this._measurementWorker.autoDistance2DBetweenPoints($(e),$(n)),T(t))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new H({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,U))}this._latestTooltipInfo.toolOptions=n}async _updateMoveTooltipDistanceAsync(e,t,n){if(t!=null&&t.action!==`end`){let{mapStart:r,mapEnd:i}=t;e.distance=await n(r,i)??c}else e.distance=c}_emitRecordUndo(){let e=this.objects.toArray().map(e=>e.createUndoRecord?.()).filter(t);e.length>0&&this.events.emit(`record-undo`,{updates:e})}_buildSnappingPipelineSteps(e,t,n,r,i){let a=v(e);if(a==null||a.type!==`point`&&a.type!==`mesh`)return{steps:n,cancel:r};let o=(a.type===`point`?a:a.origin).clone(),s=new I({elevationInfo:t,pointer:i,editGeometryOperations:P.fromGeometry(o,this.view.state.viewingMode),visualizer:new g,excludeFeature:e.graphic}),c=this.snappingManager,{snappingStep:l,cancelSnapping:u}=L({snappingContext:s,snappingManager:c,updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(u),n=n.next(e=>{let t=s.coordinateHelper.pointToVector(o);return{...e,snapOrigin:t}}).next(M(this.view,t)).next(...l),{steps:n,cancel:r}}get test(){}};e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`view`,void 0),e([f()],Q.prototype,`objects`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableVisualElements`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableZ`,void 0),e([f({constructOnly:!0})],Q.prototype,`manipulatorRadius`,void 0),e([f({constructOnly:!0,type:F})],Q.prototype,`toolOptions`,void 0),e([f({constructOnly:!0})],Q.prototype,`snappingManager`,void 0),e([f()],Q.prototype,`type`,void 0),e([f()],Q.prototype,`updating`,null),e([f()],Q.prototype,`tooltip`,void 0),e([f()],Q.prototype,`_ownedTooltip`,void 0),e([f()],Q.prototype,`_latestTooltipInfo`,void 0),e([f()],Q.prototype,`_shouldShowMovePointTooltip`,null),e([f()],Q.prototype,`activeTooltipInfo`,null),Q=e([p(`esri.views.3d.interactive.editingTools.move.MoveTool3D`)],Q);const $=m(te);class ie{constructor(e){this.object=e,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{J as HoldEvent,K as MoveEvent,G as MoveStartEvent,q as MoveStopEvent,Q as MoveTool3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as n}from"../../../../../core/arrayUtils.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{makeHandle as a,handlesGroup as o,destroyHandle as s}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as c,removeMaybe as l}from"../../../../../core/maybe.js";import{initial as u,on as d,watch as f,syncAndInitial as p,when as m,sync as h}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as y,subtract as b,lerp as x,set as ee,add as te,scale as ne}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as re,create as ie}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as ae}from"../../../../../core/support/UpdatingHandles.js";import oe from"../../../../../geometry/Point.js";import se from"../../../../../geometry/Polyline.js";import{projectPoint as ce}from"../../../../../geometry/projectionUtils.js";import le from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as ue}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as de}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as fe}from"../../../../../symbols/support/utils.js";import{Manipulator3D as S}from"../../Manipulator3D.js";import{createManipulatorMaterials as C,createSphereGeometryAsOffsets as w,placeAtObject as pe,screenSizeManipulatorSettings as me}from"../../manipulatorUtils.js";import{RenderObject as T}from"../../RenderObject.js";import{SegmentLabels3D as he}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as E}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as D,screenToRenderPlaneFromEvent as ge,convertToMapCoordinates as _e}from"../dragEventPipeline3D.js";import{orientation as ve}from"../geometryUtils.js";import{canMoveZOperations as O}from"../manipulatorUtils.js";import{Settings as ye}from"../settings.js";import{createVisualElements as be}from"../visualElementUtils.js";import{discRadiusSmall as xe}from"../manipulations/config.js";import{MoveManipulation as k}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Se}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as Ce,createEdgeOffsetIntersectionPlane as we,createEdgeOffsetOperation as A,edgeOffsetRotationMatrix as Te,screenEdgeLengthSquared as Ee,getDistanceInGeometrySR as De}from"./edgeOffsetUtils.js";import{createTooltipInfos as Oe,connectTooltipToManipulatedObject as ke,getUpdatedTranslateObjectTooltipInfo as Ae,getUpdatedEdgeOffsetTooltipInfo as j}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as M}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as je}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as N}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as P}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as F,addMapDelta as I,createManipulatorDragEventPipeline as L,dragAtLocation as R,addScreenDelta as Me}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as Ne}from"../../../../interactive/keybindings.js";import{SnappingContext as z}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as B}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Pe,enterInputModeIfAvailable as V}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Fe}from"../../../../support/GeometryWorkerHandle.js";const H=Symbol(),U=Symbol(),W=Symbol(),G=Symbol(),K=Symbol();let q=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(K)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new i,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new ae,this._recreatingManipulators=!1,this._settings=new ye({getTheme:()=>this.view.effectiveTheme}),this.events=new r,this.activeTooltipInfo=null,this._measurementWorker=new Fe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit(`reshape`,{type:`reshape`,object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit(`move`,{type:`move`,object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){let{view:e}=this,t=this._settings.manipulators,n=t.vertex;this.tooltipInfos=Oe(this._toolOptions,e),this._vertexManipulatorMaterials=C({color:n.color.toUnitRGBA(),outlineColor:n.outlineColor.toUnitRGBA(),focusedOutlineColor:n.focusedOutlineColor.toUnitRGBA(),screenSize:n,renderOccluded:n.renderOccluded});let r=t.edge;this._edgeManipulatorMaterials=C({color:r.color.toUnitRGBA(),outlineColor:r.outlineColor.toUnitRGBA(),screenSize:r,renderOccluded:r.renderOccluded});let i=t.edgeOffset;this._edgeOffsetManipulatorMaterials=C({color:i.color.toUnitRGBA(),focusedColor:i.focusedColor.toUnitRGBA(),renderOccluded:i.renderOccluded,shaded:!1});let a=t.selected;this._selectedManipulatorMaterials=C({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),focusedOutlineColor:a.focusedOutlineColor.toUnitRGBA(),screenSize:a,renderOccluded:a.renderOccluded}),this.tooltip=Pe(()=>({view:e,options:this._toolOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{let e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:n,selectedSettings:r})=>{e.applyColor(this._vertexManipulatorMaterials.material),e.applyOutline(this._vertexManipulatorMaterials.outlineMaterial),e.applyFocusedOutline(this._vertexManipulatorMaterials.focusedMaterial),t.applyColor(this._edgeManipulatorMaterials.material),t.applyOutline(this._edgeManipulatorMaterials.outlineMaterial),n.applyColor(this._edgeOffsetManipulatorMaterials.material),n.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),r.applyColor(this._selectedManipulatorMaterials.material),r.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),r.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(let t of this._manipulatorInfos)t.manipulator.available=e,Y(t)&&(t.edgeManipulator.available=e)}),this._updatingHandles.add(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),this._updatingHandles.add(()=>({labels:this._segmentLabels,enabled:this._toolOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:n})=>{e!=null&&(e.visible=t,e.edgeDistance=n?`far`:`default`)},u),ke(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{t===`input`&&e!==`input`&&this._resetTooltip()}),d(()=>this._operations,`vertex-update`,e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),d(()=>this._operations?.data,`change`,e=>{(e.operation===`undo`||e.operation===`redo`)&&this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=c(this._segmentLabels),this.tooltip=c(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _toolOptions(){return this.tool.toolOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return e.type!==`key-down`||e.key!==Ne.enterInputMode?!1:this.activeTooltipInfo?.type===`reshape-edge-offset`?this._enterInputModeDuringEdgeOffset(e):V(e,this.tooltip)?(this.tool.endDrag(),!0):!1}removeSelectedVertices(){let e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&e.type===`vertex`);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit(`manipulators-changed`)}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(W),this.removeHandles(U),this.removeHandles(K),this._moveManipulation=c(this._moveManipulation),this._objectMoveManipulation=c(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._pendingEdgeOffsetInfo&&this._exitEdgeOffsetInputMode()}_createManipulators(e){if(this._operations==null)return;let t=this.object.elevationInfo;for(let{vertices:n,segments:r,index:i}of this._operations.data.parts){let a=e?.byPartIndex.get(i);for(let e of n){let n=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,n)}for(let e of r)e.type===`line`&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit(`undo`),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=c(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){let e=this._toolOptions.labels;this._segmentLabels=new he({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if(t.action===`end`)return t;let n=0,r=[],i=e===1&&this._someVerticesSelected;for(let e of this._manipulatorInfos)e.type===`vertex`&&(e.manipulator.grabbing||i&&!e.manipulator.selected||r.push(e),n++);if(r.length===n){if(i||this._hideReshapeControls(),this._moveVertices(r,t),this._updateEventState(1),this.destroyed)return t;this.events.emit(`move`,{type:`move`,dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(r,t),this._updateEventState(2),this.destroyed)return t;this.events.emit(`reshape`,{type:`reshape`,object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),a(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],K)}_showReshapeControls(){this.removeHandles(K)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){let t=this._manipulatorInfos.filter(Y).find(t=>t.manipulator===e||t.edgeManipulator===e);t!=null&&(this.removeHandles(U),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],U))}_hideReshapeManipulators(e){return o(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Y(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(H):this.tool.manipulators.forEach(({manipulator:e})=>{let t=e.disableDisplay?.();t&&this.addHandles(t,H)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>t.type===`vertex`&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;let{mapDeltaX:t,mapDeltaY:n,mapDeltaZ:r}=e;if(!t&&!n&&!r)return;let i=[];this._forEachVertex(t=>{let{selected:n,grabbing:r}=t.manipulator;(n&&!r||t===e.info)&&i.push(t)}),this._moveVertices(i,e,1),this.events.emit(`reshape`,{type:`reshape`,object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(this._numGrabbing!==0||this._numDragging!==0))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object}),this.destroyed||this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit(`reshape`,{type:`reshape-start`,object:this.object});break;case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit(`reshape`,{type:`reshape-start`,object:this.object})}}if(this.destroyed)return!1;let n=this._reshapeEventState!==e;return this._reshapeEventState=e,n}_createObjectMoveManipulation(){let{tool:e,view:t,object:n,_operations:r}=this;if(r){if(this._objectMoveManipulation=new Se({tool:e,view:t,object:n}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,n,i)=>{n.next(e=>this._trackNumDragging(e)).next(t=>(t.action===`start`&&(e=r.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{t.action===`end`&&(this._showReshapeControls(),this._resetTooltip(),e=l(e))}),i.next(()=>this._onDragCancel(!0,()=>e=l(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on(`immediate-click`,e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){let{object:t,tool:n,view:r,_operations:i}=this;if(!i)return;this._moveManipulation=new k({tool:n,view:r,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&O(t.operations,t.elevationInfo),snapToScene:!1,radius:k.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on(`immediate-click`,t=>{!this._moveManipulation.zManipulation.hasManipulator(e)&&!this._manipulatorInfos.some(e=>e.manipulator.selected)&&this.events.emit(`immediate-click`,{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));let a=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(a(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(a(1)),this._moveManipulation.zManipulation.forEachManipulator(a(2)),this._moveManipulation.elevationInfo={mode:`absolute-height`,offset:0};let o=i.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((r,a,o,s,c)=>{let{snappingStep:l,cancelSnapping:u}=B({predicate:e=>!!e.info,snappingManager:n.snappingManager,snappingContext:new z({editGeometryOperations:i,elevationInfo:e,pointer:c,excludeFeature:t.graphic,visualizer:new E}),updatingHandles:this._updatingHandles,useZ:!1});return s=s.next(e=>(this._onDragCancel(),e)).next(u),o=o.next(e=>this._trackNumDragging(e)).next(e=>{let t=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.manipulatorType===1&&t.length===1?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(F(this.view,e,t.graphic??void 0)).next(...l).next(I()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(e.action===`end`&&this._showReshapeControls(),this._updateTranslateTooltip(r,e),e)),{steps:o,cancel:s}},e,o,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),u),t.on(`committed`,()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(G),e&&this.addHandles(je({view:this.view,geometry:()=>t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),G)},u)])}_createVisualElements(){let{object:e,view:t}=this,n=be({view:t,object:e,forEachManipulator:e=>{if(!(this.destroyed||this._recreatingManipulators)){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(let t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on(`manipulators-changed`,e)});n!=null&&(this._outlineVisualElement=n.visualElement instanceof M?n.visualElement:null);let r=this._outlineVisualElement;if(r!=null){let t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(d(()=>r.events,`attachment-origin-changed`,t,{onListenerAdd:t}))}this._manipulatorHandles.add(n)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){let n=this.view,r=this._operations;if(e.part.vertices.length<=2||!r)return null;let i=r.data.spatialReference,a=this._settings.manipulators.edgeOffset,s=a.size/2,c=s+a.collisionPadding,l=s/c,u=l/2,d=l*Math.sqrt(3)/2,{height:f,offset:p}=a,{material:m,focusedMaterial:h}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){let e=N(m,d,u,u,f,p);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){let e=N(m,-d,u,u,f,-p);this._edgeOffsetManipulatorGeometryOutside=e}let g=[new T(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryInside.instantiate({material:h}),2),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:h}),2)],_=new S({view:n,renderObjects:g,elevationInfo:t.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?t:{mode:`absolute-height`,offset:0},worldOriented:!1,focusMultiplier:1,radius:c,available:this.object.visible,collisionType:{type:`disc`,direction:re(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:J(i)}),v=new S({view:n,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?`move`:`default`,metadata:{deleting:!1},location:J(i)}),y={manipulator:_,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(y,a.minSquaredEdgeLength);let b=()=>this._updateEdgeOffsetManipulator(y);b(),y.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>this._getManipulatorInfoFromHandle(e)?.manipulator.events.on(`location-update`,b)));let x=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([y.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),L(_,this._createEdgeOffsetPipeline(y,t,r)),L(v,this._createEdgePipeline(y,t,r)),v.events.on(`immediate-click`,x),_.events.on(`immediate-click`,x),_.events.on(`focus-changed`,()=>this._resetTooltip()),_.events.on(`grab-changed`,({screenPoint:e,action:t})=>{y.grabMapPoint=t===`start`?Ce(e,this.view,this.object,y):null})],_),this._manipulatorInfos.push(y),this.manipulators.addMany([_,v]),this.events.emit(`manipulators-changed`),y}_autoHideEdgeOffsetManipulator(e,t){let n=e.manipulator,r=e.edgeManipulator,i=()=>{e.visibilityHandle=l(e.visibilityHandle);let i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),s=this._getManipulatorInfoFromHandle(e.handle.rightVertex),c=i!=null&&s!=null&&Ee(i.manipulator.renderLocation,s.manipulator.renderLocation,this.view.state.camera)<t;(!n.focused&&!r.focused||c)&&(n.grabbable=!c,r.grabbable=!c,e.visibilityHandle=o([n.disableDisplay(),a(()=>{n.grabbable=!0,r.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([n.events.on(`focus-changed`,i),r.events.on(`focus-changed`,i),a(()=>{l(e.visibilityHandle),r.metadata.deleting=!0,this.manipulators.remove(r)})],n),i()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);let{coordinateHelper:t}=this._operations.data,n=we(this.view,e.manipulator.elevationAlignedLocation,A(t,e.handle,e.manipulator.elevationInfo)),r=this._getManipulatorInfoFromHandle(e.handle.leftVertex),i=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(r==null||i==null)return;let a=r.manipulator.renderLocation,o=i.manipulator.renderLocation,s=n==null?v:Te(n,a,o);e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;let c=y(b(Z,a,o))/2;e.edgeManipulator.collisionType={type:`line`,paths:[[[-c,0,0],[c,0,0]]]}}_createEdgePipeline(e,t,n){return(r,i,a,o)=>{if(o===`touch`)this._createEdgeOffsetPipeline(e,t,n)(r,i,a);else if(this.enableMoveObject){let e=this.object.graphic,o=n.data.spatialReference,{elevationAlignedLocation:s}=r;i.next(e=>this._trackNumDragging(e)).next(R(this.view,s)).next(D(this.view,s,t,o,e)).next(Me()).next(I()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{e.action===`end`&&(this._showReshapeControls(),this._resetTooltip())}),a.next(()=>this._onDragCancel(!r.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,n){return(r,i,a)=>{let o=this._pendingEdgeOffsetInfo;if(o?.manipulatorInfo===e&&o.mode!==`drag`){a.execute({action:`cancel`});return}this._clearSelection();let{initializeStep:s,cleanup:c}=this._initializeEdgeOffset(e,t,n,a),l=this._applyEdgeOffsetStep(e);i.next(e=>this._trackNumDragging(e)).next(R(this.view,r.elevationAlignedLocation)).next(s).next(ge(this.view)).next(_e(this.view,n.data.spatialReference)).next(I()).next(Ie()).next(e=>this._pendingEdgeOffsetInfo?e:l(e)).next(e=>{e.action===`end`&&!this._pendingEdgeOffsetInfo&&c()}),a.next(()=>{this._exitEdgeOffsetInputMode(),r.metadata.deleting||(c(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,n,r){let{view:i,object:a}=this,o=A(n.data.coordinateHelper,e.handle,t),s=n.createUndoGroup(),c=we(i,e.manipulator.elevationAlignedLocation,o);this._splitEdgesBeforeEdgeOffset(e,o),this._selectEdgeOffsetArrow(e,o);let l=()=>{this._cleanEdgeOffsetCollapsedEdges(e,n),this.removeHandles(W)},u=this.events.on(`undo`,l);return this.addHandles([this._initializeEdgeOffsetVisualElement(e,a,t,n),s,u,this._connectEdgeOffsetTooltip(e,o,n,()=>{r.execute({action:`cancel`})})],W),{initializeStep:e=>o==null||c==null?(l(),null):{...e,operation:o,plane:c},cleanup:l}}_initializeEdgeOffsetVisualElement(e,t,n,r){let i=()=>new se({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:r.data.spatialReference}),a=new M({view:this.view,isDraped:t.isDraped,geometry:i(),elevationInfo:n,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),c=o([f(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{a.color=e.toUnitRGBA(),a.isDraped=t},p),t.on(`committed`,()=>{a.geometry=i()}),s(a)]);return a.attached=!0,c}_applyEdgeOffsetStep(e){return t=>(this.destroyed||t.operation==null||!this._operations||(this._updateEventState(2),t.signedDistance==null?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit(`reshape`,{type:`reshape`,object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){let n=e.handle.leftVertex.leftSegment?.leftVertex,r=e.handle.leftVertex,i=e.handle.rightVertex.rightSegment?.rightVertex,a=e.handle.rightVertex,o=t.data.coordinateHelper,s=this.view.pixelSizeAt(o.vectorToDehydratedPoint(r.pos),o.spatialReference),c=[];if(n&&o.distance(n.pos,r.pos)<Re){let e=this._getManipulatorInfoFromHandle(r);e!=null&&c.push(e)}if(o.distance(r.pos,a.pos)<s||i&&o.distance(i.pos,a.pos)<Re){let e=this._getManipulatorInfoFromHandle(a);e!=null&&c.push(e)}c.length&&this._removeVertices(c)}_enterInputModeDuringEdgeOffset(e){let t=this._findActiveEdgeOffsetManipulatorInfo();return t&&V(e,this.tooltip)?t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`drag`},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`hover`},this._connectEdgeOffsetTooltipOnHover(t),!0):!1}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Y).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){let{_operations:t,object:n}=this;if(!t)return;let{elevationInfo:r}=n,i=A(t.data.coordinateHelper,e.handle,r);this._selectEdgeOffsetArrow(e,i),this.addHandles([this._initializeEdgeOffsetVisualElement(e,n,r,t),this._connectEdgeOffsetTooltip(e,i,t,()=>{this.removeHandles(W),this._exitEdgeOffsetInputMode()})],W)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){let t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);t!=null&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){let t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);t!=null&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){let n=e.grabMapPoint??Ce(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);n&&t.selectArrowFromStartPoint(n)}_connectEdgeOffsetTooltip(e,t,n,r){let i=()=>this.tooltipInfos.edgeOffset.distance.actual,a=i=>{r(),queueMicrotask(()=>{this.view.focus();let r=n.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,De(i,e.manipulator.location,t,n)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,n),r.remove()})},s=()=>{let e=i();e==null?r():a(e)};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>s(),h),this.tooltip.on(`discard`,r),this.tooltip.on(`commit`,e=>{e.type===`commit-and-exit`&&s()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,n=!1){let r=this.view,i=this._operations;if(!i)return null;let a=i.data.type,s=i.data.spatialReference;if(e.type===`line`){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(this._vertexManipulatorGeometry==null||this._vertexManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=w(e),this._vertexManipulatorOutlineGeometry=w(t)}if(this._edgeManipulatorGeometry==null||this._edgeManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=w(e),this._edgeManipulatorOutlineGeometry=w(t)}let c=this._vertexManipulatorGeometry,u=this._vertexManipulatorOutlineGeometry,d=[];if(a!==`point`&&a!==`mesh`){d.push(new T(c.instantiate(),Q|4),new T(u.instantiate(),Q|5),new T(u.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),Q|6));{let{material:e,outlineMaterial:t,focusedMaterial:n}=this._selectedManipulatorMaterials;d.push(new T(c.instantiate({material:e}),8),new T(u.instantiate({material:t}),9),new T(u.instantiate({material:n}),10))}}if(this.enableMidpoints){let{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,n=this._edgeManipulatorGeometry,r=this._edgeManipulatorOutlineGeometry,i=$|6,a=$|5;d.push(new T(n.instantiate({material:e}),i),new T(r.instantiate({material:t}),i),new T(n.instantiate(),a),new T(r.instantiate(),a))}let f=e.type===`vertex`,p=new S({view:r,renderObjects:d,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:a===`point`||a===`mesh`,available:this.object.visible,metadata:{deleting:!1},location:J(s),...me});p.selected=n,this._setTypeSpecificManipulatorSettings(p,e,t);let m=f?{manipulator:p,handle:e,type:`vertex`,selectedIndex:0}:{manipulator:p,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0};if(this._manipulatorInfos.push(m),this.manipulators.add(p),this._updateManipulatorPosition(m),m.type===`edge`){let e=[];for(let t of[m.handle.leftVertex,m.handle.rightVertex]){let n=this._getManipulatorInfoFromHandle(t);n!=null&&e.push(n.manipulator.events.on(`location-update`,()=>this._updateManipulatorPosition(m)))}m.locationUpdateHandle=o(e),this._manipulatorHandles.add(m.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);let h=L(p,(e,n,a,o)=>{let c=null,{snappingStep:u,cancelSnapping:d}=B({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new z({editGeometryOperations:i,elevationInfo:t,pointer:o,excludeFeature:this.object.graphic,visualizer:new E}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});a.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>c=l(c)),t)).next(d);let{elevationAlignedLocation:f}=e,p=this.object.graphic??void 0,h=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,i,p):D(r,f,t,s,p);n.next(e=>this._trackNumDragging(e)).next(e=>{if(e.action===`start`&&i&&(c=i.createUndoGroup()),m.type===`edge`){let t=this._splitEdgeManipulator(m);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:m,snapOrigin:m.handle.pos}}).next(R(r,f)).next(h).next(F(r,t,p)).next(...u).next(I()).next(e=>{this._perVertexManipulatorDragAction(e),e.action===`end`&&(c=l(c)),this._resetTooltip()})});return this._manipulatorHandles.add([h,p.events.on(`immediate-click`,e=>this._manipulatorClickCallback(e,m)),p.events.on(`select-changed`,()=>{m.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),p.events.on(`focus-changed`,()=>{this._resetTooltip()})],p),this.events.emit(`manipulators-changed`),m}_screenToSceneMapForVertexDrag(e,t,n){let{view:r}=this,{coordinateHelper:i,spatialReference:a}=t.data,o=null;return t=>{if(t.action===`start`&&(o=i.vectorToPoint(t.snapOrigin)),o==null)return null;let s=r.toMap(t.screenEnd,{exclude:n,excludeLabels:!0});return s==null||(s.z=de(s,r,e),!ce(s,s,a))?null:{...t,mapStart:o,mapEnd:s}}}_trackNumDragging(e){switch(e.action){case`start`:this._numDragging++;break;case`end`:this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit(`move`,{type:`move`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape`,object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,n){let r=this._settings;switch(t.type){case`vertex`:{e.selectable=!0,e.cursor=`move`,e.collisionPriority=2,e.elevationInfo=n;let t=this._operations?.data.type;e.interactive=t!=null&&t!==`point`&&t!==`mesh`;let{size:i,collisionPadding:a}=r.manipulators.vertex;e.radius=i/2+a,e.state=Q;break}case`line`:{e.state=$,e.selectable=!1,e.cursor=`copy`,e.collisionPriority=2;let{size:t,collisionPadding:i}=r.manipulators.edge;e.radius=t/2+i,e.elevationInfo=n.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?n:{mode:`absolute-height`,offset:0};break}}}_watchAndUpdateGrabState(e,t){return e.events.on(`grab-changed`,n=>{this._onGrabStateChanged(e,t,n.action,n.pointerType)})}_onGrabStateChanged(e,t,n,r=`mouse`){if(!this._recreatingManipulators){if(n===`start`)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(U),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,(r!==`touch`||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{let{manipulator:t}=e,n=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&n!=null&&n!==`point`&&n!==`mesh`,Y(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(let e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit(`manipulators-changed`))}_removeManipulator(e){e!=null&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),n(this._manipulatorInfos,e),this.events.emit(`manipulators-changed`),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(let t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){let t=this._operations;if(e!=null&&t){if(e.type===`vertex`)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,X),e.manipulator.grabbing&&this._vertexLaserLineVisualElement!=null&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if(e.type===`edge`){let n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(n==null||r==null)return;let i=n.manipulator,a=r.manipulator;if(e.manipulator.elevationInfo?.mode===`on-the-ground`){let n=i.location,r=a.location,o=.5,s=n.x+o*(r.x-n.x),c=n.y+o*(r.y-n.y),l=n.hasZ&&r.hasZ?0:void 0;e.manipulator.location=ue(s,c,l,t.data.spatialReference)}else x(Z,i.renderLocation,a.renderLocation,.5),e.manipulator.renderLocation=Z}}}_splitEdgeManipulator(e,t=.5){let n=this._operations,r=n.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=l(e.locationUpdateHandle);let i=this.object.elevationInfo,a;this.enableEdgeOffset?(this._removeManipulator(e),a=this._createVertexOrEdgeManipulator(r)):(a=e,a.handle=r,a.type=`vertex`,this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,i)),r.leftSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.leftSegment),r.rightSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.rightSegment),this._updateManipulatorPosition(a),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);let o=this._updateEventState(2),s=n.data.coordinateHelper.vectorToArray(a.handle.pos),c=n.data.parts.indexOf(r.part);return this.events.emit(`vertex-add`,{type:`vertex-add`,object:this.object,vertices:[{coordinates:s,componentIndex:c,vertexIndex:r.index}],added:s}),o&&this._updateEventState(0),a}_updateMoveManipulationPosition(){let e=ee(Z,0,0,0),t=0,n=!1,r=null,i=null;for(let a of this._manipulatorInfos)a.type===`vertex`&&(a.manipulator.selected?(t++,te(e,e,a.manipulator.renderLocation),r==null||a.selectedIndex>r.selectedIndex?(i=r,r=a):(i==null||a.selectedIndex>i.selectedIndex)&&(i=a)):n=!0);let a=this.object,o=this._operations?.data.geometry;if(t===0){let e=a.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&O(this._operations,a.elevationInfo),this._moveManipulation.angle=ve(o),this._moveManipulation.radius=k.radiusForSymbol(a.graphic?.symbol)}else{let e=a.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&O(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&t!==1;let n=0;if(r!=null){let e=r.handle.pos,t=i==null?r.handle.leftSegment?.leftVertex?r.handle.leftSegment.leftVertex.pos:null:i.handle.pos,a=i==null&&r.handle.rightSegment?.rightVertex?r.handle.rightSegment.rightVertex.pos:null;t&&a?this._moveManipulation.xyAxisManipulation.available=!1:t?n=Le(t,e):a&&(n=Le(e,a))}this._moveManipulation.angle=n,this._moveManipulation.radius=xe}t!==0&&n?(ne(e,e,1/t),X.spatialReference=this._operations.data.spatialReference,X.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,X),this._moveManipulation.elevationAlignedLocation=X):this._outlineVisualElement!=null&&!this.object.isDraped&&this._outlineVisualElement.attachmentOrigin!=null?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:pe(this._moveManipulation,this.object)}_removeVertices(e){let t=[],n=this._operations;if(!n)return;let r=e.filter(e=>e.type===`vertex`&&n.canRemoveVertex(e.handle.part));if(r.length>0){let e=this._createBeforeVertexRemoveEvent(r);if(this.events.emit(`before-vertex-remove`,e),e.defaultPrevented)return}for(let e of r){let r=e.handle.part;if(n.canRemoveVertex(r)){t.push(e.handle),this._removeManipulator(e),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.rightSegment));let i=n.removeVertices([e.handle]).removedVertices?.[0].createdSegment;i&&i.type===`line`?this._createVertexOrEdgeManipulator(i):this.enableEdgeOffset&&r.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(r.segments[0]))}}if(t.length>0){let e=t.map(e=>{let t=n.data.parts.indexOf(e.part);return{coordinates:n.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),r=this._updateEventState(2);if(this.destroyed||(this.events.emit(`vertex-remove`,{type:`vertex-remove`,object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)||r&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){let t=this._operations,n=e.map(e=>{let n=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:n,vertexIndex:e.handle.index}}),r=!1;return{type:`before-vertex-remove`,object:this.object,removed:n.map(e=>e.coordinates),vertices:n,get defaultPrevented(){return r},preventDefault(){r=!0}}}_moveVertices(e,t,n=t.action===`start`?0:1){let r=this._operations;if(r&&(e.length>0&&r.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,n),!this._movingManipulatorsHidden))for(let t of e)this._updateManipulatorPosition(t)}_offsetEdge(e,t,n){if(!this._operations)return;let r=t.clone();r.distance=n,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],r),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),t.type===`vertex`&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===P.Right&&this._removeVertices([t])),t.type===`edge`&&e.button===P.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){this._defaultTooltipInfo==null?this._updateTranslateObjectTooltip(e,t):this._resetTooltip()}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=Ae(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=j(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){let e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&e?.type===`reshape-edge-offset`)return;let t=null;t=this._pendingEdgeOffsetInfo||this._findActiveEdgeOffsetManipulatorInfo()!=null?j(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(e==null||t==null||this.tooltip.mode!==`input`)&&(this.activeTooltipInfo=t)}get _defaultTooltipInfo(){switch(this._operations?.data.type){case`polyline`:case`polygon`:return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case`point`:case`mesh`:return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){let e=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.length===1?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>e.type===`vertex`&&e.manipulator.selected)}_forEachVertex(e){for(let t of this._manipulatorInfos)t.type===`vertex`&&e(t)}get _tooltipsContext(){let{tooltipInfos:e,activeTooltipInfo:t}=this;return{toolOptions:this._toolOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};e([g()],q.prototype,`_numGrabbing`,void 0),e([g()],q.prototype,`_numDragging`,void 0),e([g()],q.prototype,`_pendingEdgeOffsetInfo`,void 0),e([g()],q.prototype,`_operations`,null),e([g()],q.prototype,`_segmentLabels`,void 0),e([g({constructOnly:!0})],q.prototype,`tool`,void 0),e([g()],q.prototype,`tooltip`,void 0),e([g()],q.prototype,`activeTooltipInfo`,void 0),e([g({readOnly:!0})],q.prototype,`updating`,null),e([g()],q.prototype,`manipulators`,null),e([g()],q.prototype,`view`,null),e([g()],q.prototype,`object`,null),e([g()],q.prototype,`enableZShape`,null),e([g()],q.prototype,`enableDeleteVertices`,null),e([g()],q.prototype,`enableZVertex`,null),e([g()],q.prototype,`autoHideManipulators`,null),e([g()],q.prototype,`enableMoveObject`,null),e([g()],q.prototype,`enableMidpoints`,null),e([g()],q.prototype,`enableEdgeOffset`,null),e([g()],q.prototype,`_toolOptions`,null),e([g()],q.prototype,`_accentColor`,null),e([g()],q.prototype,`_tooltipsContext`,null),q=e([_(`esri.views.3d.interactive.editingTools.reshape.ReshapeOperation`)],q);function Ie(){return e=>{let{operation:t,mapEnd:n}=e;return t==null||n==null?e:{...e,signedDistance:t.signedDistanceToPoint(n)}}}function Le(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function J(e){return new oe({x:0,y:0,z:0,spatialReference:e})}function Y(e){return e.type===`edge`&&`edgeManipulator`in e}const X=ue(0,0,void 0,le.WGS84),Z=ie(),Re=1e-6,Q=16,$=32;export{q as ReshapeOperation};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as n}from"../../../../../core/arrayUtils.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{makeHandle as a,handlesGroup as o,destroyHandle as s}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as c,removeMaybe as l}from"../../../../../core/maybe.js";import{initial as u,on as d,watch as f,syncAndInitial as p,when as m,sync as h}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as y,subtract as b,lerp as x,set as ee,add as te,scale as ne}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as re,create as ie}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as ae}from"../../../../../core/support/UpdatingHandles.js";import oe from"../../../../../geometry/Point.js";import se from"../../../../../geometry/Polyline.js";import{projectPoint as ce}from"../../../../../geometry/projectionUtils.js";import le from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as S}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as ue}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as de}from"../../../../../symbols/support/utils.js";import{Manipulator3D as C}from"../../Manipulator3D.js";import{createManipulatorMaterials as w,createSphereGeometryAsOffsets as T,placeAtObject as fe,screenSizeManipulatorSettings as pe}from"../../manipulatorUtils.js";import{RenderObject as E}from"../../RenderObject.js";import{SegmentLabels3D as me}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as he}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as D,screenToRenderPlaneFromEvent as ge,convertToMapCoordinates as _e}from"../dragEventPipeline3D.js";import{orientation as ve}from"../geometryUtils.js";import{canMoveZOperations as O}from"../manipulatorUtils.js";import{Settings as ye}from"../settings.js";import{createVisualElements as be}from"../visualElementUtils.js";import{discRadiusSmall as xe}from"../manipulations/config.js";import{MoveManipulation as k}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Se}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as A,createEdgeOffsetIntersectionPlane as j,createEdgeOffsetOperation as M,edgeOffsetRotationMatrix as Ce,screenEdgeLengthSquared as we,getDistanceInGeometrySR as Te}from"./edgeOffsetUtils.js";import{createTooltipInfos as Ee,connectTooltipToManipulatedObject as De,getUpdatedTranslateObjectTooltipInfo as Oe,getUpdatedEdgeOffsetTooltipInfo as N}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as P}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as ke}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as F}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as I}from"../../../../input/mouseButtons.js";import{sceneSnappingAtProjectedLocation as Ae,addMapDelta as L,createManipulatorDragEventPipeline as R,dragAtLocation as z,addScreenDelta as je,sceneSnappingAtLocation as Me}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as Ne}from"../../../../interactive/keybindings.js";import{SnappingContext as B}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as V}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Pe,enterInputModeIfAvailable as H}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Fe}from"../../../../support/GeometryWorkerHandle.js";const U=Symbol(),W=Symbol(),G=Symbol(),Ie=Symbol(),K=Symbol();let q=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(K)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new i,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new ae,this._recreatingManipulators=!1,this._settings=new ye({getTheme:()=>this.view.effectiveTheme}),this.events=new r,this.activeTooltipInfo=null,this._measurementWorker=new Fe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit(`reshape`,{type:`reshape`,object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit(`move`,{type:`move`,object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){let{view:e}=this,t=this._settings.manipulators,n=t.vertex;this.tooltipInfos=Ee(this._toolOptions,e),this._vertexManipulatorMaterials=w({color:n.color.toUnitRGBA(),outlineColor:n.outlineColor.toUnitRGBA(),focusedOutlineColor:n.focusedOutlineColor.toUnitRGBA(),screenSize:n,renderOccluded:n.renderOccluded});let r=t.edge;this._edgeManipulatorMaterials=w({color:r.color.toUnitRGBA(),outlineColor:r.outlineColor.toUnitRGBA(),screenSize:r,renderOccluded:r.renderOccluded});let i=t.edgeOffset;this._edgeOffsetManipulatorMaterials=w({color:i.color.toUnitRGBA(),focusedColor:i.focusedColor.toUnitRGBA(),renderOccluded:i.renderOccluded,shaded:!1});let a=t.selected;this._selectedManipulatorMaterials=w({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),focusedOutlineColor:a.focusedOutlineColor.toUnitRGBA(),screenSize:a,renderOccluded:a.renderOccluded}),this.tooltip=Pe(()=>({view:e,options:this._toolOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{let e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:n,selectedSettings:r})=>{e.applyColor(this._vertexManipulatorMaterials.material),e.applyOutline(this._vertexManipulatorMaterials.outlineMaterial),e.applyFocusedOutline(this._vertexManipulatorMaterials.focusedMaterial),t.applyColor(this._edgeManipulatorMaterials.material),t.applyOutline(this._edgeManipulatorMaterials.outlineMaterial),n.applyColor(this._edgeOffsetManipulatorMaterials.material),n.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),r.applyColor(this._selectedManipulatorMaterials.material),r.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),r.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(let t of this._manipulatorInfos)t.manipulator.available=e,Y(t)&&(t.edgeManipulator.available=e)}),this._updatingHandles.add(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),this._updatingHandles.add(()=>({labels:this._segmentLabels,enabled:this._toolOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:n})=>{e!=null&&(e.visible=t,e.edgeDistance=n?`far`:`default`)},u),De(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{t===`input`&&e!==`input`&&this._resetTooltip()}),d(()=>this._operations,`vertex-update`,e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),d(()=>this._operations?.data,`change`,e=>{(e.operation===`undo`||e.operation===`redo`)&&this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=c(this._segmentLabels),this.tooltip=c(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _toolOptions(){return this.tool.toolOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return e.type!==`key-down`||e.key!==Ne.enterInputMode?!1:this.activeTooltipInfo?.type===`reshape-edge-offset`?this._enterInputModeDuringEdgeOffset(e):H(e,this.tooltip)?(this.tool.endDrag(),!0):!1}removeSelectedVertices(){let e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&e.type===`vertex`);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit(`manipulators-changed`)}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(G),this.removeHandles(W),this.removeHandles(K),this._moveManipulation=c(this._moveManipulation),this._objectMoveManipulation=c(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._pendingEdgeOffsetInfo&&this._exitEdgeOffsetInputMode()}_createManipulators(e){if(this._operations==null)return;let t=this.object.elevationInfo;for(let{vertices:n,segments:r,index:i}of this._operations.data.parts){let a=e?.byPartIndex.get(i);for(let e of n){let n=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,n)}for(let e of r)e.type===`line`&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit(`undo`),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=c(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){let e=this._toolOptions.labels;this._segmentLabels=new me({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if(t.action===`end`)return t;let n=0,r=[],i=e===1&&this._someVerticesSelected;for(let e of this._manipulatorInfos)e.type===`vertex`&&(e.manipulator.grabbing||i&&!e.manipulator.selected||r.push(e),n++);if(r.length===n){if(i||this._hideReshapeControls(),this._moveVertices(r,t),this._updateEventState(1),this.destroyed)return t;this.events.emit(`move`,{type:`move`,dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(r,t),this._updateEventState(2),this.destroyed)return t;this.events.emit(`reshape`,{type:`reshape`,object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),a(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],K)}_showReshapeControls(){this.removeHandles(K)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){let t=this._manipulatorInfos.filter(Y).find(t=>t.manipulator===e||t.edgeManipulator===e);t!=null&&(this.removeHandles(W),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],W))}_hideReshapeManipulators(e){return o(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Y(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(U):this.tool.manipulators.forEach(({manipulator:e})=>{let t=e.disableDisplay?.();t&&this.addHandles(t,U)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>t.type===`vertex`&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;let{mapDeltaX:t,mapDeltaY:n,mapDeltaZ:r}=e;if(!t&&!n&&!r)return;let i=[];this._forEachVertex(t=>{let{selected:n,grabbing:r}=t.manipulator;(n&&!r||t===e.info)&&i.push(t)}),this._moveVertices(i,e,1),this.events.emit(`reshape`,{type:`reshape`,object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(this._numGrabbing!==0||this._numDragging!==0))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object}),this.destroyed||this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit(`reshape`,{type:`reshape-start`,object:this.object});break;case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit(`reshape`,{type:`reshape-start`,object:this.object})}}if(this.destroyed)return!1;let n=this._reshapeEventState!==e;return this._reshapeEventState=e,n}_createObjectMoveManipulation(){let{tool:e,view:t,object:n,_operations:r}=this;if(r){if(this._objectMoveManipulation=new Se({tool:e,view:t,object:n}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,n,i)=>{n.next(e=>this._trackNumDragging(e)).next(t=>(t.action===`start`&&(e=r.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{t.action===`end`&&(this._showReshapeControls(),this._resetTooltip(),e=l(e))}),i.next(()=>this._onDragCancel(!0,()=>e=l(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on(`immediate-click`,e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){let{object:t,tool:n,view:r,_operations:i}=this;if(!i)return;this._moveManipulation=new k({tool:n,view:r,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&O(t.operations,t.elevationInfo),snapToScene:!1,radius:k.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on(`immediate-click`,t=>{!this._moveManipulation.zManipulation.hasManipulator(e)&&!this._manipulatorInfos.some(e=>e.manipulator.selected)&&this.events.emit(`immediate-click`,{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));let a=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(a(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(a(1)),this._moveManipulation.zManipulation.forEachManipulator(a(2)),this._moveManipulation.elevationInfo={mode:`absolute-height`,offset:0};let o=i.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((r,a,o,s,c)=>{let{snappingStep:l,cancelSnapping:u}=V({predicate:e=>!!e.info,snappingManager:n.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:e,pointer:c,excludeFeature:t.graphic,visualizer:new he}),updatingHandles:this._updatingHandles,useZ:!1});return s=s.next(e=>(this._onDragCancel(),e)).next(u),o=o.next(e=>this._trackNumDragging(e)).next(e=>{let t=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.manipulatorType===1&&t.length===1?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(Ae(this.view,e)).next(...l).next(L()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(e.action===`end`&&this._showReshapeControls(),this._updateTranslateTooltip(r,e),e)),{steps:o,cancel:s}},e,o,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),u),t.on(`committed`,()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Ie),e&&this.addHandles(ke({view:this.view,geometry:()=>t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Ie)},u)])}_createVisualElements(){let{object:e,view:t}=this,n=be({view:t,object:e,forEachManipulator:e=>{if(!(this.destroyed||this._recreatingManipulators)){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(let t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on(`manipulators-changed`,e)});n!=null&&(this._outlineVisualElement=n.visualElement instanceof P?n.visualElement:null);let r=this._outlineVisualElement;if(r!=null){let t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(d(()=>r.events,`attachment-origin-changed`,t,{onListenerAdd:t}))}this._manipulatorHandles.add(n)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){let n=this.view,r=this._operations;if(e.part.vertices.length<=2||!r)return null;let i=r.data.spatialReference,a=this._settings.manipulators.edgeOffset,s=a.size/2,c=s+a.collisionPadding,l=s/c,u=l/2,d=l*Math.sqrt(3)/2,{height:f,offset:p}=a,{material:m,focusedMaterial:h}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){let e=F(m,d,u,u,f,p);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){let e=F(m,-d,u,u,f,-p);this._edgeOffsetManipulatorGeometryOutside=e}let g=[new E(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new E(this._edgeOffsetManipulatorGeometryInside.instantiate({material:h}),2),new E(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new E(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:h}),2)],_=new C({view:n,renderObjects:g,elevationInfo:t.mode===`on-the-ground`&&!de(this.object.graphic?.symbol)?t:{mode:`absolute-height`,offset:0},worldOriented:!1,focusMultiplier:1,radius:c,available:this.object.visible,collisionType:{type:`disc`,direction:re(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:J(i)}),v=new C({view:n,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?`move`:`default`,metadata:{deleting:!1},location:J(i)}),y={manipulator:_,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(y,a.minSquaredEdgeLength);let b=()=>this._updateEdgeOffsetManipulator(y);b(),y.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>this._getManipulatorInfoFromHandle(e)?.manipulator.events.on(`location-update`,b)));let x=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([y.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),R(_,this._createEdgeOffsetPipeline(y,t,r)),R(v,this._createEdgePipeline(y,t,r)),v.events.on(`immediate-click`,x),_.events.on(`immediate-click`,x),_.events.on(`focus-changed`,()=>this._resetTooltip()),_.events.on(`grab-changed`,({screenPoint:e,action:t})=>{y.grabMapPoint=t===`start`?A(e,this.view,this.object,y):null})],_),this._manipulatorInfos.push(y),this.manipulators.addMany([_,v]),this.events.emit(`manipulators-changed`),y}_autoHideEdgeOffsetManipulator(e,t){let n=e.manipulator,r=e.edgeManipulator,i=()=>{e.visibilityHandle=l(e.visibilityHandle);let i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),s=this._getManipulatorInfoFromHandle(e.handle.rightVertex),c=i!=null&&s!=null&&we(i.manipulator.renderLocation,s.manipulator.renderLocation,this.view.state.camera)<t;(!n.focused&&!r.focused||c)&&(n.grabbable=!c,r.grabbable=!c,e.visibilityHandle=o([n.disableDisplay(),a(()=>{n.grabbable=!0,r.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([n.events.on(`focus-changed`,i),r.events.on(`focus-changed`,i),a(()=>{l(e.visibilityHandle),r.metadata.deleting=!0,this.manipulators.remove(r)})],n),i()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);let{coordinateHelper:t}=this._operations.data,n=j(this.view,e.manipulator.elevationAlignedLocation,M(t,e.handle,e.manipulator.elevationInfo)),r=this._getManipulatorInfoFromHandle(e.handle.leftVertex),i=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(r==null||i==null)return;let a=r.manipulator.renderLocation,o=i.manipulator.renderLocation,s=n==null?v:Ce(n,a,o);e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;let c=y(b(Z,a,o))/2;e.edgeManipulator.collisionType={type:`line`,paths:[[[-c,0,0],[c,0,0]]]}}_createEdgePipeline(e,t,n){return(r,i,a,o)=>{if(o===`touch`)this._createEdgeOffsetPipeline(e,t,n)(r,i,a);else if(this.enableMoveObject){let e=this.object.graphic,o=n.data.spatialReference,{elevationAlignedLocation:s}=r;i.next(e=>this._trackNumDragging(e)).next(z(this.view,s)).next(D(this.view,s,t,o,e)).next(je()).next(L()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{e.action===`end`&&(this._showReshapeControls(),this._resetTooltip())}),a.next(()=>this._onDragCancel(!r.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,n){return(r,i,a)=>{let o=this._pendingEdgeOffsetInfo;if(o?.manipulatorInfo===e&&o.mode!==`drag`){a.execute({action:`cancel`});return}this._clearSelection();let{initializeStep:s,cleanup:c}=this._initializeEdgeOffset(e,t,n,a),l=this._applyEdgeOffsetStep(e);i.next(e=>this._trackNumDragging(e)).next(z(this.view,r.elevationAlignedLocation)).next(s).next(ge(this.view)).next(_e(this.view,n.data.spatialReference)).next(L()).next(Le()).next(e=>this._pendingEdgeOffsetInfo?e:l(e)).next(e=>{e.action===`end`&&!this._pendingEdgeOffsetInfo&&c()}),a.next(()=>{this._exitEdgeOffsetInputMode(),r.metadata.deleting||(c(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,n,r){let{view:i,object:a}=this,o=M(n.data.coordinateHelper,e.handle,t),s=n.createUndoGroup(),c=j(i,e.manipulator.elevationAlignedLocation,o);this._splitEdgesBeforeEdgeOffset(e,o),this._selectEdgeOffsetArrow(e,o);let l=()=>{this._cleanEdgeOffsetCollapsedEdges(e,n),this.removeHandles(G)},u=this.events.on(`undo`,l);return this.addHandles([this._initializeEdgeOffsetVisualElement(e,a,t,n),s,u,this._connectEdgeOffsetTooltip(e,o,n,()=>{r.execute({action:`cancel`})})],G),{initializeStep:e=>o==null||c==null?(l(),null):{...e,operation:o,plane:c},cleanup:l}}_initializeEdgeOffsetVisualElement(e,t,n,r){let i=()=>new se({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:r.data.spatialReference}),a=new P({view:this.view,isDraped:t.isDraped,geometry:i(),elevationInfo:n,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),c=o([f(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{a.color=e.toUnitRGBA(),a.isDraped=t},p),t.on(`committed`,()=>{a.geometry=i()}),s(a)]);return a.attached=!0,c}_applyEdgeOffsetStep(e){return t=>(this.destroyed||t.operation==null||!this._operations||(this._updateEventState(2),t.signedDistance==null?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit(`reshape`,{type:`reshape`,object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){let n=e.handle.leftVertex.leftSegment?.leftVertex,r=e.handle.leftVertex,i=e.handle.rightVertex.rightSegment?.rightVertex,a=e.handle.rightVertex,o=t.data.coordinateHelper,s=this.view.pixelSizeAt(o.vectorToDehydratedPoint(r.pos),o.spatialReference),c=[];if(n&&o.distance(n.pos,r.pos)<ze){let e=this._getManipulatorInfoFromHandle(r);e!=null&&c.push(e)}if(o.distance(r.pos,a.pos)<s||i&&o.distance(i.pos,a.pos)<ze){let e=this._getManipulatorInfoFromHandle(a);e!=null&&c.push(e)}c.length&&this._removeVertices(c)}_enterInputModeDuringEdgeOffset(e){let t=this._findActiveEdgeOffsetManipulatorInfo();return t&&H(e,this.tooltip)?t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`drag`},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`hover`},this._connectEdgeOffsetTooltipOnHover(t),!0):!1}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Y).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){let{_operations:t,object:n}=this;if(!t)return;let{elevationInfo:r}=n,i=M(t.data.coordinateHelper,e.handle,r);this._selectEdgeOffsetArrow(e,i),this.addHandles([this._initializeEdgeOffsetVisualElement(e,n,r,t),this._connectEdgeOffsetTooltip(e,i,t,()=>{this.removeHandles(G),this._exitEdgeOffsetInputMode()})],G)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){let t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);t!=null&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){let t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);t!=null&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){let n=e.grabMapPoint??A(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);n&&t.selectArrowFromStartPoint(n)}_connectEdgeOffsetTooltip(e,t,n,r){let i=()=>this.tooltipInfos.edgeOffset.distance.actual,a=i=>{r(),queueMicrotask(()=>{this.view.focus();let r=n.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,Te(i,e.manipulator.location,t,n)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,n),r.remove()})},s=()=>{let e=i();e==null?r():a(e)};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>s(),h),this.tooltip.on(`discard`,r),this.tooltip.on(`commit`,e=>{e.type===`commit-and-exit`&&s()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,n=!1){let r=this.view,i=this._operations;if(!i)return null;let a=i.data.type,s=i.data.spatialReference;if(e.type===`line`){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(this._vertexManipulatorGeometry==null||this._vertexManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=T(e),this._vertexManipulatorOutlineGeometry=T(t)}if(this._edgeManipulatorGeometry==null||this._edgeManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=T(e),this._edgeManipulatorOutlineGeometry=T(t)}let c=this._vertexManipulatorGeometry,u=this._vertexManipulatorOutlineGeometry,d=[];if(a!==`point`&&a!==`mesh`){d.push(new E(c.instantiate(),Q|4),new E(u.instantiate(),Q|5),new E(u.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),Q|6));{let{material:e,outlineMaterial:t,focusedMaterial:n}=this._selectedManipulatorMaterials;d.push(new E(c.instantiate({material:e}),8),new E(u.instantiate({material:t}),9),new E(u.instantiate({material:n}),10))}}if(this.enableMidpoints){let{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,n=this._edgeManipulatorGeometry,r=this._edgeManipulatorOutlineGeometry,i=$|6,a=$|5;d.push(new E(n.instantiate({material:e}),i),new E(r.instantiate({material:t}),i),new E(n.instantiate(),a),new E(r.instantiate(),a))}let f=e.type===`vertex`,p=new C({view:r,renderObjects:d,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:a===`point`||a===`mesh`,available:this.object.visible,metadata:{deleting:!1},location:J(s),...pe});p.selected=n,this._setTypeSpecificManipulatorSettings(p,e,t);let m=f?{manipulator:p,handle:e,type:`vertex`,selectedIndex:0}:{manipulator:p,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0};if(this._manipulatorInfos.push(m),this.manipulators.add(p),this._updateManipulatorPosition(m),m.type===`edge`){let e=[];for(let t of[m.handle.leftVertex,m.handle.rightVertex]){let n=this._getManipulatorInfoFromHandle(t);n!=null&&e.push(n.manipulator.events.on(`location-update`,()=>this._updateManipulatorPosition(m)))}m.locationUpdateHandle=o(e),this._manipulatorHandles.add(m.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);let h=R(p,(e,n,a,o)=>{let c=null,{snappingStep:u,cancelSnapping:d}=V({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:t,pointer:o,excludeFeature:this.object.graphic,visualizer:new he}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});a.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>c=l(c)),t)).next(d);let{elevationAlignedLocation:f}=e,p=this.object.graphic??void 0,h=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,i,p):D(r,f,t,s,p);n.next(e=>this._trackNumDragging(e)).next(e=>{if(e.action===`start`&&i&&(c=i.createUndoGroup()),m.type===`edge`){let t=this._splitEdgeManipulator(m);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:m,snapOrigin:m.handle.pos}}).next(z(r,f)).next(h).next(Me(r,t,p)).next(...u).next(L()).next(e=>{this._perVertexManipulatorDragAction(e),e.action===`end`&&(c=l(c)),this._resetTooltip()})});return this._manipulatorHandles.add([h,p.events.on(`immediate-click`,e=>this._manipulatorClickCallback(e,m)),p.events.on(`select-changed`,()=>{m.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),p.events.on(`focus-changed`,()=>{this._resetTooltip()})],p),this.events.emit(`manipulators-changed`),m}_screenToSceneMapForVertexDrag(e,t,n){let{view:r}=this,{coordinateHelper:i,spatialReference:a}=t.data,o=null;return t=>{if(t.action===`start`&&(o=i.vectorToPoint(t.snapOrigin)),o==null)return null;let s=r.toMap(t.screenEnd,{exclude:n,excludeLabels:!0});return s==null||(s.z=ue(s,r,e),!ce(s,s,a))?null:{...t,mapStart:o,mapEnd:s}}}_trackNumDragging(e){switch(e.action){case`start`:this._numDragging++;break;case`end`:this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit(`move`,{type:`move`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape`,object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,n){let r=this._settings;switch(t.type){case`vertex`:{e.selectable=!0,e.cursor=`move`,e.collisionPriority=2,e.elevationInfo=n;let t=this._operations?.data.type;e.interactive=t!=null&&t!==`point`&&t!==`mesh`;let{size:i,collisionPadding:a}=r.manipulators.vertex;e.radius=i/2+a,e.state=Q;break}case`line`:{e.state=$,e.selectable=!1,e.cursor=`copy`,e.collisionPriority=2;let{size:t,collisionPadding:i}=r.manipulators.edge;e.radius=t/2+i,e.elevationInfo=n.mode===`on-the-ground`&&!de(this.object.graphic?.symbol)?n:{mode:`absolute-height`,offset:0};break}}}_watchAndUpdateGrabState(e,t){return e.events.on(`grab-changed`,n=>{this._onGrabStateChanged(e,t,n.action,n.pointerType)})}_onGrabStateChanged(e,t,n,r=`mouse`){if(!this._recreatingManipulators){if(n===`start`)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(W),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,(r!==`touch`||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{let{manipulator:t}=e,n=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&n!=null&&n!==`point`&&n!==`mesh`,Y(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(let e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit(`manipulators-changed`))}_removeManipulator(e){e!=null&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),n(this._manipulatorInfos,e),this.events.emit(`manipulators-changed`),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(let t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){let t=this._operations;if(e!=null&&t){if(e.type===`vertex`)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,X),e.manipulator.grabbing&&this._vertexLaserLineVisualElement!=null&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if(e.type===`edge`){let n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(n==null||r==null)return;let i=n.manipulator,a=r.manipulator;if(e.manipulator.elevationInfo?.mode===`on-the-ground`){let n=i.location,r=a.location,o=.5,s=n.x+o*(r.x-n.x),c=n.y+o*(r.y-n.y),l=n.hasZ&&r.hasZ?0:void 0;e.manipulator.location=S(s,c,l,t.data.spatialReference)}else x(Z,i.renderLocation,a.renderLocation,.5),e.manipulator.renderLocation=Z}}}_splitEdgeManipulator(e,t=.5){let n=this._operations,r=n.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=l(e.locationUpdateHandle);let i=this.object.elevationInfo,a;this.enableEdgeOffset?(this._removeManipulator(e),a=this._createVertexOrEdgeManipulator(r)):(a=e,a.handle=r,a.type=`vertex`,this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,i)),r.leftSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.leftSegment),r.rightSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.rightSegment),this._updateManipulatorPosition(a),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);let o=this._updateEventState(2),s=n.data.coordinateHelper.vectorToArray(a.handle.pos),c=n.data.parts.indexOf(r.part);return this.events.emit(`vertex-add`,{type:`vertex-add`,object:this.object,vertices:[{coordinates:s,componentIndex:c,vertexIndex:r.index}],added:s}),o&&this._updateEventState(0),a}_updateMoveManipulationPosition(){let e=ee(Z,0,0,0),t=0,n=!1,r=null,i=null;for(let a of this._manipulatorInfos)a.type===`vertex`&&(a.manipulator.selected?(t++,te(e,e,a.manipulator.renderLocation),r==null||a.selectedIndex>r.selectedIndex?(i=r,r=a):(i==null||a.selectedIndex>i.selectedIndex)&&(i=a)):n=!0);let a=this.object,o=this._operations?.data.geometry;if(t===0){let e=a.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&O(this._operations,a.elevationInfo),this._moveManipulation.angle=ve(o),this._moveManipulation.radius=k.radiusForSymbol(a.graphic?.symbol)}else{let e=a.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&O(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&t!==1;let n=0;if(r!=null){let e=r.handle.pos,t=i==null?r.handle.leftSegment?.leftVertex?r.handle.leftSegment.leftVertex.pos:null:i.handle.pos,a=i==null&&r.handle.rightSegment?.rightVertex?r.handle.rightSegment.rightVertex.pos:null;t&&a?this._moveManipulation.xyAxisManipulation.available=!1:t?n=Re(t,e):a&&(n=Re(e,a))}this._moveManipulation.angle=n,this._moveManipulation.radius=xe}t!==0&&n?(ne(e,e,1/t),X.spatialReference=this._operations.data.spatialReference,X.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,X),this._moveManipulation.elevationAlignedLocation=X):this._outlineVisualElement!=null&&!this.object.isDraped&&this._outlineVisualElement.attachmentOrigin!=null?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:fe(this._moveManipulation,this.object)}_removeVertices(e){let t=[],n=this._operations;if(!n)return;let r=e.filter(e=>e.type===`vertex`&&n.canRemoveVertex(e.handle.part));if(r.length>0){let e=this._createBeforeVertexRemoveEvent(r);if(this.events.emit(`before-vertex-remove`,e),e.defaultPrevented)return}for(let e of r){let r=e.handle.part;if(n.canRemoveVertex(r)){t.push(e.handle),this._removeManipulator(e),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.rightSegment));let i=n.removeVertices([e.handle]).removedVertices?.[0].createdSegment;i&&i.type===`line`?this._createVertexOrEdgeManipulator(i):this.enableEdgeOffset&&r.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(r.segments[0]))}}if(t.length>0){let e=t.map(e=>{let t=n.data.parts.indexOf(e.part);return{coordinates:n.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),r=this._updateEventState(2);if(this.destroyed||(this.events.emit(`vertex-remove`,{type:`vertex-remove`,object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)||r&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){let t=this._operations,n=e.map(e=>{let n=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:n,vertexIndex:e.handle.index}}),r=!1;return{type:`before-vertex-remove`,object:this.object,removed:n.map(e=>e.coordinates),vertices:n,get defaultPrevented(){return r},preventDefault(){r=!0}}}_moveVertices(e,t,n=t.action===`start`?0:1){let r=this._operations;if(r&&(e.length>0&&r.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,n),!this._movingManipulatorsHidden))for(let t of e)this._updateManipulatorPosition(t)}_offsetEdge(e,t,n){if(!this._operations)return;let r=t.clone();r.distance=n,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],r),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),t.type===`vertex`&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===I.Right&&this._removeVertices([t])),t.type===`edge`&&e.button===I.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){this._defaultTooltipInfo==null?this._updateTranslateObjectTooltip(e,t):this._resetTooltip()}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=Oe(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=N(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){let e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&e?.type===`reshape-edge-offset`)return;let t=null;t=this._pendingEdgeOffsetInfo||this._findActiveEdgeOffsetManipulatorInfo()!=null?N(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(e==null||t==null||this.tooltip.mode!==`input`)&&(this.activeTooltipInfo=t)}get _defaultTooltipInfo(){switch(this._operations?.data.type){case`polyline`:case`polygon`:return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case`point`:case`mesh`:return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){let e=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.length===1?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>e.type===`vertex`&&e.manipulator.selected)}_forEachVertex(e){for(let t of this._manipulatorInfos)t.type===`vertex`&&e(t)}get _tooltipsContext(){let{tooltipInfos:e,activeTooltipInfo:t}=this;return{toolOptions:this._toolOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};e([g()],q.prototype,`_numGrabbing`,void 0),e([g()],q.prototype,`_numDragging`,void 0),e([g()],q.prototype,`_pendingEdgeOffsetInfo`,void 0),e([g()],q.prototype,`_operations`,null),e([g()],q.prototype,`_segmentLabels`,void 0),e([g({constructOnly:!0})],q.prototype,`tool`,void 0),e([g()],q.prototype,`tooltip`,void 0),e([g()],q.prototype,`activeTooltipInfo`,void 0),e([g({readOnly:!0})],q.prototype,`updating`,null),e([g()],q.prototype,`manipulators`,null),e([g()],q.prototype,`view`,null),e([g()],q.prototype,`object`,null),e([g()],q.prototype,`enableZShape`,null),e([g()],q.prototype,`enableDeleteVertices`,null),e([g()],q.prototype,`enableZVertex`,null),e([g()],q.prototype,`autoHideManipulators`,null),e([g()],q.prototype,`enableMoveObject`,null),e([g()],q.prototype,`enableMidpoints`,null),e([g()],q.prototype,`enableEdgeOffset`,null),e([g()],q.prototype,`_toolOptions`,null),e([g()],q.prototype,`_accentColor`,null),e([g()],q.prototype,`_tooltipsContext`,null),q=e([_(`esri.views.3d.interactive.editingTools.reshape.ReshapeOperation`)],q);function Le(){return e=>{let{operation:t,mapEnd:n}=e;return t==null||n==null?e:{...e,signedDistance:t.signedDistanceToPoint(n)}}}function Re(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function J(e){return new oe({x:0,y:0,z:0,spatialReference:e})}function Y(e){return e.type===`edge`&&`edgeManipulator`in e}const X=S(0,0,void 0,le.WGS84),Z=ie(),ze=1e-6,Q=16,$=32;export{q as ReshapeOperation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{copy as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{VisualElement as n}from"./VisualElement.js";import{Object3D as r}from"../../webgl-engine/lib/Object3D.js";import{WebGLLayer as i}from"../../webgl-engine/lib/WebGLLayer.js";class a extends n{constructor(e){super(e),this._resources=null,this._transform=t()}get object(){return this._resources==null?null:this._resources.object}get transform(){return this._transform}set transform(t){e(this._transform,t),this._resources!=null&&(this._resources.object.transformation=this._transform)}recreate(){this.attached&&this.createResources()}recreateGeometry(){if(this._resources==null)return;let e=this._resources.object;e.removeAllGeometries(),this.createGeometries(e),e.visible=this.visible}createResources(){this.destroyResources();let e=this.view.stage;if(!e)return;let t=new i(e,{pickable:!1,updatePolicy:1}),n=new r({castShadow:!1});n.transformation=this._transform,this.createExternalResources(),this.createGeometries(n),t.add(n),n.visible=this.visible,this._resources={layer:t,object:n}}destroyResources(){let e=this.view.stage;this._resources!=null&&e&&(this._resources.layer.destroy(),this._resources.object.dispose(),this.destroyExternalResources(),this._resources=null)}updateVisibility(e){this._resources!=null&&(this._resources.object.visible=e)}}export{a as Object3DVisualElement};
2
+ import{StageObjectVisualElement as e}from"./StageObjectVisualElement.js";import{Object3D as t}from"../../webgl-engine/lib/Object3D.js";class n extends e{createObject(){let e=new t({castShadow:!1});return e.transformation=this._transform,e}updateObjectTransform(e){e.transformation=this._transform}}export{n as Object3DVisualElement};