@arcgis/core 4.33.0-next.20250204 → 4.33.0-next.20250206

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 (148) hide show
  1. package/assets/components/assets/icon/dualImageArea16.json +1 -0
  2. package/assets/components/assets/icon/dualImageArea24.json +1 -0
  3. package/assets/components/assets/icon/dualImageArea32.json +1 -0
  4. package/assets/components/assets/icon/dualImageDistance16.json +1 -0
  5. package/assets/components/assets/icon/dualImageDistance24.json +1 -0
  6. package/assets/components/assets/icon/dualImageDistance32.json +1 -0
  7. package/assets/components/assets/icon/dualImageLocation16.json +1 -0
  8. package/assets/components/assets/icon/dualImageLocation24.json +1 -0
  9. package/assets/components/assets/icon/dualImageLocation32.json +1 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/06f693780f70e5a627c4.js +1 -0
  12. package/assets/esri/core/workers/chunks/{24a86c52c8bdd0b5eb4d.js → 09a99c556089c166d1f8.js} +1 -1
  13. package/assets/esri/core/workers/chunks/15f850c9a1154fc57e5a.js +1 -0
  14. package/assets/esri/core/workers/chunks/{9b4f471fcd8a3b5e089f.js → 192569dfa7c0ea8dd864.js} +1 -1
  15. package/assets/esri/core/workers/chunks/1a2e1a414e651e988435.js.LICENSE.txt +1 -1
  16. package/assets/esri/core/workers/chunks/24e47f748f0e4f815c6e.js +1 -0
  17. package/assets/esri/core/workers/chunks/28374a64790342e1b5ae.js +1 -0
  18. package/assets/esri/core/workers/chunks/{c3f03ccabca691186aad.js → 287362f9af132fafe4de.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{ad215219e5eef8598745.js → 28dbbfc44cc2bdcd221d.js} +1 -1
  20. package/assets/esri/core/workers/chunks/2adc533dadcb018a9755.js +1 -0
  21. package/assets/esri/core/workers/chunks/308ec51ff4a66f7fcb0d.js.LICENSE.txt +1 -1
  22. package/assets/esri/core/workers/chunks/333091ab2e267652ed56.js +1 -0
  23. package/assets/esri/core/workers/chunks/354531dc2f0dea2ad96f.js.LICENSE.txt +1 -1
  24. package/assets/esri/core/workers/chunks/38cd7745b8ef1b8b6196.js +1 -0
  25. package/assets/esri/core/workers/chunks/{8a1e4f65fc81aba7a704.js → 4122d10bc910e888eee1.js} +1 -1
  26. package/assets/esri/core/workers/chunks/41cd1a5c99ab3bbd1fb4.js +1 -0
  27. package/assets/esri/core/workers/chunks/433576983754f690bcc7.js +1 -0
  28. package/assets/esri/core/workers/chunks/{b1269b51cef3e11c85e3.js → 48ecc5a74fecbb2b9c6f.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{b8a519d5d24b2e728ff8.js → 5a25cef6355fd20e44e7.js} +2 -2
  30. package/assets/esri/core/workers/chunks/{b8a519d5d24b2e728ff8.js.LICENSE.txt → 5a25cef6355fd20e44e7.js.LICENSE.txt} +1 -1
  31. package/assets/esri/core/workers/chunks/{8edae4ca2b18a219a43e.js → 5e7f16b312077ca8c18d.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{7a0415db78c68d31733f.js → 6039da57a2adedd3b83f.js} +1 -1
  33. package/assets/esri/core/workers/chunks/72cf9192292e5c85c6df.js.LICENSE.txt +1 -1
  34. package/assets/esri/core/workers/chunks/73d03c208242778e67bf.js +1 -0
  35. package/assets/esri/core/workers/chunks/{e4f82b5b50996b1ae48e.js → 746c964cf07e4306f21f.js} +1 -1
  36. package/assets/esri/core/workers/chunks/77764ca90bdd13ee2167.js.LICENSE.txt +1 -1
  37. package/assets/esri/core/workers/chunks/{723a9fba144e2fa6d017.js → 7cb09e58bcc537ec1f7a.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{07360fde6ea65664e6ca.js → 82d26884127ed772cc4b.js} +1 -1
  39. package/assets/esri/core/workers/chunks/842db06ce62758fab1e7.js +1 -0
  40. package/assets/esri/core/workers/chunks/{60cd8f4bba3e682ba57e.js → 91d2bdfa6e34c10b7f50.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{12dd892cf61a76fb40ad.js → 991e0f619f1f81f94d56.js} +1 -1
  42. package/assets/esri/core/workers/chunks/9a27824d94df702e6e28.js +1 -0
  43. package/assets/esri/core/workers/chunks/{610b33b7291cffcc4e5d.js → a42ae5d5e5f66d120b4d.js} +1 -1
  44. package/assets/esri/core/workers/chunks/a5e9ea13e844a62b2a7f.js +1 -0
  45. package/assets/esri/core/workers/chunks/b21b152fa15896577242.js.LICENSE.txt +1 -1
  46. package/assets/esri/core/workers/chunks/b43d88b6e7dc4ab13599.js +1 -0
  47. package/assets/esri/core/workers/chunks/{da77eefaad83c0644380.js → b8fae500c69ca2cff62a.js} +1 -1
  48. package/assets/esri/core/workers/chunks/b9d9a1dc3c5d799e2685.js +1 -0
  49. package/assets/esri/core/workers/chunks/{9c5c6ecaf5be24279fa5.js → ddc30044f61a2c2df3fe.js} +1 -1
  50. package/assets/esri/core/workers/chunks/e26dc0c1654316bb1558.js +1 -0
  51. package/assets/esri/core/workers/chunks/ef6279f5c63ab1e88c71.js +1 -0
  52. package/assets/esri/core/workers/chunks/{0711d3ad4d403bcfdcad.js → f117a89d1f4001a1f9f0.js} +1 -1
  53. package/assets/esri/core/workers/chunks/f4e48bbdbc9da10ec71a.js +1 -0
  54. package/assets/esri/core/workers/chunks/f9e48205178a5a804d38.js +1 -0
  55. package/assets/esri/themes/base/widgets/_Directions.scss +74 -17
  56. package/assets/esri/themes/dark/main.css +1 -1
  57. package/assets/esri/themes/light/main.css +1 -1
  58. package/assets/esri/themes/light/view.css +1 -1
  59. package/chunks/ColorMaterial.glsl.js +4 -5
  60. package/chunks/Pattern.glsl.js +1 -1
  61. package/chunks/WaterSurface.glsl.js +2 -2
  62. package/geometry/operators/projectOperator.js +1 -1
  63. package/geometry/operators/shapePreservingProjectOperator.js +1 -1
  64. package/geometry/support/meshUtils/elevation.js +1 -1
  65. package/interfaces.d.ts +76 -28
  66. package/layers/Layer.js +1 -1
  67. package/layers/graphics/data/FeatureStore.js +1 -1
  68. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  69. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  70. package/layers/ogc/wcsUtils.js +1 -1
  71. package/layers/support/RasterFunctionTemplate.js +1 -1
  72. package/layers/support/Sublayer.js +1 -1
  73. package/layers/support/capabilities.js +1 -1
  74. package/layers/support/featureLayerUtils.js +1 -1
  75. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  76. package/layers/support/rasterDatasets/multipartParser.js +1 -1
  77. package/layers/support/rasterDatasets/wcsCapabilitiesParser.js +1 -1
  78. package/layers/support/rasterFunctionUtils.d.ts +2 -1
  79. package/layers/support/rasterFunctionUtils.js +1 -1
  80. package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +1 -1
  81. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  82. package/package.json +2 -2
  83. package/rest/query/operations/queryAttachments.js +1 -1
  84. package/rest/support/AttachmentQuery.js +1 -1
  85. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  86. package/smartMapping/support/adapters/support/histogramUtils.js +1 -1
  87. package/support/revision.js +1 -1
  88. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  89. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapResources.js +1 -1
  90. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  91. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  92. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  93. package/views/2d/layers/LayerView2D.js +1 -1
  94. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  95. package/views/2d/layers/TileLayerView2D.js +1 -1
  96. package/views/2d/layers/graphics/HighlightGraphicContainer.js +1 -1
  97. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  98. package/views/2d/layers/support/util.js +1 -1
  99. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  100. package/views/3d/layers/MediaLayerView3D.js +1 -1
  101. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  102. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  103. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  104. package/views/3d/terrain/OverlayManager.js +1 -1
  105. package/views/3d/terrain/OverlayRenderer.js +1 -1
  106. package/views/3d/terrain/TerrainSurface.js +1 -1
  107. package/views/3d/webgl-engine/Stage.js +1 -1
  108. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  109. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  110. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  111. package/views/LayerViewManager.js +1 -1
  112. package/views/SceneView.js +1 -1
  113. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  114. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js +1 -1
  115. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  116. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  117. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  118. package/widgets/Attachments/AttachmentsViewModel.js +1 -1
  119. package/widgets/Directions.js +1 -1
  120. package/widgets/Editor/UpdateWorkflow.js +1 -1
  121. package/widgets/Editor/support/EditorItem.js +1 -1
  122. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  123. package/widgets/Feature/FeatureViewModel.js +1 -1
  124. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  125. package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
  126. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  127. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  128. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  129. package/widgets/support/geolocationUtils.js +1 -1
  130. package/assets/esri/core/workers/chunks/04306c2760c1f5b19966.js +0 -1
  131. package/assets/esri/core/workers/chunks/1e3ab66d0e8a7f160f33.js +0 -1
  132. package/assets/esri/core/workers/chunks/380d37ceb8cf52bad190.js +0 -1
  133. package/assets/esri/core/workers/chunks/39e38aab86dcee3f79be.js +0 -1
  134. package/assets/esri/core/workers/chunks/3ce826ebf0692363309d.js +0 -1
  135. package/assets/esri/core/workers/chunks/402de76b5de05615e111.js +0 -1
  136. package/assets/esri/core/workers/chunks/69d307758262e5d7a32e.js +0 -1
  137. package/assets/esri/core/workers/chunks/6dee40b94f94ee7bc4e4.js +0 -1
  138. package/assets/esri/core/workers/chunks/7a3e4cb5f64dac2cfe0e.js +0 -1
  139. package/assets/esri/core/workers/chunks/7e4d72279cc599b7029c.js +0 -1
  140. package/assets/esri/core/workers/chunks/8438fba57e82e4cc7c11.js +0 -1
  141. package/assets/esri/core/workers/chunks/92155d112ebb6a4c6c6e.js +0 -1
  142. package/assets/esri/core/workers/chunks/ba37ab9e560644dc1f18.js +0 -1
  143. package/assets/esri/core/workers/chunks/bbbe5d6cb8b737811c84.js +0 -1
  144. package/assets/esri/core/workers/chunks/bf26f58210755875748c.js +0 -1
  145. package/assets/esri/core/workers/chunks/c7a94e569c905f97244a.js +0 -1
  146. package/assets/esri/core/workers/chunks/d8c762ca94e3a11b125d.js +0 -1
  147. package/assets/esri/core/workers/chunks/dbc447413ab40a79ba87.js +0 -1
  148. package/assets/esri/core/workers/chunks/f48ef415b90edc7ccadd.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{isSome as i,equals as a}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import l from"../../core/Evented.js";import c from"../../core/JSONSupport.js";import{equalsShallow as h}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as p}from"../../core/mathUtils.js";import{abortMaybe as m,destroyMaybe as d}from"../../core/maybe.js";import g from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as f,waitTick as v}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{on as b,watch as F,syncAndInitial as _,initial as P}from"../../core/reactiveUtils.js";import{sqlAnd as S}from"../../core/sql.js";import{getMetersPerUnitForSR as I}from"../../core/unitUtils.js";import{property as M}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{distance as C}from"../../core/libs/gl-matrix-2/math/vec2.js";import{UpdatingHandles as A}from"../../core/support/UpdatingHandles.js";import{union as V}from"../../geometry/geometryEngineAsync.js";import R from"../../geometry/Multipoint.js";import G from"../../geometry/Point.js";import O from"../../geometry/Polygon.js";import j from"../../geometry/Polyline.js";import{projectWithZConversion as z}from"../../geometry/projection.js";import L from"../../geometry/SpatialReference.js";import{isClockwise as x}from"../../geometry/support/coordsUtils.js";import{fromJSON as B}from"../../geometry/support/jsonUtils.js";import{geographicToWebMercator as E}from"../../geometry/support/webMercatorUtils.js";import H from"../../layers/GraphicsLayer.js";import{searchImages as D}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as T}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as U,computePolygonForInspection as N,resizePolygon as W,checkIfPolygonContainsSelectedPoint as q}from"../../layers/orientedImagery/core/coverageUtils.js";import{isConstantElevation as $,isElevationSource as J}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{imageToWorld as Z,imageToWorldPanoramic as K}from"../../layers/orientedImagery/transformations/imageToWorld.js";import Q from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as X}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{getInitialAngle as Y,convertPixelToHeadingPitch as ee,getImageToWorldProperties as te,getUpdateElevationProps as ie,isElevationSampler as ae,getImageToWorldPanoramicProperties as re,pointToArray as se,transformGraphicCoordinatesToPixel as oe,getWorldToImageProperties as ne,convertHeadingPitchToSphereVertex as le,or as ce}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as he,worldToImage as ue}from"../../layers/orientedImagery/transformations/worldToImage.js";import{getFloorFilterClause as pe}from"../../layers/support/floorFilterUtils.js";import me from"../../rest/support/AttachmentQuery.js";import de from"../../symbols/SimpleLineSymbol.js";import ge from"../../views/draw/Draw.js";import{scale as ye}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as fe}from"../../views/input/InputManager.js";import ve from"../PanoramicViewer.js";import{invalidCameraHeading as we,sectorsInOrder as be,sectorsRadii as Fe}from"./constants.js";import{configureSketchTool as _e,isValidDigitizationLayer as Pe,extractFieldsFromDigitizationLayer as Se}from"./digitizationUtils.js";import{formatPixels as Ie,heightMeasurement2D as Me,calculateHeightAccuracy as ke,pixelAreaMeasurement2D as Ce,pixelAreaMeasurementPanoramic as Ae,pixelDistanceMeasurement2D as Ve,pixelDistanceMeasurementPanoramic as Re,generateCombinations as Ge,generateCombinationsPanoramic as Oe,calculateTempImagePoint as je,calculateAngle as ze,calculateCorrectedPixel as Le,calculateHeightFromTemporaryDistance as xe}from"./imageMeasurementUtils.js";import{crossSymbol as Be,crossSymbol3D as Ee,measurementPolygonSymbol as He,measurementPolylineSymbol as De,sourcePointSymbol as Te,digitizationSymbol as Ue,diamondSymbol as Ne,diamondSymbol3D as We,activeSourcePointSymbol as qe}from"./symbols.js";import{isNoAttachmentError as $e,getContentType as Je,isTifOrMrf as Ze,filterOILLayerView as Ke,isSceneView as Qe,isGraphic as Xe,calculateSegment as Ye,calculateDirection as et}from"./utils.js";import tt from"./components/ImageViewer.js";const it={click:"view-click",imageClick:"image-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles",sketchHandles:"sketch-handles"},at=new Set(["JPG","JPEG"]),rt=/\.(\w+)$/,st=e=>"FA"===e,ot=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let nt=class extends(l.EventedMixin(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.collectionId=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:a,selectedPoint:r,view:s}=this;if(s?.closePopup(),a&&r){this._initialCurrentCoverageUpdate=!0;try{await this._updatePointsAndPolygons(i),await this._loadImage(i)}catch(o){y(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.digitizationLayer=null,this.features=new s,this.groundCoordinates=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.draw=null,this.drawEv=null,this.sketchAdapter=null,this.updateFootprint=async(e,t)=>{"image-loaded"===this.state&&await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new tt,this._initialCurrentCoverageUpdate=!0,this._overlays=new H({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new ve,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._updatingHandles=new A,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find((({attributes:{imageID:t}})=>t===Number(e)));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDigitizationAdapter=async e=>{const{sketchAdapter:t}=this;if(await this.loadSketch(e),"digitization"===t?.type)return t;const i=import("./adapters/sketch/DigitizationAdapter.js"),{default:a}=await i;return f(e),this.sketchAdapter=new a({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.loadImageViewer=e=>{this._imageViewer.container=e},this.loadPanoramicViewer=e=>{this._panoramicViewer.container=e},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.toggleImageAttributes=()=>{m(this._openPopupTask),this._openPopupTask=r((async e=>{const{currentBestFeature:i,popupEnabled:a,layer:r,view:s}=this;if(s?.closePopup(),!(s&&i&&a&&r))return;const{attributes:o,geometry:n}=i,l=new t({geometry:n,attributes:o.toJSON(),layer:r});f(e),await s.openPopup({features:[l],location:o.location.clone()})}))},this._createViewClickHandle=()=>{if(this.removeHandles(it.click),"disabled"===this.state||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,fe.WIDGET),it.click)},this._createImageClickHandle=()=>{this.removeHandles(it.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:i,currentBestFeature:a,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&a))return;i.clickAction="pixel-location";let n=null;const l=b((()=>i),"pixel-location",(e=>{this.plotReferencePointOnImage(e),n?.abort(),n=r((async i=>{if(!e)return;const r=await this.getMapPoint(e,{feature:a,imageSize:o,mode:t}).then((e=>{const t=this.view?.spatialReference;return ce(!t,e.spatialReference.equals(t))?e:z(e,t)}));f(i),this.plotReferencePointOnGround(r)}))}));this.addHandles(l,it.imageClick)},this._createImageLocationHandle=()=>{this.removeHandles(it.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:i,currentBestFeature:a,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&a))return;i.clickAction="pixel-location";let n=null;const l=b((()=>i),"pixel-location",(e=>{this.pixelCoordinates=e,n?.abort(),n=r((async i=>{if(!e)return;let r=await this.getMapPoint(e,{feature:a,imageSize:o,mode:t});f(i);const s=this.view?.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await z(r,s),f(i)),this.groundCoordinates=r}))}));this.addHandles(l,it.imageClick)},this._getImageSourceFromAttachment=async(e,t,i)=>{const a=new me({objectIds:[t]}),r=await e.queryAttachments(a,i),s=r[`${t}`]?.[0],o=s?.url;if(!o)throw new n("NoAttachmentError","no attachments found",{[e.objectIdField]:t,layer:e});return{datasetFormat:s.contentType.split("/")[1].toUpperCase(),url:o}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:a}=this;if(this.clearGraphics(),!i||!t||"none"===a)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:h,cameraOrientation:p,location:m}=r,d=(l??0)+(o??0),g=m.spatialReference.isWGS84&&4!==p?.type?E(m):new G(m);let v=s;if(st(s))try{v=await this._getImageSourceFromAttachment(i,h,e)}catch(w){if(y(w))return;return $e(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${i.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[i.objectIdField]:h,layer:i}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${i.objectIdField} ${h}`))}try{await this.loadImageFromSource(v,{imageRotation:d,options:e,pitch:c,yaw:n,mode:a,cameraLocation:g}),f(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:i,imageRotation:a,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:l}=new URL(o);let c=s?n.match(rt)?.[1]:e.datasetFormat;if(!c){const e=await Je(o,{...t.options});c=e?.split("/")[1]??"UNKNOWN FORMAT"}switch(i){case"default":this._imageViewer.imageSource={datasetFormat:c.toUpperCase(),url:o.split("?")[0]},this._imageViewer.customParameters=Object.fromEntries(l),this._imageViewer.imageRotation=a??0,await this._imageViewer.loadImage(r);break;case"panoramic":if(at.has(c.toUpperCase())){const{selectedPoint:e}=this,{pitch:i,yaw:a,cameraLocation:s,viewAngle:n}=t;this._panoramicViewer.imageSource=o;let l=a??0;"number"==typeof n?l=n-l:s&&e&&(l=await Y(s,e)-l),this._panoramicViewer.pitch=i??0,this._panoramicViewer.yaw=l,await this._panoramicViewer.loadImage(r)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:c});break}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");f(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");f(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{e.stopPropagation(),e.preventDefault(),e.mapPoint&&this.plotMapPoint(e.mapPoint)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=r((async t=>{const{pointerType:i,button:a,mapPoint:r}=e;if(("mouse"!==i||0===a)&&r)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))}))},this.plotSelectedPointOnImage=async(e,i)=>{if(await v(i),!e)return;const a=new G({...c.isSerializable(e)?e.toJSON():e});if("default"===this.mode)a.x-=.5,a.y=.5-a.y,a.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:a,symbol:Be}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:i}=this._panoramicViewer;if(!i)return;const[a,r]=i,{heading:s,pitch:o}=ee(e,a,r),n=le(s,o);this._crossSymbol=new t({geometry:new G(n,L.WebMercator),symbol:Ee}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this),this.selectBestFeature=this.selectBestFeature.bind(this)}initialize(){this.addHandles([F((()=>this.view),(()=>{this.load()}),_),F((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),P),F((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),P),F((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),_),F((()=>[this.state,this.imageLocationToolState,this.view]),(()=>{this.imageLocationToolState||this.clearPreviousGroundLocation(),this._createImageLocationHandle()}),_),F((()=>this.measureType),(()=>{this.clearPreviousMeasurements()}),_),F((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),_),F((()=>this.currentBestFeature),(async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=r((async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}]))),await this._featureChangedTask.promise}),{sync:!0}),F((()=>this.mode),(e=>{switch(this.removeHandles(it.interactionHandles),e){case"default":this.addHandles(F((()=>this._imageViewer.imagePointsInView),(e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=r((async t=>{await this.updateFootprint(e,{signal:t})})))}),{..._,equals:(e,t)=>a(e,t,h)}),it.interactionHandles);break;case"panoramic":this.addHandles(F((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:i,vfov:a,hfov:r,pitch:s,yaw:o}=this._panoramicViewer;return e&&i&&"image-loading"!==t?[a,r,o,s]:null}),(e=>{if(!e||"image-loading"===this.state)return;const[t,i,a,s]=e;m(this._updateFootprintTask),this._updateFootprintTask=r((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:a,pitch:s},{signal:e})}))}),{..._,equals:(e,t)=>a(e,t,h)}),it.interactionHandles)}}),_),F((()=>[this.brightness,this.contrast,this.sharpness]),(()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:a,sharpness:r}=this;"default"===a&&(e.brightness=t,e.contrast=i,e.sharpness=r)}),_),F((()=>this.activeViewer?.imageRenderer),(()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}))]),this.when().finally((()=>{this.notifyChange("state")}))}destroy(){this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=d(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._crossSymbol=d(this._crossSymbol),this._referencePointOnGround=d(this._referencePointOnGround),this._referencePointOnImage=d(this._referencePointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this._panoramicViewer.destroy()}get activeLayer(){return o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:i}=this;switch(i){case"default":return e;case"panoramic":return t;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every((e=>0===e))??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",p(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",p(e,-10,10))}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){return Ze(this.currentBestFeature?.attributes.imagePath.trim())}get imageLoaded(){return o(u.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===we}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(Ke(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?pe(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const{horizontalFieldOfView:t,isSpherical:i}=e;return 360===t||i?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?be.map((t=>e[t])):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",p(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t}=this;if(t)return"disabled";if(!this.isFulfilled())return"loading";if(this.isRejected())return"error";if(this._updatingHandles.updating)return"image-loading";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map((({attributes:{imagePath:e,objectId:t,cameraRoll:i,imageRotation:a}})=>{const r=e.trim();return Ze(r)?{url:r,objectId:t,rotation:(i??0)+(a??0)}:null})).filter(i)):null}set view(e){this._set("view",e)}get _sketchGraphicsLayer(){const{mode:e}=this;switch(e){case"panoramic":return new H({elevationInfo:{mode:"absolute-height"}});case"default":return new H;case"none":return}}get _overlaysView(){return this.view?.layerViews.find((({layer:e})=>e===this._overlays))}async computeHeight(e,t=!0){const{currentBestFeature:i,activeViewer:a,layer:r}=this,s=a?.imageSize,o=i?.attributes,n=r?.orientationAccuracy;if(!o||!s||!e||e.length<2||!n)return;const l=te(o,s[0],s[1]),c=e.at(0),h=e.at(-1);if(!c||!h||!n)return;const u=[h,c],p=Ie(u,!1),m=await Me(u,l,n,!0,t);if(!m)return;const d=await ke(n,p,l,m,!0);return d?{value:m,accuracy:d}:{value:m}}async calculateAreaMeasurement(e,t,i){if(e.length<3||!this.currentBestFeature||!this.activeViewer?.imageSize||"none"===t)return null;const a="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return f(i),a?"default"===t?await Ce(e,a,!0):await Ae(e,a,!0,i):null}async calculateDistanceMeasurement(e,t,i){const{currentBestFeature:a,activeViewer:r}=this;if(e.length<2||!a||!r?.imageSize||"none"===t)return null;const s="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return f(i),s?"default"===t?await Ve([e.at(0),e.at(-1)],s,!0):await Re([e.at(0),e.at(-1)],s,!0):null}async calculateAccuracy(e,t,i){const{layer:a,currentBestFeature:r,activeViewer:s}=this,o=a?.orientationAccuracy,n=o?.every((e=>0===e))||!o?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!r||!s?.imageSize||n)return null;const l=await this.getMeasurementProperties();if(f(i),!l)return null;const c="area"===t?await Ce(e,l,!0):await Ve([e.at(0),e.at(-1)],l,!0);f(i);const{updateElevationProps:h,...u}=l,p=Ge(u,o);if(!p?.length)return null;const m=p.map((e=>({...e,updateElevationProps:h}))).map((async a=>{const r="area"===t?await Ce(e,a,!0):await Ve([e.at(0),e.at(-1)],a,!0);if(f(i),r&&c){if("area"===t){const e="number"!=typeof r?r.area:null;return e?Math.abs(e-c.area):null}return Math.abs(r-c)}return null})),d=await Promise.all(m);f(i);const g=d.filter((e=>null!==e));if(0===g.length)return null;return Math.max(...g.map((e=>e)))}async calculateAccuracyPanoramic(e,t,i){const{layer:a,currentBestFeature:r,activeViewer:s,mode:o}=this,n=a?.orientationAccuracy,l=n?.every((e=>0===e))||!n?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!r||!s?.imageSize||l||"panoramic"!==o)return null;const c=await this.getMeasurementPropertiesPanoramic();if(f(i),!c)return null;const h="area"===t?await Ae(e,c,!0):await Re([e.at(0),e.at(-1)],c,!0);f(i);const{updateElevationProps:u,...p}=c,m=Oe(p,n);if(!m?.length)return null;const d=m.map((e=>({...e,updateElevationProps:u}))).map((async a=>{const r="area"===t?await Ae(e,a,!0):await Re([e.at(0),e.at(-1)],a,!0);if(f(i),r&&h){if("area"===t){const e="number"!=typeof r?r.area:null;return e?Math.abs(e-h.area):null}return Math.abs(r-h)}return null})),g=await Promise.all(d);f(i);const y=g.filter((e=>null!==e));if(0===y.length)return null;return Math.max(...y.map((e=>e)))}async calculateHeightMeasurementInfo(e,t){const{currentBestFeature:i,activeViewer:a}=this,r=a?.imageSize;if(!i||!a||!r?.length)return;const{attributes:s}=i,[o]=Ie([e],!0),n=te(s,r[0],r[1]),l=await je(o,n,t);if(!l)return;const c=ze(o,l),h=C([o.x,o.y],[l.x,l.y]);return c&&h?{measurementAngle:c,tempDistance:h}:void 0}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.pixelCoordinates=null}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null)}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:i,digitizationLayer:a}=this;if(!i)throw ot();_e(a,e,i),await i.create(e,{...t,defaultZ:0})}async digitizeDelete(){if(!this.sketch)throw ot();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw ot();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw ot();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw ot();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw ot();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw ot();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:i}=this,a=t?.imageSize,r=e?.attributes;if(!r||!a)return;const s=await this.computeHeight(i);s?.value&&s?.accuracy&&(this.heightMeasurementResult=s.value,this.heightMeasurementAccuracy=s.accuracy)}filterByFootprints(e,t){const i=[],a=[],r=[];return e.forEach((e=>{const{layer:{coveragePercent:s},attributes:o}=e;let n;const l=I(e.geometry.spatialReference);o.cameraHeight/=l,o.farDistance/=l,o.nearDistance/=l,$(o.elevationSource)&&(o.elevationSource.constantElevation/=l);const{polygon:c,frustum:h}=U(o);if(n=c.clone(),o.isInspection&&(n=N(o)),s&&(n=W(n,s)),q(n,t)){r.push(e);const{geometry:t,objectId:s,cameraHeight:n,cameraHeading:l}=o,u=t.clone();u.z=n,u.imageID=s,this.pointSources.push(u),l!==we&&(i.push(c),h&&a.push(h))}})),{features:r,polygons:i,frustums:a}}getMeasurementProperties(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:i,attributes:a}=e,{elevationSource:r,cameraHeight:s}=a,o=te(a,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?z(n,L.WebMercator):Promise.resolve(n)).then((e=>(n=e,ie((n.z??0)-s,{elevationSample:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&ae(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}getMeasurementPropertiesPanoramic(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:i,attributes:a}=e,{elevationSource:r,cameraHeight:s}=a,o=re(a,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?z(n,L.WebMercator):Promise.resolve(n)).then((e=>(n=e,ie((n.z??0)-s,{elevationSample:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&ae(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}async deleteDigitizedFeatures(e){const{digitizationLayer:t}=this;if(!t)throw new n("Digitization layer is not available");return t.queryFeatures({objectIds:e}).then((({features:e})=>t.applyEdits({deleteFeatures:e})))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[be[e]];t?.length&&this._updateCurrentBestFeature(t.at(0))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const a=this._sectorData?.[t];a?.length&&this._updateCurrentBestFeature(a.at(i))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:i,heightMeasurementPixels:a}=this;if(!e.vertices)return;const r=e.vertices.at(-1);if(a.length<1||!r||!i||!t)return;const s=Le(a[0],r,t);if(!s?.length)return;this.heightMeasurementPixels.push(s),this.createPolylineGraphic();const o=xe(this.heightMeasurementPixels,i);o&&(this.heightMeasurementResult=o)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:i,activeViewer:a,heightMeasurementPixels:r}=this;if(!i||!a||!e.vertices?.length)return;const s=a?.imageSize;if(!r.length&&s){const i=e.vertices.at(-1);this.heightMeasurementPixels.push(i);const a=await this.calculateHeightMeasurementInfo(i,t);if(!a?.measurementAngle||!a?.tempDistance)return;this.measurementAngle=a.measurementAngle,this.tempDistance=a.tempDistance}}async load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch((e=>{if(!y(e))throw e}))),this}async loadBestImage(e,t){return this.view?.closePopup(),this.displayMessage=null,this.clearPreviousGroundLocation(),this.imageLocationToolState=!1,this.selectedPoint=e.spatialReference.isGeographic?E(e):e.clone(),this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._overlays?.removeAll(),this._fetchFeaturesWithController(e,t)}loadImageError(e){u.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:i}=await t;f(e),this.sketch=new i({layer:this._sketchGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(f(e),this.sketchAdapter=new i({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async startMeasurement(e,t){await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:a,activeViewer:r,mode:s}=this;if(!i||!a||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===s){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=He(o),this.sketch.polylineSymbol=De(o))}startHeightMeasurement(){this.heightMeasurementPixels=[],this.displayNewMeasurementButton=!1,this.draw=new ge({view:this.activeViewer?.imageRenderer}),this.drawEv=this.draw.create("polyline"),this.drawEv.on(["cursor-update","vertex-add","draw-complete"],(e=>this.handleDrawEvents(e)))}createPolylineGraphic(){const e=[this.heightMeasurementPixels[0],this.heightMeasurementPixels.at(-1)],i=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[e],spatialReference:i});else{const a=new j({paths:[e],spatialReference:i}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:a,symbol:De(r,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}async handleDrawEvents(e,t){if(this.draw)switch(e.type){case"cursor-update":this.handleDrawCursorUpdateEvents(e);break;case"vertex-add":this.handleDrawVertexAddEvents(e,t);break;case"draw-complete":await this.displayHeightResults()}}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:i,currentBestFeature:a,overlayedCameraLocations:r,layer:s,mode:o,state:n}=this,l=i?.imageSize;if(!l||!a||!s||"none"===o||n.includes("loading"))return;const{polygon:c}=U(a.attributes);if(i.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await s.queryFeatures({where:`${s.objectIdField} <> ${a.attributes.objectId}`,geometry:c,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map((async e=>{const{attributes:i,geometry:r}=e,s=await this.getPixels(r,{feature:a,imageSize:l,mode:o}),n=Te.clone();return n.outline=new de({color:[0,0,0],width:1}),new t({attributes:i,symbol:n,geometry:s})})));r.addMany(n),i.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,a=!1){const{activeViewer:r,currentBestFeature:o,mode:n,state:l}=this,c=r?.imageSize;if(!c||!o||"none"===n||l.includes("loading"))return;const{polygon:h}=U(o.attributes),p=Pe(e);try{const{imageGeometryField:t,oiObjectIdField:i}=Se(e);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:m}=await e.queryFeatures({geometry:h,returnGeometry:!0,outFields:["*"]}),d=new s((await Promise.all(m.map((async i=>{const r=i.symbol?.clone()??e.renderer?.getSymbol(i)?.clone(),{attributes:s,geometry:l}=i;let h=l;if(p&&this.imageGeometryField&&this.oiObjectIdField){if(s[this.oiObjectIdField]===`${o.attributes.objectId}`)return h=B(JSON.parse(atob(s[this.imageGeometryField]))),new t({attributes:s,layer:e,symbol:h.type===e.geometryType?r:Ue(h.type)?.()??null,geometry:h,visible:e.visible&&a})}switch(h?.type){case"point":{const i=await this.getPixels(h,{feature:o,imageSize:c,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:i,visible:e.visible&&a})}case"polygon":{const{rings:i,spatialReference:l}=h,u=i.map((e=>e.map((([e,t,i])=>new G({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(u.map((async e=>this.getPixels(e,{feature:o,imageSize:c,mode:n}).then((e=>e.map(se))))));return new t({attributes:s,layer:e,symbol:r,geometry:new O({rings:p,spatialReference:L.WebMercator}),visible:e.visible&&a})}case"polyline":{const{paths:i,spatialReference:l}=h,u=i.map((e=>e.map((([e,t,i])=>new G({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(u.map((async e=>this.getPixels(e,{feature:o,imageSize:c,mode:n}).then((e=>e.map(se))))));return new t({attributes:s,layer:e,symbol:r,geometry:new j({paths:p,spatialReference:L.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:l}=h,u=i.map((([e,t,i])=>new G({x:e,y:t,z:i,spatialReference:l}))),p=await this.getPixels(u,{feature:o,imageSize:c,mode:n}).then((e=>e.map(se)));return new t({attributes:s,layer:e,symbol:r,geometry:new R({points:p,spatialReference:L.WebMercator}),visible:e.visible&&a})}}return null})))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,d)}async getPixels(e,t){const{imageSize:i,mode:a}=t,r=(await this.worldToImage(Array.isArray(e)?e:[e])).map((e=>{if("default"===a)return new G({x:e.x-.5,y:.5-e.y,spatialReference:L.WebMercator});const[t,r]=i,{heading:s,pitch:o}=ee(e,t,r),n=le(s,o);return new G(n,L.WebMercator)}));return Array.isArray(e)?r:r[0]}async getMapPoint(e,t){const{feature:i,mode:a,imageSize:r}=t,{elevationSample:s,attributes:o}=i,{elevationSource:n,location:l,elevation:c,cameraHeight:h}=o;let u=l.clone();u.spatialReference.isGeographic&&(u=await z(u,L.WebMercator));const p=await ie(c??(l.z??0)-h,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let m;if("elevationSample"in p&&ae(p.elevationSample)&&(i.elevationSample=p.elevationSample),"default"===a){const t=te(o,r[0],r[1]);m=await Z(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}else{const t=re(o,r[0],r[1]);m=await K(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}return Array.isArray(e)?m:m[0]}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new G({...e.toJSON()}),symbol:Ne}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const i=c.isSerializable(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._referencePointOnImage=new t({geometry:new G({spatialReference:this._imageViewer.imageRenderer.spatialReference.clone(),...i}),symbol:Ne}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:i}=this._panoramicViewer;if(!i)return;const[a,r]=i,{heading:s,pitch:o}=ee(e,a,r),n=le(s,o);this._referencePointOnImage=new t({geometry:new G(n,L.WebMercator),symbol:We}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach((e=>{this._imageViewer.removeManyGraphics(e.toArray())})),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementPixels=[],this.heightMeasurementResult=0,this.tempDistance=null,this.measurementAngle=null,this.heightMeasurementAccuracy=0,this.heightGraphic=null}async saveDrawing(){const{digitizationLayer:e,sketchAdapter:t}=this;if(!e||"digitization"!==t?.type)return;const{pendingGraphics:i,savedGraphics:a}=t,r=i.get(e.id),s=r?.toArray();if(!r||!s?.length)return;const{addFeatureResults:o}=await this.saveDigitizedFeatures(s),n=o.reduce(((t,{objectId:i,globalId:a,error:r},o)=>{const n=s[o],{attributes:l}=n;return r?t.error.push(n):(i&&(l[e.objectIdField]=i),a&&e.globalIdField&&(l[e.globalIdField]=a),t.success.push(n)),t}),{success:[],error:[]});a.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDigitizedFeatures(e){const{activeViewer:t,currentBestFeature:a,digitizationLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!a||"none"===s)throw new n("Image size, current best feature and mode are required to save digitized features");if(!r)throw new n("Digitization layer is not available");const l=await Promise.all(e.map((async e=>{const t=e.clone(),{geometry:i}=t;if(!i)return;const n=i.type,l=r.hasZ,c=r.geometryType,h=n!==c,u=h?await import("./transformers.js"):null,p=u?.default[c],m=h?p?.(i):i;if(m)switch(m.type){case"point":return t.geometry=await this.getMapPoint(oe(s,m,o),{feature:a,imageSize:o,mode:s}),l||(delete t.geometry.z,t.geometry.hasZ=!1),t.geometry.hasM=!1,t;case"polygon":{const e=await Promise.all(m.rings.map((async e=>this.getMapPoint(e.map((([e,t,i])=>oe(s,{x:e,y:t,z:i},o))),{feature:a,imageSize:o,mode:s}))));return t.geometry=new O({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,rings:e.map((e=>e.map(se)))}),t}case"polyline":{const e=await Promise.all(m.paths.map((async e=>this.getMapPoint(e.map((([e,t,i])=>oe(s,{x:e,y:t,z:i},o))),{feature:a,imageSize:o,mode:s}))));return t.geometry=new j({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,paths:e.map((e=>e.map(se)))}),t}}}))),c=l.filter(i);return r.applyEdits({addFeatures:c}).then((e=>{const{addFeatureResults:t}=e;let i=0;const a=l.map((e=>{const a=t[i++];return e?a:{error:new n("Error in saving digitized features"),objectId:null,globalId:null}}));return{...e,addFeatureResults:a}}))}async searchBestImage(e,t){try{const i=await D(e,t);i&&await this._processFeatureResponse(i,e.point,{signal:t?.signal})}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),u.getLogger(this).error("error occurred while finding best image",i))}}selectBestFeature(e){this.currentBestFeature=this.features?.find((({attributes:t})=>t.objectId===Number(e)))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach((t=>{t.visible=e}))}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach((t=>{t.visible=e}))}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}async startDigitization(e,t){const i=this.activeViewer?.imageRenderer;if(!i)return;const a=this.overlayedMapFeatures.get(e.id)?.toArray()??[];this.removeOverlayedGraphicsOnImage(e.id),this.collectionId=e.id,await this.loadSketch(t),await this.loadDigitizationAdapter(t),f(t),this.sketchGraphicsLayer?.addMany(a),this.sketchAdapter?.savedGraphics.addMany(a);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}stopDigitization(e){this.sketch?.cancel();const t=this.sketchAdapter?.savedGraphics;this.sketchGraphicsLayer?.removeAll();const i=this.activeViewer?.imageRenderer;if(!t||!i)return;this.overlayGraphicsOnImage(e,t);i.ui.find("zoom").visible=!0,i.map.layers.remove(this.sketchGraphicsLayer)}stopMeasurement(){this.heightMeasurementPixels=[],this.sketch&&this.sketchAdapter&&this.sketch.cancel()}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach((t=>{this._toggleVisiblity(t,e)}))}toggleOverlayMapFeatures(e,t){const i=this.overlayedMapFeatures.get(e);i&&this._toggleVisiblity(i,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{selectedLocation:t,options:i}=e;let a=!1,r=!1;const s=this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=t.spatialReference.equals(s.spatialReference)?t:await z(t,s.spatialReference);a=s.contains(e);break}case"mesh":{const e=t.spatialReference.equals(s.spatialReference)?t:await z(t,s.spatialReference);r=s.extent.contains(e);break}}if(!a&&!r)return void this.clearReferencePointOnImage();const o=await this.worldToImage(t,i);if(o)return f(i),this.plotReferencePointOnImage(o),{x:o.x,y:o.y};this.clearReferencePointOnImage()}updateSuitabilities(e){e.sort(((e,t)=>e.suitability-t.suitability)),this._suitabilities=e;const t=this._suitabilities.map((({feature:e})=>e));this._initialCurrentCoverageUpdate=!0,this._updateFeatures(t),this._groupFeaturesBySectors()}async _fetchFeatures(e,t){if(!this.view)return;const i=this.layer;if(i){const a={include:i},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,a);return this._processHitTestResults(i,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,currentBestFeature:i,features:a,invalidCameraHeading:r}=this;if(!e||!t||!i||!a||r)return void(this._sectorData=null);this._sectorData={};for(const c of be)this._sectorData[c]=new s;const o=e.map(((e,t)=>({...e,featureIndex:t})));o.sort(((e,t)=>e.trueSuitability-t.trueSuitability));const n=o.map((({distance:e})=>e)),l=Math.max(...n);o.forEach((e=>{const{distance:t,angle:i,featureIndex:r}=e,s=t/l*Fe[2],o=Ye(t,l),n=et(i);if(!this._sectorData)return;const c=Fe[3]+s*Math.sin(i*Math.PI/180),h=Fe[3]+s*Math.cos(i*Math.PI/180);let u;const p=a.at(r),m=p===this.currentBestFeature,d=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;if(m&&d)u=-90;else{const e=c-Fe[3],t=h-Fe[3],i=t/Math.sqrt(e**2+t**2);let a=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(a*=-1),u=a}const g=""===o?n:`${o}_${n}`;m&&(u===this.bestFeatureAngle?this.previousFeatureAngle=u:this.bestFeatureAngle=u,this.navigatorCurrentBestFeature=d?null:{x:c,y:h,direction:n});const y=this._sectorData[g];y.add({angle:i,featureIndex:r,x:c,y:h,objectID:p.attributes.objectId,sector:g,featureIndexInSector:y.length})}))}async _processFeatureResponse(e,t,i){const{features:a}=e;if(!a?.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll();const{features:r,polygons:s,frustums:o}=this.filterByFootprints(a,t);if(!r.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);let n;if(this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o),s[0]){let e=new O({spatialReference:s[0].spatialReference});for(const i of s)e=await V(e,i);const t=[];for(const{geometry:i}of r)e.contains(i)||t.push([i.x,i.y]);if(t.sort(((e,t)=>+x([e,t]))),e.addRing(t),this.footprintExtent=ye(e.extent,2,2),this.view?.supportsGround)try{n=await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(l){y(l)||u.getLogger(this).error(l)}}if((n||r[0].attributes.elevationSource)&&this.footprintExtent){const e=r[0].attributes.elevationSource;J(e)&&!n&&(n=await X({extent:this.footprintExtent,lod:e.lod,url:e.url,rasterFunction:e.rasterFunction}));const i=await ie((r[0].attributes.location.z??0)-r[0].attributes.cameraHeight,{elevationSample:n,elevationSource:e,extent:this.footprintExtent}),[a,...s]=await Q([t,...r.map((e=>e.attributes.geometry.clone()))],i);r[0].elevationSample=n??i.elevationSample,t.elevation=a.z,r.forEach(((e,t)=>{e.attributes.elevation=s[t].z}))}r[0].elevationSample&&r.forEach((e=>{e.elevationSample=r[0].elevationSample})),this._suitabilities=T({features:r,selectedPoint:t,camera:Qe(this.view)?this.view.camera:null,currentImage:this.currentBestFeature}),this.updateSuitabilities(this._suitabilities)}async _processHitTestResults(e,t,i){const{screenPoint:a,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(a);if(!o)return;const{layerFloorFilterClause:n}=this,l=e.spatialReference.equals(o.spatialReference)?o:await z(o,e.spatialReference),c=S("1=1",S(e.definitionExpression,n)),h=l.spatialReference.isGeographic?1:I(l.spatialReference),u={layerInstanceOrURL:e,point:l,queryParams:{where:c,maximumDistance:e.maximumDistance?e.maximumDistance/h:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(u,i)}_toggleVisiblity(e,t){e.forEach((e=>{e.visible=t}))}_updateFeatures(e){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this.currentBestFeature=e[0]}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:a,currentCoverageVisible:r,isAdditionalPointSourcesVisible:s}=this;if(a&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),f(e);for(const e of i)e.imageID===a.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e,symbol:qe,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e,symbol:Te,visible:s}))}}_updateCurrentBestFeature(e){if(!e)return;this.currentBestFeature=this.features?.at(e.featureIndex);const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let i;if(t)i=-90;else{const t=e.x-Fe[3],a=e.y-Fe[3],r=a/Math.sqrt(t**2+a**2);let s=180*Math.acos(r)/Math.PI;(t<0&&a<0||t<0&&a>0)&&(s*=-1),i=s}i===this.bestFeatureAngle?this.previousFeatureAngle=i:this.bestFeatureAngle=i,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=d(this._referencePointOnImage))}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}setMessage(e,t,i,a){this.displayMessage={key:e,type:t,data:i,map:a}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:i,selectedPoint:a,state:r}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=d(this._crossSymbol)),!a||!t||"image-loaded"!==r||i)return;let s;try{s=await this.worldToImage(a,e),f(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:a,feature:t})}}async worldToImage(e,t){const{footprintExtent:i}=this,{imageSize:a}=this.activeViewer;if("none"===this.mode||!this.currentBestFeature||!a||!i)return;const{attributes:{location:r,elevationSource:s,cameraHeading:o,elevation:n,cameraHeight:l},elevationSample:c}=this.currentBestFeature;let h=r.clone();const u=await ie(n??(r.z??0)-l,{elevationSample:c,elevationSource:s});this.currentBestFeature.elevationSample=u.elevationSample;const p=Array.isArray(e)?e:[e];let m,d=await Promise.all(p.map((e=>new Promise((t=>{if(!e.hasZ)return t(Q(e,u));t(e)})))));if(r.spatialReference.isGeographic&&(h=await z(h,L.WebMercator,t)),d=await Promise.all(d.map((async e=>h.spatialReference.equals(e.spatialReference)?e:await z(e,h.spatialReference,t)))),f(t),"panoramic"===this.mode)m=he(d,{imageHeight:a[1],imageWidth:a[0],cameraHeading:o,cameraLocation:h});else{const e=ne(this.currentBestFeature.attributes,a[0],a[1]);m=ue(d,{...e,cameraLocation:h})}return Array.isArray(e)?m:m[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:a,currentBestFeature:r,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:l,_adapter:c}=this,{attributes:{objectId:h},elevationSample:u}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...a,this.bestFeatureCurrentFootprint,s].filter(Xe);l.supportsGround&&u&&c?.updateGroundElevation&&c.updateGroundElevation(e,u),n&&e.push(new t({geometry:n.clone(),symbol:Be.clone(),attributes:{imageID:h}})),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,l?.supportsGround&&u&&c?.updateGroundElevation&&c.updateGroundElevation([e],u),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([M()],nt.prototype,"activeLayer",null),e([M({readOnly:!0})],nt.prototype,"activeViewer",null),e([M()],nt.prototype,"accuracyParametersMissing",null),e([M()],nt.prototype,"additionalFeatures",void 0),e([M({type:s.ofType(t)})],nt.prototype,"additionalCameraLocations",void 0),e([M({type:s.ofType(t)})],nt.prototype,"additionalFootprints",void 0),e([M()],nt.prototype,"areaMeasurementResult",void 0),e([M()],nt.prototype,"areaMeasurementAccuracy",void 0),e([M()],nt.prototype,"bestFeatureAngle",void 0),e([M()],nt.prototype,"bestFeatureCurrentFootprint",void 0),e([M({type:t})],nt.prototype,"bestFeatureFootprint",void 0),e([M({type:Number})],nt.prototype,"brightness",null),e([M()],nt.prototype,"collectionId",void 0),e([M({type:Number})],nt.prototype,"contrast",null),e([M()],nt.prototype,"conversionProps",void 0),e([M()],nt.prototype,"coverageFrustums",void 0),e([M()],nt.prototype,"coveragePolygons",void 0),e([M()],nt.prototype,"currentBestFeature",void 0),e([M()],nt.prototype,"currentBestFeatureLocation",void 0),e([M()],nt.prototype,"currentCoverageVisible",void 0),e([M({json:{write:!1}})],nt.prototype,"determineWorkflowForFeature",void 0),e([M()],nt.prototype,"disabled",void 0),e([M()],nt.prototype,"displayMessage",void 0),e([M()],nt.prototype,"displayNewMeasurementButton",void 0),e([M()],nt.prototype,"distanceMeasurementResult",void 0),e([M()],nt.prototype,"distanceAccuracyArray",void 0),e([M()],nt.prototype,"digitizationLayer",void 0),e([M({readOnly:!0})],nt.prototype,"featureCount",null),e([M()],nt.prototype,"features",void 0),e([M()],nt.prototype,"groundCoordinates",void 0),e([M()],nt.prototype,"heightMeasurementPixels",void 0),e([M()],nt.prototype,"heightGraphic",void 0),e([M()],nt.prototype,"heightMeasurementResult",void 0),e([M()],nt.prototype,"heightMeasurementAccuracy",void 0),e([M()],nt.prototype,"measurementAngle",void 0),e([M()],nt.prototype,"tempDistance",void 0),e([M({readOnly:!0})],nt.prototype,"imageGalleryEnabled",null),e([M()],nt.prototype,"imageGeometryField",void 0),e([M({readOnly:!0})],nt.prototype,"imageLoaded",null),e([M()],nt.prototype,"imageLocationToolState",void 0),e([M({readOnly:!0})],nt.prototype,"invalidCameraHeading",null),e([M()],nt.prototype,"imagePointsInView",null),e([M()],nt.prototype,"isAdditionalCoverageVisible",void 0),e([M()],nt.prototype,"isAdditionalPointSourcesVisible",void 0),e([M()],nt.prototype,"layer",void 0),e([M()],nt.prototype,"layerView",null),e([M({readOnly:!0})],nt.prototype,"layerFloorFilterClause",null),e([M({type:Number})],nt.prototype,"localPort",void 0),e([M()],nt.prototype,"mapImageConversionToolState",void 0),e([M()],nt.prototype,"measureType",void 0),e([M()],nt.prototype,"measurementGraphic",void 0),e([M({readOnly:!0,value:"none"})],nt.prototype,"mode",null),e([M()],nt.prototype,"navigatorCurrentBestFeature",void 0),e([M()],nt.prototype,"oiObjectIdField",void 0),e([M({type:s.ofType(t)})],nt.prototype,"overlayedCameraLocations",void 0),e([M()],nt.prototype,"overlayedMapFeatures",void 0),e([M()],nt.prototype,"pixelCoordinates",void 0),e([M()],nt.prototype,"pointSources",void 0),e([M({readOnly:!0})],nt.prototype,"popupEnabled",null),e([M()],nt.prototype,"previousFeatureAngle",void 0),e([M()],nt.prototype,"referencePoint",null),e([M({readOnly:!0})],nt.prototype,"sectorData",null),e([M()],nt.prototype,"selectedPoint",void 0),e([M({type:Number})],nt.prototype,"sharpness",null),e([M()],nt.prototype,"shouldShowSelectedImage",void 0),e([M()],nt.prototype,"sketch",void 0),e([M()],nt.prototype,"draw",void 0),e([M()],nt.prototype,"drawEv",void 0),e([M()],nt.prototype,"sketchAdapter",void 0),e([M({readOnly:!0})],nt.prototype,"sketchGraphicsLayer",null),e([M({readOnly:!0})],nt.prototype,"state",null),e([M({readOnly:!0})],nt.prototype,"thumbnails",null),e([M()],nt.prototype,"updateFootprint",void 0),e([M()],nt.prototype,"updateFootprintPanorama",void 0),e([M({value:null})],nt.prototype,"view",null),e([M()],nt.prototype,"_adapter",void 0),e([M()],nt.prototype,"_sketchGraphicsLayer",null),e([M()],nt.prototype,"_highlightedFeatureHandle",void 0),e([M()],nt.prototype,"_imageViewer",void 0),e([M()],nt.prototype,"_initialCurrentCoverageUpdate",void 0),e([M()],nt.prototype,"_overlays",void 0),e([M({readOnly:!0})],nt.prototype,"_overlaysView",null),e([M()],nt.prototype,"_panoramicViewer",void 0),e([M()],nt.prototype,"_referencePointOnGround",void 0),e([M()],nt.prototype,"_referencePointOnImage",void 0),e([M()],nt.prototype,"_sectorData",void 0),e([M({readOnly:!0})],nt.prototype,"_updatingHandles",void 0),e([M()],nt.prototype,"footprintExtent",void 0),nt=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],nt);const lt=nt;export{lt as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{isSome as i,equals as a}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import l from"../../core/Evented.js";import c from"../../core/JSONSupport.js";import{equalsShallow as h}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as p}from"../../core/mathUtils.js";import{abortMaybe as m,destroyMaybe as d}from"../../core/maybe.js";import g from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as f,waitTick as v}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{on as b,watch as F,syncAndInitial as _,initial as P}from"../../core/reactiveUtils.js";import{sqlAnd as S}from"../../core/sql.js";import{getMetersPerUnitForSR as I}from"../../core/unitUtils.js";import{property as M}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{distance as C}from"../../core/libs/gl-matrix-2/math/vec2.js";import{UpdatingHandles as A}from"../../core/support/UpdatingHandles.js";import{union as V}from"../../geometry/geometryEngineAsync.js";import R from"../../geometry/Multipoint.js";import G from"../../geometry/Point.js";import O from"../../geometry/Polygon.js";import j from"../../geometry/Polyline.js";import{projectWithZConversion as z}from"../../geometry/projection.js";import L from"../../geometry/SpatialReference.js";import{isClockwise as x}from"../../geometry/support/coordsUtils.js";import{fromJSON as B}from"../../geometry/support/jsonUtils.js";import{geographicToWebMercator as E}from"../../geometry/support/webMercatorUtils.js";import H from"../../layers/GraphicsLayer.js";import{searchImages as D}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as T}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as U,computePolygonForInspection as N,resizePolygon as W,checkIfPolygonContainsSelectedPoint as q}from"../../layers/orientedImagery/core/coverageUtils.js";import{isConstantElevation as $,isElevationSource as J}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{imageToWorld as Z,imageToWorldPanoramic as K}from"../../layers/orientedImagery/transformations/imageToWorld.js";import Q from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as X}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{getInitialAngle as Y,convertPixelToHeadingPitch as ee,getImageToWorldProperties as te,getUpdateElevationProps as ie,isElevationSampler as ae,getImageToWorldPanoramicProperties as re,pointToArray as se,transformGraphicCoordinatesToPixel as oe,getWorldToImageProperties as ne,convertHeadingPitchToSphereVertex as le,or as ce}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as he,worldToImage as ue}from"../../layers/orientedImagery/transformations/worldToImage.js";import{getFloorFilterClause as pe}from"../../layers/support/floorFilterUtils.js";import me from"../../rest/support/AttachmentQuery.js";import de from"../../symbols/SimpleLineSymbol.js";import ge from"../../views/draw/Draw.js";import{scale as ye}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as fe}from"../../views/input/InputManager.js";import ve from"../PanoramicViewer.js";import{invalidCameraHeading as we,sectorsInOrder as be,sectorsRadii as Fe}from"./constants.js";import{configureSketchTool as _e,isValidDigitizationLayer as Pe,extractFieldsFromDigitizationLayer as Se}from"./digitizationUtils.js";import{formatPixels as Ie,heightMeasurement2D as Me,calculateHeightAccuracy as ke,pixelAreaMeasurement2D as Ce,pixelAreaMeasurementPanoramic as Ae,pixelDistanceMeasurement2D as Ve,pixelDistanceMeasurementPanoramic as Re,generateCombinations as Ge,generateCombinationsPanoramic as Oe,calculateTempImagePoint as je,calculateAngle as ze,calculateCorrectedPixel as Le,calculateHeightFromTemporaryDistance as xe}from"./imageMeasurementUtils.js";import{crossSymbol as Be,crossSymbol3D as Ee,measurementPolygonSymbol as He,measurementPolylineSymbol as De,sourcePointSymbol as Te,digitizationSymbol as Ue,diamondSymbol as Ne,diamondSymbol3D as We,activeSourcePointSymbol as qe}from"./symbols.js";import{isNoAttachmentError as $e,getContentType as Je,isTifOrMrf as Ze,filterOILLayerView as Ke,isSceneView as Qe,isGraphic as Xe,calculateSegment as Ye,calculateDirection as et}from"./utils.js";import tt from"./components/ImageViewer.js";const it={click:"view-click",imageClick:"image-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles",sketchHandles:"sketch-handles"},at=new Set(["JPG","JPEG"]),rt=/\.(\w+)$/,st=e=>"FA"===e,ot=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let nt=class extends(l.EventedMixin(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.collectionId=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:a,selectedPoint:r,view:s}=this;if(s?.closePopup(),a&&r){this._initialCurrentCoverageUpdate=!0;try{await this._updatePointsAndPolygons(i),await this._loadImage(i)}catch(o){y(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.digitizationLayer=null,this.features=new s,this.groundCoordinates=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.draw=null,this.sketchAdapter=null,this.updateFootprint=async(e,t)=>{"image-loaded"===this.state&&await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new tt,this._initialCurrentCoverageUpdate=!0,this._overlays=new H({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new ve,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._updatingHandles=new A,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find((({attributes:{imageID:t}})=>t===Number(e)));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDigitizationAdapter=async e=>{const{sketchAdapter:t}=this;if(await this.loadSketch(e),"digitization"===t?.type)return t;const i=import("./adapters/sketch/DigitizationAdapter.js"),{default:a}=await i;return f(e),this.sketchAdapter=new a({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.loadImageViewer=e=>{this._imageViewer.container=e},this.loadPanoramicViewer=e=>{this._panoramicViewer.container=e},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.toggleImageAttributes=()=>{m(this._openPopupTask),this._openPopupTask=r((async e=>{const{currentBestFeature:i,popupEnabled:a,layer:r,view:s}=this;if(s?.closePopup(),!(s&&i&&a&&r))return;const{attributes:o,geometry:n}=i,l=new t({geometry:n,attributes:o.toJSON(),layer:r});f(e),await s.openPopup({features:[l],location:o.location.clone()})}))},this._createViewClickHandle=()=>{if(this.removeHandles(it.click),"disabled"===this.state||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,fe.WIDGET),it.click)},this._createImageClickHandle=()=>{this.removeHandles(it.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:i,currentBestFeature:a,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&a))return;i.clickAction="pixel-location";let n=null;const l=b((()=>i),"pixel-location",(e=>{this.plotReferencePointOnImage(e),n?.abort(),n=r((async i=>{if(!e)return;const r=await this.getMapPoint(e,{feature:a,imageSize:o,mode:t}).then((e=>{const t=this.view?.spatialReference;return ce(!t,e.spatialReference.equals(t))?e:z(e,t)}));f(i),this.plotReferencePointOnGround(r)}))}));this.addHandles(l,it.imageClick)},this._createImageLocationHandle=()=>{this.removeHandles(it.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:i,currentBestFeature:a,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&a))return;i.clickAction="pixel-location";let n=null;const l=b((()=>i),"pixel-location",(e=>{this.pixelCoordinates=e,n?.abort(),n=r((async i=>{if(!e)return;let r=await this.getMapPoint(e,{feature:a,imageSize:o,mode:t});f(i);const s=this.view?.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await z(r,s),f(i)),this.groundCoordinates=r}))}));this.addHandles(l,it.imageClick)},this._getImageSourceFromAttachment=async(e,t,i)=>{const a=new me({objectIds:[t]}),r=await e.queryAttachments(a,i),s=r[`${t}`]?.[0],o=s?.url;if(!o)throw new n("NoAttachmentError","no attachments found",{[e.objectIdField]:t,layer:e});return{datasetFormat:s.contentType.split("/")[1].toUpperCase(),url:o}},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:a}=this;if(this.clearGraphics(),!i||!t||"none"===a)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:h,cameraOrientation:p,location:m}=r,d=(l??0)+(o??0),g=m.spatialReference.isWGS84&&4!==p?.type?E(m):new G(m);let v=s;if(st(s))try{v=await this._getImageSourceFromAttachment(i,h,e)}catch(w){if(y(w))return;return $e(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${i.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[i.objectIdField]:h,layer:i}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${i.objectIdField} ${h}`))}try{await this.loadImageFromSource(v,{imageRotation:d,options:e,pitch:c,yaw:n,mode:a,cameraLocation:g}),f(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:i,imageRotation:a,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:l}=new URL(o);let c=s?n.match(rt)?.[1]:e.datasetFormat;if(!c){const e=await Je(o,{...t.options});c=e?.split("/")[1]??"UNKNOWN FORMAT"}switch(i){case"default":this._imageViewer.imageSource={datasetFormat:c.toUpperCase(),url:o.split("?")[0]},this._imageViewer.customParameters=Object.fromEntries(l),this._imageViewer.imageRotation=a??0,await this._imageViewer.loadImage(r);break;case"panoramic":if(at.has(c.toUpperCase())){const{selectedPoint:e}=this,{pitch:i,yaw:a,cameraLocation:s,viewAngle:n}=t;this._panoramicViewer.imageSource=o;let l=a??0;"number"==typeof n?l=n-l:s&&e&&(l=await Y(s,e)-l),this._panoramicViewer.pitch=i??0,this._panoramicViewer.yaw=l,await this._panoramicViewer.loadImage(r)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:c});break}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");f(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");f(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{e.stopPropagation(),e.preventDefault(),e.mapPoint&&this.plotMapPoint(e.mapPoint)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=r((async t=>{const{pointerType:i,button:a,mapPoint:r}=e;if(("mouse"!==i||0===a)&&r)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))}))},this.plotSelectedPointOnImage=async(e,i)=>{if(await v(i),!e)return;const a=new G({...c.isSerializable(e)?e.toJSON():e});if("default"===this.mode)a.x-=.5,a.y=.5-a.y,a.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:a,symbol:Be}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:i}=this._panoramicViewer;if(!i)return;const[a,r]=i,{heading:s,pitch:o}=ee(e,a,r),n=le(s,o);this._crossSymbol=new t({geometry:new G(n,L.WebMercator),symbol:Ee}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this),this.selectBestFeature=this.selectBestFeature.bind(this)}initialize(){this.addHandles([F((()=>this.view),(()=>{this.load()}),_),F((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),P),F((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),P),F((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),_),F((()=>[this.state,this.imageLocationToolState,this.view]),(()=>{this.imageLocationToolState||this.clearPreviousGroundLocation(),this._createImageLocationHandle()}),_),F((()=>this.measureType),(()=>{this.clearPreviousMeasurements()}),_),F((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),_),F((()=>this.currentBestFeature),(async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=r((async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}]))),await this._featureChangedTask.promise}),{sync:!0}),F((()=>this.mode),(e=>{switch(this.removeHandles(it.interactionHandles),e){case"default":this.addHandles(F((()=>this._imageViewer.imagePointsInView),(e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=r((async t=>{await this.updateFootprint(e,{signal:t})})))}),{..._,equals:(e,t)=>a(e,t,h)}),it.interactionHandles);break;case"panoramic":this.addHandles(F((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:i,vfov:a,hfov:r,pitch:s,yaw:o}=this._panoramicViewer;return e&&i&&"image-loading"!==t?[a,r,o,s]:null}),(e=>{if(!e||"image-loading"===this.state)return;const[t,i,a,s]=e;m(this._updateFootprintTask),this._updateFootprintTask=r((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:a,pitch:s},{signal:e})}))}),{..._,equals:(e,t)=>a(e,t,h)}),it.interactionHandles)}}),_),F((()=>[this.brightness,this.contrast,this.sharpness]),(()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:a,sharpness:r}=this;"default"===a&&(e.brightness=t,e.contrast=i,e.sharpness=r)}),_),F((()=>this.activeViewer?.imageRenderer),(()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}))]),this.when().finally((()=>{this.notifyChange("state")}))}destroy(){this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=d(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._crossSymbol=d(this._crossSymbol),this._referencePointOnGround=d(this._referencePointOnGround),this._referencePointOnImage=d(this._referencePointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this._panoramicViewer.destroy()}get activeLayer(){return o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:i}=this;switch(i){case"default":return e;case"panoramic":return t;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every((e=>0===e))??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",p(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",p(e,-10,10))}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){return Ze(this.currentBestFeature?.attributes.imagePath.trim())}get imageLoaded(){return o(u.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===we}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(Ke(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?pe(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const{horizontalFieldOfView:t,isSpherical:i}=e;return 360===t||i?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?be.map((t=>e[t])):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",p(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t}=this;if(t)return"disabled";if(!this.isFulfilled())return"loading";if(this.isRejected())return"error";if(this._updatingHandles.updating)return"image-loading";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map((({attributes:{imagePath:e,objectId:t,cameraRoll:i,imageRotation:a}})=>{const r=e.trim();return Ze(r)?{url:r,objectId:t,rotation:(i??0)+(a??0)}:null})).filter(i)):null}set view(e){this._set("view",e)}get _sketchGraphicsLayer(){const{mode:e}=this;switch(e){case"panoramic":return new H({elevationInfo:{mode:"absolute-height"}});case"default":return new H;case"none":return}}get _overlaysView(){return this.view?.layerViews.find((({layer:e})=>e===this._overlays))}async computeHeight(e,t=!0){const{currentBestFeature:i,activeViewer:a,layer:r}=this,s=a?.imageSize,o=i?.attributes,n=r?.orientationAccuracy;if(!o||!s||!e||e.length<2||!n)return;const l=te(o,s[0],s[1]),c=e.at(0),h=e.at(-1);if(!c||!h||!n)return;const u=[h,c],p=Ie(u,!1),m=await Me(u,l,n,!0,t);if(!m)return;const d=await ke(n,p,l,m,!0);return d?{value:m,accuracy:d}:{value:m}}async calculateAreaMeasurement(e,t,i){if(e.length<3||!this.currentBestFeature||!this.activeViewer?.imageSize||"none"===t)return null;const a="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return f(i),a?"default"===t?await Ce(e,a,!0):await Ae(e,a,!0,i):null}async calculateDistanceMeasurement(e,t,i){const{currentBestFeature:a,activeViewer:r}=this;if(e.length<2||!a||!r?.imageSize||"none"===t)return null;const s="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return f(i),s?"default"===t?await Ve([e.at(0),e.at(-1)],s,!0):await Re([e.at(0),e.at(-1)],s,!0):null}async calculateAccuracy(e,t,i){const{layer:a,currentBestFeature:r,activeViewer:s}=this,o=a?.orientationAccuracy,n=o?.every((e=>0===e))||!o?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!r||!s?.imageSize||n)return null;const l=await this.getMeasurementProperties();if(f(i),!l)return null;const c="area"===t?await Ce(e,l,!0):await Ve([e.at(0),e.at(-1)],l,!0);f(i);const{updateElevationProps:h,...u}=l,p=Ge(u,o);if(!p?.length)return null;const m=p.map((e=>({...e,updateElevationProps:h}))).map((async a=>{const r="area"===t?await Ce(e,a,!0):await Ve([e.at(0),e.at(-1)],a,!0);if(f(i),r&&c){if("area"===t){const e="number"!=typeof r?r.area:null;return e?Math.abs(e-c.area):null}return Math.abs(r-c)}return null})),d=await Promise.all(m);f(i);const g=d.filter((e=>null!==e));if(0===g.length)return null;return Math.max(...g.map((e=>e)))}async calculateAccuracyPanoramic(e,t,i){const{layer:a,currentBestFeature:r,activeViewer:s,mode:o}=this,n=a?.orientationAccuracy,l=n?.every((e=>0===e))||!n?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!r||!s?.imageSize||l||"panoramic"!==o)return null;const c=await this.getMeasurementPropertiesPanoramic();if(f(i),!c)return null;const h="area"===t?await Ae(e,c,!0):await Re([e.at(0),e.at(-1)],c,!0);f(i);const{updateElevationProps:u,...p}=c,m=Oe(p,n);if(!m?.length)return null;const d=m.map((e=>({...e,updateElevationProps:u}))).map((async a=>{const r="area"===t?await Ae(e,a,!0):await Re([e.at(0),e.at(-1)],a,!0);if(f(i),r&&h){if("area"===t){const e="number"!=typeof r?r.area:null;return e?Math.abs(e-h.area):null}return Math.abs(r-h)}return null})),g=await Promise.all(d);f(i);const y=g.filter((e=>null!==e));if(0===y.length)return null;return Math.max(...y.map((e=>e)))}async calculateHeightMeasurementInfo(e,t){const{currentBestFeature:i,activeViewer:a}=this,r=a?.imageSize;if(!i||!a||!r?.length)return;const{attributes:s}=i,[o]=Ie([e],!0),n=te(s,r[0],r[1]),l=await je(o,n,t);if(!l)return;const c=ze(o,l),h=C([o.x,o.y],[l.x,l.y]);return c&&h?{measurementAngle:c,tempDistance:h}:void 0}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.pixelCoordinates=null}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null)}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:i,digitizationLayer:a}=this;if(!i)throw ot();_e(a,e,i),await i.create(e,{...t,defaultZ:0})}async digitizeDelete(){if(!this.sketch)throw ot();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw ot();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw ot();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw ot();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw ot();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw ot();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:i}=this,a=t?.imageSize,r=e?.attributes;if(!r||!a)return;const s=await this.computeHeight(i);s?.value&&s?.accuracy&&(this.heightMeasurementResult=s.value,this.heightMeasurementAccuracy=s.accuracy)}filterByFootprints(e,t){const i=[],a=[],r=[];return e.forEach((e=>{const{layer:{coveragePercent:s},attributes:o}=e;let n;const l=I(e.geometry.spatialReference);o.cameraHeight/=l,o.farDistance/=l,o.nearDistance/=l,$(o.elevationSource)&&(o.elevationSource.constantElevation/=l);const{polygon:c,frustum:h}=U(o);if(n=c.clone(),o.isInspection&&(n=N(o)),s&&(n=W(n,s)),q(n,t)){r.push(e);const{geometry:t,objectId:s,cameraHeight:n,cameraHeading:l}=o,u=t.clone();u.z=n,u.imageID=s,this.pointSources.push(u),l!==we&&(i.push(c),h&&a.push(h))}})),{features:r,polygons:i,frustums:a}}getMeasurementProperties(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:i,attributes:a}=e,{elevationSource:r,cameraHeight:s}=a,o=te(a,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?z(n,L.WebMercator):Promise.resolve(n)).then((e=>(n=e,ie((n.z??0)-s,{elevationSample:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&ae(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}getMeasurementPropertiesPanoramic(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:i,attributes:a}=e,{elevationSource:r,cameraHeight:s}=a,o=re(a,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?z(n,L.WebMercator):Promise.resolve(n)).then((e=>(n=e,ie((n.z??0)-s,{elevationSample:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&ae(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}async deleteDigitizedFeatures(e){const{digitizationLayer:t}=this;if(!t)throw new n("Digitization layer is not available");return t.queryFeatures({objectIds:e}).then((({features:e})=>t.applyEdits({deleteFeatures:e})))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[be[e]];t?.length&&this._updateCurrentBestFeature(t.at(0))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const a=this._sectorData?.[t];a?.length&&this._updateCurrentBestFeature(a.at(i))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:i,heightMeasurementPixels:a}=this;if(!e.vertices)return;const r=e.vertices.at(-1);if(a.length<1||!r||!i||!t)return;const s=Le(a[0],r,t);if(!s?.length)return;this.heightMeasurementPixels.push(s),this.createPolylineGraphic();const o=xe(this.heightMeasurementPixels,i);o&&(this.heightMeasurementResult=o)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:i,activeViewer:a,heightMeasurementPixels:r}=this;if(!i||!a||!e.vertices?.length)return;const s=a?.imageSize;if(!r.length&&s){const i=e.vertices.at(-1);this.heightMeasurementPixels.push(i);const a=await this.calculateHeightMeasurementInfo(i,t);if(!a?.measurementAngle||!a?.tempDistance)return;this.measurementAngle=a.measurementAngle,this.tempDistance=a.tempDistance}}async load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch((e=>{if(!y(e))throw e}))),this}async loadBestImage(e,t){return this.view?.closePopup(),this.displayMessage=null,this.clearPreviousGroundLocation(),this.imageLocationToolState=!1,this.selectedPoint=e.spatialReference.isGeographic?E(e):e.clone(),this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._overlays?.removeAll(),this._fetchFeaturesWithController(e,t)}loadImageError(e){u.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:i}=await t;f(e),this.sketch=new i({layer:this._sketchGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(f(e),this.sketchAdapter=new i({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async startMeasurement(e,t){await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:a,activeViewer:r,mode:s}=this;if(!i||!a||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===s){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=He(o),this.sketch.polylineSymbol=De(o))}startHeightMeasurement(){this.heightMeasurementPixels=[],this.displayNewMeasurementButton=!1,this.draw??=new ge({view:this.activeViewer?.imageRenderer});this.draw.create("polyline").on(["cursor-update","vertex-add","draw-complete"],(e=>this.handleDrawEvents(e)))}createPolylineGraphic(){const e=[this.heightMeasurementPixels[0],this.heightMeasurementPixels.at(-1)],i=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[e],spatialReference:i});else{const a=new j({paths:[e],spatialReference:i}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:a,symbol:De(r,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}async handleDrawEvents(e,t){if(this.draw)switch(e.type){case"cursor-update":this.handleDrawCursorUpdateEvents(e);break;case"vertex-add":this.handleDrawVertexAddEvents(e,t);break;case"draw-complete":await this.displayHeightResults()}}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:i,currentBestFeature:a,overlayedCameraLocations:r,layer:s,mode:o,state:n}=this,l=i?.imageSize;if(!l||!a||!s||"none"===o||n.includes("loading"))return;const{polygon:c}=U(a.attributes);if(i.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await s.queryFeatures({where:`${s.objectIdField} <> ${a.attributes.objectId}`,geometry:c,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map((async e=>{const{attributes:i,geometry:r}=e,s=await this.getPixels(r,{feature:a,imageSize:l,mode:o}),n=Te.clone();return n.outline=new de({color:[0,0,0],width:1}),new t({attributes:i,symbol:n,geometry:s})})));r.addMany(n),i.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,a=!1){const{activeViewer:r,currentBestFeature:o,mode:n,state:l}=this,c=r?.imageSize;if(!c||!o||"none"===n||l.includes("loading"))return;const{polygon:h}=U(o.attributes),p=Pe(e);try{const{imageGeometryField:t,oiObjectIdField:i}=Se(e);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:m}=await e.queryFeatures({geometry:h,returnGeometry:!0,outFields:["*"]}),d=new s((await Promise.all(m.map((async i=>{const r=i.symbol?.clone()??e.renderer?.getSymbol(i)?.clone(),{attributes:s,geometry:l}=i;let h=l;if(p&&this.imageGeometryField&&this.oiObjectIdField){if(s[this.oiObjectIdField]===`${o.attributes.objectId}`)return h=B(JSON.parse(atob(s[this.imageGeometryField]))),new t({attributes:s,layer:e,symbol:h.type===e.geometryType?r:Ue(h.type)?.()??null,geometry:h,visible:e.visible&&a})}switch(h?.type){case"point":{const i=await this.getPixels(h,{feature:o,imageSize:c,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:i,visible:e.visible&&a})}case"polygon":{const{rings:i,spatialReference:l}=h,u=i.map((e=>e.map((([e,t,i])=>new G({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(u.map((async e=>this.getPixels(e,{feature:o,imageSize:c,mode:n}).then((e=>e.map(se))))));return new t({attributes:s,layer:e,symbol:r,geometry:new O({rings:p,spatialReference:L.WebMercator}),visible:e.visible&&a})}case"polyline":{const{paths:i,spatialReference:l}=h,u=i.map((e=>e.map((([e,t,i])=>new G({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(u.map((async e=>this.getPixels(e,{feature:o,imageSize:c,mode:n}).then((e=>e.map(se))))));return new t({attributes:s,layer:e,symbol:r,geometry:new j({paths:p,spatialReference:L.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:l}=h,u=i.map((([e,t,i])=>new G({x:e,y:t,z:i,spatialReference:l}))),p=await this.getPixels(u,{feature:o,imageSize:c,mode:n}).then((e=>e.map(se)));return new t({attributes:s,layer:e,symbol:r,geometry:new R({points:p,spatialReference:L.WebMercator}),visible:e.visible&&a})}}return null})))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,d)}async getPixels(e,t){const{imageSize:i,mode:a}=t,r=(await this.worldToImage(Array.isArray(e)?e:[e])).map((e=>{if("default"===a)return new G({x:e.x-.5,y:.5-e.y,spatialReference:L.WebMercator});const[t,r]=i,{heading:s,pitch:o}=ee(e,t,r),n=le(s,o);return new G(n,L.WebMercator)}));return Array.isArray(e)?r:r[0]}async getMapPoint(e,t){const{feature:i,mode:a,imageSize:r}=t,{elevationSample:s,attributes:o}=i,{elevationSource:n,location:l,elevation:c,cameraHeight:h}=o;let u=l.clone();u.spatialReference.isGeographic&&(u=await z(u,L.WebMercator));const p=await ie(c??(l.z??0)-h,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let m;if("elevationSample"in p&&ae(p.elevationSample)&&(i.elevationSample=p.elevationSample),"default"===a){const t=te(o,r[0],r[1]);m=await Z(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}else{const t=re(o,r[0],r[1]);m=await K(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}return Array.isArray(e)?m:m[0]}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new G({...e.toJSON()}),symbol:Ne}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const i=c.isSerializable(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._referencePointOnImage=new t({geometry:new G({spatialReference:this._imageViewer.imageRenderer.spatialReference.clone(),...i}),symbol:Ne}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:i}=this._panoramicViewer;if(!i)return;const[a,r]=i,{heading:s,pitch:o}=ee(e,a,r),n=le(s,o);this._referencePointOnImage=new t({geometry:new G(n,L.WebMercator),symbol:We}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach((e=>{this._imageViewer.removeManyGraphics(e.toArray())})),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementPixels=[],this.heightMeasurementResult=0,this.tempDistance=null,this.measurementAngle=null,this.heightMeasurementAccuracy=0,this.heightGraphic=null}async saveDrawing(){const{digitizationLayer:e,sketchAdapter:t}=this;if(!e||"digitization"!==t?.type)return;const{pendingGraphics:i,savedGraphics:a}=t,r=i.get(e.id),s=r?.toArray();if(!r||!s?.length)return;const{addFeatureResults:o}=await this.saveDigitizedFeatures(s),n=o.reduce(((t,{objectId:i,globalId:a,error:r},o)=>{const n=s[o],{attributes:l}=n;return r?t.error.push(n):(i&&(l[e.objectIdField]=i),a&&e.globalIdField&&(l[e.globalIdField]=a),t.success.push(n)),t}),{success:[],error:[]});a.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDigitizedFeatures(e){const{activeViewer:t,currentBestFeature:a,digitizationLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!a||"none"===s)throw new n("Image size, current best feature and mode are required to save digitized features");if(!r)throw new n("Digitization layer is not available");const l=await Promise.all(e.map((async e=>{const t=e.clone(),{geometry:i}=t;if(!i)return;const n=i.type,l=r.hasZ,c=r.geometryType,h=n!==c,u=h?await import("./transformers.js"):null,p=u?.default[c],m=h?p?.(i):i;if(m)switch(m.type){case"point":return t.geometry=await this.getMapPoint(oe(s,m,o),{feature:a,imageSize:o,mode:s}),l||(delete t.geometry.z,t.geometry.hasZ=!1),t.geometry.hasM=!1,t;case"polygon":{const e=await Promise.all(m.rings.map((async e=>this.getMapPoint(e.map((([e,t,i])=>oe(s,{x:e,y:t,z:i},o))),{feature:a,imageSize:o,mode:s}))));return t.geometry=new O({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,rings:e.map((e=>e.map(se)))}),t}case"polyline":{const e=await Promise.all(m.paths.map((async e=>this.getMapPoint(e.map((([e,t,i])=>oe(s,{x:e,y:t,z:i},o))),{feature:a,imageSize:o,mode:s}))));return t.geometry=new j({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,paths:e.map((e=>e.map(se)))}),t}}}))),c=l.filter(i);return r.applyEdits({addFeatures:c}).then((e=>{const{addFeatureResults:t}=e;let i=0;const a=l.map((e=>{const a=t[i++];return e?a:{error:new n("Error in saving digitized features"),objectId:null,globalId:null}}));return{...e,addFeatureResults:a}}))}async searchBestImage(e,t){try{const i=await D(e,t);i&&await this._processFeatureResponse(i,e.point,{signal:t?.signal})}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),u.getLogger(this).error("error occurred while finding best image",i))}}selectBestFeature(e){this.currentBestFeature=this.features?.find((({attributes:t})=>t.objectId===Number(e)))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach((t=>{t.visible=e}))}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach((t=>{t.visible=e}))}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}async startDigitization(e,t){const i=this.activeViewer?.imageRenderer;if(!i)return;const a=this.overlayedMapFeatures.get(e.id)?.toArray()??[];this.removeOverlayedGraphicsOnImage(e.id),this.collectionId=e.id,await this.loadSketch(t),await this.loadDigitizationAdapter(t),f(t),this.sketchGraphicsLayer?.addMany(a),this.sketchAdapter?.savedGraphics.addMany(a);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}stopDigitization(e){this.sketch?.cancel();const t=this.sketchAdapter?.savedGraphics;this.sketchGraphicsLayer?.removeAll();const i=this.activeViewer?.imageRenderer;if(!t||!i)return;this.overlayGraphicsOnImage(e,t);i.ui.find("zoom").visible=!0,i.map.layers.remove(this.sketchGraphicsLayer)}stopMeasurement(){this.heightMeasurementPixels=[],this.draw?.reset(),this.sketch?.cancel()}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach((t=>{this._toggleVisiblity(t,e)}))}toggleOverlayMapFeatures(e,t){const i=this.overlayedMapFeatures.get(e);i&&this._toggleVisiblity(i,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{selectedLocation:t,options:i}=e;let a=!1,r=!1;const s=this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=t.spatialReference.equals(s.spatialReference)?t:await z(t,s.spatialReference);a=s.contains(e);break}case"mesh":{const e=t.spatialReference.equals(s.spatialReference)?t:await z(t,s.spatialReference);r=s.extent.contains(e);break}}if(!a&&!r)return void this.clearReferencePointOnImage();const o=await this.worldToImage(t,i);if(o)return f(i),this.plotReferencePointOnImage(o),{x:o.x,y:o.y};this.clearReferencePointOnImage()}updateSuitabilities(e){e.sort(((e,t)=>e.suitability-t.suitability)),this._suitabilities=e;const t=this._suitabilities.map((({feature:e})=>e));this._initialCurrentCoverageUpdate=!0,this._updateFeatures(t),this._groupFeaturesBySectors()}async _fetchFeatures(e,t){if(!this.view)return;const i=this.layer;if(i){const a={include:i},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,a);return this._processHitTestResults(i,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,currentBestFeature:i,features:a,invalidCameraHeading:r}=this;if(!e||!t||!i||!a||r)return void(this._sectorData=null);this._sectorData={};for(const c of be)this._sectorData[c]=new s;const o=e.map(((e,t)=>({...e,featureIndex:t})));o.sort(((e,t)=>e.trueSuitability-t.trueSuitability));const n=o.map((({distance:e})=>e)),l=Math.max(...n);o.forEach((e=>{const{distance:t,angle:i,featureIndex:r}=e,s=t/l*Fe[2],o=Ye(t,l),n=et(i);if(!this._sectorData)return;const c=Fe[3]+s*Math.sin(i*Math.PI/180),h=Fe[3]+s*Math.cos(i*Math.PI/180);let u;const p=a.at(r),m=p===this.currentBestFeature,d=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;if(m&&d)u=-90;else{const e=c-Fe[3],t=h-Fe[3],i=t/Math.sqrt(e**2+t**2);let a=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(a*=-1),u=a}const g=""===o?n:`${o}_${n}`;m&&(u===this.bestFeatureAngle?this.previousFeatureAngle=u:this.bestFeatureAngle=u,this.navigatorCurrentBestFeature=d?null:{x:c,y:h,direction:n});const y=this._sectorData[g];y.add({angle:i,featureIndex:r,x:c,y:h,objectID:p.attributes.objectId,sector:g,featureIndexInSector:y.length})}))}async _processFeatureResponse(e,t,i){const{features:a}=e;if(!a?.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll();const{features:r,polygons:s,frustums:o}=this.filterByFootprints(a,t);if(!r.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);let n;if(this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o),s[0]){let e=new O({spatialReference:s[0].spatialReference});for(const i of s)e=await V(e,i);const t=[];for(const{geometry:i}of r)e.contains(i)||t.push([i.x,i.y]);if(t.sort(((e,t)=>+x([e,t]))),e.addRing(t),this.footprintExtent=ye(e.extent,2,2),this.view?.supportsGround)try{n=await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(l){y(l)||u.getLogger(this).error(l)}}if((n||r[0].attributes.elevationSource)&&this.footprintExtent){const e=r[0].attributes.elevationSource;J(e)&&!n&&(n=await X({extent:this.footprintExtent,lod:e.lod,url:e.url,rasterFunction:e.rasterFunction}));const i=await ie((r[0].attributes.location.z??0)-r[0].attributes.cameraHeight,{elevationSample:n,elevationSource:e,extent:this.footprintExtent}),[a,...s]=await Q([t,...r.map((e=>e.attributes.geometry.clone()))],i);r[0].elevationSample=n??i.elevationSample,t.elevation=a.z,r.forEach(((e,t)=>{e.attributes.elevation=s[t].z}))}r[0].elevationSample&&r.forEach((e=>{e.elevationSample=r[0].elevationSample})),this._suitabilities=T({features:r,selectedPoint:t,camera:Qe(this.view)?this.view.camera:null,currentImage:this.currentBestFeature}),this.updateSuitabilities(this._suitabilities)}async _processHitTestResults(e,t,i){const{screenPoint:a,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(a);if(!o)return;const{layerFloorFilterClause:n}=this,l=e.spatialReference.equals(o.spatialReference)?o:await z(o,e.spatialReference),c=S("1=1",S(e.definitionExpression,n)),h=l.spatialReference.isGeographic?1:I(l.spatialReference),u={layerInstanceOrURL:e,point:l,queryParams:{where:c,maximumDistance:e.maximumDistance?e.maximumDistance/h:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(u,i)}_toggleVisiblity(e,t){e.forEach((e=>{e.visible=t}))}_updateFeatures(e){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this.currentBestFeature=e[0]}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:a,currentCoverageVisible:r,isAdditionalPointSourcesVisible:s}=this;if(a&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),f(e);for(const e of i)e.imageID===a.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e,symbol:qe,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e,symbol:Te,visible:s}))}}_updateCurrentBestFeature(e){if(!e)return;this.currentBestFeature=this.features?.at(e.featureIndex);const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let i;if(t)i=-90;else{const t=e.x-Fe[3],a=e.y-Fe[3],r=a/Math.sqrt(t**2+a**2);let s=180*Math.acos(r)/Math.PI;(t<0&&a<0||t<0&&a>0)&&(s*=-1),i=s}i===this.bestFeatureAngle?this.previousFeatureAngle=i:this.bestFeatureAngle=i,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=d(this._referencePointOnImage))}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}setMessage(e,t,i,a){this.displayMessage={key:e,type:t,data:i,map:a}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:i,selectedPoint:a,state:r}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=d(this._crossSymbol)),!a||!t||"image-loaded"!==r||i)return;let s;try{s=await this.worldToImage(a,e),f(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:a,feature:t})}}async worldToImage(e,t){const{footprintExtent:i}=this,{imageSize:a}=this.activeViewer;if("none"===this.mode||!this.currentBestFeature||!a||!i)return;const{attributes:{location:r,elevationSource:s,cameraHeading:o,elevation:n,cameraHeight:l},elevationSample:c}=this.currentBestFeature;let h=r.clone();const u=await ie(n??(r.z??0)-l,{elevationSample:c,elevationSource:s});this.currentBestFeature.elevationSample=u.elevationSample;const p=Array.isArray(e)?e:[e];let m,d=await Promise.all(p.map((e=>new Promise((t=>{if(!e.hasZ)return t(Q(e,u));t(e)})))));if(r.spatialReference.isGeographic&&(h=await z(h,L.WebMercator,t)),d=await Promise.all(d.map((async e=>h.spatialReference.equals(e.spatialReference)?e:await z(e,h.spatialReference,t)))),f(t),"panoramic"===this.mode)m=he(d,{imageHeight:a[1],imageWidth:a[0],cameraHeading:o,cameraLocation:h});else{const e=ne(this.currentBestFeature.attributes,a[0],a[1]);m=ue(d,{...e,cameraLocation:h})}return Array.isArray(e)?m:m[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:a,currentBestFeature:r,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:l,_adapter:c}=this,{attributes:{objectId:h},elevationSample:u}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...a,this.bestFeatureCurrentFootprint,s].filter(Xe);l.supportsGround&&u&&c?.updateGroundElevation&&c.updateGroundElevation(e,u),n&&e.push(new t({geometry:n.clone(),symbol:Be.clone(),attributes:{imageID:h}})),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,l?.supportsGround&&u&&c?.updateGroundElevation&&c.updateGroundElevation([e],u),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([M()],nt.prototype,"activeLayer",null),e([M({readOnly:!0})],nt.prototype,"activeViewer",null),e([M()],nt.prototype,"accuracyParametersMissing",null),e([M()],nt.prototype,"additionalFeatures",void 0),e([M({type:s.ofType(t)})],nt.prototype,"additionalCameraLocations",void 0),e([M({type:s.ofType(t)})],nt.prototype,"additionalFootprints",void 0),e([M()],nt.prototype,"areaMeasurementResult",void 0),e([M()],nt.prototype,"areaMeasurementAccuracy",void 0),e([M()],nt.prototype,"bestFeatureAngle",void 0),e([M()],nt.prototype,"bestFeatureCurrentFootprint",void 0),e([M({type:t})],nt.prototype,"bestFeatureFootprint",void 0),e([M({type:Number})],nt.prototype,"brightness",null),e([M()],nt.prototype,"collectionId",void 0),e([M({type:Number})],nt.prototype,"contrast",null),e([M()],nt.prototype,"conversionProps",void 0),e([M()],nt.prototype,"coverageFrustums",void 0),e([M()],nt.prototype,"coveragePolygons",void 0),e([M()],nt.prototype,"currentBestFeature",void 0),e([M()],nt.prototype,"currentBestFeatureLocation",void 0),e([M()],nt.prototype,"currentCoverageVisible",void 0),e([M({json:{write:!1}})],nt.prototype,"determineWorkflowForFeature",void 0),e([M()],nt.prototype,"disabled",void 0),e([M()],nt.prototype,"displayMessage",void 0),e([M()],nt.prototype,"displayNewMeasurementButton",void 0),e([M()],nt.prototype,"distanceMeasurementResult",void 0),e([M()],nt.prototype,"distanceAccuracyArray",void 0),e([M()],nt.prototype,"digitizationLayer",void 0),e([M({readOnly:!0})],nt.prototype,"featureCount",null),e([M()],nt.prototype,"features",void 0),e([M()],nt.prototype,"groundCoordinates",void 0),e([M()],nt.prototype,"heightMeasurementPixels",void 0),e([M()],nt.prototype,"heightGraphic",void 0),e([M()],nt.prototype,"heightMeasurementResult",void 0),e([M()],nt.prototype,"heightMeasurementAccuracy",void 0),e([M()],nt.prototype,"measurementAngle",void 0),e([M()],nt.prototype,"tempDistance",void 0),e([M({readOnly:!0})],nt.prototype,"imageGalleryEnabled",null),e([M()],nt.prototype,"imageGeometryField",void 0),e([M({readOnly:!0})],nt.prototype,"imageLoaded",null),e([M()],nt.prototype,"imageLocationToolState",void 0),e([M({readOnly:!0})],nt.prototype,"invalidCameraHeading",null),e([M()],nt.prototype,"imagePointsInView",null),e([M()],nt.prototype,"isAdditionalCoverageVisible",void 0),e([M()],nt.prototype,"isAdditionalPointSourcesVisible",void 0),e([M()],nt.prototype,"layer",void 0),e([M()],nt.prototype,"layerView",null),e([M({readOnly:!0})],nt.prototype,"layerFloorFilterClause",null),e([M({type:Number})],nt.prototype,"localPort",void 0),e([M()],nt.prototype,"mapImageConversionToolState",void 0),e([M()],nt.prototype,"measureType",void 0),e([M()],nt.prototype,"measurementGraphic",void 0),e([M({readOnly:!0,value:"none"})],nt.prototype,"mode",null),e([M()],nt.prototype,"navigatorCurrentBestFeature",void 0),e([M()],nt.prototype,"oiObjectIdField",void 0),e([M({type:s.ofType(t)})],nt.prototype,"overlayedCameraLocations",void 0),e([M()],nt.prototype,"overlayedMapFeatures",void 0),e([M()],nt.prototype,"pixelCoordinates",void 0),e([M()],nt.prototype,"pointSources",void 0),e([M({readOnly:!0})],nt.prototype,"popupEnabled",null),e([M()],nt.prototype,"previousFeatureAngle",void 0),e([M()],nt.prototype,"referencePoint",null),e([M({readOnly:!0})],nt.prototype,"sectorData",null),e([M()],nt.prototype,"selectedPoint",void 0),e([M({type:Number})],nt.prototype,"sharpness",null),e([M()],nt.prototype,"shouldShowSelectedImage",void 0),e([M()],nt.prototype,"sketch",void 0),e([M()],nt.prototype,"draw",void 0),e([M()],nt.prototype,"sketchAdapter",void 0),e([M({readOnly:!0})],nt.prototype,"sketchGraphicsLayer",null),e([M({readOnly:!0})],nt.prototype,"state",null),e([M({readOnly:!0})],nt.prototype,"thumbnails",null),e([M()],nt.prototype,"updateFootprint",void 0),e([M()],nt.prototype,"updateFootprintPanorama",void 0),e([M({value:null})],nt.prototype,"view",null),e([M()],nt.prototype,"_adapter",void 0),e([M()],nt.prototype,"_sketchGraphicsLayer",null),e([M()],nt.prototype,"_highlightedFeatureHandle",void 0),e([M()],nt.prototype,"_imageViewer",void 0),e([M()],nt.prototype,"_initialCurrentCoverageUpdate",void 0),e([M()],nt.prototype,"_overlays",void 0),e([M({readOnly:!0})],nt.prototype,"_overlaysView",null),e([M()],nt.prototype,"_panoramicViewer",void 0),e([M()],nt.prototype,"_referencePointOnGround",void 0),e([M()],nt.prototype,"_referencePointOnImage",void 0),e([M()],nt.prototype,"_sectorData",void 0),e([M({readOnly:!0})],nt.prototype,"_updatingHandles",void 0),e([M()],nt.prototype,"footprintExtent",void 0),nt=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],nt);const lt=nt;export{lt as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{createTask as t}from"../../../../core/asyncUtils.js";import a from"../../../../core/Promise.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../geometry/Point.js";import{load as n}from"../../../../geometry/projection.js";import{convertSphereVertexToPixelLocation as c}from"../../../../layers/orientedImagery/transformations/utils.js";import{SketchHandlerMixin as l}from"../../mixins/SketchHandlerMixin.js";let u=[],h=[],m=0,d=class extends(l(a)){constructor(e){super(e),this.type="measurement",this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(n())}async handleCreate(e){const t=e.toolEventInfo;switch(e.tool){case"polyline":this.handlePolylineEvents(e,t);break;case"polygon":this.handlePolygonEvents(e,t)}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}cursorUpdatePolylineHandler(e){const{mode:t,activeViewer:a,view:s}=this.viewModel;if("none"===t||!a?.imageSize||!s?.spatialReference)return;if("default"===t)this.measurementArray.push(e.coordinates);else{const t=c(new o(e.coordinates[0],e.coordinates[1],e.coordinates[2],s.spatialReference),a.imageSize[0],a.imageSize[1]);this.measurementArray.push([t.x,t.y])}const i=h.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=i}async cursorUpdatePolygonHandler(e){const{mode:t,activeViewer:a,view:s}=this.viewModel;if(!t||!a?.imageSize||!s?.spatialReference)return;const i=e.coordinates;if(u=[...this.polygonVertices],"default"===t)u.push(i);else{const e=c(new o(i[0],i[1],i[2],this.viewModel.view?.spatialReference),a?.imageSize[0],a?.imageSize[1]);u.push([e.x,e.y])}if(u.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const r=u[0];u=u.filter(((e,t)=>0===t||t===u.length-1||JSON.stringify(e)!==JSON.stringify(r)));const n=await this._getAreaFromTask(u);n?.area&&n?.perimeter&&(m=n.area)}async handlePolylineEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[],void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic)return this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.measurementGraphic=e.graphic,void this.resetDistanceMeasurements();switch(t?.type){case"cursor-update":this.cursorUpdatePolylineHandler(t);break;case"vertex-add":if(this.measurementArray.length&&a){const e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}const s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0,void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic)return this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.measurementGraphic=e.graphic,void this.resetAreaMeasurements();switch(t?.type){case"vertex-add":await this.vertexAddPolygonHandler(t,a);break;case"cursor-update":await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=m>0?m:this.pixelAreaMeasurement}async vertexAddPolygonHandler(e,t){const{mode:a,activeViewer:s}=this.viewModel,i=e.added,r=i[i.length-1];if(!Array.isArray(r)||!a||!s?.imageSize)return;if("default"===a)this.polygonVertices.push(r);else{const e=c(new o(r[0],r[1],r[2],this.viewModel.view?.spatialReference),s?.imageSize[0],s?.imageSize[1]);this.polygonVertices.push([e.x,e.y])}if(this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;if(t){const e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e&&e>this.viewModel.areaMeasurementAccuracy?e:this.viewModel.areaMeasurementAccuracy}const n=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter(((e,t)=>0===t||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(n)));const l=await this._getAreaFromTask(this.polygonVertices);if(!l?.area||!l?.perimeter)return;const{area:u}=l;this.pixelAreaMeasurement=u}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);const e=h.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&h.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,h=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,m=0}async _getAreaFromTask(e){const{mode:a}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._areaCalculation=null;const i=await this.viewModel.calculateAreaMeasurement(e,a,t);s(t),this._areaCalculation=i})),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){const{mode:e}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const a=await this.viewModel.calculateDistanceMeasurement(this.measurementArray,e,t);s(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){const{mode:e}=this.viewModel;return e?(this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const a="default"===e?await this.viewModel.calculateAccuracy(this.measurementArray,"distance",t):await this.viewModel.calculateAccuracyPanoramic(this.measurementArray,"distance",t);s(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation):null}async _getAreaAccuracyFromTask(e){const{mode:a}=this.viewModel;return a?(this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const i="default"===a?await this.viewModel.calculateAccuracy(e,"area",t):await this.viewModel.calculateAccuracyPanoramic(e,"area",t);s(t),this._distanceCalculation=i})),await this._calculationTask.promise,this._distanceCalculation):null}};e([i()],d.prototype,"type",void 0),e([i()],d.prototype,"measurementArray",void 0),e([i()],d.prototype,"pixelMeasurement",void 0),e([i()],d.prototype,"pixelAreaMeasurement",void 0),e([i()],d.prototype,"polygonVertices",void 0),d=e([r("esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter")],d);const p=d;export{p as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{createTask as t}from"../../../../core/asyncUtils.js";import a from"../../../../core/Promise.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{load as o}from"../../../../geometry/projection.js";import{convertSphereVertexToPixelLocation as n}from"../../../../layers/orientedImagery/transformations/utils.js";import{SketchHandlerMixin as c}from"../../mixins/SketchHandlerMixin.js";let l=[],u=[],h=0,m=class extends(c(a)){constructor(e){super(e),this.type="measurement",this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(o())}async handleCreate(e){const t=e.toolEventInfo;switch(e.tool){case"polyline":this.handlePolylineEvents(e,t);break;case"polygon":this.handlePolygonEvents(e,t)}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}cursorUpdatePolylineHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;if("default"===t)this.measurementArray.push(e.coordinates);else{const t={x:e.coordinates[0],y:e.coordinates[1],z:e.coordinates[2]},s=n(t,a.imageSize[0],a.imageSize[1]);this.measurementArray.push([s.x,s.y])}const s=u.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=s}async cursorUpdatePolygonHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;const s=e.coordinates;if(l=[...this.polygonVertices],"default"===t)l.push(s);else{const e={x:s[0],y:s[1],z:s[2]},t=n(e,a?.imageSize[0],a?.imageSize[1]);l.push([t.x,t.y])}if(l.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const i=l[0];l=l.filter(((e,t)=>0===t||t===l.length-1||JSON.stringify(e)!==JSON.stringify(i)));const r=await this._getAreaFromTask(l);r?.area&&r?.perimeter&&(h=r.area)}async handlePolylineEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[],void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic)return this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.measurementGraphic=e.graphic,void this.resetDistanceMeasurements();switch(t?.type){case"cursor-update":this.cursorUpdatePolylineHandler(t);break;case"vertex-add":if(this.measurementArray.length&&a){const e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}const s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0,void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic)return this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.measurementGraphic=e.graphic,void this.resetAreaMeasurements();switch(t?.type){case"vertex-add":await this.vertexAddPolygonHandler(t,a);break;case"cursor-update":await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=h>0?h:this.pixelAreaMeasurement}async vertexAddPolygonHandler(e,t){const{mode:a,activeViewer:s}=this.viewModel,i=e.added,r=i[i.length-1];if(!Array.isArray(r)||"none"===a||!s?.imageSize)return;if("default"===a)this.polygonVertices.push(r);else{const e={x:r[0],y:r[1],z:r[2]},t=n(e,s?.imageSize[0],s?.imageSize[1]);this.polygonVertices.push([t.x,t.y])}if(this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;if(t){const e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e&&e>this.viewModel.areaMeasurementAccuracy?e:this.viewModel.areaMeasurementAccuracy}const o=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter(((e,t)=>0===t||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(o)));const c=await this._getAreaFromTask(this.polygonVertices);if(!c?.area||!c?.perimeter)return;const{area:l}=c;this.pixelAreaMeasurement=l}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);const e=u.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&u.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,u=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,h=0}async _getAreaFromTask(e){const{mode:a}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._areaCalculation=null;const i=await this.viewModel.calculateAreaMeasurement(e,a,t);s(t),this._areaCalculation=i})),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){const{mode:e}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const a=await this.viewModel.calculateDistanceMeasurement(this.measurementArray,e,t);s(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){const{mode:e}=this.viewModel;return"none"===e?null:(this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const a="default"===e?await this.viewModel.calculateAccuracy(this.measurementArray,"distance",t):await this.viewModel.calculateAccuracyPanoramic(this.measurementArray,"distance",t);s(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation)}async _getAreaAccuracyFromTask(e){const{mode:a}=this.viewModel;return"none"===a?null:(this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const i="default"===a?await this.viewModel.calculateAccuracy(e,"area",t):await this.viewModel.calculateAccuracyPanoramic(e,"area",t);s(t),this._distanceCalculation=i})),await this._calculationTask.promise,this._distanceCalculation)}};e([i()],m.prototype,"type",void 0),e([i()],m.prototype,"measurementArray",void 0),e([i()],m.prototype,"pixelMeasurement",void 0),e([i()],m.prototype,"pixelAreaMeasurement",void 0),e([i()],m.prototype,"polygonVertices",void 0),m=e([r("esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter")],m);const d=m;export{d as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{substitute as r}from"../../../intl/substitute.js";import s from"../../Widget.js";import{css as i}from"../css.js";import{copyToClipboard as n}from"../imageMeasurementUtils.js";import{loadCalciteComponents as c}from"../../support/componentsUtils.js";import{tsx as a}from"../../support/jsxFactory.js";let p=class extends s{constructor(o){super(o),this.messages=null}loadDependencies(){return c({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")})}get _renderLocation(){const{groundCoordinates:o}=this;return o?a("calcite-block",{heading:this.getLocation(),headingLevel:6},a("calcite-action",{icon:"copy-to-clipboard",onclick:()=>this.copyLocation(),slot:"control",text:"Copy"})):null}copyLocation(){const{groundCoordinates:o}=this;if(!o)return;const t=this.getLocation();t&&n(t)}getLocation(){const{groundCoordinates:o}=this;if(!o?.longitude||!o?.latitude)return"";const t={groundX:o.longitude.toFixed(3),groundY:o.latitude.toFixed(3)};return r("{groundX}° , {groundY}°",t)}render(){return a("calcite-panel",{class:i.measurementResults,key:"ground-location-container"},this._renderLocation)}};o([t()],p.prototype,"messages",void 0),o([t()],p.prototype,"groundCoordinates",void 0),o([t()],p.prototype,"_renderLocation",null),p=o([e("esri.widgets.OrientedImageryViewer.components.ImageLocationWidget")],p);const d=p;export{d as default};
5
+ import{_ as o}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{substitute as r}from"../../../intl/substitute.js";import s from"../../Widget.js";import{css as n}from"../css.js";import{copyToClipboard as i}from"../imageMeasurementUtils.js";import{loadCalciteComponents as c}from"../../support/componentsUtils.js";import{tsx as a}from"../../support/jsxFactory.js";let p=class extends s{constructor(o){super(o),this.messages=null}loadDependencies(){return c({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")})}get _renderLocation(){const{groundCoordinates:o}=this;return o?a("calcite-block",{heading:this.getLocation(),headingLevel:6},a("calcite-action",{icon:"copy-to-clipboard",onclick:()=>this.copyLocation(),slot:"control",text:"Copy"})):null}copyLocation(){const{groundCoordinates:o}=this;if(!o)return;const t=this.getLocation();t&&i(t)}getLocation(){const{groundCoordinates:o}=this;if(null==o?.longitude||null==o?.latitude)return"";const t={groundX:o.longitude.toFixed(3),groundY:o.latitude.toFixed(3)};return r("{groundX}° , {groundY}°",t)}render(){return a("calcite-panel",{class:n.measurementResults,key:"ground-location-container"},this._renderLocation)}};o([t()],p.prototype,"messages",void 0),o([t()],p.prototype,"groundCoordinates",void 0),o([t()],p.prototype,"_renderLocation",null),p=o([e("esri.widgets.OrientedImageryViewer.components.ImageLocationWidget")],p);const l=p;export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../config.js";import t from"../../core/Error.js";import has from"../../core/has.js";import o from"../../core/Logger.js";import r from"../../geometry/Point.js";import{geographicToWebMercator as i}from"../../geometry/support/webMercatorUtils.js";import n from"../../portal/Portal.js";import{project as c}from"../../rest/geometryService/project.js";import s from"../../rest/support/ProjectParameters.js";const u=()=>o.getLogger("esri.widgets.support.geolocationUtils"),a={maximumAge:0,timeout:15e3,enableHighAccuracy:!0};function m(){const e=!!has("esri-geolocation");return e||u().warn("geolocation-unsupported","Geolocation unsupported."),e}function l(){const e=window.isSecureContext;return e||u().warn("insecure-context","Geolocation requires a secure origin."),e}function g(){return m()&&l()}function p(e){const o=15e3;return e??=a,new Promise(((r,i)=>{setTimeout((()=>i(new t("geolocation:timeout","getting the current geolocation position timed out"))),o),navigator.geolocation.getCurrentPosition(r,i,e??void 0)}))}let d;function f(e,o){if(d)return d(e,o);const{position:r,view:i}=e,n=v(r),c=n?.coords;if(!c)throw new t("geometry-service:no-coords","Geolocation has no coordinates");return h(y(c),i,o)}function w(e){d=e}function v(e){const t=e&&e.coords||{},o={accuracy:t.accuracy,altitude:t.altitude,altitudeAccuracy:t.altitudeAccuracy,heading:t.heading,latitude:t.latitude,longitude:t.longitude,speed:t.speed,toJSON:()=>({})};return e?{coords:o,timestamp:e.timestamp,toJSON:()=>({})}:e}function y({longitude:e,latitude:t,altitude:o}){return new r({longitude:e,latitude:t,z:o||void 0,spatialReference:{wkid:4326}})}function h(e,o,r){if(!o)return Promise.resolve(e);const n=o.spatialReference;return n.isWGS84?Promise.resolve(e):n.isWebMercator?Promise.resolve(i(e)):j(r).then((o=>{if(!o)throw new t("geometry-service:missing-url","Geometry service URL is missing");const i=new s({geometries:[e],outSpatialReference:n});return c(o,i,r).then((e=>e[0]))}))}function j(t){if(e.geometryServiceUrl)return Promise.resolve(e.geometryServiceUrl);const o=n.getDefault();return o.load(t).catch((()=>{})).then((()=>o.helperServices?.geometry?.url))}export{p as getCurrentPosition,w as overridePositionToPoint,f as positionToPoint,g as supported};
5
+ import e from"../../config.js";import t from"../../core/Error.js";import has from"../../core/has.js";import o from"../../core/Logger.js";import r from"../../geometry/Point.js";import{geographicToWebMercator as i}from"../../geometry/support/webMercatorUtils.js";import n from"../../portal/Portal.js";import{project as c}from"../../rest/geometryService/project.js";import s from"../../rest/support/ProjectParameters.js";const u=()=>o.getLogger("esri.widgets.support.geolocationUtils"),a={maximumAge:0,timeout:15e3,enableHighAccuracy:!0};function m(){const e=!!has("esri-geolocation");return e||u().warn("geolocation-unsupported","Geolocation unsupported."),e}function l(){const e=window.isSecureContext;return e||u().warnOnce("insecure-context","Geolocation requires a secure origin."),e}function g(){return m()&&l()}function p(e){const o=15e3;return e??=a,new Promise(((r,i)=>{setTimeout((()=>i(new t("geolocation:timeout","getting the current geolocation position timed out"))),o),navigator.geolocation.getCurrentPosition(r,i,e??void 0)}))}let d;function f(e,o){if(d)return d(e,o);const{position:r,view:i}=e,n=v(r),c=n?.coords;if(!c)throw new t("geometry-service:no-coords","Geolocation has no coordinates");return h(y(c),i,o)}function w(e){d=e}function v(e){const t=e&&e.coords||{},o={accuracy:t.accuracy,altitude:t.altitude,altitudeAccuracy:t.altitudeAccuracy,heading:t.heading,latitude:t.latitude,longitude:t.longitude,speed:t.speed,toJSON:()=>({})};return e?{coords:o,timestamp:e.timestamp,toJSON:()=>({})}:e}function y({longitude:e,latitude:t,altitude:o}){return new r({longitude:e,latitude:t,z:o||void 0,spatialReference:{wkid:4326}})}function h(e,o,r){if(!o)return Promise.resolve(e);const n=o.spatialReference;return n.isWGS84?Promise.resolve(e):n.isWebMercator?Promise.resolve(i(e)):j(r).then((o=>{if(!o)throw new t("geometry-service:missing-url","Geometry service URL is missing");const i=new s({geometries:[e],outSpatialReference:n});return c(o,i,r).then((e=>e[0]))}))}function j(t){if(e.geometryServiceUrl)return Promise.resolve(e.geometryServiceUrl);const o=n.getDefault();return o.load(t).catch((()=>{})).then((()=>o.helperServices?.geometry?.url))}export{p as getCurrentPosition,w as overridePositionToPoint,f as positionToPoint,g as supported};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1768,3200,8430,9340],{39516:(e,t,r)=>{let o;async function s(){return null==o&&(o=r.e(4123).then(r.bind(r,44123)).then((e=>new e.WhereClauseCache(500,500)))),o}async function n(e,t){const r=await s(),o=r.get(e,t);if(null==o)throw r.getError(e,t);return o}function i(e,t){return e||=null,t||=null,"1=1"===e?t??e:"1=1"===t?e??t:e&&t?`(${e}) AND (${t})`:e??t}function a(e,t){return e||=null,t||=null,"1=1"===e||"1=1"===t||e===t?"1=1"===e?e:t:e&&t?`(${e}) OR (${t})`:e??t}r.d(t,{GP:()=>n,IW:()=>a,mA:()=>i})},13069:(e,t,r)=>{r.d(t,{AG:()=>a,lk:()=>s,vD:()=>i,yS:()=>n});const o="randomUUID"in crypto;function s(){if(o)return crypto.randomUUID();const e=crypto.getRandomValues(new Uint16Array(8));e[3]=4095&e[3]|16384,e[4]=16383&e[4]|32768;const t=t=>e[t].toString(16).padStart(4,"0");return t(0)+t(1)+"-"+t(2)+"-"+t(3)+"-"+t(4)+"-"+t(5)+t(6)+t(7)}function n(){return`{${s().toUpperCase()}}`}function i(){return`{${s()}}`}function a(e){const t=e.toUpperCase();return"{"!==e[0]?`{${t}}`:t}},72256:(e,t,r)=>{r.r(t),r.d(t,{default:()=>A});var o=r(90237),s=r(49186),n=r(74887),i=r(84952),a=r(10107),l=r(44208),p=(r(53966),r(87811),r(36005)),u=r(40608),c=r(16930),d=r(13600),y=r(92474),h=r(29953),m=r(5443),f=r(22671);let g=class extends y.A{constructor(e){super(e),this.type="csv",this.refresh=(0,n.sg)((async e=>{await this.load();const{extent:t,timeExtent:r}=await this._connection.invoke("refresh",e);return t&&(this.sourceJSON.extent=t),r&&(this.sourceJSON.timeInfo.timeExtent=[r.start,r.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}}))}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeatures(e,t={}){await this.load(t);const r=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t);return f.A.fromJSON(r)}async queryFeaturesJSON(e,t={}){return await this.load(t),this._connection.invoke("queryFeatures",e?e.toJSON():null,t)}async queryFeatureCount(e,t={}){return await this.load(t),this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t)}async queryObjectIds(e,t={}){return await this.load(t),this._connection.invoke("queryObjectIds",e?e.toJSON():null,t)}async queryExtent(e,t={}){await this.load(t);const r=await this._connection.invoke("queryExtent",e?e.toJSON():null,t);return{count:r.count,extent:m.A.fromJSON(r.extent)}}async querySnapping(e,t={}){return await this.load(t),this._connection.invoke("querySnapping",e,t)}async queryAttributeBins(e,t={}){return await this.load(),this._connection.invoke("queryAttributeBins",e?e.toJSON():null,t)}async _startWorker(e){this._connection=await(0,h.ho)("CSVSourceWorker",{strategy:(0,l.A)("feature-layers-workers")?"dedicated":"local",signal:e,registryTarget:this});const{url:t,delimiter:r,fields:o,latitudeField:s,longitudeField:n,spatialReference:i,timeInfo:a}=this.loadOptions,p=await this._connection.invoke("load",{url:t,customParameters:this.customParameters,parsingOptions:{delimiter:r,fields:o?.map((e=>e.toJSON())),latitudeField:s,longitudeField:n,spatialReference:i?.toJSON(),timeInfo:a?.toJSON()}},{signal:e});this.locationInfo=p.locationInfo,this.sourceJSON=p.layerDefinition,this.delimiter=p.delimiter}};(0,o._)([(0,a.MZ)()],g.prototype,"type",void 0),(0,o._)([(0,a.MZ)()],g.prototype,"loadOptions",void 0),(0,o._)([(0,a.MZ)()],g.prototype,"customParameters",void 0),(0,o._)([(0,a.MZ)()],g.prototype,"locationInfo",void 0),(0,o._)([(0,a.MZ)()],g.prototype,"sourceJSON",void 0),(0,o._)([(0,a.MZ)()],g.prototype,"delimiter",void 0),g=(0,o._)([(0,u.$)("esri.layers.graphics.sources.CSVSource")],g);var v=r(64714),S=r(61956),w=r(97159);function x(e,t){throw new s.A(t,`CSVLayer (title: ${e.title}, id: ${e.id}) cannot be saved to a portal item`)}let _=class extends d.default{constructor(...e){super(...e),this.geometryType="point",this.capabilities=(0,v.f)(!1,!1),this.delimiter=null,this.editingEnabled=!1,this.fields=null,this.latitudeField=null,this.locationType="coordinates",this.longitudeField=null,this.operationalLayerType="CSV",this.outFields=["*"],this.path=null,this.spatialReference=c.A.WGS84,this.source=null,this.type="csv"}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["CSV"],supportsData:!1},e).catch(n.QP).then((async()=>this.initLayerProperties(await this.createGraphicsSource(t))));return this.addResolvingPromise(r),Promise.resolve(this)}get isTable(){return this.loaded&&null==this.geometryType}readWebMapLabelsVisible(e,t){return null!=t.showLabels?t.showLabels:!!t.layerDefinition?.drawingInfo?.labelingInfo}set url(e){if(!e)return void this._set("url",e);const t=(0,i.An)(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async createGraphicsSource(e){const t=new g({loadOptions:{delimiter:this.delimiter,fields:this.fields,latitudeField:this.latitudeField??void 0,longitudeField:this.longitudeField??void 0,spatialReference:this.spatialReference??void 0,timeInfo:this.timeInfo??void 0,url:this.url},customParameters:this.customParameters??void 0});return this._set("source",t),await t.load({signal:e}),this.read({locationInfo:t.locationInfo,columnDelimiter:t.delimiter},{origin:"service",url:this.parsedUrl}),t}queryFeatures(e,t){return this.load().then((()=>this.source.queryFeatures(S.A.from(e)||this.createQuery()))).then((e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}))}async queryObjectIds(e,t){return await this.load(),this.source.queryObjectIds(S.A.from(e)||this.createQuery())}queryFeatureCount(e,t){return this.load().then((()=>this.source.queryFeatureCount(S.A.from(e)||this.createQuery())))}queryExtent(e,t){return this.load().then((()=>this.source.queryExtent(S.A.from(e)||this.createQuery())))}read(e,t){super.read(e,t),t&&"service"===t.origin&&this.revert(["latitudeField","longitudeField"],"service")}write(e,t){return super.write(e,{...t,writeLayerSchema:!0})}clone(){throw new s.A("csv-layer:clone",`CSVLayer (title: ${this.title}, id: ${this.id}) cannot be cloned`)}async save(e){return x(this,"csv-layer:save")}async saveAs(e,t){return x(this,"csv-layer:save-as")}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return null!=t&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}_verifyFields(){}_verifySource(){}_hasMemorySource(){return!1}};(0,o._)([(0,a.MZ)({readOnly:!0,json:{read:!1,write:!1}})],_.prototype,"capabilities",void 0),(0,o._)([(0,a.MZ)({type:[","," ",";","|","\t"],json:{read:{source:"columnDelimiter"},write:{target:"columnDelimiter",ignoreOrigin:!0}}})],_.prototype,"delimiter",void 0),(0,o._)([(0,a.MZ)({readOnly:!0,type:Boolean,json:{origins:{"web-scene":{read:!1,write:!1}}}})],_.prototype,"editingEnabled",void 0),(0,o._)([(0,a.MZ)({json:{read:{source:"layerDefinition.fields"},write:{target:"layerDefinition.fields"}}})],_.prototype,"fields",void 0),(0,o._)([(0,a.MZ)({type:Boolean,readOnly:!0})],_.prototype,"isTable",null),(0,o._)([(0,p.w)("web-map","labelsVisible",["layerDefinition.drawingInfo.labelingInfo","showLabels"])],_.prototype,"readWebMapLabelsVisible",null),(0,o._)([(0,a.MZ)({type:String,json:{read:{source:"locationInfo.latitudeFieldName"},write:{target:"locationInfo.latitudeFieldName",ignoreOrigin:!0}}})],_.prototype,"latitudeField",void 0),(0,o._)([(0,a.MZ)({type:["show","hide"]})],_.prototype,"listMode",void 0),(0,o._)([(0,a.MZ)({type:["coordinates"],json:{read:{source:"locationInfo.locationType"},write:{target:"locationInfo.locationType",ignoreOrigin:!0,isRequired:!0}}})],_.prototype,"locationType",void 0),(0,o._)([(0,a.MZ)({type:String,json:{read:{source:"locationInfo.longitudeFieldName"},write:{target:"locationInfo.longitudeFieldName",ignoreOrigin:!0}}})],_.prototype,"longitudeField",void 0),(0,o._)([(0,a.MZ)({type:["CSV"]})],_.prototype,"operationalLayerType",void 0),(0,o._)([(0,a.MZ)()],_.prototype,"outFields",void 0),(0,o._)([(0,a.MZ)({type:String,json:{origins:{"web-scene":{read:!1,write:!1}},read:!1,write:!1}})],_.prototype,"path",void 0),(0,o._)([(0,a.MZ)({json:{read:!1},cast:null,type:g,readOnly:!0})],_.prototype,"source",void 0),(0,o._)([(0,a.MZ)({json:{read:!1},value:"csv",readOnly:!0})],_.prototype,"type",void 0),(0,o._)([(0,a.MZ)({json:{read:w.r,write:{isRequired:!0,ignoreOrigin:!0,writer:w.w}}})],_.prototype,"url",null),_=(0,o._)([(0,u.$)("esri.layers.CSVLayer")],_);const A=_},99352:(e,t,r)=>{r.d(t,{F:()=>o});const o={supportsStatistics:!0,supportsPercentileStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsCentroid:!0,supportsCacheHint:!0,supportsCurrentUser:!1,supportsDistance:!0,supportsDistinct:!0,supportsExtent:!0,supportsGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryGeometry:!0,supportsResultType:!0,supportsReturnMesh:!1,supportsSqlExpression:!0,supportsMaxRecordCountFactor:!1,supportsStandardizedQueriesOnly:!0,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!0,supportsQueryByOthers:!0,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!0,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,maxRecordCountFactor:void 0,maxRecordCount:void 0,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1}},64714:(e,t,r)=>{r.d(t,{F0:()=>l,Vx:()=>c,e2:()=>y,f:()=>h});var o=r(44208),s=r(4718),n=r(99352),i=r(4071),a=r(93470);function l(e){return{renderer:{type:"simple",symbol:"esriGeometryPoint"===e||"esriGeometryMultipoint"===e?a.Cb:"esriGeometryPolyline"===e?a.yM:a.WR}}}const p=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/;let u=1;function c(e,t){if((0,o.A)("esri-csp-restrictions"))return()=>({[t]:null,...e});try{let r=`this${d(t)} = null;`;for(const t in e)r+=`this${d(t)} = ${JSON.stringify(e[t])};`;const o=new Function(`\n return class AttributesClass$${u++} {\n constructor() {\n ${r};\n }\n }\n `)();return()=>new o}catch(r){return()=>({[t]:null,...e})}}function d(e){return p.test(e)?`.${e}`:`["${e}"]`}function y(e={}){return[{name:"New Feature",description:"",prototype:{attributes:(0,s.o8)(e)}}]}function h(e,t){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:t,supportsDelete:t,supportsEditing:t,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:t,supportsExceedsLimitStatistics:!0,supportsAsyncConvert3D:!1},query:n.F,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:i.$,editing:{supportsGeometryUpdate:t,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}},32756:(e,t,r)=>{r.d(t,{Rr:()=>l,fY:()=>u,ne:()=>p});var o=r(90237),s=r(93637),n=r(10107),i=(r(44208),r(53966),r(87811),r(40608)),a=r(91880);function l(e,t,r){if(!e)return null;const o=e.find((e=>!!e.field));if(!o)return null;const s=new a.A;return s.read(o,r),[s]}const p={type:[a.A],json:{origins:{"web-scene":{write:!1,read:!1}},name:"layerDefinition.orderBy",read:{reader:l},write:{writer:function(e,t,r,o){const n=e.find((e=>!!e.field));n&&(0,s.sM)(r,[n.toJSON()],t)}}}},u=e=>{let t=class extends e{constructor(){super(...arguments),this.orderBy=null}};return(0,o._)([(0,n.MZ)(p)],t.prototype,"orderBy",void 0),t=(0,o._)([(0,i.$)("esri.layers.mixins.OrderedLayer")],t),t}},33143:(e,t,r)=>{r.d(t,{A:()=>y});var o=r(90237),s=r(69540),n=r(25482),i=r(10107),a=(r(44208),r(53966),r(87811),r(36005)),l=r(40608),p=r(43937),u=r(80451),c=r(29005);let d=class extends(s.A.ClonableMixin(n.A)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const r of Object.keys(e))t[r]=(0,u.rS)(e[r]);return t}writeDomains(e,t){const r={};for(const t of Object.keys(e))e[t]&&(r[t]=e[t]?.toJSON());t.domains=r}};(0,o._)([(0,i.MZ)({json:{write:!0}})],d.prototype,"id",void 0),(0,o._)([(0,i.MZ)({json:{write:!0}})],d.prototype,"name",void 0),(0,o._)([(0,i.MZ)({json:{write:!0}})],d.prototype,"domains",void 0),(0,o._)([(0,a.w)("domains")],d.prototype,"readDomains",null),(0,o._)([(0,p.K)("domains")],d.prototype,"writeDomains",null),(0,o._)([(0,i.MZ)({type:[c.A],json:{write:!0}})],d.prototype,"templates",void 0),d=(0,o._)([(0,l.$)("esri.layers.support.FeatureType")],d);const y=d},91880:(e,t,r)=>{r.d(t,{A:()=>c});var o,s=r(90237),n=r(66552),i=r(25482),a=r(10107),l=(r(44208),r(53966),r(87811),r(40608));const p=new n.J({asc:"ascending",desc:"descending"});let u=o=class extends i.A{constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new o({field:this.field,valueExpression:this.valueExpression,order:this.order})}};(0,s._)([(0,a.MZ)({type:String,json:{write:!0}})],u.prototype,"field",void 0),(0,s._)([(0,a.MZ)({type:String,json:{write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],u.prototype,"valueExpression",void 0),(0,s._)([(0,a.MZ)({type:p.apiValues,json:{type:p.jsonValues,read:p.read,write:p.write}})],u.prototype,"order",void 0),u=o=(0,s._)([(0,l.$)("esri.layers.support.OrderByInfo")],u);const c=u},4071:(e,t,r)=>{r.d(t,{$:()=>o,P:()=>s});const o={supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1,supportedStatistics:void 0,supportedNormalizationTypes:void 0},s={analytics:{supportsCacheHint:!1},attachment:{supportsContentType:!1,supportsExifInfo:!1,supportsKeywords:!1,supportsName:!1,supportsSize:!1,supportsCacheHint:!1,supportsResize:!1},data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsAsyncApplyEdits:!1,zDefault:void 0},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:o,query:{maxRecordCount:0,maxRecordCountFactor:0,standardMaxRecordCount:0,supportsCacheHint:!1,supportsCentroid:!1,supportsCompactGeometry:!1,supportsCurrentUser:!1,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsSqlExpression:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsTrueCurve:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsStatistics:!1,tileMaxRecordCount:0}}},41560:(e,t,r)=>{r.d(t,{Ch:()=>i,mW:()=>n});var o=r(34727),s=r(39516);function n(e,t){return{...t,filterMode:e.mode}}function i(e,t,r){const n=function(e){if("manual"===p(e))return null;const t=[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY];for(const{minScale:r,maxScale:o}of e.filters)t[0]=Math.max(t[0],u(r)),t[1]=Math.min(t[1],c(o));return t}(e);if(n&&((0,o.gg)(t,n[0])||(0,o.ZH)(r,n[1])))return"";const i=Array.from(a(e,t,r)),l=function(e,t,r){if(0===e.length)return!0;const s=u(e.at(0)?.minScale),n=c(e.at(-1)?.maxScale);if((0,o.ZH)(s,t)||(0,o.gg)(n,r))return!0;for(let t=0;t<e.length-1;t++){const r=e[t],s=e[t+1];if((0,o.ZH)(u(s.minScale),c(r.maxScale)))return!0}return!1}(i,t,r)?"1=1":i.map((e=>e.where||"1=1")).reduce(((e,t)=>(0,s.IW)(e,t)),"");return l&&"1=1"!==l?l:""}function*a(e,t,r){if("manual"===p(e)){const t=e.filters.find((t=>t.id===e.activeFilterId));t&&(yield t)}else{"object"==typeof t&&(t=t.scale);for(const o of e.filters)l(o.minScale,o.maxScale,t,r)&&(yield o)}}function l(e,t,r,s){return e=u(e),r=u(r),t=c(t),!(!(0,o.Sp)(r,e)&&(s??r)>e||(0,o.Hx)(t,r)||void 0!==s&&(0,o.Sp)(s,e))}function p(e){return"mode"in e?e.mode:e.filterMode}function u(e){return e||Number.POSITIVE_INFINITY}function c(e){return e||0}},32730:(e,t,r)=>{r.d(t,{BI:()=>f,D3:()=>h,XJ:()=>m,lc:()=>y,mX:()=>v,rU:()=>g,tH:()=>A});var o=r(799);const s="__begin__",n="__end__",i=new RegExp(s,"ig"),a=new RegExp(n,"ig"),l=new RegExp("^"+s,"i"),p=new RegExp(n+"$","i"),u='"',c=u+" + ",d=" + "+u;function y(e){return e.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function h(e){return e.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function m(e){const t={expression:"",type:"none"};return e.labelExpressionInfo?e.labelExpressionInfo.value?(t.expression=e.labelExpressionInfo.value,t.type="conventional"):e.labelExpressionInfo.expression&&(t.expression=e.labelExpressionInfo.expression,t.type="arcade"):null!=e.labelExpression&&(t.expression=y(e.labelExpression),t.type="conventional"),t}function f(e){const t=m(e);switch(t.type){case"conventional":return v(t.expression);case"arcade":return t.expression}return null}function g(e){const t=m(e);switch(t.type){case"conventional":return function(e){const t=e?.match(S);return t?.[1].trim()||null}(t.expression);case"arcade":return A(t.expression)}return null}function v(e){let t;return e?(t=(0,o.HC)(e,(e=>s+'$feature["'+e+'"]'+n)),t=l.test(t)?t.replace(l,""):u+t,t=p.test(t)?t.replace(p,""):t+u,t=t.replaceAll(i,c).replaceAll(a,d)):t='""',t}const S=/^\s*\{([^}]+)\}\s*$/i,w=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,x=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,_=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(.+)(\1)\s*\));?\s*$/i;function A(e){if(!e)return null;let t=w.exec(e)||x.exec(e);return t?t[1]||t[3]:(t=_.exec(e),t?t[2]:null)}},58501:(e,t,r)=>{r.d(t,{q:()=>s});var o=r(62815);function s(e,t,r){if(!r?.features||!r.hasZ)return;const s=(0,o.N)(r.geometryType,t,e.outSpatialReference);if(null!=s)for(const e of r.features)s(e.geometry)}},22671:(e,t,r)=>{r.d(t,{A:()=>S});var o,s=r(90237),n=r(52106),i=r(66552),a=r(25482),l=r(4718),p=r(10107),u=(r(44208),r(53966),r(36005)),c=r(40608),d=r(43937),y=r(16930),h=r(65864),m=r(50498),f=r(20437);const g=new i.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let v=o=class extends a.A{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){return this.readFeaturesWithClass(e,t,n.A)}writeGeometryType(e,t,r,o){if(e)return void g.write(e,t,r,o);const{features:s}=this;if(s)for(const e of s)if(null!=e?.geometry)return void g.write(e.geometry.type,t,r,o)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,o=(0,h.rS)(e);return o&&!r&&t.spatialReference&&(o.spatialReference=y.A.fromJSON(t.spatialReference)),o}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const e of r)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new o(this.cloneProperties())}cloneProperties(){return(0,l.o8)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let r=0;r<t.features.length;r++){const o=t.features[r];if(o.geometry){const t=e?.[r];o.geometry=t?.toJSON()||o.geometry}}return t}quantize(e){const{scale:[t,r],translate:[o,s]}=e,n=this.features,i=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-o)/t)),(e=>Math.round((s-e)/r)));for(let e=0,t=n.length;e<t;e++)i?.(n[e].geometry)||(n.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[o,s],scale:[n,i]}=r;let a=null,l=null;if(this.hasZ&&null!=r?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=r;a=r=>r*t+e}if(this.hasM&&null!=r?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=r;l=r=>null==r?r:r*t+e}const p=this._getHydrationFunction(e,(e=>e*n+o),(e=>s-e*i),a,l);for(const{geometry:e}of t)null!=e&&p&&p(e);return this.transform=null,this}readFeaturesWithClass(e,t,r){const o=y.A.fromJSON(t.spatialReference),s=[];for(let t=0;t<e.length;t++){const n=e[t],i=r.fromJSON(n),a=n.geometry?.spatialReference;null==i.geometry||a||(i.geometry.spatialReference=o);const l=n.aggregateGeometries,p=i.aggregateGeometries;if(l&&null!=p)for(const e in p){const t=p[e],r=l[e],s=r?.spatialReference;null==t||s||(t.spatialReference=o)}s.push(i)}return s}_quantizePoints(e,t,r){let o,s;const n=[];for(let i=0,a=e.length;i<a;i++){const a=e[i];if(i>0){const e=t(a[0]),i=r(a[1]);e===o&&i===s||(n.push([e-o,i-s]),o=e,s=i)}else o=t(a[0]),s=r(a[1]),n.push([o,s])}return n.length>0?n:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const o=(0,h.Bi)(e)?e.rings:e.paths,s=[];for(let e=0,n=o.length;e<n;e++){const n=o[e],i=this._quantizePoints(n,t,r);i&&s.push(i)}return s.length>0?((0,h.Bi)(e)?e.rings=s:e.paths=s,e):null}:"multipoint"===e?e=>{const o=this._quantizePoints(e.points,t,r);return o&&o.length>0?(e.points=o,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r,o,s){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y),o&&(e.z=o(e.z))}:"polyline"===e||"polygon"===e?e=>{const n=(0,h.Bi)(e)?e.rings:e.paths;let i,a;for(let e=0,o=n.length;e<o;e++){const o=n[e];for(let e=0,s=o.length;e<s;e++){const s=o[e];e>0?(i+=s[0],a+=s[1]):(i=s[0],a=s[1]),s[0]=t(i),s[1]=r(a)}}if(o&&s)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=o(r[2]),r[3]=s(r[3])}}else if(o)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=o(r[2])}}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=s(r[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax),o&&null!=e.zmax&&null!=e.zmin&&(e.zmax=o(e.zmax),e.zmin=o(e.zmin)),s&&null!=e.mmax&&null!=e.mmin&&(e.mmax=s(e.mmax),e.mmin=s(e.mmin))}:"multipoint"===e?e=>{const n=e.points;let i,a;for(let e=0,o=n.length;e<o;e++){const o=n[e];e>0?(i+=o[0],a+=o[1]):(i=o[0],a=o[1]),o[0]=t(i),o[1]=r(a)}if(o&&s)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=o(t[2]),t[3]=s(t[3])}else if(o)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=o(t[2])}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=s(t[2])}}:null}};(0,s._)([(0,p.MZ)({type:String,json:{write:!0}})],v.prototype,"displayFieldName",void 0),(0,s._)([(0,p.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],v.prototype,"exceededTransferLimit",void 0),(0,s._)([(0,p.MZ)({type:[n.A],json:{write:!0}})],v.prototype,"features",void 0),(0,s._)([(0,u.w)("features")],v.prototype,"readFeatures",null),(0,s._)([(0,p.MZ)({type:[f.A],json:{write:!0}})],v.prototype,"fields",void 0),(0,s._)([(0,p.MZ)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],v.prototype,"geometryType",void 0),(0,s._)([(0,d.K)("geometryType")],v.prototype,"writeGeometryType",null),(0,s._)([(0,p.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],v.prototype,"hasM",void 0),(0,s._)([(0,p.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],v.prototype,"hasZ",void 0),(0,s._)([(0,p.MZ)({types:m.yR,json:{write:!0}})],v.prototype,"queryGeometry",void 0),(0,s._)([(0,u.w)("queryGeometry")],v.prototype,"readQueryGeometry",null),(0,s._)([(0,p.MZ)({type:y.A,json:{write:!0}})],v.prototype,"spatialReference",void 0),(0,s._)([(0,d.K)("spatialReference")],v.prototype,"writeSpatialReference",null),(0,s._)([(0,p.MZ)({json:{write:!0}})],v.prototype,"transform",void 0),v=o=(0,s._)([(0,c.$)("esri.rest.support.FeatureSet")],v),v.prototype.toJSON.isDefaultToJSON=!0;const S=v},41366:(e,t,r)=>{r.d(t,{K:()=>d,Q:()=>p});var o=r(90237),s=r(66552),n=r(53966),i=r(10107),a=(r(44208),r(87811),r(93223)),l=r(40608);const p=(0,s.O)()({naturalLog:"natural-log",squareRoot:"square-root",percentOfTotal:"percent-of-total",log:"log",field:"field"}),u="percent-of-total",c="field",d=e=>{let t=class extends e{constructor(){super(...arguments),this.normalizationField=null,this.normalizationMaxValue=null,this.normalizationMinValue=null,this.normalizationTotal=null}get normalizationType(){let e=this._get("normalizationType");const t=!!this.normalizationField,r=null!=this.normalizationTotal;return t||r?(e=t&&c||r&&u||null,t&&r&&n.A.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):e!==c&&e!==u||(e=null),e}set normalizationType(e){this._set("normalizationType",e)}};return(0,o._)([(0,i.MZ)({type:String,json:{name:"parameters.normalizationField",write:!0}})],t.prototype,"normalizationField",void 0),(0,o._)([(0,i.MZ)({type:Number,json:{name:"parameters.normalizationMaxValue",write:!0}})],t.prototype,"normalizationMaxValue",void 0),(0,o._)([(0,i.MZ)({type:Number,json:{name:"parameters.normalizationMinValue",write:!0}})],t.prototype,"normalizationMinValue",void 0),(0,o._)([(0,i.MZ)({type:Number,json:{name:"parameters.normalizationTotal",write:!0}})],t.prototype,"normalizationTotal",void 0),(0,o._)([(0,a.e)(p,{name:"parameters.normalizationType"})],t.prototype,"normalizationType",null),t=(0,o._)([(0,l.$)("esri.rest.support.NormalizationBinParametersMixin")],t),t}},92935:(e,t,r)=>{var o;r.d(t,{X:()=>o}),function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(o||(o={}))}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9432],{67482:(e,t,s)=>{function r(e){return null!=u(e)||null!=o(e)}function i(e){return a.test(e)}function n(e){return u(e)??o(e)}function o(e){const t=new Date(e);return function(e,t){if(Number.isNaN(e.getTime()))return!1;let s=!0;if(l&&/\d+\W*$/.test(t)){const e=t.match(/[a-zA-Z]{2,}/);if(e){let t=!1,r=0;for(;!t&&r<=e.length;)t=!p.test(e[r]),r++;s=!t}}return s}(t,e)?Number.isNaN(t.getTime())?null:t.getTime()-6e4*t.getTimezoneOffset():null}function u(e){const t=a.exec(e);if(!t?.groups)return null;const s=t.groups,r=+s.year,i=+s.month-1,n=+s.day,o=+(s.hours??"0"),u=+(s.minutes??"0"),p=+(s.seconds??"0");if(o>23)return null;if(u>59)return null;if(p>59)return null;const l=s.ms??"0",d=l?+l.padEnd(3,"0").slice(0,3):0;let c;if(s.isUTC||!s.offsetSign)c=Date.UTC(r,i,n,o,u,p,d);else{const e=+s.offsetHours,t=+s.offsetMinutes;c=6e4*("+"===s.offsetSign?-1:1)*(60*e+t)+Date.UTC(r,i,n,o,u,p,d)}return Number.isNaN(c)?null:c}s.d(t,{Br:()=>i,Cq:()=>r,_U:()=>n});const a=/^(?:(?<year>-?\d{4,})-(?<month>\d{2})-(?<day>\d{2}))(?:T(?<hours>\d{2}):(?<minutes>\d{2}):(?<seconds>\d{2})(?:\.(?<ms>\d+))?)?(?:(?<isUTC>Z)|(?:(?<offsetSign>\+|-)(?<offsetHours>\d{2}):(?<offsetMinutes>\d{2})))?$/,p=/^((jan(uary)?)|(feb(ruary)?)|(mar(ch)?)|(apr(il)?)|(may)|(jun(e)?)|(jul(y)?)|(aug(ust)?)|(sep(tember)?)|(oct(ober)?)|(nov(ember)?)|(dec(ember)?)|(am)|(pm)|(gmt)|(utc))$/i,l=!Number.isNaN(new Date("technology 10").getTime())},33032:(e,t,s)=>{s.d(t,{H:()=>i,L:()=>r});const r=1;function i(e,t){let s=0;for(const r of t){const t=r.attributes?.[e];"number"==typeof t&&isFinite(t)&&(s=Math.max(s,t))}return s}},29432:(e,t,s)=>{s.r(t),s.d(t,{default:()=>R});var r=s(49186),i=s(65864),n=s(21325),o=s(90708),u=s(33032),a=s(58376),p=s(83221),l=s(31464),d=s(19730),c=s(64714),y=s(82832),f=s(95466),m=s(98453),h=s(30524),g=s(56400);const b=n.KK,S={xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:n.KK},F={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!0,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0,supportsQueryWithCacheHint:!0}};function I(e){return(0,i.fT)(e)?null!=e.z:!!e.hasZ}function T(e){return(0,i.fT)(e)?null!=e.m:!!e.hasM}class R{constructor(){this._queryEngine=null,this._nextObjectId=null}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e){const t=[],{features:s}=e,i=this._inferLayerProperties(s,e.fields),n=e.fields||[],o=null!=e.hasM?e.hasM:!!i.hasM,a=null!=e.hasZ?e.hasZ:!!i.hasZ,y=!e.spatialReference&&!i.spatialReference,I=y?b:e.spatialReference||i.spatialReference,T=y?S:null,R=e.geometryType||i.geometryType,x=!R;let C=e.objectIdField||i.objectIdField,E=e.timeInfo;const A=new f.A(n);if(!x&&(y&&t.push({name:"feature-layer:spatial-reference-not-found",message:"Spatial reference not provided or found in features. Defaults to WGS84"}),!R))throw new r.A("feature-layer:missing-property","geometryType not set and couldn't be inferred from the provided features");if(!C)throw new r.A("feature-layer:missing-property","objectIdField not set and couldn't be found in the provided fields");if(i.objectIdField&&C!==i.objectIdField&&(t.push({name:"feature-layer:duplicated-oid-field",message:`Provided objectIdField "${C}" doesn't match the field name "${i.objectIdField}", found in the provided fields`}),C=i.objectIdField),C&&!i.objectIdField){const e=A.get(C);e?(C=e.name,e.type="esriFieldTypeOID",e.editable=!1,e.nullable=!1):n.unshift({alias:C,name:C,type:"esriFieldTypeOID",editable:!1,nullable:!1})}for(const e of n){if(null==e.name&&(e.name=e.alias),null==e.alias&&(e.alias=e.name),!e.name)throw new r.A("feature-layer:invalid-field-name","field name is missing",{field:e});if(e.name===C&&(e.type="esriFieldTypeOID"),!m.m.jsonValues.includes(e.type))throw new r.A("feature-layer:invalid-field-type",`invalid type for field "${e.name}"`,{field:e});null==e.length&&(e.length=(0,h._b)(e))}const _={};for(const e of n)if("esriFieldTypeOID"!==e.type&&"esriFieldTypeGlobalID"!==e.type){const t=(0,h.lD)(e);void 0!==t&&(_[e.name]=t)}if(E){if(E.startTimeField){const e=A.get(E.startTimeField);e?(E.startTimeField=e.name,e.type="esriFieldTypeDate"):E.startTimeField=null}if(E.endTimeField){const e=A.get(E.endTimeField);e?(E.endTimeField=e.name,e.type="esriFieldTypeDate"):E.endTimeField=null}if(E.trackIdField){const e=A.get(E.trackIdField);e?E.trackIdField=e.name:(E.trackIdField=null,t.push({name:"feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:E}}))}E.startTimeField||E.endTimeField||(t.push({name:"feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing or invalid",details:{timeInfo:E}}),E=null)}const D=A.dateFields.length?{timeZoneIANA:e.dateFieldsTimeZone??g.n$}:null;this._createDefaultAttributes=(0,c.Vx)(_,C);const q={warnings:t,featureErrors:[],layerDefinition:{...F,drawingInfo:(0,c.F0)(R),templates:(0,c.e2)(_),extent:T,geometryType:R,objectIdField:C,fields:n,hasZ:a,hasM:o,timeInfo:E,dateFieldsTimeReference:D},assignedObjectIds:{}};if(this._queryEngine=new d.do({fieldsIndex:f.A.fromLayerJSON({fields:n,timeInfo:E,dateFieldsTimeReference:D}),geometryType:R,hasM:o,hasZ:a,objectIdField:C,spatialReference:I,featureStore:new p.A({geometryType:R,hasM:o,hasZ:a}),timeInfo:E}),!s?.length)return this._nextObjectId=u.L,q;const v=(0,u.H)(C,s);return this._nextObjectId=v+1,await(0,l.Nk)(s,I),this._loadInitialFeatures(q,s)}async applyEdits(e){const{spatialReference:t,geometryType:s}=this._queryEngine;return await Promise.all([(0,y.$1)(t,s),(0,l.Nk)(e.adds,t),(0,l.Nk)(e.updates,t)]),this._applyEdits(e)}queryFeatures(e,t={}){return this._queryEngine.executeQuery(e,t.signal)}queryFeatureCount(e,t={}){return this._queryEngine.executeQueryForCount(e,t.signal)}queryObjectIds(e,t={}){return this._queryEngine.executeQueryForIds(e,t.signal)}queryExtent(e,t={}){return this._queryEngine.executeQueryForExtent(e,t.signal)}querySnapping(e,t={}){return(0,a.J)(this._queryEngine,e,t.signal)}queryAttributeBins(e,t={}){return this._queryEngine.executeAttributeBinsQuery(e,t.signal)}_inferLayerProperties(e,t){let s,r,n=null,o=null,u=null;for(const t of e){const e=t.geometry;if(null!=e&&(n||(n=(0,i.$B)(e)),o||(o=e.spatialReference),null==s&&(s=I(e)),null==r&&(r=T(e)),n&&o&&null!=s&&null!=r))break}if(t&&t.length){let e=null;t.some((t=>{const s="esriFieldTypeOID"===t.type,r=!t.type&&t.name&&"objectid"===t.name.toLowerCase();return e=t,s||r}))&&(u=e.name)}return{geometryType:n,spatialReference:o,objectIdField:u,hasM:r,hasZ:s}}async _loadInitialFeatures(e,t){const{geometryType:s,hasM:r,hasZ:n,objectIdField:u,spatialReference:a,featureStore:p,fieldsIndex:d}=this._queryEngine,c=[];for(const r of t){if(null!=r.uid&&(e.assignedObjectIds[r.uid]=-1),r.geometry&&s!==(0,i.$B)(r.geometry)){e.featureErrors.push((0,y.Yx)("Incorrect geometry type."));continue}const t=this._createDefaultAttributes(),n=(0,y.MB)(d,t,r.attributes,!0);n?e.featureErrors.push(n):(this._assignObjectId(t,r.attributes,!0),r.attributes=t,null!=r.uid&&(e.assignedObjectIds[r.uid]=r.attributes[u]),null!=r.geometry&&(r.geometry=(0,l.Cv)(r.geometry,r.geometry.spatialReference,a)),c.push(r))}p.addMany((0,o.Di)([],c,s,n,r,u));const{fullExtent:f,timeExtent:m}=await this._queryEngine.fetchRecomputedExtents();if(e.layerDefinition.extent=f,m){const{start:t,end:s}=m;e.layerDefinition.timeInfo.timeExtent=[t,s]}return e}async _applyEdits(e){const{adds:t,updates:s,deletes:r}=e,i={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(i,t),s?.length&&this._applyUpdateEdits(i,s),r?.length){for(const e of r)i.deleteResults.push((0,y.bP)(e));this._queryEngine.featureStore.removeManyById(r)}const{fullExtent:n,timeExtent:o}=await this._queryEngine.fetchRecomputedExtents();return{extent:n,timeExtent:o,featureEditResults:i}}_applyAddEdits(e,t){const{addResults:s}=e,{geometryType:r,hasM:n,hasZ:u,objectIdField:a,spatialReference:p,featureStore:d,fieldsIndex:c}=this._queryEngine,f=[];for(const n of t){if(n.geometry&&r!==(0,i.$B)(n.geometry)){s.push((0,y.Yx)("Incorrect geometry type."));continue}const t=this._createDefaultAttributes(),o=(0,y.MB)(c,t,n.attributes);if(o)s.push(o);else{if(this._assignObjectId(t,n.attributes),n.attributes=t,null!=n.uid){const t=n.attributes[a];e.uidToObjectId[n.uid]=t}if(null!=n.geometry){const e=n.geometry.spatialReference??p;n.geometry=(0,l.Cv)((0,y.CR)(n.geometry,e),e,p)}f.push(n),s.push((0,y.bP)(n.attributes[a]))}}d.addMany((0,o.Di)([],f,r,u,n,a))}_applyUpdateEdits({updateResults:e},t){const{geometryType:s,hasM:r,hasZ:n,objectIdField:u,spatialReference:a,featureStore:p,fieldsIndex:d}=this._queryEngine;for(const c of t){const{attributes:t,geometry:f}=c,m=t?.[u];if(null==m){e.push((0,y.Yx)(`Identifier field ${u} missing`));continue}if(!p.has(m)){e.push((0,y.Yx)(`Feature with object id ${m} missing`));continue}const h=(0,o.oN)(p.getFeature(m),s,n,r);if(null!=f){if(s!==(0,i.$B)(f)){e.push((0,y.Yx)("Incorrect geometry type."));continue}const t=f.spatialReference??a;h.geometry=(0,l.Cv)((0,y.CR)(f,t),t,a)}if(t){const s=(0,y.MB)(d,h.attributes,t);if(s){e.push(s);continue}}p.add((0,o.E2)(h,s,n,r,u)),e.push((0,y.bP)(m))}}_assignObjectId(e,t,s=!1){const r=this._queryEngine.objectIdField;s&&t&&isFinite(t[r])?e[r]=t[r]:e[r]=this._nextObjectId++}}},64714:(e,t,s)=>{s.d(t,{F0:()=>a,Vx:()=>d,e2:()=>y,f:()=>f});var r=s(44208),i=s(4718),n=s(99352),o=s(4071),u=s(93470);function a(e){return{renderer:{type:"simple",symbol:"esriGeometryPoint"===e||"esriGeometryMultipoint"===e?u.Cb:"esriGeometryPolyline"===e?u.yM:u.WR}}}const p=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/;let l=1;function d(e,t){if((0,r.A)("esri-csp-restrictions"))return()=>({[t]:null,...e});try{let s=`this${c(t)} = null;`;for(const t in e)s+=`this${c(t)} = ${JSON.stringify(e[t])};`;const r=new Function(`\n return class AttributesClass$${l++} {\n constructor() {\n ${s};\n }\n }\n `)();return()=>new r}catch(s){return()=>({[t]:null,...e})}}function c(e){return p.test(e)?`.${e}`:`["${e}"]`}function y(e={}){return[{name:"New Feature",description:"",prototype:{attributes:(0,i.o8)(e)}}]}function f(e,t){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:t,supportsDelete:t,supportsEditing:t,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:t,supportsExceedsLimitStatistics:!0,supportsAsyncConvert3D:!1},query:n.F,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:o.$,editing:{supportsGeometryUpdate:t,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}},82832:(e,t,s)=>{s.d(t,{$1:()=>h,CR:()=>m,MB:()=>c,Yx:()=>a,bP:()=>l});var r=s(67482),i=s(21325),n=s(30524);class o{constructor(){this.code=null,this.description=null}}class u{constructor(e){this.error=new o,this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error.description=e}}function a(e){return new u(e)}class p{constructor(e){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=e}}function l(e){return new p(e)}const d=new Set;function c(e,t,s,r=!1){d.clear();for(const i in s){const o=e.get(i);if(!o)continue;const u=y(o,s[i]);if(d.add(o.name),o&&(r||o.editable)){const e=(0,n.CJ)(o,u);if(e)return a((0,n.uo)(e,o,u));t[o.name]=u}}for(const t of e.requiredFields??[])if(!d.has(t.name))return a(`missing required field "${t.name}"`);return null}function y(e,t){let s=t;return(0,n.WA)(e)&&"string"==typeof t?s=parseFloat(t):(0,n.yM)(e)&&null!=t&&"string"!=typeof t?s=String(t):(0,n.vE)(e)&&"string"==typeof t&&(s=(0,r._U)(t)),(0,n.WX)(s)}let f;function m(e,t){if(!e||!(0,i.fn)(t))return e;if("rings"in e||"paths"in e){if(null==f)throw new TypeError("geometry engine not loaded");return f.simplify(t,e)}return e}async function h(e,t){!(0,i.fn)(e)||"esriGeometryPolygon"!==t&&"esriGeometryPolyline"!==t||await async function(){return null==f&&(f=await Promise.all([s.e(9930),s.e(1275)]).then(s.bind(s,47559))),f}()}},4071:(e,t,s)=>{s.d(t,{$:()=>r,P:()=>i});const r={supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1,supportedStatistics:void 0,supportedNormalizationTypes:void 0},i={analytics:{supportsCacheHint:!1},attachment:{supportsContentType:!1,supportsExifInfo:!1,supportsKeywords:!1,supportsName:!1,supportsSize:!1,supportsCacheHint:!1,supportsResize:!1},data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsAsyncApplyEdits:!1,zDefault:void 0},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:r,query:{maxRecordCount:0,maxRecordCountFactor:0,standardMaxRecordCount:0,supportsCacheHint:!1,supportsCentroid:!1,supportsCompactGeometry:!1,supportsCurrentUser:!1,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsSqlExpression:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsTrueCurve:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsStatistics:!1,tileMaxRecordCount:0}}},93470:(e,t,s)=>{s.d(t,{Cb:()=>n,HW:()=>l,JR:()=>i,JZ:()=>a,WR:()=>u,b6:()=>d,fT:()=>r,nC:()=>p,yM:()=>o});const r=[252,146,31,255],i=[153,153,153,255],n={type:"esriSMS",style:"esriSMSCircle",size:6,color:r,outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[153,153,153,255]}},o={type:"esriSLS",style:"esriSLSSolid",width:.75,color:r},u={type:"esriSFS",style:"esriSFSSolid",color:[252,146,31,196],outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[255,255,255,191]}},a={type:"esriTS",color:[255,255,255,255],font:{family:"arial-unicode-ms",size:10,weight:"bold"},horizontalAlignment:"center",kerning:!0,haloColor:[0,0,0,255],haloSize:1,rotated:!1,text:"",xoffset:0,yoffset:0,angle:0},p={type:"esriSMS",style:"esriSMSCircle",color:[0,0,0,255],outline:null,size:10.5},l={type:"esriSLS",style:"esriSLSSolid",color:[0,0,0,255],width:1.5},d={type:"esriSFS",style:"esriSFSSolid",color:[0,0,0,255],outline:null}}}]);