@arcgis/core 4.33.0-next.20250425 → 4.33.0-next.20250426
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.
- package/WebLinkChart.js +1 -1
- package/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{d696abbb1b13ac1a689b.js → 345993291540433d3d92.js} +1 -1
- package/assets/esri/core/workers/chunks/{db5913824d5e5a2a8365.js → 360c8cff7c3b25d2b2d2.js} +1 -1
- package/assets/esri/core/workers/chunks/73f9c3a74a815baa239c.js +1 -0
- package/assets/esri/core/workers/chunks/76575d2c1c56e37c1315.js +319 -0
- package/assets/esri/core/workers/chunks/{f2cef954b58c6604642c.js → 87dcfbbcf290e0fa5c0f.js} +160 -167
- package/assets/esri/core/workers/chunks/91acd69dcf7dac109017.js +1 -0
- package/assets/esri/core/workers/chunks/{265f69d153b7b6f07e42.js → 92836e3a2c5226296fec.js} +1 -1
- package/assets/esri/core/workers/chunks/{75a04b073231da70c18d.js → d44e99b4bb1cec6a922b.js} +1 -1
- package/assets/esri/themes/base/_core.scss +2 -0
- package/assets/esri/themes/base/widgets/_Legend.scss +64 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewerNavigationUI.scss +77 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
- package/chunks/boundedPlane.js +1 -1
- package/geometry/support/boundedPlane.js +1 -1
- package/interfaces.d.ts +328 -65
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/package.json +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/spikeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/FeatureProcessingContext.js +5 -0
- package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/Factory.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/SimpleFeatureRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/ViewSlice.js +5 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/AnalyticalSkyModel.glsl.js +3 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +15 -15
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +0 -9
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
- package/views/3d/webgl-engine/shaders/BlackLevelLightSoftCompression.glsl.js +10 -0
- package/views/SceneView.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
- package/webscene/types.d.ts +5 -0
- package/webscene/types.js +5 -0
- package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
- package/widgets/Legend/styles/card/SizeRamp.js +1 -1
- package/widgets/Legend/styles/classic/SizeRamp.js +1 -1
- package/widgets/Legend/styles/support/sizeRampUtils.js +5 -0
- package/widgets/Legend/styles/support/univariateUtils.js +1 -1
- package/widgets/Legend/styles/support/utils.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationNode.js +5 -0
- package/widgets/OrientedImageryViewer/components/NavigationUI.js +5 -0
- package/widgets/OrientedImageryViewer/components/NavigationUIViewModel.js +5 -0
- package/widgets/OrientedImageryViewer/components/imageNavigationUtils.js +5 -0
- package/widgets/OrientedImageryViewer/css.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/ShadowCast/DiscreteOptions.d.ts +4 -0
- package/widgets/ShadowCast/DiscreteOptions.js +1 -1
- package/widgets/ShadowCast/DurationOptions.d.ts +4 -0
- package/widgets/ShadowCast/DurationOptions.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/ShadowCast/ThresholdOptions.d.ts +4 -0
- package/widgets/ShadowCast/ThresholdOptions.js +1 -1
- package/widgets/TimeZoneLabel.js +1 -1
- package/assets/esri/core/workers/chunks/7c7ff11246479382974c.js +0 -1
- package/assets/esri/core/workers/chunks/b53300b46646cfad2526.js +0 -319
- package/assets/esri/core/workers/chunks/bd0dbad694ce5531deab.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 a,equals as i}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{equalsShallow as c}from"../../core/lang.js";import h from"../../core/Logger.js";import{clamp as u}from"../../core/mathUtils.js";import{abortMaybe as p,destroyMaybe as m}from"../../core/maybe.js";import d from"../../core/Promise.js";import{isAbortError as g,throwIfAborted as y,waitTick as f}from"../../core/promiseUtils.js";import v from"../../core/ReactiveMap.js";import{on as w,watch as b,syncAndInitial as F,initial as _}from"../../core/reactiveUtils.js";import{sqlAnd as P}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 S}from"../../core/accessorSupport/decorators/subclass.js";import{distance as C}from"../../core/libs/gl-matrix-2/math/vec2.js";import{isSerializable as k}from"../../core/support/jsonUtils.js";import{UpdatingHandles as V}from"../../core/support/UpdatingHandles.js";import{union as A}from"../../geometry/geometryEngineAsync.js";import R from"../../geometry/Multipoint.js";import G from"../../geometry/Point.js";import O from"../../geometry/Polygon.js";import L from"../../geometry/Polyline.js";import{projectWithZConversion as x}from"../../geometry/projection.js";import j from"../../geometry/SpatialReference.js";import{isClockwise as E}from"../../geometry/support/coordsUtils.js";import{geographicToWebMercator as B}from"../../geometry/support/webMercatorUtils.js";import z from"../../layers/GraphicsLayer.js";import{searchImages as H}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as D}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as T,computePolygonForInspection as U,resizePolygon as N,checkIfPolygonContainsSelectedPoint as W}from"../../layers/orientedImagery/core/coverageUtils.js";import{isConstantElevation as q,isElevationSource as $}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{imageToWorld as J,imageToWorldPanoramic as Z}from"../../layers/orientedImagery/transformations/imageToWorld.js";import K from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as Q}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{getInitialAngle as X,convertPixelToHeadingPitch as Y,getImageToWorldProperties as ee,getUpdateElevationProps as te,isElevationSampler as ae,getImageToWorldPanoramicProperties as ie,pointToArray as re,transformGraphicCoordinatesToPixel as se,getWorldToImageProperties as oe,convertHeadingPitchToSphereVertex as ne,or as le}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as ce,worldToImage as he}from"../../layers/orientedImagery/transformations/worldToImage.js";import{getFloorFilterClause as ue}from"../../layers/support/floorFilterUtils.js";import pe from"../../symbols/SimpleLineSymbol.js";import me from"../../views/draw/Draw.js";import{scale as de}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ge}from"../../views/input/InputManager.js";import ye from"../PanoramicViewer.js";import{invalidCameraHeading as fe,sectorsInOrder as ve,sectorsRadii as we}from"./constants.js";import{configureSketchTool as be,extractFieldsFromDataCaptureLayer as Fe,isValidDataCaptureLayer as _e,constructGraphicFromImageGeometry as Pe}from"./dataCaptureUtils.js";import{isFeatureAttachment as Ie,getImageSourceFromAttachment as Me}from"./galleryUtils.js";import{formatPixels as Se,heightMeasurementPanoramic as Ce,heightMeasurement2D as ke,calculateHeightAccuracyPanoramic as Ve,calculateHeightAccuracy as Ae,pixelAreaMeasurement2D as Re,pixelAreaMeasurementPanoramic as Ge,pixelDistanceMeasurement2D as Oe,pixelDistanceMeasurementPanoramic as Le,generateCombinations as xe,getRootOfSumOfSquaredErrors as je,generateCombinationsPanoramic as Ee,calculateLocationAccuracyFromDeviations as Be,calculateReferenceImagePointPanoramic as ze,calculateAnglePano as He,calculateTempImagePoint as De,calculateAngle as Te,getModeCorrectedPoint as Ue,calculateCorrectedPixel as Ne,calculateHeightFromTemporaryDistance as We}from"./imageMeasurementUtils.js";import{crossSymbol as qe,crossSymbol3D as $e,measurementPolygonSymbol as Je,polylineSymbolPanoramic as Ze,measurementPolylineSymbol as Ke,sourcePointSymbol as Qe,diamondSymbol as Xe,diamondSymbol3D as Ye,locationSymbol as et,locationSymbol3D as tt,activeSourcePointSymbol as at}from"./symbols.js";import{isNoAttachmentError as it,getContentType as rt,isTifOrMrf as st,filterOILLayerView as ot,isSceneView as nt,isGraphic as lt,calculateSegment as ct,calculateDirection as ht}from"./utils.js";import ut from"./components/ImageViewer.js";const pt={click:"view-click",imageClick:"image-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles",sketchHandles:"sketch-handles"},mt=new Set(["JPG","JPEG"]),dt=/\.(\w+)$/,gt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let yt=class extends(l.EventedMixin(d)){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,a)=>{const{currentBestFeature:i,selectedPoint:r,view:s}=this;if(s?.closePopup(),i&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(a),await this._loadImage(a)}catch(o){g(o)||(this.loadImageError(o),h.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.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=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 v,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 ut,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._overlays=new z({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new ye,this._previousCursor=null,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._updatingHandles=new V,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._updateGroundElevation=!1,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.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:a}=await t;return y(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=()=>{p(this._openPopupTask),this._openPopupTask=r((async e=>{const{currentBestFeature:a,popupEnabled:i,layer:r,view:s}=this;if(s?.closePopup(),!(s&&a&&i&&r))return;const{attributes:o,geometry:n}=a,l=new t({geometry:n,attributes:o.toJSON(),layer:r});y(e),await s.openPopup({features:[l],location:o.location.clone()})}))},this._createViewClickHandle=()=>{if(this.removeHandles(pt.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,ge.WIDGET),pt.click)},this._createImageClickHandle=()=>{this.removeHandles(pt.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;a.clickAction="pixel-location";let n=null;const l=w((()=>a),"pixel-location",(e=>{this.plotReferencePointOnImage(e),n?.abort(),n=r((async a=>{if(!e)return;const r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t}).then((e=>{const t=this.view?.spatialReference;return le(!t,e.spatialReference.equals(t))?e:x(e,t)}));y(a),this.plotReferencePointOnGround(r)}))}));this.addHandles(l,pt.imageClick)},this._createImageLocationHandle=()=>{this.removeHandles(pt.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;a.clickAction="pixel-location";let n=null;const l=w((()=>a),"pixel-location",(e=>{this.pixelCoordinates=e,this.plotLocationPointOnImage(e),n?.abort(),n=r((async a=>{if(!e)return;let r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t});y(a);const s=this.view?.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await x(r,s),y(a)),this.groundCoordinates=r;const n=await this.calculateLocationAccuracy(e,r,t,a);y(a),n&&(this.groundCoordinatesAccuracy=n)}))}));this.addHandles(l,pt.imageClick)},this._loadImage=async e=>{const{currentBestFeature:t,layer:a,mode:i}=this;if(this.clearGraphics(),!a||!t||"none"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:u,cameraOrientation:p,location:m}=r,d=(l??0)+(o??0),f=m.spatialReference.isWGS84&&4!==p?.type?B(m):new G(m);let v=s;if(Ie(s))try{v=await Me(a,u,e)}catch(w){if(g(w))return;return it(w)?(h.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${u}`)):(h.getLogger(this).error(w,{[a.objectIdField]:u,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${u}`))}try{await this.loadImageFromSource(v,{imageRotation:d,options:e,pitch:c,yaw:n,mode:i,cameraLocation:f}),y(e),await this.transformAndPlotSelectedLocation(e)}catch(w){g(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:a,imageRotation:i,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:l}=new URL(o);let c=s?n.match(dt)?.[1]:e.datasetFormat;if(!c)try{c=await rt(o,{...t.options})}catch(u){g(u)||h.getLogger(this).error("#getContentType()",u)}switch(c??="UNKNOWN FORMAT",a){case"default":this._imageViewer.imageSource={datasetFormat:c.toUpperCase(),url:o.split("?")[0]},this._imageViewer.customParameters=Object.fromEntries(l),this._imageViewer.imageRotation=i??0,await this._imageViewer.loadImage(r);break;case"panoramic":if(mt.has(c.toUpperCase())){const{selectedPoint:e}=this,{pitch:a,yaw:i,cameraLocation:s,viewAngle:n}=t;this._panoramicViewer.imageSource=o;let l=i??0;"number"==typeof n?l=n-l:s&&e&&(l=await X(s,e)-l),this._panoramicViewer.pitch=a??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");y(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");y(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:a,button:i,mapPoint:r}=e;if(("mouse"!==a||0===i)&&r)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))}))},this.plotSelectedPointOnImage=async(e,a)=>{if(await f(a),!e)return;const i=new G({...k(e)?e.toJSON():e});if("default"===this.mode)i.x-=.5,i.y=.5-i.y,i.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:i,symbol:qe}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=Y(e,i,r),n=ne(s,o);this._crossSymbol=new t({geometry:new G(n,j.WebMercator),symbol:$e}),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([b((()=>this.view),(()=>{this.load()}),F),b((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),_),b((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),_),b((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),F),b((()=>[this.state,this.imageLocationToolState,this.view]),(()=>{if(this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();this._setMeasurementCursor()}),F),b((()=>this.measureType),(()=>{this.clearPreviousMeasurements()}),F),b((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),F),b((()=>this.currentBestFeature),(async(e,t)=>{p(this._featureChangedTask),this._featureChangedTask=r((async a=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:a}]))),await this._featureChangedTask.promise}),{sync:!0}),b((()=>this.mode),(e=>{switch(this.removeHandles(pt.interactionHandles),e){case"default":this.addHandles(b((()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null}),(e=>{e&&(p(this._updateFootprintTask),this._updateFootprintTask=r((async t=>{await this.updateFootprint(e,{signal:t})})))}),{...F,equals:(e,t)=>i(e,t,c)}),pt.interactionHandles);break;case"panoramic":this.addHandles(b((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:a,vfov:i,hfov:r,pitch:s,yaw:o}=this._panoramicViewer;return e&&a&&!t.includes("loading")?[i,r,o,s]:null}),(e=>{if(!e||this.state.includes("loading"))return;const[t,a,i,s]=e;p(this._updateFootprintTask),this._updateFootprintTask=r((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:i,pitch:s},{signal:e})}))}),{...F,equals:(e,t)=>i(e,t,c)}),pt.interactionHandles)}}),F),b((()=>[this.brightness,this.contrast,this.sharpness]),(()=>{const{_imageViewer:e,brightness:t,contrast:a,mode:i,sharpness:r}=this;"default"===i&&(e.brightness=t,e.contrast=a,e.sharpness=r)}),F),b((()=>this.activeViewer?.imageRenderer),(()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}))]),this.when().finally((()=>{this.notifyChange("state")}))}destroy(){this._updateFootprintTask=p(this._updateFootprintTask),this._clickTask=p(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=m(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this._crossSymbol=m(this._crossSymbol),this._referencePointOnGround=m(this._referencePointOnGround),this._referencePointOnImage=m(this._referencePointOnImage),this._locationPointOnImage=m(this._locationPointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this._panoramicViewer.destroy()}get activeLayer(){return o(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:a}=this;switch(a){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",u(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",u(e,-10,10))}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return st(t)||Ie(t)}get imageLoaded(){return o(h.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===fe}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(ot(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ue(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const{horizontalFieldOfView:t,isSpherical:a}=e;return 360===t||a?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?ve.map((t=>e[t])):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",u(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t,_updatingHandles:{updating:a},_featureChangedTask:i}=this;if(t)return"disabled";if(!this.isFulfilled()||a||!1===i?.finished)return"loading";if(this.isRejected())return"error";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:a,imageRotation:i}})=>{const r=e?.trim();return st(r)||Ie(r)?{url:r,objectId:t,rotation:(a??0)+(i??0)}:null})).filter(a)):null}set view(e){this._set("view",e)}get _sketchGraphicsLayer(){const{mode:e}=this;switch(e){case"panoramic":return new z({elevationInfo:{mode:"absolute-height"}});case"default":return new z;case"none":return}}get _overlaysView(){return this.view?.layerViews.find((({layer:e})=>e===this._overlays))}async computeHeight(e,t,a=!0){const{currentBestFeature:i,activeViewer:r,layer:s,footprintExtent:o}=this,n=r?.imageSize,l=i?.attributes,c=s?.orientationAccuracy;if(!l||!n||!e||e.length<2||!c)return;const h="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ee(l,n[0],n[1]),u=e.at(0),p=e.at(-1);if(!(h&&u&&p&&c&&o))return;const m=[p,u],d=Se(m,!1),g="panoramic"===t?await Ce(m,h,c,i,!0,!1):await ke(m,h,c,!0,a);if(!g)return;const y="panoramic"===t?await Ve(c,d,h,g,i,!0):await Ae(c,d,h,g,!0);return y?{value:g,accuracy:y}:{value:g}}async calculateAreaMeasurement(e,t,a){if(e.length<3||!this.currentBestFeature||!this.activeViewer?.imageSize||"none"===t)return null;const i="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return y(a),i?"default"===t?await Re(e,i,!0):await Ge(e,i,!0,a):null}async calculateDistanceMeasurement(e,t,a){const{currentBestFeature:i,activeViewer:r}=this;if(e.length<2||!i||!r?.imageSize||"none"===t)return null;const s="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return y(a),s?"default"===t?await Oe([e.at(0),e.at(-1)],s,!0):await Le([e.at(0),e.at(-1)],s,!0):null}async calculateAccuracy(e,t,a){const{layer:i,currentBestFeature:r,activeViewer:s}=this,o=i?.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(y(a),!l)return null;const c="area"===t?await Re(e,l,!0):await Oe([e.at(0),e.at(-1)],l,!0);y(a);const{updateElevationProps:h,...u}=l,p=xe(u,o);if(!p?.length)return null;const m=p.map((e=>({...e,updateElevationProps:h}))).map((async i=>{const r="area"===t?await Re(e,i,!0):await Oe([e.at(0),e.at(-1)],i,!0);if(y(a),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);y(a);const g=d.filter((e=>null!==e));return 0===g.length?null:je(g)}async calculateLocationAccuracy(e,t,a="default",i){const{layer:r,currentBestFeature:s}=this,o=r?.orientationAccuracy,n=this.view?.spatialReference,l=o?.every((e=>0===e))||!o?.length;if(!s||l)return null;const c="default"===a?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();if(y(i),!c)return null;const{updateElevationProps:h,...u}=c,p="default"===a?xe(u,o):Ee(u,o);if(!p?.length)return null;const m=p.map((e=>({...e,updateElevationProps:h}))).map((async r=>{const{updateElevationProps:s,...o}=r;let l="default"===a?await J(e,o,s):await Z(e,o,s);return y(i),n&&!l.spatialReference.equals(n)&&(l=await x(l,n),y(i)),l&&t?[Math.abs(l.x-t.x),Math.abs(l.y-t.y),l.z&&t.z?Math.abs(l.z-t.z):0]:null})),d=await Promise.all(m);if(y(i),!d?.length)return null;const g=d.map((e=>[e?.[0]??0,e?.[1]??0,e?.[2]??0])),[f,v,w]=Be(g);return{x:f,y:v,z:w}}async calculateAccuracyPanoramic(e,t,a){const{layer:i,currentBestFeature:r,activeViewer:s,mode:o}=this,n=i?.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(y(a),!c)return null;const h="area"===t?await Ge(e,c,!0):await Le([e.at(0),e.at(-1)],c,!0);y(a);const{updateElevationProps:u,...p}=c,m=Ee(p,n);if(!m?.length)return null;const d=m.map((e=>({...e,updateElevationProps:u}))).map((async i=>{const r="area"===t?await Ge(e,i,!0):await Le([e.at(0),e.at(-1)],i,!0);if(y(a),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);y(a);const f=g.filter((e=>null!==e));return 0===f.length?null:je(f)}async calculateHeightMeasurementInfo(e,t,a){const{currentBestFeature:i,activeViewer:r}=this,s=r?.imageSize;if(!i||!r||!s?.length||"none"===t)return;const{attributes:o}=i,[n]=Se([e],"panoramic"!==t),l="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ee(o,s[0],s[1]);if("panoramic"===t){if(!l)return;const e=await ze(n,l,i,a);if(!e)return;e?.heading>180&&(e.heading-=360);const t=He(n,e),r=C([n.x,n.y],[e.x,e.y]);if(!t||!r)return;return{measurementAngle:t,tempDistance:r}}const c=await De(n,l,a);if(!c)return;const h=Te(n,c),u=C([n.x,n.y],[c.x,c.y]);return h&&u?{measurementAngle:h,tempDistance:u}:void 0}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}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:a,dataCaptureLayer:i}=this;if(!a)throw gt();be(i,e,a),await a.create(e,{...t,defaultZ:0})}async digitizeDelete(){if(!this.sketch)throw gt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw gt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw gt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw gt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw gt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw gt();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:a,mode:i}=this,r=t?.imageSize,s=e?.attributes;if(!s||!r)return;const o=await this.computeHeight(a,i);o?.value&&o?.accuracy&&(this.heightMeasurementResult=o.value,this.heightMeasurementAccuracy=o.accuracy)}filterByFootprints(e,t){const a=[],i=[],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,q(o.elevationSource)&&(o.elevationSource.constantElevation/=l);const{polygon:c,frustum:h}=T(o);if(n=c.clone(),o.isInspection&&(n=U(o)),s&&(n=N(n,s)),W(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!==fe&&(a.push(c),h&&i.push(h))}})),{features:r,polygons:a,frustums:i}}getMeasurementProperties(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=ee(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?x(n,j.WebMercator):Promise.resolve(n)).then((e=>(n=e,te((n.z??0)-s,{elevationSample:a,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:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=ie(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?x(n,j.WebMercator):Promise.resolve(n)).then((e=>(n=e,te((n.z??0)-s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&ae(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimagery","Data capture 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?.[ve[e]];t?.length&&this._updateCurrentBestFeature(t.at(0))}handleFeatureClick(e){const{sector:t,featureIndexInSector:a}=e;if(isNaN(a))return;const i=this._sectorData?.[t];i?.length&&this._updateCurrentBestFeature(i.at(a))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:a,heightMeasurementPixels:i,mode:r,activeViewer:s}=this,o=s?.imageSize;if(!e.vertices||!o)return;const n=Ue(e.vertices.at(-1),r,o);if(i.length<1||!n||!a||!t||"none"===r)return;const l=Ne(i[0],n,t);if(!l?.length)return;this.heightMeasurementPixels.push(l),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const c=We(this.heightMeasurementPixels,a);c&&(this.heightMeasurementResult=c)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:a,activeViewer:i,heightMeasurementPixels:r,mode:s}=this;if(!a||!i||!e.vertices?.length||"none"===s)return;const o=i?.imageSize;if(!r.length&&o){const a=Ue(e.vertices.at(-1),s,o);this.heightMeasurementPixels.push(a);const i=await this.calculateHeightMeasurementInfo(a,s,t);if(!i?.measurementAngle||!i?.tempDistance)return;this.measurementAngle=i.measurementAngle,this.tempDistance=i.tempDistance}}async load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch((e=>{if(!g(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?B(e):e.clone(),this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this._overlays?.removeAll(),this._fetchFeaturesWithController(e,t)}loadImageError(e){h.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:a}=await t;y(e),this.sketch=new a({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:a}=await t;if(y(e),this.sketchAdapter=new a({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async startMeasurement(e,t){await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:a,sketchAdapter:i,activeViewer:r,mode:s}=this;if(!a||!i||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(a.defaultCreateOptions.defaultZ=0),await a.create(e),"panoramic"===s){const{drawOperation:e}=a.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=Je(o),this.sketch.polylineSymbol="panoramic"===s?Ze:Ke(o))}startHeightMeasurement(){this.heightMeasurementPixels=[],this.displayNewMeasurementButton=!1,this.draw??=new me({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)],a=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new L({paths:[e],spatialReference:a});else{const i=new L({paths:[e],spatialReference:a}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:i,symbol:Ke(r,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}createPolylineGraphicPano(){const e=this.activeViewer?.imageRenderer.spatialReference,a=this.activeViewer?.imageSize;if(!a)return;const i={x:this.heightMeasurementPixels[0][0],y:this.heightMeasurementPixels[0][1]},r={x:this.heightMeasurementPixels.at(-1)[0],y:this.heightMeasurementPixels.at(-1)[1]},{heading:s,pitch:o}=Y(i,a[0],a[1]),{heading:n,pitch:l}=Y(r,a[0],a[1]),c=[[...ne(s,o)],[...ne(n,l)]];if(this.heightGraphic)this.heightGraphic.geometry=new L({paths:[c],spatialReference:e});else{const a=new L({paths:[c],spatialReference:e});this.heightGraphic=new t({geometry:a,symbol:Ze}),this._panoramicViewer.addGraphic(this.heightGraphic,0)}}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:a,currentBestFeature:i,overlayedCameraLocations:r,layer:s,mode:o,state:n}=this,l=a?.imageSize;if(!l||!i||!s||"none"===o||n.includes("loading"))return;const{polygon:c}=T(i.attributes);if(a.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await s.queryFeatures({where:`${s.objectIdField} <> ${i.attributes.objectId}`,geometry:c,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map((async e=>{const{attributes:a,geometry:r}=e,s=await this.getPixels(r,{feature:i,imageSize:l,mode:o}),n=Qe.clone();return n.outline=new pe({color:[0,0,0],width:1}),new t({attributes:a,symbol:n,geometry:s})})));r.addMany(n),a.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,i=!1){const{activeViewer:r,currentBestFeature:o,mode:n,state:l,layer:c}=this,u=r?.imageSize;if(!u||!o||"none"===n||l.includes("loading")||!c)return;const{polygon:p}=T(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:a}=Fe(e,c.imageGeometryField,c.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=a.name}catch(g){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:m}=await e.queryFeatures({geometry:p,returnGeometry:!0,outFields:["*"]}),d=new s((await Promise.all(m.map((async a=>{const r=a.symbol?.clone()??e.renderer?.getSymbol(a)?.clone(),{attributes:s,geometry:l}=a,c=l,{imageGeometryField:p,oiObjectIdField:m}=this;if(p&&m&&_e(e,p,m)&&`${s[m]}`==`${o.attributes.objectId}`)try{return Pe(s,p,e,i,u,n,r)}catch(g){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:g,feature:a,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}switch(c?.type){case"point":{const a=await this.getPixels(c,{feature:o,imageSize:u,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:a,visible:e.visible&&i})}case"polygon":{const{rings:a,spatialReference:l}=c,h=a.map((e=>e.map((([e,t,a])=>new G({x:e,y:t,z:a,spatialReference:l}))))),p=await Promise.all(h.map((async e=>this.getPixels(e,{feature:o,imageSize:u,mode:n}).then((e=>e.map(re))))));return new t({attributes:s,layer:e,symbol:r,geometry:new O({rings:p,spatialReference:j.WebMercator}),visible:e.visible&&i})}case"polyline":{const{paths:a,spatialReference:l}=c,h=a.map((e=>e.map((([e,t,a])=>new G({x:e,y:t,z:a,spatialReference:l}))))),p=await Promise.all(h.map((async e=>this.getPixels(e,{feature:o,imageSize:u,mode:n}).then((e=>e.map(re))))));return new t({attributes:s,layer:e,symbol:r,geometry:new L({paths:p,spatialReference:j.WebMercator}),visible:e.visible&&i})}case"multipoint":{const{points:a,spatialReference:l}=c,h=a.map((([e,t,a])=>new G({x:e,y:t,z:a,spatialReference:l}))),p=await this.getPixels(h,{feature:o,imageSize:u,mode:n}).then((e=>e.map(re)));return new t({attributes:s,layer:e,symbol:r,geometry:new R({points:p,spatialReference:j.WebMercator}),visible:e.visible&&i})}}return null})))).filter(a));this.overlayGraphicsOnImage(`${e.id}`,d)}async getPixels(e,t){const{imageSize:a,mode:i}=t,r=(await this.worldToImage(Array.isArray(e)?e:[e])).map((e=>{if("default"===i)return new G({x:e.x-.5,y:.5-e.y,spatialReference:j.WebMercator});const[t,r]=a,{heading:s,pitch:o}=Y(e,t,r),n=ne(s,o);return new G(n,j.WebMercator)}));return Array.isArray(e)?r:r[0]}async getMapPoint(e,t){const{feature:a,mode:i,imageSize:r}=t,{elevationSample:s,attributes:o}=a,{elevationSource:n,location:l,elevation:c,cameraHeight:h}=o;let u=l.clone();u.spatialReference.isGeographic&&(u=await x(u,j.WebMercator));const p=await te(c??(l.z??0)-h,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let m;if("elevationSample"in p&&ae(p.elevationSample)&&(a.elevationSample=p.elevationSample),"default"===i){const t=ee(o,r[0],r[1]);m=await J(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}else{const t=ie(o,r[0],r[1]);m=await Z(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:Xe}),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 a=k(e)?e.toJSON():e;a.x-=.5,a.y=.5-a.y,this._referencePointOnImage=new t({geometry:new G({spatialReference:this._imageViewer.imageRenderer.spatialReference,...a}),symbol:Xe}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=Y(e,i,r),n=ne(s,o);this._referencePointOnImage=new t({geometry:new G(n,j.WebMercator),symbol:Ye}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}plotLocationPointOnImage(e){if("image-loaded"===this.state)switch(this.clearLocationPointOnImage(),this.mode){case"default":this._plotLocationPointOnDefaultImage(e);break;case"panoramic":this._plotLocationPointOnPanoramicImage(e)}}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=p(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{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:a,savedGraphics:i}=t,r=a.get(e.id),s=r?.toArray();if(!r||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce(((t,{objectId:a,globalId:i,error:r},o)=>{const n=s[o],{attributes:l}=n;return r?t.error.push(n):(a&&(l[e.objectIdField]=a),i&&e.globalIdField&&(l[e.globalIdField]=i),t.success.push(n)),t}),{success:[],error:[]});i.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDataCaptureFeatures(e){const{activeViewer:t,currentBestFeature:i,dataCaptureLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!i||"none"===s)throw new n("orientedimagery","Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("orientedimagery","Data capture layer is not available");const l=await Promise.all(e.map((async e=>{const t=e.clone(),{geometry:a}=t;if(!a)return;const n=a.type,l=r.hasZ,c=r.geometryType,h=n!==c,u=h?await import("./transformers.js"):null,p=u?.default[c],m=h?p?.(a):a;if(m)switch(m.type){case"point":return t.geometry=await this.getMapPoint(se(s,m,o),{feature:i,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,a])=>se(s,{x:e,y:t,z:a},o))),{feature:i,imageSize:o,mode:s}))));return t.geometry=new O({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,rings:e.map((e=>e.map(re)))}),t}case"polyline":{const e=await Promise.all(m.paths.map((async e=>this.getMapPoint(e.map((([e,t,a])=>se(s,{x:e,y:t,z:a},o))),{feature:i,imageSize:o,mode:s}))));return t.geometry=new L({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,paths:e.map((e=>e.map(re)))}),t}}}))),c=l.filter(a);return r.applyEdits({addFeatures:c}).then((e=>{const{addFeatureResults:t}=e;let a=0;const i=l.map((e=>{const i=t[a++];return e?i:{error:new n("orientedimagery","Error in saving data capture features"),objectId:null,globalId:null}}));return{...e,addFeatureResults:i}}))}async searchBestImage(e,t){try{const a=await H(e,t);a&&await this._processFeatureResponse(a,e.point,{signal:t?.signal})}catch(a){g(a)||(this.setMessage("imageLoadError","error",a.message),h.getLogger(this).error("error occurred while finding best image",a))}}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 startDataCapture(e,t){const a=this.activeViewer?.imageRenderer,{oiObjectIdField:i,currentBestFeature:r}=this;if(!a||!r||!i)return;const{attributes:{objectId:o}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],c=[];for(const s of n)`${s.getAttribute(i)}`==`${o}`?l.push(s):c.push(s);this.overlayGraphicsOnImage(e.id,new s(c)),this.collectionId=e.id;const h=await this.loadSketch(t),u=await this.loadDataCaptureAdapter(t);y(t),h.layer.addMany(l),h.layer.blendMode="source-atop",u.savedGraphics.addMany(l);a.ui.find("zoom").visible=!1,a.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=m(this.sketchAdapter),this.sketch=m(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,a=this.activeViewer?.imageRenderer;if(!a||a.destroyed)return;a.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const i=a.ui.find("zoom");i&&(i.visible=!0)}stopMeasurement(){this.heightMeasurementPixels=[],this.draw?.reset(),this.sketch?.cancel()}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach((t=>{this._toggleVisiblity(t,e)}))}toggleOverlayMapFeatures(e,t){const a=this.overlayedMapFeatures.get(e);a&&this._toggleVisiblity(a,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{selectedLocation:t,options:a}=e;let i=!1,r=!1;const s=this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=t.spatialReference.equals(s.spatialReference)?t:await x(t,s.spatialReference);i=s.contains(e);break}case"mesh":{const e=t.spatialReference.equals(s.spatialReference)?t:await x(t,s.spatialReference);r=s.extent.contains(e);break}}if(!i&&!r)return void this.clearReferencePointOnImage();const o=await this.worldToImage(t,a);if(o)return y(a),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 a=this.layer;if(a){const i={include:a},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,i);return this._processHitTestResults(a,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(a){if(g(a))return;this.setMessage("imageLoadError","error"),h.getLogger(this).error("error occurred while fetching features",a)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,currentBestFeature:a,features:i,invalidCameraHeading:r}=this;if(!e||!t||!a||!i||r)return void(this._sectorData=null);this._sectorData={};for(const c of ve)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:a,featureIndex:r}=e,s=t/l*we[2],o=ct(t,l),n=ht(a);if(!this._sectorData)return;const c=we[3]+s*Math.sin(a*Math.PI/180),h=we[3]+s*Math.cos(a*Math.PI/180);let u;const p=i.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-we[3],t=h-we[3],a=t/Math.sqrt(e**2+t**2);let i=180*Math.acos(a)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(i*=-1),u=i}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:a,featureIndex:r,x:c,y:h,objectID:p.attributes.objectId,sector:g,featureIndexInSector:y.length})}))}_plotLocationPointOnDefaultImage(e){const a=k(e)?e.toJSON():e;a.x-=.5,a.y=.5-a.y,this._locationPointOnImage=new t({geometry:new G({spatialReference:this._imageViewer.imageRenderer.spatialReference,...a}),symbol:et}),this._imageViewer.addGraphic(this._locationPointOnImage,0)}_plotLocationPointOnPanoramicImage(e){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=Y(e,i,r),n=ne(s,o);this._locationPointOnImage=new t({geometry:new G(n,j.WebMercator),symbol:tt}),this._panoramicViewer.addGraphic(this._locationPointOnImage,0)}async _processFeatureResponse(e,t,a){const{features:i}=e;if(!i?.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(i,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 a of s)e=await A(e,a);const t=[];for(const{geometry:a}of r)e.contains(a)||t.push([a.x,a.y]);if(t.sort(((e,t)=>+E([e,t]))),e.addRing(t),this.footprintExtent=de(e.extent,2,2),this.view?.supportsGround)try{n=await this.view.map.ground.createElevationSampler(this.footprintExtent,a)}catch(l){g(l)||h.getLogger(this).error(l)}}if((n||r[0].attributes.elevationSource)&&this.footprintExtent){const e=r[0].attributes.elevationSource;$(e)&&!n&&(n=await Q({extent:this.footprintExtent,lod:e.lod,url:e.url,rasterFunction:e.rasterFunction}));const a=await te((r[0].attributes.location.z??0)-r[0].attributes.cameraHeight,{elevationSample:n,elevationSource:e,extent:this.footprintExtent}),[i,...s]=await K([t,...r.map((e=>e.attributes.geometry.clone()))],a);r[0].elevationSample=n??a.elevationSample,t.elevation=i.z,r.forEach(((e,t)=>{e.attributes.elevation=s[t].z}))}r[0].elevationSample&&r.forEach((e=>{e.elevationSample=r[0].elevationSample})),this._suitabilities=D({features:r,selectedPoint:t,camera:nt(this.view)?this.view.camera:null,currentImage:this.currentBestFeature}),this.updateSuitabilities(this._suitabilities)}async _processHitTestResults(e,t,a){const{screenPoint:i,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(i);if(!o)return;const{layerFloorFilterClause:n}=this,l=e.spatialReference.equals(o.spatialReference)?o:await x(o,e.spatialReference),c=P("1=1",P(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,a)}_resetCursor(){const{activeViewer:e}=this;e&&(e.imageRenderer.cursor=this._previousCursor)}_setMeasurementCursor(){const{activeViewer:e}=this;e&&(this._previousCursor=e.imageRenderer.cursor,e.imageRenderer.cursor="crosshair")}_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._updateGroundElevation=!0,this.currentBestFeature=e[0]}async _updatePointsAndPolygons(e){const{pointSources:a,currentBestFeature:i,currentCoverageVisible:r,isAdditionalPointSourcesVisible:s}=this;if(i&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),y(e);for(const e of a)e.imageID===i.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:at,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:Qe,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 a;if(t)a=-90;else{const t=e.x-we[3],i=e.y-we[3],r=i/Math.sqrt(t**2+i**2);let s=180*Math.acos(r)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(s*=-1),a=s}a===this.bestFeatureAngle?this.previousFeatureAngle=a:this.bestFeatureAngle=a,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=m(this._referencePointOnImage))}clearLocationPointOnImage(){this._locationPointOnImage&&(this._imageViewer.removeGraphic(this._locationPointOnImage),this._panoramicViewer.removeGraphic(this._locationPointOnImage),this._locationPointOnImage=m(this._locationPointOnImage))}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}setMessage(e,t,a,i){this.displayMessage={key:e,type:t,data:a,map:i}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:a,selectedPoint:i,activeViewer:r}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=m(this._crossSymbol)),!i||!t||"image-loaded"!==r?.state||a)return;let s;try{s=await this.worldToImage(i,e),y(e),await this.plotSelectedPointOnImage(s,e)}catch(o){g(o)||h.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:i,feature:t})}}async worldToImage(e,t){const{footprintExtent:a}=this,{imageSize:i}=this.activeViewer;if("none"===this.mode||!this.currentBestFeature||!i||!a)return;const{attributes:{location:r,elevationSource:s,cameraHeading:o,elevation:n,cameraHeight:l},elevationSample:c}=this.currentBestFeature;let h=r.clone();const u=await te(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(K(e,u));t(e)})))));if(r.spatialReference.isGeographic&&(h=await x(h,j.WebMercator,t)),d=await Promise.all(d.map((async e=>h.spatialReference.equals(e.spatialReference)?e:await x(e,h.spatialReference,t)))),y(t),"panoramic"===this.mode)m=ce(d,{imageHeight:i[1],imageWidth:i[0],cameraHeading:o,cameraLocation:h});else{const e=oe(this.currentBestFeature.attributes,i[0],i[1]);m=he(d,{...e,cameraLocation:h})}return Array.isArray(e)?m:m[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:a,additionalCameraLocations:i,currentBestFeature:r,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:l,_adapter:c,mode:h}=this,{attributes:{objectId:u},elevationSample:p}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),l){const e=[...a,...i,s].filter(lt);l.supportsGround&&p&&c?.updateGroundElevation&&(this._updateGroundElevation&&c.updateGroundElevation(e,p),"panoramic"===h&&c.updateGroundElevation([this.bestFeatureCurrentFootprint],p)),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:qe.clone(),attributes:{imageID:u}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,l?.supportsGround&&p&&c?.updateGroundElevation&&"panoramic"===h&&c.updateGroundElevation([e],p),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([M()],yt.prototype,"activeLayer",null),e([M({readOnly:!0})],yt.prototype,"activeViewer",null),e([M()],yt.prototype,"accuracyParametersMissing",null),e([M()],yt.prototype,"additionalFeatures",void 0),e([M({type:s.ofType(t)})],yt.prototype,"additionalCameraLocations",void 0),e([M({type:s.ofType(t)})],yt.prototype,"additionalFootprints",void 0),e([M()],yt.prototype,"areaMeasurementResult",void 0),e([M()],yt.prototype,"areaMeasurementAccuracy",void 0),e([M()],yt.prototype,"bestFeatureAngle",void 0),e([M()],yt.prototype,"bestFeatureCurrentFootprint",void 0),e([M({type:t})],yt.prototype,"bestFeatureFootprint",void 0),e([M({type:Number})],yt.prototype,"brightness",null),e([M()],yt.prototype,"collectionId",void 0),e([M({type:Number})],yt.prototype,"contrast",null),e([M()],yt.prototype,"conversionProps",void 0),e([M()],yt.prototype,"coverageFrustums",void 0),e([M()],yt.prototype,"coveragePolygons",void 0),e([M()],yt.prototype,"currentBestFeature",void 0),e([M()],yt.prototype,"currentBestFeatureLocation",void 0),e([M()],yt.prototype,"currentCoverageVisible",void 0),e([M({json:{write:!1}})],yt.prototype,"determineWorkflowForFeature",void 0),e([M()],yt.prototype,"disabled",void 0),e([M()],yt.prototype,"displayMessage",void 0),e([M()],yt.prototype,"displayNewMeasurementButton",void 0),e([M()],yt.prototype,"distanceMeasurementResult",void 0),e([M()],yt.prototype,"distanceAccuracyArray",void 0),e([M()],yt.prototype,"dataCaptureLayer",void 0),e([M({readOnly:!0})],yt.prototype,"featureCount",null),e([M()],yt.prototype,"features",void 0),e([M()],yt.prototype,"groundCoordinates",void 0),e([M()],yt.prototype,"groundCoordinatesAccuracy",void 0),e([M()],yt.prototype,"heightMeasurementPixels",void 0),e([M()],yt.prototype,"heightGraphic",void 0),e([M()],yt.prototype,"heightMeasurementResult",void 0),e([M()],yt.prototype,"heightMeasurementAccuracy",void 0),e([M()],yt.prototype,"measurementAngle",void 0),e([M()],yt.prototype,"tempDistance",void 0),e([M({readOnly:!0})],yt.prototype,"imageGalleryEnabled",null),e([M()],yt.prototype,"imageGeometryField",void 0),e([M({readOnly:!0})],yt.prototype,"imageLoaded",null),e([M()],yt.prototype,"imageLocationToolState",void 0),e([M({readOnly:!0})],yt.prototype,"invalidCameraHeading",null),e([M()],yt.prototype,"imagePointsInView",null),e([M()],yt.prototype,"isAdditionalCoverageVisible",void 0),e([M()],yt.prototype,"isAdditionalPointSourcesVisible",void 0),e([M()],yt.prototype,"layer",void 0),e([M()],yt.prototype,"layerView",null),e([M({readOnly:!0})],yt.prototype,"layerFloorFilterClause",null),e([M({type:Number})],yt.prototype,"localPort",void 0),e([M()],yt.prototype,"mapImageConversionToolState",void 0),e([M()],yt.prototype,"measureType",void 0),e([M()],yt.prototype,"measurementGraphic",void 0),e([M({readOnly:!0,value:"none"})],yt.prototype,"mode",null),e([M()],yt.prototype,"navigatorCurrentBestFeature",void 0),e([M()],yt.prototype,"oiObjectIdField",void 0),e([M({type:s.ofType(t)})],yt.prototype,"overlayedCameraLocations",void 0),e([M()],yt.prototype,"overlayedMapFeatures",void 0),e([M()],yt.prototype,"pixelCoordinates",void 0),e([M()],yt.prototype,"pointSources",void 0),e([M({readOnly:!0})],yt.prototype,"popupEnabled",null),e([M()],yt.prototype,"previousFeatureAngle",void 0),e([M()],yt.prototype,"referencePoint",null),e([M({readOnly:!0})],yt.prototype,"sectorData",null),e([M()],yt.prototype,"selectedPoint",void 0),e([M({type:Number})],yt.prototype,"sharpness",null),e([M()],yt.prototype,"shouldShowSelectedImage",void 0),e([M()],yt.prototype,"sketch",void 0),e([M()],yt.prototype,"draw",void 0),e([M()],yt.prototype,"sketchAdapter",void 0),e([M({readOnly:!0})],yt.prototype,"sketchGraphicsLayer",null),e([M({readOnly:!0})],yt.prototype,"state",null),e([M({readOnly:!0})],yt.prototype,"thumbnails",null),e([M()],yt.prototype,"updateFootprint",void 0),e([M()],yt.prototype,"updateFootprintPanorama",void 0),e([M({value:null})],yt.prototype,"view",null),e([M()],yt.prototype,"_adapter",void 0),e([M()],yt.prototype,"_sketchGraphicsLayer",null),e([M()],yt.prototype,"_highlightedFeatureHandle",void 0),e([M()],yt.prototype,"_imageViewer",void 0),e([M()],yt.prototype,"_initialCurrentCoverageUpdate",void 0),e([M()],yt.prototype,"_locationPointOnImage",void 0),e([M()],yt.prototype,"_overlays",void 0),e([M({readOnly:!0})],yt.prototype,"_overlaysView",null),e([M()],yt.prototype,"_panoramicViewer",void 0),e([M()],yt.prototype,"_previousCursor",void 0),e([M()],yt.prototype,"_referencePointOnGround",void 0),e([M()],yt.prototype,"_referencePointOnImage",void 0),e([M()],yt.prototype,"_sectorData",void 0),e([M({readOnly:!0})],yt.prototype,"_updatingHandles",void 0),e([M()],yt.prototype,"footprintExtent",void 0),e([M()],yt.prototype,"_featureChangedTask",void 0),yt=e([S("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],yt);const ft=yt;export{ft 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{equalsShallow as c}from"../../core/lang.js";import h from"../../core/Logger.js";import{clamp as u,deg2rad 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{whenOnce as b,on as F,watch as _,syncAndInitial as P,initial as I}from"../../core/reactiveUtils.js";import{sqlAnd as M}from"../../core/sql.js";import{getMetersPerUnitForSR as S}from"../../core/unitUtils.js";import{property as C}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{distance as A}from"../../core/libs/gl-matrix-2/math/vec2.js";import{isSerializable as V}from"../../core/support/jsonUtils.js";import{UpdatingHandles as G}from"../../core/support/UpdatingHandles.js";import{union as R}from"../../geometry/geometryEngineAsync.js";import O from"../../geometry/Multipoint.js";import L from"../../geometry/Point.js";import x from"../../geometry/Polygon.js";import j from"../../geometry/Polyline.js";import{projectWithZConversion as E}from"../../geometry/projection.js";import z from"../../geometry/SpatialReference.js";import{isClockwise as B}from"../../geometry/support/coordsUtils.js";import{geographicToWebMercator as D}from"../../geometry/support/webMercatorUtils.js";import H from"../../layers/GraphicsLayer.js";import{searchImages as T}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as N}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as U,computePolygonForInspection as W,resizePolygon as q,checkIfPolygonContainsSelectedPoint as $}from"../../layers/orientedImagery/core/coverageUtils.js";import{isConstantElevation as J,isElevationSource as Z}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{imageToWorld as K,imageToWorldPanoramic as Q}from"../../layers/orientedImagery/transformations/imageToWorld.js";import X from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as Y}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{getInitialAngle as ee,convertPixelToHeadingPitch as te,getImageToWorldProperties as ie,getUpdateElevationProps as ae,isElevationSampler as re,getImageToWorldPanoramicProperties as se,pointToArray as oe,transformGraphicCoordinatesToPixel as ne,getWorldToImageProperties as le,convertHeadingPitchToSphereVertex as ce,or as he}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as ue,worldToImage as pe}from"../../layers/orientedImagery/transformations/worldToImage.js";import{getFloorFilterClause as me}from"../../layers/support/floorFilterUtils.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,extractFieldsFromDataCaptureLayer as Pe,isValidDataCaptureLayer as Ie,constructGraphicFromImageGeometry as Me}from"./dataCaptureUtils.js";import{isFeatureAttachment as Se,getImageSourceFromAttachment as Ce}from"./galleryUtils.js";import{formatPixels as ke,heightMeasurementPanoramic as Ae,heightMeasurement2D as Ve,calculateHeightAccuracyPanoramic as Ge,calculateHeightAccuracy as Re,pixelAreaMeasurement2D as Oe,pixelAreaMeasurementPanoramic as Le,pixelDistanceMeasurement2D as xe,pixelDistanceMeasurementPanoramic as je,generateCombinations as Ee,getRootOfSumOfSquaredErrors as ze,generateCombinationsPanoramic as Be,calculateLocationAccuracyFromDeviations as De,calculateReferenceImagePointPanoramic as He,calculateAnglePano as Te,calculateTempImagePoint as Ne,calculateAngle as Ue,getModeCorrectedPoint as We,calculateCorrectedPixel as qe,calculateHeightFromTemporaryDistance as $e}from"./imageMeasurementUtils.js";import{crossSymbol as Je,crossSymbol3D as Ze,measurementPolygonSymbol as Ke,polylineSymbolPanoramic as Qe,measurementPolylineSymbol as Xe,sourcePointSymbol as Ye,diamondSymbol as et,diamondSymbol3D as tt,locationSymbol as it,locationSymbol3D as at,activeSourcePointSymbol as rt}from"./symbols.js";import{isNoAttachmentError as st,getContentType as ot,isTifOrMrf as nt,filterOILLayerView as lt,assignElevationSampleToFeatures as ct,isSceneView as ht,isGraphic as ut,calculateSegment as pt,calculateDirection as mt}from"./utils.js";import dt from"./components/ImageViewer.js";import gt from"./components/NavigationNode.js";const yt={click:"view-click",imageClick:"image-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles",sketchHandles:"sketch-handles"},ft=new Set(["JPG","JPEG"]),vt=/\.(\w+)$/,wt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first"),bt=5;let Ft=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.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:a,selectedPoint:r,view:s}=this;if(s?.closePopup(),a&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadImage(i)}catch(o){y(o)||(this.loadImageError(o),h.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.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=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 dt,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._overlays=new H({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new ve,this._previousCursor=null,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._featureToSector=null,this._updatingHandles=new G,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._updateGroundElevation=!1,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.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:i}=await t;return f(e),this.sketchAdapter=new i({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.afterNavigate=async(e,t,i)=>this.selectBestFeature(t.id,i).then((i=>(this._panoramicViewer.yaw=e.currentHeading-t.heading,this._panoramicViewer.pitch=e.currentPitch-t.pitch,i))),this.queryAndProcessNavigationNode=async(e,t,i)=>{const{layer:a,layerFloorFilterClause:r}=this;if(!a)return null;const{currentHeading:s,currentPitch:o}=e,{attributes:{farDistance:n},geometry:l}=t,{x:c,y:h,spatialReference:u}=l,m=u.isGeographic?1:S(u),d=n/(bt*m),g=d*Math.sin(p(s))*Math.sin(p(o)),y=d*Math.sin(p(o))*Math.cos(p(s)),v=M("1=1",M(a.definitionExpression,r)),w=new L(c+g,h+y,u);this.selectedPoint=w;const b=await T({layerInstanceOrURL:a,point:w,queryParams:{where:v,maximumDistance:a.maximumDistance?a.maximumDistance/m:void 0}},i);return f(i),await this._processFeatureResponse(b,w,{loadBestImage:!1,signal:i?.signal}),f(i),this.afterNavigate(e,t)},this.navigate=async(e,t)=>{const{currentNode:i}=this;if(!i)return null;const a=this.currentNode?.[e];if(!a)return null;const r=this._suitabilities.find((e=>e.feature.attributes.objectId===a.id)),s=this._featureToSector[`${a.id}`],[o,n]=s.split("_"),l=`NEAR_${n}`,c=`FAR_${n}`,h=this._activeSectors?.includes(l),u=this._activeSectors?.includes(c);return r&&(n===s&&!h&&!u||s===l&&!u||s===c)?this.queryAndProcessNavigationNode(i,a,t):this.afterNavigate(i,a,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(f(t),this.currentBestFeature=this.features?.find((({attributes:t})=>`${t.objectId}`==`${e}`)),b((()=>"image-loaded"===this.state),t)),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(yt.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),yt.click)},this._createImageClickHandle=()=>{this.removeHandles(yt.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=F((()=>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 he(!t,e.spatialReference.equals(t))?e:E(e,t)}));f(i),this.plotReferencePointOnGround(r)}))}));this.addHandles(l,yt.imageClick)},this._createImageLocationHandle=()=>{this.removeHandles(yt.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=F((()=>i),"pixel-location",(e=>{this.pixelCoordinates=e,this.plotLocationPointOnImage(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 E(r,s),f(i)),this.groundCoordinates=r;const n=await this.calculateLocationAccuracy(e,r,t,i);f(i),n&&(this.groundCoordinatesAccuracy=n)}))}));this.addHandles(l,yt.imageClick)},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:u,cameraOrientation:p,location:m}=r,d=(l??0)+(o??0),g=m.spatialReference.isWGS84&&4!==p?.type?D(m):new L(m);let v=s;if(Se(s))try{v=await Ce(i,u,e)}catch(w){if(y(w))return;return st(w)?(h.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${i.objectIdField}: ${u}`)):(h.getLogger(this).error(w,{[i.objectIdField]:u,layer:i}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${i.objectIdField} ${u}`))}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(vt)?.[1]:e.datasetFormat;if(!c)try{c=await ot(o,{...t.options})}catch(u){y(u)||h.getLogger(this).error("#getContentType()",u)}switch(c??="UNKNOWN FORMAT",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(ft.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 ee(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 L({...V(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:Je}),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}=te(e,a,r),n=ce(s,o);this._crossSymbol=new t({geometry:new L(n,z.WebMercator),symbol:Ze}),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)}initialize(){this.addHandles([_((()=>this.view),(()=>{this.load()}),P),_((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),I),_((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),I),_((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),P),_((()=>[this.state,this.imageLocationToolState,this.view]),(()=>{if(this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();this._setMeasurementCursor()}),P),_((()=>this.measureType),(()=>{this.clearPreviousMeasurements()}),P),_((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),P),_((()=>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}),_((()=>this.mode),(e=>{switch(this.removeHandles(yt.interactionHandles),e){case"default":this.addHandles(_((()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null}),(e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=r((async t=>{await this.updateFootprint(e,{signal:t})})))}),{...P,equals:(e,t)=>a(e,t,c)}),yt.interactionHandles);break;case"panoramic":this.addHandles(_((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:i,vfov:a,hfov:r,pitch:s,yaw:o}=this._panoramicViewer;return e&&i&&!t.includes("loading")?[a,r,o,s]:null}),(e=>{if(!e||this.state.includes("loading"))return;const[t,i,a,s]=e;this.currentNode&&(this.currentNode.currentHeading=a+(this.currentNode.heading??0),this.currentNode.currentPitch=s+(this.currentNode.pitch??0)),m(this._updateFootprintTask),this._updateFootprintTask=r((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:a,pitch:s},{signal:e})}))}),{...P,equals:(e,t)=>a(e,t,c)}),yt.interactionHandles)}}),P),_((()=>[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)}),P),_((()=>this.activeViewer?.imageRenderer),(()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)})),F((()=>this.features),"change",(()=>{this.navigationNodes.removeAll(),this.features.forEach((e=>{const t=new gt({geometry:e.geometry,attributes:e.attributes});this.navigationNodes.add(t)}))}))]),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._locationPointOnImage=d(this._locationPointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this._panoramicViewer.destroy()}get activeLayer(){return o(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(h.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",u(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",u(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t?.find((t=>t.id===e?.attributes.objectId))}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return nt(t)||Se(t)}get imageLoaded(){return o(h.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(lt(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?me(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",u(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t,_updatingHandles:{updating:i},_featureChangedTask:a}=this;if(t)return"disabled";if(!this.isFulfilled()||i||!1===a?.finished)return"loading";if(this.isRejected())return"error";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 nt(r)||Se(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))}get _activeSectors(){return be.filter((e=>this._sectorData?.[e]?.length))}async computeHeight(e,t,i=!0){const{currentBestFeature:a,activeViewer:r,layer:s,footprintExtent:o}=this,n=r?.imageSize,l=a?.attributes,c=s?.orientationAccuracy;if(!l||!n||!e||e.length<2||!c)return;const h="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ie(l,n[0],n[1]),u=e.at(0),p=e.at(-1);if(!(h&&u&&p&&c&&o))return;const m=[p,u],d=ke(m,!1),g="panoramic"===t?await Ae(m,h,c,a,!0,!1):await Ve(m,h,c,!0,i);if(!g)return;const y="panoramic"===t?await Ge(c,d,h,g,a,!0):await Re(c,d,h,g,!0);return y?{value:g,accuracy:y}:{value:g}}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 Oe(e,a,!0):await Le(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 xe([e.at(0),e.at(-1)],s,!0):await je([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 Oe(e,l,!0):await xe([e.at(0),e.at(-1)],l,!0);f(i);const{updateElevationProps:h,...u}=l,p=Ee(u,o);if(!p?.length)return null;const m=p.map((e=>({...e,updateElevationProps:h}))).map((async a=>{const r="area"===t?await Oe(e,a,!0):await xe([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));return 0===g.length?null:ze(g)}async calculateLocationAccuracy(e,t,i="default",a){const{layer:r,currentBestFeature:s}=this,o=r?.orientationAccuracy,n=this.view?.spatialReference,l=o?.every((e=>0===e))||!o?.length;if(!s||l)return null;const c="default"===i?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();if(f(a),!c)return null;const{updateElevationProps:h,...u}=c,p="default"===i?Ee(u,o):Be(u,o);if(!p?.length)return null;const m=p.map((e=>({...e,updateElevationProps:h}))).map((async r=>{const{updateElevationProps:s,...o}=r;let l="default"===i?await K(e,o,s):await Q(e,o,s);return f(a),n&&!l.spatialReference.equals(n)&&(l=await E(l,n),f(a)),l&&t?[Math.abs(l.x-t.x),Math.abs(l.y-t.y),l.z&&t.z?Math.abs(l.z-t.z):0]:null})),d=await Promise.all(m);if(f(a),!d?.length)return null;const g=d.map((e=>[e?.[0]??0,e?.[1]??0,e?.[2]??0])),[y,v,w]=De(g);return{x:y,y:v,z:w}}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 Le(e,c,!0):await je([e.at(0),e.at(-1)],c,!0);f(i);const{updateElevationProps:u,...p}=c,m=Be(p,n);if(!m?.length)return null;const d=m.map((e=>({...e,updateElevationProps:u}))).map((async a=>{const r="area"===t?await Le(e,a,!0):await je([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));return 0===y.length?null:ze(y)}async calculateHeightMeasurementInfo(e,t,i){const{currentBestFeature:a,activeViewer:r}=this,s=r?.imageSize;if(!a||!r||!s?.length||"none"===t)return;const{attributes:o}=a,[n]=ke([e],"panoramic"!==t),l="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ie(o,s[0],s[1]);if("panoramic"===t){if(!l)return;const e=await He(n,l,a,i);if(!e)return;e?.heading>180&&(e.heading-=360);const t=Te(n,e),r=A([n.x,n.y],[e.x,e.y]);if(!t||!r)return;return{measurementAngle:t,tempDistance:r}}const c=await Ne(n,l,i);if(!c)return;const h=Ue(n,c),u=A([n.x,n.y],[c.x,c.y]);return h&&u?{measurementAngle:h,tempDistance:u}:void 0}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}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,dataCaptureLayer:a}=this;if(!i)throw wt();_e(a,e,i),await i.create(e,{...t,defaultZ:0})}async digitizeDelete(){if(!this.sketch)throw wt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw wt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw wt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw wt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw wt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw wt();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:i,mode:a}=this,r=t?.imageSize,s=e?.attributes;if(!s||!r)return;const o=await this.computeHeight(i,a);o?.value&&o?.accuracy&&(this.heightMeasurementResult=o.value,this.heightMeasurementAccuracy=o.accuracy)}filterByFootprints(e,t){const i=[],a=[],r=[];return e.forEach((e=>{const{layer:{coveragePercent:s},attributes:o}=e;let n;const l=S(e.geometry.spatialReference);o.cameraHeight/=l,o.farDistance/=l,o.nearDistance/=l,J(o.elevationSource)&&(o.elevationSource.constantElevation/=l);const{polygon:c,frustum:h}=U(o);if(n=c.clone(),o.isInspection&&(n=W(o)),s&&(n=q(n,s)),!t||$(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=ie(a,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?E(n,z.WebMercator):Promise.resolve(n)).then((e=>(n=e,ae((n.z??0)-s,{elevationSample:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&re(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=se(a,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?E(n,z.WebMercator):Promise.resolve(n)).then((e=>(n=e,ae((n.z??0)-s,{elevationSample:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&re(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimagery","Data capture 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,mode:r,activeViewer:s}=this,o=s?.imageSize;if(!e.vertices||!o)return;const n=We(e.vertices.at(-1),r,o);if(a.length<1||!n||!i||!t||"none"===r)return;const l=qe(a[0],n,t);if(!l?.length)return;this.heightMeasurementPixels.push(l),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const c=$e(this.heightMeasurementPixels,i);c&&(this.heightMeasurementResult=c)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:i,activeViewer:a,heightMeasurementPixels:r,mode:s}=this;if(!i||!a||!e.vertices?.length||"none"===s)return;const o=a?.imageSize;if(!r.length&&o){const i=We(e.vertices.at(-1),s,o);this.heightMeasurementPixels.push(i);const a=await this.calculateHeightMeasurementInfo(i,s,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?D(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){h.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=Ke(o),this.sketch.polylineSymbol="panoramic"===s?Qe:Xe(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:Xe(r,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}createPolylineGraphicPano(){const e=this.activeViewer?.imageRenderer.spatialReference,i=this.activeViewer?.imageSize;if(!i)return;const a={x:this.heightMeasurementPixels[0][0],y:this.heightMeasurementPixels[0][1]},r={x:this.heightMeasurementPixels.at(-1)[0],y:this.heightMeasurementPixels.at(-1)[1]},{heading:s,pitch:o}=te(a,i[0],i[1]),{heading:n,pitch:l}=te(r,i[0],i[1]),c=[[...ce(s,o)],[...ce(n,l)]];if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[c],spatialReference:e});else{const i=new j({paths:[c],spatialReference:e});this.heightGraphic=new t({geometry:i,symbol:Qe}),this._panoramicViewer.addGraphic(this.heightGraphic,0)}}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=Ye.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,layer:c}=this,u=r?.imageSize;if(!u||!o||"none"===n||l.includes("loading")||!c)return;const{polygon:p}=U(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=Pe(e,c.imageGeometryField,c.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(g){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:m}=await e.queryFeatures({geometry:p,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,c=l,{imageGeometryField:p,oiObjectIdField:m}=this;if(p&&m&&Ie(e,p,m)&&`${s[m]}`==`${o.attributes.objectId}`)try{return Me(s,p,e,a,u,n,r)}catch(g){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:g,feature:i,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}switch(c?.type){case"point":{const i=await this.getPixels(c,{feature:o,imageSize:u,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:i,visible:e.visible&&a})}case"polygon":{const{rings:i,spatialReference:l}=c,h=i.map((e=>e.map((([e,t,i])=>new L({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(h.map((async e=>this.getPixels(e,{feature:o,imageSize:u,mode:n}).then((e=>e.map(oe))))));return new t({attributes:s,layer:e,symbol:r,geometry:new x({rings:p,spatialReference:z.WebMercator}),visible:e.visible&&a})}case"polyline":{const{paths:i,spatialReference:l}=c,h=i.map((e=>e.map((([e,t,i])=>new L({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(h.map((async e=>this.getPixels(e,{feature:o,imageSize:u,mode:n}).then((e=>e.map(oe))))));return new t({attributes:s,layer:e,symbol:r,geometry:new j({paths:p,spatialReference:z.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:l}=c,h=i.map((([e,t,i])=>new L({x:e,y:t,z:i,spatialReference:l}))),p=await this.getPixels(h,{feature:o,imageSize:u,mode:n}).then((e=>e.map(oe)));return new t({attributes:s,layer:e,symbol:r,geometry:new O({points:p,spatialReference:z.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 L({x:e.x-.5,y:.5-e.y,spatialReference:z.WebMercator});const[t,r]=i,{heading:s,pitch:o}=te(e,t,r),n=ce(s,o);return new L(n,z.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 E(u,z.WebMercator));const p=await ae(c??(l.z??0)-h,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let m;if("elevationSample"in p&&re(p.elevationSample)&&(i.elevationSample=p.elevationSample),"default"===a){const t=ie(o,r[0],r[1]);m=await K(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}else{const t=se(o,r[0],r[1]);m=await Q(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 L({...e.toJSON()}),symbol:et}),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=V(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._referencePointOnImage=new t({geometry:new L({spatialReference:this._imageViewer.imageRenderer.spatialReference,...i}),symbol:et}),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}=te(e,a,r),n=ce(s,o);this._referencePointOnImage=new t({geometry:new L(n,z.WebMercator),symbol:tt}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}plotLocationPointOnImage(e){if("image-loaded"===this.state)switch(this.clearLocationPointOnImage(),this.mode){case"default":this._plotLocationPointOnDefaultImage(e);break;case"panoramic":this._plotLocationPointOnPanoramicImage(e)}}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{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==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.saveDataCaptureFeatures(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 saveDataCaptureFeatures(e){const{activeViewer:t,currentBestFeature:a,dataCaptureLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!a||"none"===s)throw new n("orientedimagery","Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("orientedimagery","Data capture 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(ne(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])=>ne(s,{x:e,y:t,z:i},o))),{feature:a,imageSize:o,mode:s}))));return t.geometry=new x({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,rings:e.map((e=>e.map(oe)))}),t}case"polyline":{const e=await Promise.all(m.paths.map((async e=>this.getMapPoint(e.map((([e,t,i])=>ne(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(oe)))}),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("orientedimagery","Error in saving data capture features"),objectId:null,globalId:null}}));return{...e,addFeatureResults:a}}))}async searchBestImage(e,t){try{const i=await T(e,t);i&&await this._processFeatureResponse(i,e.point,t)}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),h.getLogger(this).error("error occurred while finding best image",i))}}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 startDataCapture(e,t){const i=this.activeViewer?.imageRenderer,{oiObjectIdField:a,currentBestFeature:r}=this;if(!i||!r||!a)return;const{attributes:{objectId:o}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],c=[];for(const s of n)`${s.getAttribute(a)}`==`${o}`?l.push(s):c.push(s);this.overlayGraphicsOnImage(e.id,new s(c)),this.collectionId=e.id;const h=await this.loadSketch(t),u=await this.loadDataCaptureAdapter(t);f(t),h.layer.addMany(l),h.layer.blendMode="source-atop",u.savedGraphics.addMany(l);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=d(this.sketchAdapter),this.sketch=d(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,i=this.activeViewer?.imageRenderer;if(!i||i.destroyed)return;i.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const a=i.ui.find("zoom");a&&(a.visible=!0)}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 E(t,s.spatialReference);a=s.contains(e);break}case"mesh":{const e=t.spatialReference.equals(s.spatialReference)?t:await E(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,t=!0){e.sort(((e,t)=>e.suitability-t.suitability)),this._suitabilities=e;const i=this._suitabilities.map((({feature:e})=>e));this._initialCurrentCoverageUpdate=!0,this._updateFeatures(i,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"),h.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={};const o={};this._featureToSector=o;for(const u of be)this._sectorData[u]=new s;const n=e.map(((e,t)=>({...e,featureIndex:t})));n.sort(((e,t)=>e.trueSuitability-t.trueSuitability));const l=n.map((({distance:e})=>e)),c=Math.max(...l),h=a.reduce(((e,t)=>Math.max(e,t.attributes.location.z??0)),-1/0);n.forEach((e=>{const{distance:t,angle:i,featureIndex:r}=e,s=t/c*Fe[2],n=pt(t,c),l=mt(i);if(!this._sectorData)return;const u=Fe[3]+s*Math.sin(i*Math.PI/180),p=Fe[3]+s*Math.cos(i*Math.PI/180);let m;const d=a.at(r),g=(d.attributes.location.z??0)/h*Fe[2],y=d===this.currentBestFeature,f=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;if(y&&f)m=-90;else{const e=u-Fe[3],t=p-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),m=a}const v=""===n?l:`${n}_${l}`;y&&(m===this.bestFeatureAngle?this.previousFeatureAngle=m:this.bestFeatureAngle=m,this.navigatorCurrentBestFeature=f?null:{x:u,y:p,direction:l}),o[`${d.attributes.objectId}`]=v;const w=this._sectorData[v];w.add({angle:i,featureIndex:r,x:u,y:p,z:g,objectID:d.attributes.objectId,sector:v,featureIndexInSector:w.length})}))}_plotLocationPointOnDefaultImage(e){const i=V(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._locationPointOnImage=new t({geometry:new L({spatialReference:this._imageViewer.imageRenderer.spatialReference,...i}),symbol:it}),this._imageViewer.addGraphic(this._locationPointOnImage,0)}_plotLocationPointOnPanoramicImage(e){const{imageSize:i}=this._panoramicViewer;if(!i)return;const[a,r]=i,{heading:s,pitch:o}=te(e,a,r),n=ce(s,o);this._locationPointOnImage=new t({geometry:new L(n,z.WebMercator),symbol:at}),this._panoramicViewer.addGraphic(this._locationPointOnImage,0)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.setMessage("noImageError","error"),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,i){if(!e[0])return;const a=await R(e);if(this._updateFootprintWithFeatures(t,a),this.view?.supportsGround)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(r){y(r)||h.getLogger(this).error(r)}}async processElevationSample(e,t,i){const{elevationSource:a}=t[0].attributes,r=await this._getElevationSampleFromGround(e,t,i);return r||(a&&this.footprintExtent&&Z(a)?await Y({extent:this.footprintExtent,lod:a.lod,url:a.url,rasterFunction:a.rasterFunction}):void 0)}async _processFeatureResponse(e,t,i){const{features:a}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(a))return;const{features:r,polygons:s,frustums:o}=this.filterByFootprints(a,t);if(!this._checkFeatures(r))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o);const n=await this.processElevationSample(s,r,i);f(i),await this._updateElevationOfSelectedPointAndLocations(r,t,n),f(i),ct(r,n),this._processSuitableFeatures(r,t),this._updateSuitabilities(i?.loadBestImage)}_processSuitableFeatures(e,t){this._suitabilities=N({features:e,selectedPoint:t,camera:ht(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}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 E(o,e.spatialReference),c=l.spatialReference.isGeographic?D(l):l,h=M("1=1",M(e.definitionExpression,n)),u=c.spatialReference.isGeographic?1:S(c.spatialReference),p={layerInstanceOrURL:e,point:c,queryParams:{where:h,maximumDistance:e.maximumDistance?e.maximumDistance/u:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(p,i)}_resetCursor(){const{activeViewer:e}=this;e&&(e.imageRenderer.cursor=this._previousCursor)}_setMeasurementCursor(){const{activeViewer:e}=this;e&&(this._previousCursor=e.imageRenderer.cursor,e.imageRenderer.cursor="crosshair")}_toggleVisiblity(e,t){e.forEach((e=>{e.visible=t}))}async _updateElevationOfSelectedPointAndLocations(e,t,i,a){const r=re(i),s=await ae((e[0].attributes.location.z??0)-e[0].attributes.cameraHeight,{elevationSample:r?i:void 0,elevationSource:r?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},a);f(a);const[o,...n]=await X([t,...e.map((e=>e.attributes.geometry.clone()))],s);f(a),t.elevation=o.z,e.forEach(((e,t)=>{e.attributes.elevation=n[t].z}))}_updateFeatures(e,t=!0){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._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0])}_updateFootprintWithFeatures(e,t){const i=[];for(const{geometry:a}of e)t.contains(a)||i.push([a.x,a.y]);i.sort(((e,t)=>+B([e,t]))),t.addRing(i),this.footprintExtent=ye(t.extent,2,2)}_updateSuitabilities(e){const{_suitabilities:t}=this;t&&this.updateSuitabilities(t,e)}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.clone(),symbol:rt,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:Ye,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))}clearLocationPointOnImage(){this._locationPointOnImage&&(this._imageViewer.removeGraphic(this._locationPointOnImage),this._panoramicViewer.removeGraphic(this._locationPointOnImage),this._locationPointOnImage=d(this._locationPointOnImage))}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,activeViewer: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?.state||i)return;let s;try{s=await this.worldToImage(a,e),f(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||h.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 ae(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(X(e,u));t(e)})))));if(r.spatialReference.isGeographic&&(h=await E(h,z.WebMercator,t)),d=await Promise.all(d.map((async e=>h.spatialReference.equals(e.spatialReference)?e:await E(e,h.spatialReference,t)))),f(t),"panoramic"===this.mode)m=ue(d,{imageHeight:a[1],imageWidth:a[0],cameraHeading:o,cameraLocation:h});else{const e=le(this.currentBestFeature.attributes,a[0],a[1]);m=pe(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,mode:h}=this,{attributes:{objectId:u},elevationSample:p}=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,s].filter(ut);l.supportsGround&&p&&c?.updateGroundElevation&&(this._updateGroundElevation&&c.updateGroundElevation(e,p),"panoramic"===h&&c.updateGroundElevation([this.bestFeatureCurrentFootprint],p)),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Je.clone(),attributes:{imageID:u}}))),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&&p&&c?.updateGroundElevation&&"panoramic"===h&&c.updateGroundElevation([e],p),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([C()],Ft.prototype,"activeLayer",null),e([C({readOnly:!0})],Ft.prototype,"activeViewer",null),e([C()],Ft.prototype,"accuracyParametersMissing",null),e([C()],Ft.prototype,"additionalFeatures",void 0),e([C({type:s.ofType(t)})],Ft.prototype,"additionalCameraLocations",void 0),e([C({type:s.ofType(t)})],Ft.prototype,"additionalFootprints",void 0),e([C()],Ft.prototype,"areaMeasurementResult",void 0),e([C()],Ft.prototype,"areaMeasurementAccuracy",void 0),e([C()],Ft.prototype,"bestFeatureAngle",void 0),e([C()],Ft.prototype,"bestFeatureCurrentFootprint",void 0),e([C({type:t})],Ft.prototype,"bestFeatureFootprint",void 0),e([C({type:Number})],Ft.prototype,"brightness",null),e([C()],Ft.prototype,"collectionId",void 0),e([C({type:Number})],Ft.prototype,"contrast",null),e([C()],Ft.prototype,"conversionProps",void 0),e([C()],Ft.prototype,"coverageFrustums",void 0),e([C()],Ft.prototype,"coveragePolygons",void 0),e([C()],Ft.prototype,"currentBestFeature",void 0),e([C()],Ft.prototype,"currentBestFeatureLocation",void 0),e([C()],Ft.prototype,"currentCoverageVisible",void 0),e([C()],Ft.prototype,"currentNode",null),e([C()],Ft.prototype,"navigationNodes",void 0),e([C({json:{write:!1}})],Ft.prototype,"determineWorkflowForFeature",void 0),e([C()],Ft.prototype,"disabled",void 0),e([C()],Ft.prototype,"displayMessage",void 0),e([C()],Ft.prototype,"displayNewMeasurementButton",void 0),e([C()],Ft.prototype,"distanceMeasurementResult",void 0),e([C()],Ft.prototype,"distanceAccuracyArray",void 0),e([C()],Ft.prototype,"dataCaptureLayer",void 0),e([C({readOnly:!0})],Ft.prototype,"featureCount",null),e([C()],Ft.prototype,"features",void 0),e([C()],Ft.prototype,"groundCoordinates",void 0),e([C()],Ft.prototype,"groundCoordinatesAccuracy",void 0),e([C()],Ft.prototype,"heightMeasurementPixels",void 0),e([C()],Ft.prototype,"heightGraphic",void 0),e([C()],Ft.prototype,"heightMeasurementResult",void 0),e([C()],Ft.prototype,"heightMeasurementAccuracy",void 0),e([C()],Ft.prototype,"measurementAngle",void 0),e([C()],Ft.prototype,"tempDistance",void 0),e([C({readOnly:!0})],Ft.prototype,"imageGalleryEnabled",null),e([C()],Ft.prototype,"imageGeometryField",void 0),e([C({readOnly:!0})],Ft.prototype,"imageLoaded",null),e([C()],Ft.prototype,"imageLocationToolState",void 0),e([C({readOnly:!0})],Ft.prototype,"invalidCameraHeading",null),e([C()],Ft.prototype,"imagePointsInView",null),e([C()],Ft.prototype,"isAdditionalCoverageVisible",void 0),e([C()],Ft.prototype,"isAdditionalPointSourcesVisible",void 0),e([C()],Ft.prototype,"layer",void 0),e([C()],Ft.prototype,"layerView",null),e([C({readOnly:!0})],Ft.prototype,"layerFloorFilterClause",null),e([C({type:Number})],Ft.prototype,"localPort",void 0),e([C()],Ft.prototype,"mapImageConversionToolState",void 0),e([C()],Ft.prototype,"measureType",void 0),e([C()],Ft.prototype,"measurementGraphic",void 0),e([C({readOnly:!0,value:"none"})],Ft.prototype,"mode",null),e([C()],Ft.prototype,"navigatorCurrentBestFeature",void 0),e([C()],Ft.prototype,"oiObjectIdField",void 0),e([C({type:s.ofType(t)})],Ft.prototype,"overlayedCameraLocations",void 0),e([C()],Ft.prototype,"overlayedMapFeatures",void 0),e([C()],Ft.prototype,"pixelCoordinates",void 0),e([C()],Ft.prototype,"pointSources",void 0),e([C({readOnly:!0})],Ft.prototype,"popupEnabled",null),e([C()],Ft.prototype,"previousFeatureAngle",void 0),e([C()],Ft.prototype,"referencePoint",null),e([C({readOnly:!0})],Ft.prototype,"sectorData",null),e([C()],Ft.prototype,"selectedPoint",void 0),e([C({type:Number})],Ft.prototype,"sharpness",null),e([C()],Ft.prototype,"shouldShowSelectedImage",void 0),e([C()],Ft.prototype,"sketch",void 0),e([C()],Ft.prototype,"draw",void 0),e([C()],Ft.prototype,"sketchAdapter",void 0),e([C({readOnly:!0})],Ft.prototype,"sketchGraphicsLayer",null),e([C({readOnly:!0})],Ft.prototype,"state",null),e([C({readOnly:!0})],Ft.prototype,"thumbnails",null),e([C()],Ft.prototype,"updateFootprint",void 0),e([C()],Ft.prototype,"updateFootprintPanorama",void 0),e([C({value:null})],Ft.prototype,"view",null),e([C()],Ft.prototype,"_adapter",void 0),e([C()],Ft.prototype,"_sketchGraphicsLayer",null),e([C()],Ft.prototype,"_highlightedFeatureHandle",void 0),e([C()],Ft.prototype,"_imageViewer",void 0),e([C()],Ft.prototype,"_initialCurrentCoverageUpdate",void 0),e([C()],Ft.prototype,"_locationPointOnImage",void 0),e([C()],Ft.prototype,"_overlays",void 0),e([C({readOnly:!0})],Ft.prototype,"_overlaysView",null),e([C()],Ft.prototype,"_panoramicViewer",void 0),e([C()],Ft.prototype,"_previousCursor",void 0),e([C()],Ft.prototype,"_referencePointOnGround",void 0),e([C()],Ft.prototype,"_referencePointOnImage",void 0),e([C()],Ft.prototype,"_sectorData",void 0),e([C()],Ft.prototype,"_featureToSector",void 0),e([C()],Ft.prototype,"_activeSectors",null),e([C({readOnly:!0})],Ft.prototype,"_updatingHandles",void 0),e([C()],Ft.prototype,"footprintExtent",void 0),e([C()],Ft.prototype,"_featureChangedTask",void 0),Ft=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],Ft);const _t=Ft;export{_t 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 e from"../../core/Accessor.js";import{deprecatedProperty as t}from"../../core/deprecate.js";import n from"../../core/Logger.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{deprecatedProperty as t}from"../../core/deprecate.js";import n from"../../core/Logger.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";let r=class extends e{constructor(){super(...arguments),this.additionalFootprintToggle=!0,this.additionalCameraLocationsToggle=!0,this.currentFootprintToggle=!0,this.imageEnhancement=!0,this.imageGallery=!0,this.imageOverlays=!0,this.measurementTools=!0,this.mapImageConversionTool=!0,this.menu=!0,this.navigationTool=!0,this.digitization=!0,this.title=!0,this.showPopupsAction=!0,this.directions=!0}get coverageMenu(){return t(n.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu}set coverageMenu(o){t(n.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu=o}};o([l({type:Boolean,nonNullable:!0})],r.prototype,"additionalFootprintToggle",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"additionalCameraLocationsToggle",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"currentFootprintToggle",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"coverageMenu",null),o([l({type:Boolean,nonNullable:!0})],r.prototype,"imageEnhancement",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"imageGallery",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"imageOverlays",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"measurementTools",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"mapImageConversionTool",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"menu",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"navigationTool",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"digitization",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"title",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"showPopupsAction",void 0),o([l({type:Boolean,nonNullable:!0})],r.prototype,"directions",void 0),r=o([i("esri.widgets.OrientedImageryViewer.OrientedImageryViewerVisibleElements")],r);const a=r;export{a as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../../geometry/Point.js";import s from"../../../layers/orientedImagery/core/ExposurePoint.js";import{normalizeDegrees as n,getRelativeAngleBetweenPoints as a}from"./imageNavigationUtils.js";const c=["right","towards","left","backwards"];let l=class extends r{constructor(t){super(t),this.attributes=null,this.backwards=null,this.geometry=null,this.left=null,this.right=null,this.towards=null}get currentHeading(){return this._get("currentHeading")??0}set currentHeading(t){const r=n(t);this._set("currentHeading",r)}get currentPitch(){return this._get("currentPitch")??0}set currentPitch(t){const r=n(t);this._set("currentPitch",r)}get heading(){return this.attributes.cameraHeading}get id(){return this.attributes.objectId}get pitch(){return this.attributes.cameraPitch}get roll(){return this.attributes.cameraRoll??0}getDistanceTo(t){return this.geometry.distance(t.geometry)}getDirectionTo(t){if(!t)return null;const{geometry:{x:r,y:e},currentHeading:o}=this,{geometry:{x:i,y:s}}=t,l=a(r,e,i,s),p=n(l+o),u=Math.floor((p+45)/90)%4;return c[u]}reset(){this.towards=null,this.backwards=null,this.left=null,this.right=null}};t([e({type:s})],l.prototype,"attributes",void 0),t([e({type:l})],l.prototype,"backwards",void 0),t([e()],l.prototype,"currentHeading",null),t([e()],l.prototype,"currentPitch",null),t([e({type:i})],l.prototype,"geometry",void 0),t([e({readOnly:!0})],l.prototype,"heading",null),t([e({readOnly:!0})],l.prototype,"id",null),t([e({type:l})],l.prototype,"left",void 0),t([e({readOnly:!0})],l.prototype,"pitch",null),t([e({type:l})],l.prototype,"right",void 0),t([e({readOnly:!0})],l.prototype,"roll",null),t([e({type:l})],l.prototype,"towards",void 0),l=t([o("esri.widgets.OrientedImageryViewer.components.NavigationNode")],l);const p=l;export{p as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{createTask as o}from"../../../core/asyncUtils.js";import i from"../../../core/Collection.js";import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{whenOnce as s}from"../../../core/reactiveUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../Widget.js";import{css as a}from"../css.js";import l from"./NavigationNode.js";import d from"./NavigationUIViewModel.js";import{loadCalciteComponents as p}from"../../support/componentsUtils.js";import"../../support/widgetUtils.js";import{tsx as h}from"../../support/jsxFactory.js";let m=class extends c{constructor(t){super(t),this.navigate=null,this.viewModel=new d,this._clickTask=null,this._handleClick=t=>{this._clickTask?.abort(),this._clickTask=o((async o=>{const i=t.target;if(this.navigate){await s((()=>"compiled"===this.viewModel.state),{signal:o});const t=i.getAttribute("data-direction");e(o),await this.navigate(t,{signal:o})}}))}}loadDependencies(){return p({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}set currentNode(t){this.viewModel.currentNode=t}get currentNode(){return this.viewModel.currentNode}get nodes(){return this.viewModel.nodes}set nodes(t){this.viewModel.nodes=t}render(){const{currentNode:t}=this;if(!t)return null;const{currentHeading:o}=t,i={"--rotate-transform":` rotate(${-o}deg)`},e=t=>{const i=(t-(o??0)+360)%360;return i<45||i>=315?"towards":i>=135&&i<225?"backwards":i>=45&&i<135?"right":"left"},s=e(0),r=e(90),n=e(180),c=e(270);return h("div",{class:a.navigationUI},h("div",{class:a.navigationDirectionPad,styles:i},t[s]?h("calcite-icon",{class:this.classes(a.navigationDirection,a.navigationTop),"data-direction":s,icon:"chevron-up",key:"chevron-up",onclick:this._handleClick}):null,t[r]?h("calcite-icon",{class:this.classes(a.navigationDirection,a.navigationRight),"data-direction":r,icon:"chevron-right",key:"chevron-right",onclick:this._handleClick}):null,t[n]?h("calcite-icon",{class:this.classes(a.navigationDirection,a.navigationBottom),"data-direction":n,icon:"chevron-down",key:"chevron-down",onclick:this._handleClick}):null,t[c]?h("calcite-icon",{class:this.classes(a.navigationDirection,a.navigationLeft),"data-direction":c,icon:"chevron-left",key:"chevron-left",onclick:this._handleClick}):null))}};t([r()],m.prototype,"currentNode",null),t([r()],m.prototype,"navigate",void 0),t([r({type:i.ofType(l),nonNullable:!0})],m.prototype,"nodes",null),t([r({type:d})],m.prototype,"viewModel",void 0),t([r()],m.prototype,"_clickTask",void 0),m=t([n("esri.widgets.OrientedImageryViewer.components.NavigationUI")],m);const v=m;export{v as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import o from"../../../core/Accessor.js";import{createTask as t}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{watch as i,syncAndInitial as c}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";let a=class extends o{constructor(e){super(e),this._compileTask=null,this.currentNode=null,this.nodes=new r,this.compile=()=>{const{currentNode:e,nodes:o}=this;e&&o.length&&(e.reset(),o.forEach((o=>{if(o===e)return;const t=e.getDistanceTo(o),r=e.getDirectionTo(o),s=e[r];(!s||e.getDistanceTo(s)>t)&&(e[r]=o)})))}}initialize(){this.addHandles(i((()=>({nodes:this.nodes,currenNode:this.currentNode,length:this.nodes.length,currentHeading:this.currentNode?.currentHeading,currentPitch:this.currentNode?.currentPitch})),(()=>{this._compileTask?.abort(),this._compileTask=t((async e=>{s(e),this.compile()}))}),c))}get state(){const e=this._compileTask;return e?e.finished?e.error?"ready":"compiled":"compiling":this.initialized?"initialized":"ready"}};e([n()],a.prototype,"_compileTask",void 0),e([n()],a.prototype,"currentNode",void 0),e([n()],a.prototype,"nodes",void 0),e([n()],a.prototype,"state",null),a=e([p("esri.widgets.OrientedImageryViewer.components.NavigationUIViewModel")],a);const d=a;export{d as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{rad2deg as t}from"../../../core/mathUtils.js";function n(n,r,o,e){const a=o-n,c=e-r;return t(Math.atan2(c,a))}function r(t){let n=t%360;return n<0&&(n+=360),n}export{n as getRelativeAngleBetweenPoints,r as normalizeDegrees};
|
|
@@ -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
|
-
const e="esri-oriented-imagery-viewer",t=`${e}__carousel`,a=`${e}__image-enhancement`,o=`${e}__navigation`,r="--oi-navigation-tool-rotation-from",n="--oi-navigation-tool-rotation-to",s=`${e}__image-overlays`,
|
|
5
|
+
const e="esri-oriented-imagery-viewer",t=`${e}__carousel`,a=`${e}__image-enhancement`,o=`${e}__navigation`,r="--oi-navigation-tool-rotation-from",n="--oi-navigation-tool-rotation-to",i=`${o}-ui`,s=`${i}__direction`,$=`${e}__image-overlays`,m={alert:`${e}__alert`,addCoverage:`${e}__body-additional-coverage`,addExpPoints:`${e}__body-additional-camera-locations`,body:`${e}__body`,carousel:`${e}__carousel`,carouselContainer:`${t}-container`,carouselContent:`${t}-content`,carouselItem:`${t}-item`,carouselItemWrapper:`${t}-item-wrapper`,close:`${e}__close`,currentCoverage:`${e}__body-current-coverage`,feature:`${o}-feature`,footprint:`${e}__body-footprint`,imageEnhancementToolContainer:`${a}-tool-container`,imageEnhancementTools:`${a}-tools`,imageEnhancementWrapper:`${a}-wrapper`,imageOverlays:$,imageOverlaysContainer:`${$}-container`,imageOverlaysNoResult:`${$}-no-result`,imageOverlaysIncreasedHeight:`${$}-increased-height`,imageOverlaysLayerList:`${$}-layer-list`,measurementResults:`${e}__measurement-results`,measurementsBar:`${e}__measurements-bar`,measurementsButton:`${e}__measurements-button`,measurementsTable:`${e}__measurements-table`,measurementDisplay:`${e}__measurement-display`,messageBox:`${e}__message-box`,navigationPathOffset0:`${o}-feature-path-stop-offset-0`,navigationPathOffset1:`${o}-feature-path-stop-offset-1`,navigationWrapper:`${o}-wrapper`,navigationZoomed:`${o}-wrapper--zoomed`,north:`${o}-pointer-north`,outerSector:`${o}-sector-outer`,overlaysSwitch:`${$}-switch`,pointer:`${o}-pointer`,rotateWithAnimation:`${o}-animate`,sector:`${o}-sector`,sectorCross:`${o}-sector-cross`,sectorDisabled:`${o}-sector-disabled`,sectorEnabled:`${o}-sector-enabled`,sectorSeparator:`${o}-sector-separator`,selectedFeaturePath:`${o}-feature-path`,sketchTools:`${e}__sketch-tools`,submenu:`${e}__submenu`,viewer:`${e}__viewer`,viewerHidden:`${e}__viewer--hidden`,viewerContainer:`${e}__viewer-container`,navigationUI:i,navigationDirection:s,navigationDirectionPad:`${s}-pad`,navigationTop:`${s}--top`,navigationBottom:`${s}--bottom`,navigationLeft:`${s}--left`,navigationRight:`${s}--right`};export{t as carousel,m as css,a as imageEnhancement,o as navigation,r as navigationToolRotationFrom,n as navigationToolRotationTo,e as root};
|
|
@@ -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 t from"../../request.js";import r from"../../core/Logger.js";import{sectorsRadii as n}from"./constants.js";function e(t){return"3d"===t?.type}function i(t){return"esri.Graphic"===t?.declaredClass}function o(t){return/(tiff|tif|mrf)$/i.test(t??"")}function s(t){if(!t)return!1;if(!URL.canParse(t))return!1;const{pathname:r}=new URL(t);return/.*\.(tiff|tif|mrf)$/i.test(r??"")}function
|
|
5
|
+
import t from"../../request.js";import r from"../../core/Logger.js";import{sectorsRadii as n}from"./constants.js";function e(t){return"3d"===t?.type}function i(t){return"esri.Graphic"===t?.declaredClass}function o(t){return/(tiff|tif|mrf)$/i.test(t??"")}function s(t){if(!t)return!1;if(!URL.canParse(t))return!1;const{pathname:r}=new URL(t);return/.*\.(tiff|tif|mrf)$/i.test(r??"")}function a(t){return Math.abs(t)>=135?"WEST":t<-45&&t>-135?"SOUTH":t<=45?"EAST":"NORTH"}function f(t,r){const e=t/r*n[2];return e<=n[0]?"NEAR":e<=n[1]?"":"FAR"}function u(t){return t&&t.url&&t.datasetFormat?t:null}function c(t){return"string"==typeof t&&t.length?t:u(t)}const m=t=>r=>r.layer===t;function p(t){return"NoAttachmentError"===t?.name}const g=t=>`${t}:missing-property`,l=(t,r)=>`Property ${r} is missing in ${t}`,y=(t="esri.widgets.OrientedImageryViewer",n)=>{throw r.getLogger(t).error(n),n},d=async(r,n)=>{const e=await t(r,{...n,method:"head"}),i=e?.getHeader?.("Content-Type");if(i)return i.split("/")[1]};function h(t,r){0!==r&&(t.xmin/=r,t.xmax*=r,t.ymin/=r,t.ymax*=r)}function w(t,r){r&&t.forEach((t=>{t.elevationSample=r}))}export{w as assignElevationSampleToFeatures,a as calculateDirection,f as calculateSegment,c as castImageSource,u as castURLWithDatasetFormat,m as filterOILLayerView,d as getContentType,l as getMissingPropertyErrorMessage,g as getMissingPropertyErrorName,i as isGraphic,p as isNoAttachmentError,e as isSceneView,s as isTifOrMrf,y as logAndThrow,h as scaleExtent,o as validateTifOrMrfExtension};
|