@arcgis/core 4.33.0-next.20250313 → 4.33.0-next.20250314

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/065ae931b5891847a06f.js +1 -0
  3. package/assets/esri/core/workers/chunks/{08bfceab05b5ea02bb4e.js → 23aa7254fffe67e3f1bc.js} +3 -3
  4. package/assets/esri/core/workers/chunks/29ba2022c2978e9bd53e.js +1 -0
  5. package/assets/esri/core/workers/chunks/2b21152c7e2d9c170ed7.js +1 -0
  6. package/assets/esri/core/workers/chunks/7ded83eb64eff069b761.js +1 -0
  7. package/assets/esri/core/workers/chunks/a7a1832274892e99c388.js +1 -0
  8. package/assets/esri/core/workers/chunks/{6388fdacb434a266b039.js → c43c273725b1a33712ec.js} +5 -5
  9. package/chunks/FocusAreaMask.glsl.js +2 -1
  10. package/layers/VoxelWasmPerSceneView.js +1 -1
  11. package/layers/orientedImagery/transformations/utils.js +1 -1
  12. package/package.json +1 -1
  13. package/support/revision.js +1 -1
  14. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  15. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  16. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  17. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  18. package/views/3d/environment/EnvironmentManager.js +1 -1
  19. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  20. package/views/3d/environment/Fog.js +1 -1
  21. package/views/3d/environment/MarsAtmosphere.js +1 -1
  22. package/views/3d/environment/Precipitation.js +1 -1
  23. package/views/3d/interactive/Manipulator3D.js +1 -1
  24. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  25. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  26. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  27. package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
  28. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  29. package/views/3d/interactive/visualElements/VisualElement.js +1 -1
  30. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  31. package/views/3d/layers/DrapedSubView3D.js +5 -0
  32. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  33. package/views/3d/layers/I3SMeshView3D.js +1 -1
  34. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  35. package/views/3d/layers/ImagerySubView3D.js +5 -0
  36. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  37. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  38. package/views/3d/layers/Lyr3DWasm.js +1 -1
  39. package/views/3d/layers/MediaLayerView3D.js +1 -1
  40. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  41. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  42. package/views/3d/layers/SubView3D.js +5 -0
  43. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  44. package/views/3d/layers/WMSLayerView3D.js +1 -1
  45. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  46. package/views/3d/layers/graphics/Labeler.js +1 -1
  47. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  48. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  49. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  50. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  51. package/views/3d/state/ViewStateManager.js +1 -1
  52. package/views/3d/state/controllers/FovController.js +1 -1
  53. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  54. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  55. package/views/3d/state/controllers/RotateController.js +1 -1
  56. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  57. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  58. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  59. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  60. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  61. package/views/3d/support/MemoryController.js +1 -1
  62. package/views/3d/support/SceneViewPerformanceInfo.js +1 -1
  63. package/views/3d/support/SharedSymbolResources.js +1 -1
  64. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  65. package/views/3d/terrain/OverlayManager.js +1 -1
  66. package/views/3d/terrain/OverlayRenderer.js +1 -1
  67. package/views/3d/terrain/TerrainSurface.js +1 -1
  68. package/views/3d/terrain/TileCompositor.js +1 -1
  69. package/views/3d/webgl/RenderNode.js +1 -1
  70. package/views/3d/webgl-engine/Stage.js +1 -1
  71. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  72. package/views/3d/webgl-engine/effects/geometry/ObjectAndLayerIDRenderNode.js +1 -1
  73. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  74. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  75. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  76. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  77. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  78. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  79. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  80. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  81. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  82. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  83. package/views/FocusAreas.js +1 -1
  84. package/views/SceneView.js +1 -1
  85. package/views/webgl/Program.js +1 -1
  86. package/views/webgl/RenderingContext.js +1 -1
  87. package/views/webgl/Texture.js +1 -1
  88. package/views/webgl/capabilities/Capabilities.js +1 -1
  89. package/views/webgl/checkWebGLError.js +1 -1
  90. package/views/webgl/enums.js +1 -1
  91. package/views/webgl/testFloatBufferBlend.js +1 -1
  92. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  93. package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
  94. package/widgets/OrientedImageryViewer/dataCaptureUtils.js +1 -1
  95. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  96. package/assets/esri/core/workers/chunks/025f8b72d7d8b5cccb0f.js +0 -1
  97. package/assets/esri/core/workers/chunks/0e5c77d043ed4641556f.js +0 -1
  98. package/assets/esri/core/workers/chunks/10fc47b441ae49ef4db8.js +0 -1
  99. package/assets/esri/core/workers/chunks/4908b36ef448bfe1f448.js +0 -1
  100. package/assets/esri/core/workers/chunks/fe6e7ac83cd2293d576e.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{isSome as i,equals as a}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import l from"../../core/Evented.js";import c from"../../core/JSONSupport.js";import{equalsShallow as h}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as p}from"../../core/mathUtils.js";import{abortMaybe as m,destroyMaybe as d}from"../../core/maybe.js";import g from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as f,waitTick as v}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{on as b,watch as F,syncAndInitial as _,initial as P}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{getMetersPerUnitForSR as S}from"../../core/unitUtils.js";import{property as M}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as C}from"../../core/accessorSupport/decorators/subclass.js";import{distance as k}from"../../core/libs/gl-matrix-2/math/vec2.js";import{UpdatingHandles as V}from"../../core/support/UpdatingHandles.js";import{union as A}from"../../geometry/geometryEngineAsync.js";import G from"../../geometry/Multipoint.js";import R 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 ie,getImageToWorldPanoramicProperties as ae,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 Se}from"./galleryUtils.js";import{formatPixels as Me,heightMeasurementPanoramic as Ce,heightMeasurement2D as ke,calculateHeightAccuracyPanoramic as Ve,calculateHeightAccuracy as Ae,pixelAreaMeasurement2D as Ge,pixelAreaMeasurementPanoramic as Re,pixelDistanceMeasurement2D as Oe,pixelDistanceMeasurementPanoramic as Le,generateCombinations as xe,getRootOfSumOfSquaredErrors as je,generateCombinationsPanoramic as Ee,calculateReferenceImagePointPanoramic as Be,calculateAnglePano as ze,calculateTempImagePoint as He,calculateAngle as De,getModeCorrectedPoint as Te,calculateCorrectedPixel as Ue,calculateHeightFromTemporaryDistance as Ne}from"./imageMeasurementUtils.js";import{crossSymbol as We,crossSymbol3D as qe,measurementPolygonSymbol as $e,polylineSymbolPanoramic as Je,measurementPolylineSymbol as Ze,sourcePointSymbol as Ke,diamondSymbol as Qe,diamondSymbol3D as Xe,locationSymbol as Ye,locationSymbol3D as et,activeSourcePointSymbol as tt}from"./symbols.js";import{isNoAttachmentError as it,getContentType as at,isTifOrMrf as rt,filterOILLayerView as st,isSceneView as ot,isGraphic as nt,calculateSegment as lt,calculateDirection as ct}from"./utils.js";import ht from"./components/ImageViewer.js";const ut={click:"view-click",imageClick:"image-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles",sketchHandles:"sketch-handles"},pt=new Set(["JPG","JPEG"]),mt=/\.(\w+)$/,dt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let gt=class extends(l.EventedMixin(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.collectionId=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:a,selectedPoint:r,view:s}=this;if(s?.closePopup(),a&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadImage(i)}catch(o){y(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.draw=null,this.sketchAdapter=null,this.updateFootprint=async(e,t)=>{"image-loaded"===this.state&&await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new ht,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: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.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.toggleImageAttributes=()=>{m(this._openPopupTask),this._openPopupTask=r((async e=>{const{currentBestFeature:i,popupEnabled:a,layer:r,view:s}=this;if(s?.closePopup(),!(s&&i&&a&&r))return;const{attributes:o,geometry:n}=i,l=new t({geometry:n,attributes:o.toJSON(),layer:r});f(e),await s.openPopup({features:[l],location:o.location.clone()})}))},this._createViewClickHandle=()=>{if(this.removeHandles(ut.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),ut.click)},this._createImageClickHandle=()=>{this.removeHandles(ut.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:i,currentBestFeature:a,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&a))return;i.clickAction="pixel-location";let n=null;const l=b((()=>i),"pixel-location",(e=>{this.plotReferencePointOnImage(e),n?.abort(),n=r((async i=>{if(!e)return;const r=await this.getMapPoint(e,{feature:a,imageSize:o,mode:t}).then((e=>{const t=this.view?.spatialReference;return le(!t,e.spatialReference.equals(t))?e:x(e,t)}));f(i),this.plotReferencePointOnGround(r)}))}));this.addHandles(l,ut.imageClick)},this._createImageLocationHandle=()=>{this.removeHandles(ut.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:i,currentBestFeature:a,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&a))return;i.clickAction="pixel-location";let n=null;const l=b((()=>i),"pixel-location",(e=>{this.pixelCoordinates=e,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 x(r,s),f(i)),this.groundCoordinates=r}))}));this.addHandles(l,ut.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:h,cameraOrientation:p,location:m}=r,d=(l??0)+(o??0),g=m.spatialReference.isWGS84&&4!==p?.type?B(m):new R(m);let v=s;if(Ie(s))try{v=await Se(i,h,e)}catch(w){if(y(w))return;return it(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${i.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[i.objectIdField]:h,layer:i}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${i.objectIdField} ${h}`))}try{await this.loadImageFromSource(v,{imageRotation:d,options:e,pitch:c,yaw:n,mode:a,cameraLocation:g}),f(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:i,imageRotation:a,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:l}=new URL(o);let c=s?n.match(mt)?.[1]:e.datasetFormat;if(!c)try{c=await at(o,{...t.options})}catch(h){y(h)||u.getLogger(this).error("#getContentType()",h)}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(pt.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 X(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 R({...c.isSerializable(e)?e.toJSON():e});if("default"===this.mode)a.x-=.5,a.y=.5-a.y,a.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:a,symbol:We}),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}=Y(e,a,r),n=ne(s,o);this._crossSymbol=new t({geometry:new R(n,j.WebMercator),symbol:qe}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this),this.selectBestFeature=this.selectBestFeature.bind(this)}initialize(){this.addHandles([F((()=>this.view),(()=>{this.load()}),_),F((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),P),F((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),P),F((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),_),F((()=>[this.state,this.imageLocationToolState,this.view]),(()=>{if(this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();this._setMeasurementCursor()}),_),F((()=>this.measureType),(()=>{this.clearPreviousMeasurements()}),_),F((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),_),F((()=>this.currentBestFeature),(async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=r((async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}]))),await this._featureChangedTask.promise}),{sync:!0}),F((()=>this.mode),(e=>{switch(this.removeHandles(ut.interactionHandles),e){case"default":this.addHandles(F((()=>{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})})))}),{..._,equals:(e,t)=>a(e,t,h)}),ut.interactionHandles);break;case"panoramic":this.addHandles(F((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:i,vfov:a,hfov:r,pitch:s,yaw:o}=this._panoramicViewer;return e&&i&&!t.includes("loading")?[a,r,o,s]:null}),(e=>{if(!e||this.state.includes("loading"))return;const[t,i,a,s]=e;m(this._updateFootprintTask),this._updateFootprintTask=r((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:a,pitch:s},{signal:e})}))}),{..._,equals:(e,t)=>a(e,t,h)}),ut.interactionHandles)}}),_),F((()=>[this.brightness,this.contrast,this.sharpness]),(()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:a,sharpness:r}=this;"default"===a&&(e.brightness=t,e.contrast=i,e.sharpness=r)}),_),F((()=>this.activeViewer?.imageRenderer),(()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}))]),this.when().finally((()=>{this.notifyChange("state")}))}destroy(){this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=d(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._crossSymbol=d(this._crossSymbol),this._referencePointOnGround=d(this._referencePointOnGround),this._referencePointOnImage=d(this._referencePointOnImage),this._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(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:i}=this;switch(i){case"default":return e;case"panoramic":return t;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every((e=>0===e))??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",p(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",p(e,-10,10))}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return rt(t)||Ie(t)}get imageLoaded(){return o(u.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===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(st(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: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?ve.map((t=>e[t])):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",p(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t,_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 rt(r)||Ie(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 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,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():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=Me(m,!1),g="panoramic"===t?await Ce(m,h,c,a,!0,!1):await ke(m,h,c,!0,i);if(!g)return;const y="panoramic"===t?await Ve(c,d,h,g,a,!0):await Ae(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 Ge(e,a,!0):await Re(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 Oe([e.at(0),e.at(-1)],s,!0):await Le([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 Ge(e,l,!0):await Oe([e.at(0),e.at(-1)],l,!0);f(i);const{updateElevationProps:h,...u}=l,p=xe(u,o);if(!p?.length)return null;const m=p.map((e=>({...e,updateElevationProps:h}))).map((async a=>{const r="area"===t?await Ge(e,a,!0):await Oe([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:je(g)}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 Re(e,c,!0):await Le([e.at(0),e.at(-1)],c,!0);f(i);const{updateElevationProps:u,...p}=c,m=Ee(p,n);if(!m?.length)return null;const d=m.map((e=>({...e,updateElevationProps:u}))).map((async a=>{const r="area"===t?await Re(e,a,!0):await Le([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:je(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]=Me([e],"panoramic"!==t),l="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ee(o,s[0],s[1]);if("panoramic"===t){if(!l)return;const e=await Be(n,l,a,i);if(!e)return;e?.heading>180&&(e.heading-=360);const t=ze(n,e),r=k([n.x,n.y],[e.x,e.y]);if(!t||!r)return;return{measurementAngle:t,tempDistance:r}}const c=await He(n,l,i);if(!c)return;const h=De(n,c),u=k([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.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 dt();be(a,e,i),await i.create(e,{...t,defaultZ:0})}async digitizeDelete(){if(!this.sketch)throw dt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw dt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw dt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw dt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw dt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw dt();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,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&&(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=ee(a,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:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&ie(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=ae(a,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:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&ie(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("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: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=Te(e.vertices.at(-1),r,o);if(a.length<1||!n||!i||!t||"none"===r)return;const l=Ue(a[0],n,t);if(!l?.length)return;this.heightMeasurementPixels.push(l),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const c=Ne(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=Te(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?B(e):e.clone(),this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._overlays?.removeAll(),this._fetchFeaturesWithController(e,t)}loadImageError(e){u.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:i}=await t;f(e),this.sketch=new i({layer:this._sketchGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(f(e),this.sketchAdapter=new i({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async startMeasurement(e,t){await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:a,activeViewer:r,mode:s}=this;if(!i||!a||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===s){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=$e(o),this.sketch.polylineSymbol="panoramic"===s?Je:Ze(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)],i=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new L({paths:[e],spatialReference:i});else{const a=new L({paths:[e],spatialReference:i}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:a,symbol:Ze(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}=Y(a,i[0],i[1]),{heading:n,pitch:l}=Y(r,i[0],i[1]),c=[[...ne(s,o)],[...ne(n,l)]];if(this.heightGraphic)this.heightGraphic.geometry=new L({paths:[c],spatialReference:e});else{const i=new L({paths:[c],spatialReference:e});this.heightGraphic=new t({geometry:i,symbol:Je}),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}=T(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=Ke.clone();return n.outline=new pe({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,h=r?.imageSize;if(!h||!o||"none"===n||l.includes("loading")||!c)return;const{polygon:p}=T(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=Fe(e,c.imageGeometryField,c.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:m}=await e.queryFeatures({geometry: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&&_e(e,p,m)&&`${s[m]}`==`${o.attributes.objectId}`)try{return Pe(s,p,e,a,r)}catch(g){u.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:h,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,u=i.map((e=>e.map((([e,t,i])=>new R({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(u.map((async e=>this.getPixels(e,{feature:o,imageSize:h,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&&a})}case"polyline":{const{paths:i,spatialReference:l}=c,u=i.map((e=>e.map((([e,t,i])=>new R({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(u.map((async e=>this.getPixels(e,{feature:o,imageSize:h,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&&a})}case"multipoint":{const{points:i,spatialReference:l}=c,u=i.map((([e,t,i])=>new R({x:e,y:t,z:i,spatialReference:l}))),p=await this.getPixels(u,{feature:o,imageSize:h,mode:n}).then((e=>e.map(re)));return new t({attributes:s,layer:e,symbol:r,geometry:new G({points:p,spatialReference:j.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 R({x:e.x-.5,y:.5-e.y,spatialReference:j.WebMercator});const[t,r]=i,{heading:s,pitch:o}=Y(e,t,r),n=ne(s,o);return new R(n,j.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 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&&ie(p.elevationSample)&&(i.elevationSample=p.elevationSample),"default"===a){const t=ee(o,r[0],r[1]);m=await J(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}else{const t=ae(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 R({...e.toJSON()}),symbol:Qe}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const i=c.isSerializable(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._referencePointOnImage=new t({geometry:new R({spatialReference:this._imageViewer.imageRenderer.spatialReference,...i}),symbol:Qe}),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}=Y(e,a,r),n=ne(s,o);this._referencePointOnImage=new t({geometry:new R(n,j.WebMercator),symbol:Xe}),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("Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("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(se(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])=>se(s,{x:e,y:t,z:i},o))),{feature:a,imageSize:o,mode:s}))));return t.geometry=new O({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,rings:e.map((e=>e.map(re)))}),t}case"polyline":{const e=await Promise.all(m.paths.map((async e=>this.getMapPoint(e.map((([e,t,i])=>se(s,{x:e,y:t,z:i},o))),{feature:a,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(i);return r.applyEdits({addFeatures:c}).then((e=>{const{addFeatureResults:t}=e;let i=0;const a=l.map((e=>{const a=t[i++];return e?a:{error:new n("Error in saving data capture features"),objectId:null,globalId:null}}));return{...e,addFeatureResults:a}}))}async searchBestImage(e,t){try{const i=await H(e,t);i&&await this._processFeatureResponse(i,e.point,{signal:t?.signal})}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),u.getLogger(this).error("error occurred while finding best image",i))}}selectBestFeature(e){this.currentBestFeature=this.features?.find((({attributes:t})=>t.objectId===Number(e)))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach((t=>{t.visible=e}))}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach((t=>{t.visible=e}))}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}async 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 x(t,s.spatialReference);a=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(!a&&!r)return void this.clearReferencePointOnImage();const o=await this.worldToImage(t,i);if(o)return f(i),this.plotReferencePointOnImage(o),{x:o.x,y:o.y};this.clearReferencePointOnImage()}updateSuitabilities(e){e.sort(((e,t)=>e.suitability-t.suitability)),this._suitabilities=e;const t=this._suitabilities.map((({feature:e})=>e));this._initialCurrentCoverageUpdate=!0,this._updateFeatures(t),this._groupFeaturesBySectors()}async _fetchFeatures(e,t){if(!this.view)return;const i=this.layer;if(i){const a={include:i},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,a);return this._processHitTestResults(i,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,currentBestFeature:i,features:a,invalidCameraHeading:r}=this;if(!e||!t||!i||!a||r)return void(this._sectorData=null);this._sectorData={};for(const c of 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:i,featureIndex:r}=e,s=t/l*we[2],o=lt(t,l),n=ct(i);if(!this._sectorData)return;const c=we[3]+s*Math.sin(i*Math.PI/180),h=we[3]+s*Math.cos(i*Math.PI/180);let u;const p=a.at(r),m=p===this.currentBestFeature,d=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;if(m&&d)u=-90;else{const e=c-we[3],t=h-we[3],i=t/Math.sqrt(e**2+t**2);let a=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(a*=-1),u=a}const g=""===o?n:`${o}_${n}`;m&&(u===this.bestFeatureAngle?this.previousFeatureAngle=u:this.bestFeatureAngle=u,this.navigatorCurrentBestFeature=d?null:{x:c,y:h,direction:n});const y=this._sectorData[g];y.add({angle:i,featureIndex:r,x:c,y:h,objectID:p.attributes.objectId,sector:g,featureIndexInSector:y.length})}))}_plotLocationPointOnDefaultImage(e){const i=c.isSerializable(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._locationPointOnImage=new t({geometry:new R({spatialReference:this._imageViewer.imageRenderer.spatialReference,...i}),symbol:Ye}),this._imageViewer.addGraphic(this._locationPointOnImage,0)}_plotLocationPointOnPanoramicImage(e){const{imageSize:i}=this._panoramicViewer;if(!i)return;const[a,r]=i,{heading:s,pitch:o}=Y(e,a,r),n=ne(s,o);this._locationPointOnImage=new t({geometry:new R(n,j.WebMercator),symbol:et}),this._panoramicViewer.addGraphic(this._locationPointOnImage,0)}async _processFeatureResponse(e,t,i){const{features:a}=e;if(!a?.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll();const{features:r,polygons:s,frustums:o}=this.filterByFootprints(a,t);if(!r.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);let n;if(this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o),s[0]){let e=new O({spatialReference:s[0].spatialReference});for(const i of s)e=await A(e,i);const t=[];for(const{geometry:i}of r)e.contains(i)||t.push([i.x,i.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,i)}catch(l){y(l)||u.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 i=await te((r[0].attributes.location.z??0)-r[0].attributes.cameraHeight,{elevationSample:n,elevationSource:e,extent:this.footprintExtent}),[a,...s]=await K([t,...r.map((e=>e.attributes.geometry.clone()))],i);r[0].elevationSample=n??i.elevationSample,t.elevation=a.z,r.forEach(((e,t)=>{e.attributes.elevation=s[t].z}))}r[0].elevationSample&&r.forEach((e=>{e.elevationSample=r[0].elevationSample})),this._suitabilities=D({features:r,selectedPoint:t,camera:ot(this.view)?this.view.camera:null,currentImage:this.currentBestFeature}),this.updateSuitabilities(this._suitabilities)}async _processHitTestResults(e,t,i){const{screenPoint:a,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(a);if(!o)return;const{layerFloorFilterClause:n}=this,l=e.spatialReference.equals(o.spatialReference)?o:await x(o,e.spatialReference),c=I("1=1",I(e.definitionExpression,n)),h=l.spatialReference.isGeographic?1:S(l.spatialReference),u={layerInstanceOrURL:e,point:l,queryParams:{where:c,maximumDistance:e.maximumDistance?e.maximumDistance/h:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(u,i)}_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: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:tt,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:Ke,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-we[3],a=e.y-we[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)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:a,feature:t})}}async worldToImage(e,t){const{footprintExtent:i}=this,{imageSize:a}=this.activeViewer;if("none"===this.mode||!this.currentBestFeature||!a||!i)return;const{attributes:{location:r,elevationSource:s,cameraHeading:o,elevation:n,cameraHeight:l},elevationSample:c}=this.currentBestFeature;let h=r.clone();const u=await 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)))),f(t),"panoramic"===this.mode)m=ce(d,{imageHeight:a[1],imageWidth:a[0],cameraHeading:o,cameraLocation:h});else{const e=oe(this.currentBestFeature.attributes,a[0],a[1]);m=he(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(nt);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:We.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([M()],gt.prototype,"activeLayer",null),e([M({readOnly:!0})],gt.prototype,"activeViewer",null),e([M()],gt.prototype,"accuracyParametersMissing",null),e([M()],gt.prototype,"additionalFeatures",void 0),e([M({type:s.ofType(t)})],gt.prototype,"additionalCameraLocations",void 0),e([M({type:s.ofType(t)})],gt.prototype,"additionalFootprints",void 0),e([M()],gt.prototype,"areaMeasurementResult",void 0),e([M()],gt.prototype,"areaMeasurementAccuracy",void 0),e([M()],gt.prototype,"bestFeatureAngle",void 0),e([M()],gt.prototype,"bestFeatureCurrentFootprint",void 0),e([M({type:t})],gt.prototype,"bestFeatureFootprint",void 0),e([M({type:Number})],gt.prototype,"brightness",null),e([M()],gt.prototype,"collectionId",void 0),e([M({type:Number})],gt.prototype,"contrast",null),e([M()],gt.prototype,"conversionProps",void 0),e([M()],gt.prototype,"coverageFrustums",void 0),e([M()],gt.prototype,"coveragePolygons",void 0),e([M()],gt.prototype,"currentBestFeature",void 0),e([M()],gt.prototype,"currentBestFeatureLocation",void 0),e([M()],gt.prototype,"currentCoverageVisible",void 0),e([M({json:{write:!1}})],gt.prototype,"determineWorkflowForFeature",void 0),e([M()],gt.prototype,"disabled",void 0),e([M()],gt.prototype,"displayMessage",void 0),e([M()],gt.prototype,"displayNewMeasurementButton",void 0),e([M()],gt.prototype,"distanceMeasurementResult",void 0),e([M()],gt.prototype,"distanceAccuracyArray",void 0),e([M()],gt.prototype,"dataCaptureLayer",void 0),e([M({readOnly:!0})],gt.prototype,"featureCount",null),e([M()],gt.prototype,"features",void 0),e([M()],gt.prototype,"groundCoordinates",void 0),e([M()],gt.prototype,"heightMeasurementPixels",void 0),e([M()],gt.prototype,"heightGraphic",void 0),e([M()],gt.prototype,"heightMeasurementResult",void 0),e([M()],gt.prototype,"heightMeasurementAccuracy",void 0),e([M()],gt.prototype,"measurementAngle",void 0),e([M()],gt.prototype,"tempDistance",void 0),e([M({readOnly:!0})],gt.prototype,"imageGalleryEnabled",null),e([M()],gt.prototype,"imageGeometryField",void 0),e([M({readOnly:!0})],gt.prototype,"imageLoaded",null),e([M()],gt.prototype,"imageLocationToolState",void 0),e([M({readOnly:!0})],gt.prototype,"invalidCameraHeading",null),e([M()],gt.prototype,"imagePointsInView",null),e([M()],gt.prototype,"isAdditionalCoverageVisible",void 0),e([M()],gt.prototype,"isAdditionalPointSourcesVisible",void 0),e([M()],gt.prototype,"layer",void 0),e([M()],gt.prototype,"layerView",null),e([M({readOnly:!0})],gt.prototype,"layerFloorFilterClause",null),e([M({type:Number})],gt.prototype,"localPort",void 0),e([M()],gt.prototype,"mapImageConversionToolState",void 0),e([M()],gt.prototype,"measureType",void 0),e([M()],gt.prototype,"measurementGraphic",void 0),e([M({readOnly:!0,value:"none"})],gt.prototype,"mode",null),e([M()],gt.prototype,"navigatorCurrentBestFeature",void 0),e([M()],gt.prototype,"oiObjectIdField",void 0),e([M({type:s.ofType(t)})],gt.prototype,"overlayedCameraLocations",void 0),e([M()],gt.prototype,"overlayedMapFeatures",void 0),e([M()],gt.prototype,"pixelCoordinates",void 0),e([M()],gt.prototype,"pointSources",void 0),e([M({readOnly:!0})],gt.prototype,"popupEnabled",null),e([M()],gt.prototype,"previousFeatureAngle",void 0),e([M()],gt.prototype,"referencePoint",null),e([M({readOnly:!0})],gt.prototype,"sectorData",null),e([M()],gt.prototype,"selectedPoint",void 0),e([M({type:Number})],gt.prototype,"sharpness",null),e([M()],gt.prototype,"shouldShowSelectedImage",void 0),e([M()],gt.prototype,"sketch",void 0),e([M()],gt.prototype,"draw",void 0),e([M()],gt.prototype,"sketchAdapter",void 0),e([M({readOnly:!0})],gt.prototype,"sketchGraphicsLayer",null),e([M({readOnly:!0})],gt.prototype,"state",null),e([M({readOnly:!0})],gt.prototype,"thumbnails",null),e([M()],gt.prototype,"updateFootprint",void 0),e([M()],gt.prototype,"updateFootprintPanorama",void 0),e([M({value:null})],gt.prototype,"view",null),e([M()],gt.prototype,"_adapter",void 0),e([M()],gt.prototype,"_sketchGraphicsLayer",null),e([M()],gt.prototype,"_highlightedFeatureHandle",void 0),e([M()],gt.prototype,"_imageViewer",void 0),e([M()],gt.prototype,"_initialCurrentCoverageUpdate",void 0),e([M()],gt.prototype,"_locationPointOnImage",void 0),e([M()],gt.prototype,"_overlays",void 0),e([M({readOnly:!0})],gt.prototype,"_overlaysView",null),e([M()],gt.prototype,"_panoramicViewer",void 0),e([M()],gt.prototype,"_previousCursor",void 0),e([M()],gt.prototype,"_referencePointOnGround",void 0),e([M()],gt.prototype,"_referencePointOnImage",void 0),e([M()],gt.prototype,"_sectorData",void 0),e([M({readOnly:!0})],gt.prototype,"_updatingHandles",void 0),e([M()],gt.prototype,"footprintExtent",void 0),e([M()],gt.prototype,"_featureChangedTask",void 0),gt=e([C("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],gt);const yt=gt;export{yt as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{isSome as i,equals as a}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import l from"../../core/Evented.js";import c from"../../core/JSONSupport.js";import{equalsShallow as h}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as p}from"../../core/mathUtils.js";import{abortMaybe as m,destroyMaybe as d}from"../../core/maybe.js";import g from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as f,waitTick as v}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{on as b,watch as F,syncAndInitial as _,initial as P}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{getMetersPerUnitForSR as S}from"../../core/unitUtils.js";import{property as M}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as C}from"../../core/accessorSupport/decorators/subclass.js";import{distance as k}from"../../core/libs/gl-matrix-2/math/vec2.js";import{UpdatingHandles as V}from"../../core/support/UpdatingHandles.js";import{union as A}from"../../geometry/geometryEngineAsync.js";import G from"../../geometry/Multipoint.js";import R 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 ie,getImageToWorldPanoramicProperties as ae,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 Se}from"./galleryUtils.js";import{formatPixels as Me,heightMeasurementPanoramic as Ce,heightMeasurement2D as ke,calculateHeightAccuracyPanoramic as Ve,calculateHeightAccuracy as Ae,pixelAreaMeasurement2D as Ge,pixelAreaMeasurementPanoramic as Re,pixelDistanceMeasurement2D as Oe,pixelDistanceMeasurementPanoramic as Le,generateCombinations as xe,getRootOfSumOfSquaredErrors as je,generateCombinationsPanoramic as Ee,calculateReferenceImagePointPanoramic as Be,calculateAnglePano as ze,calculateTempImagePoint as He,calculateAngle as De,getModeCorrectedPoint as Te,calculateCorrectedPixel as Ue,calculateHeightFromTemporaryDistance as Ne}from"./imageMeasurementUtils.js";import{crossSymbol as We,crossSymbol3D as qe,measurementPolygonSymbol as $e,polylineSymbolPanoramic as Je,measurementPolylineSymbol as Ze,sourcePointSymbol as Ke,diamondSymbol as Qe,diamondSymbol3D as Xe,locationSymbol as Ye,locationSymbol3D as et,activeSourcePointSymbol as tt}from"./symbols.js";import{isNoAttachmentError as it,getContentType as at,isTifOrMrf as rt,filterOILLayerView as st,isSceneView as ot,isGraphic as nt,calculateSegment as lt,calculateDirection as ct}from"./utils.js";import ht from"./components/ImageViewer.js";const ut={click:"view-click",imageClick:"image-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles",sketchHandles:"sketch-handles"},pt=new Set(["JPG","JPEG"]),mt=/\.(\w+)$/,dt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let gt=class extends(l.EventedMixin(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.collectionId=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:a,selectedPoint:r,view:s}=this;if(s?.closePopup(),a&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadImage(i)}catch(o){y(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.draw=null,this.sketchAdapter=null,this.updateFootprint=async(e,t)=>{"image-loaded"===this.state&&await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new ht,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: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.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.toggleImageAttributes=()=>{m(this._openPopupTask),this._openPopupTask=r((async e=>{const{currentBestFeature:i,popupEnabled:a,layer:r,view:s}=this;if(s?.closePopup(),!(s&&i&&a&&r))return;const{attributes:o,geometry:n}=i,l=new t({geometry:n,attributes:o.toJSON(),layer:r});f(e),await s.openPopup({features:[l],location:o.location.clone()})}))},this._createViewClickHandle=()=>{if(this.removeHandles(ut.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),ut.click)},this._createImageClickHandle=()=>{this.removeHandles(ut.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:i,currentBestFeature:a,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&a))return;i.clickAction="pixel-location";let n=null;const l=b((()=>i),"pixel-location",(e=>{this.plotReferencePointOnImage(e),n?.abort(),n=r((async i=>{if(!e)return;const r=await this.getMapPoint(e,{feature:a,imageSize:o,mode:t}).then((e=>{const t=this.view?.spatialReference;return le(!t,e.spatialReference.equals(t))?e:x(e,t)}));f(i),this.plotReferencePointOnGround(r)}))}));this.addHandles(l,ut.imageClick)},this._createImageLocationHandle=()=>{this.removeHandles(ut.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:i,currentBestFeature:a,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&a))return;i.clickAction="pixel-location";let n=null;const l=b((()=>i),"pixel-location",(e=>{this.pixelCoordinates=e,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 x(r,s),f(i)),this.groundCoordinates=r}))}));this.addHandles(l,ut.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:h,cameraOrientation:p,location:m}=r,d=(l??0)+(o??0),g=m.spatialReference.isWGS84&&4!==p?.type?B(m):new R(m);let v=s;if(Ie(s))try{v=await Se(i,h,e)}catch(w){if(y(w))return;return it(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${i.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[i.objectIdField]:h,layer:i}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${i.objectIdField} ${h}`))}try{await this.loadImageFromSource(v,{imageRotation:d,options:e,pitch:c,yaw:n,mode:a,cameraLocation:g}),f(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:i,imageRotation:a,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:l}=new URL(o);let c=s?n.match(mt)?.[1]:e.datasetFormat;if(!c)try{c=await at(o,{...t.options})}catch(h){y(h)||u.getLogger(this).error("#getContentType()",h)}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(pt.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 X(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 R({...c.isSerializable(e)?e.toJSON():e});if("default"===this.mode)a.x-=.5,a.y=.5-a.y,a.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:a,symbol:We}),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}=Y(e,a,r),n=ne(s,o);this._crossSymbol=new t({geometry:new R(n,j.WebMercator),symbol:qe}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this),this.selectBestFeature=this.selectBestFeature.bind(this)}initialize(){this.addHandles([F((()=>this.view),(()=>{this.load()}),_),F((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),P),F((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),P),F((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),_),F((()=>[this.state,this.imageLocationToolState,this.view]),(()=>{if(this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();this._setMeasurementCursor()}),_),F((()=>this.measureType),(()=>{this.clearPreviousMeasurements()}),_),F((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),_),F((()=>this.currentBestFeature),(async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=r((async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}]))),await this._featureChangedTask.promise}),{sync:!0}),F((()=>this.mode),(e=>{switch(this.removeHandles(ut.interactionHandles),e){case"default":this.addHandles(F((()=>{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})})))}),{..._,equals:(e,t)=>a(e,t,h)}),ut.interactionHandles);break;case"panoramic":this.addHandles(F((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:i,vfov:a,hfov:r,pitch:s,yaw:o}=this._panoramicViewer;return e&&i&&!t.includes("loading")?[a,r,o,s]:null}),(e=>{if(!e||this.state.includes("loading"))return;const[t,i,a,s]=e;m(this._updateFootprintTask),this._updateFootprintTask=r((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:a,pitch:s},{signal:e})}))}),{..._,equals:(e,t)=>a(e,t,h)}),ut.interactionHandles)}}),_),F((()=>[this.brightness,this.contrast,this.sharpness]),(()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:a,sharpness:r}=this;"default"===a&&(e.brightness=t,e.contrast=i,e.sharpness=r)}),_),F((()=>this.activeViewer?.imageRenderer),(()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}))]),this.when().finally((()=>{this.notifyChange("state")}))}destroy(){this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=d(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._crossSymbol=d(this._crossSymbol),this._referencePointOnGround=d(this._referencePointOnGround),this._referencePointOnImage=d(this._referencePointOnImage),this._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(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:i}=this;switch(i){case"default":return e;case"panoramic":return t;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every((e=>0===e))??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",p(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",p(e,-10,10))}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return rt(t)||Ie(t)}get imageLoaded(){return o(u.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===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(st(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: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?ve.map((t=>e[t])):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",p(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t,_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 rt(r)||Ie(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 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,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():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=Me(m,!1),g="panoramic"===t?await Ce(m,h,c,a,!0,!1):await ke(m,h,c,!0,i);if(!g)return;const y="panoramic"===t?await Ve(c,d,h,g,a,!0):await Ae(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 Ge(e,a,!0):await Re(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 Oe([e.at(0),e.at(-1)],s,!0):await Le([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 Ge(e,l,!0):await Oe([e.at(0),e.at(-1)],l,!0);f(i);const{updateElevationProps:h,...u}=l,p=xe(u,o);if(!p?.length)return null;const m=p.map((e=>({...e,updateElevationProps:h}))).map((async a=>{const r="area"===t?await Ge(e,a,!0):await Oe([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:je(g)}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 Re(e,c,!0):await Le([e.at(0),e.at(-1)],c,!0);f(i);const{updateElevationProps:u,...p}=c,m=Ee(p,n);if(!m?.length)return null;const d=m.map((e=>({...e,updateElevationProps:u}))).map((async a=>{const r="area"===t?await Re(e,a,!0):await Le([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:je(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]=Me([e],"panoramic"!==t),l="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ee(o,s[0],s[1]);if("panoramic"===t){if(!l)return;const e=await Be(n,l,a,i);if(!e)return;e?.heading>180&&(e.heading-=360);const t=ze(n,e),r=k([n.x,n.y],[e.x,e.y]);if(!t||!r)return;return{measurementAngle:t,tempDistance:r}}const c=await He(n,l,i);if(!c)return;const h=De(n,c),u=k([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.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 dt();be(a,e,i),await i.create(e,{...t,defaultZ:0})}async digitizeDelete(){if(!this.sketch)throw dt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw dt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw dt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw dt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw dt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw dt();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,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&&(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=ee(a,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:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&ie(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=ae(a,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:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&ie(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("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: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=Te(e.vertices.at(-1),r,o);if(a.length<1||!n||!i||!t||"none"===r)return;const l=Ue(a[0],n,t);if(!l?.length)return;this.heightMeasurementPixels.push(l),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const c=Ne(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=Te(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?B(e):e.clone(),this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._overlays?.removeAll(),this._fetchFeaturesWithController(e,t)}loadImageError(e){u.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:i}=await t;f(e),this.sketch=new i({layer:this._sketchGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(f(e),this.sketchAdapter=new i({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async startMeasurement(e,t){await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:a,activeViewer:r,mode:s}=this;if(!i||!a||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===s){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=$e(o),this.sketch.polylineSymbol="panoramic"===s?Je:Ze(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)],i=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new L({paths:[e],spatialReference:i});else{const a=new L({paths:[e],spatialReference:i}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:a,symbol:Ze(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}=Y(a,i[0],i[1]),{heading:n,pitch:l}=Y(r,i[0],i[1]),c=[[...ne(s,o)],[...ne(n,l)]];if(this.heightGraphic)this.heightGraphic.geometry=new L({paths:[c],spatialReference:e});else{const i=new L({paths:[c],spatialReference:e});this.heightGraphic=new t({geometry:i,symbol:Je}),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}=T(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=Ke.clone();return n.outline=new pe({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,h=r?.imageSize;if(!h||!o||"none"===n||l.includes("loading")||!c)return;const{polygon:p}=T(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=Fe(e,c.imageGeometryField,c.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:m}=await e.queryFeatures({geometry: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&&_e(e,p,m)&&`${s[m]}`==`${o.attributes.objectId}`)try{return Pe(s,p,e,a,h,n,r)}catch(g){u.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:h,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,u=i.map((e=>e.map((([e,t,i])=>new R({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(u.map((async e=>this.getPixels(e,{feature:o,imageSize:h,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&&a})}case"polyline":{const{paths:i,spatialReference:l}=c,u=i.map((e=>e.map((([e,t,i])=>new R({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(u.map((async e=>this.getPixels(e,{feature:o,imageSize:h,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&&a})}case"multipoint":{const{points:i,spatialReference:l}=c,u=i.map((([e,t,i])=>new R({x:e,y:t,z:i,spatialReference:l}))),p=await this.getPixels(u,{feature:o,imageSize:h,mode:n}).then((e=>e.map(re)));return new t({attributes:s,layer:e,symbol:r,geometry:new G({points:p,spatialReference:j.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 R({x:e.x-.5,y:.5-e.y,spatialReference:j.WebMercator});const[t,r]=i,{heading:s,pitch:o}=Y(e,t,r),n=ne(s,o);return new R(n,j.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 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&&ie(p.elevationSample)&&(i.elevationSample=p.elevationSample),"default"===a){const t=ee(o,r[0],r[1]);m=await J(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}else{const t=ae(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 R({...e.toJSON()}),symbol:Qe}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const i=c.isSerializable(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._referencePointOnImage=new t({geometry:new R({spatialReference:this._imageViewer.imageRenderer.spatialReference,...i}),symbol:Qe}),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}=Y(e,a,r),n=ne(s,o);this._referencePointOnImage=new t({geometry:new R(n,j.WebMercator),symbol:Xe}),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("Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("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(se(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])=>se(s,{x:e,y:t,z:i},o))),{feature:a,imageSize:o,mode:s}))));return t.geometry=new O({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,rings:e.map((e=>e.map(re)))}),t}case"polyline":{const e=await Promise.all(m.paths.map((async e=>this.getMapPoint(e.map((([e,t,i])=>se(s,{x:e,y:t,z:i},o))),{feature:a,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(i);return r.applyEdits({addFeatures:c}).then((e=>{const{addFeatureResults:t}=e;let i=0;const a=l.map((e=>{const a=t[i++];return e?a:{error:new n("Error in saving data capture features"),objectId:null,globalId:null}}));return{...e,addFeatureResults:a}}))}async searchBestImage(e,t){try{const i=await H(e,t);i&&await this._processFeatureResponse(i,e.point,{signal:t?.signal})}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),u.getLogger(this).error("error occurred while finding best image",i))}}selectBestFeature(e){this.currentBestFeature=this.features?.find((({attributes:t})=>t.objectId===Number(e)))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach((t=>{t.visible=e}))}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach((t=>{t.visible=e}))}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}async 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 x(t,s.spatialReference);a=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(!a&&!r)return void this.clearReferencePointOnImage();const o=await this.worldToImage(t,i);if(o)return f(i),this.plotReferencePointOnImage(o),{x:o.x,y:o.y};this.clearReferencePointOnImage()}updateSuitabilities(e){e.sort(((e,t)=>e.suitability-t.suitability)),this._suitabilities=e;const t=this._suitabilities.map((({feature:e})=>e));this._initialCurrentCoverageUpdate=!0,this._updateFeatures(t),this._groupFeaturesBySectors()}async _fetchFeatures(e,t){if(!this.view)return;const i=this.layer;if(i){const a={include:i},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,a);return this._processHitTestResults(i,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,currentBestFeature:i,features:a,invalidCameraHeading:r}=this;if(!e||!t||!i||!a||r)return void(this._sectorData=null);this._sectorData={};for(const c of 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:i,featureIndex:r}=e,s=t/l*we[2],o=lt(t,l),n=ct(i);if(!this._sectorData)return;const c=we[3]+s*Math.sin(i*Math.PI/180),h=we[3]+s*Math.cos(i*Math.PI/180);let u;const p=a.at(r),m=p===this.currentBestFeature,d=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;if(m&&d)u=-90;else{const e=c-we[3],t=h-we[3],i=t/Math.sqrt(e**2+t**2);let a=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(a*=-1),u=a}const g=""===o?n:`${o}_${n}`;m&&(u===this.bestFeatureAngle?this.previousFeatureAngle=u:this.bestFeatureAngle=u,this.navigatorCurrentBestFeature=d?null:{x:c,y:h,direction:n});const y=this._sectorData[g];y.add({angle:i,featureIndex:r,x:c,y:h,objectID:p.attributes.objectId,sector:g,featureIndexInSector:y.length})}))}_plotLocationPointOnDefaultImage(e){const i=c.isSerializable(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._locationPointOnImage=new t({geometry:new R({spatialReference:this._imageViewer.imageRenderer.spatialReference,...i}),symbol:Ye}),this._imageViewer.addGraphic(this._locationPointOnImage,0)}_plotLocationPointOnPanoramicImage(e){const{imageSize:i}=this._panoramicViewer;if(!i)return;const[a,r]=i,{heading:s,pitch:o}=Y(e,a,r),n=ne(s,o);this._locationPointOnImage=new t({geometry:new R(n,j.WebMercator),symbol:et}),this._panoramicViewer.addGraphic(this._locationPointOnImage,0)}async _processFeatureResponse(e,t,i){const{features:a}=e;if(!a?.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll();const{features:r,polygons:s,frustums:o}=this.filterByFootprints(a,t);if(!r.length)return this.setMessage("noImageError","error"),void(this.currentBestFeature=null);let n;if(this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o),s[0]){let e=new O({spatialReference:s[0].spatialReference});for(const i of s)e=await A(e,i);const t=[];for(const{geometry:i}of r)e.contains(i)||t.push([i.x,i.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,i)}catch(l){y(l)||u.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 i=await te((r[0].attributes.location.z??0)-r[0].attributes.cameraHeight,{elevationSample:n,elevationSource:e,extent:this.footprintExtent}),[a,...s]=await K([t,...r.map((e=>e.attributes.geometry.clone()))],i);r[0].elevationSample=n??i.elevationSample,t.elevation=a.z,r.forEach(((e,t)=>{e.attributes.elevation=s[t].z}))}r[0].elevationSample&&r.forEach((e=>{e.elevationSample=r[0].elevationSample})),this._suitabilities=D({features:r,selectedPoint:t,camera:ot(this.view)?this.view.camera:null,currentImage:this.currentBestFeature}),this.updateSuitabilities(this._suitabilities)}async _processHitTestResults(e,t,i){const{screenPoint:a,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(a);if(!o)return;const{layerFloorFilterClause:n}=this,l=e.spatialReference.equals(o.spatialReference)?o:await x(o,e.spatialReference),c=I("1=1",I(e.definitionExpression,n)),h=l.spatialReference.isGeographic?1:S(l.spatialReference),u={layerInstanceOrURL:e,point:l,queryParams:{where:c,maximumDistance:e.maximumDistance?e.maximumDistance/h:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(u,i)}_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: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:tt,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:Ke,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-we[3],a=e.y-we[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)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:a,feature:t})}}async worldToImage(e,t){const{footprintExtent:i}=this,{imageSize:a}=this.activeViewer;if("none"===this.mode||!this.currentBestFeature||!a||!i)return;const{attributes:{location:r,elevationSource:s,cameraHeading:o,elevation:n,cameraHeight:l},elevationSample:c}=this.currentBestFeature;let h=r.clone();const u=await 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)))),f(t),"panoramic"===this.mode)m=ce(d,{imageHeight:a[1],imageWidth:a[0],cameraHeading:o,cameraLocation:h});else{const e=oe(this.currentBestFeature.attributes,a[0],a[1]);m=he(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(nt);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:We.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([M()],gt.prototype,"activeLayer",null),e([M({readOnly:!0})],gt.prototype,"activeViewer",null),e([M()],gt.prototype,"accuracyParametersMissing",null),e([M()],gt.prototype,"additionalFeatures",void 0),e([M({type:s.ofType(t)})],gt.prototype,"additionalCameraLocations",void 0),e([M({type:s.ofType(t)})],gt.prototype,"additionalFootprints",void 0),e([M()],gt.prototype,"areaMeasurementResult",void 0),e([M()],gt.prototype,"areaMeasurementAccuracy",void 0),e([M()],gt.prototype,"bestFeatureAngle",void 0),e([M()],gt.prototype,"bestFeatureCurrentFootprint",void 0),e([M({type:t})],gt.prototype,"bestFeatureFootprint",void 0),e([M({type:Number})],gt.prototype,"brightness",null),e([M()],gt.prototype,"collectionId",void 0),e([M({type:Number})],gt.prototype,"contrast",null),e([M()],gt.prototype,"conversionProps",void 0),e([M()],gt.prototype,"coverageFrustums",void 0),e([M()],gt.prototype,"coveragePolygons",void 0),e([M()],gt.prototype,"currentBestFeature",void 0),e([M()],gt.prototype,"currentBestFeatureLocation",void 0),e([M()],gt.prototype,"currentCoverageVisible",void 0),e([M({json:{write:!1}})],gt.prototype,"determineWorkflowForFeature",void 0),e([M()],gt.prototype,"disabled",void 0),e([M()],gt.prototype,"displayMessage",void 0),e([M()],gt.prototype,"displayNewMeasurementButton",void 0),e([M()],gt.prototype,"distanceMeasurementResult",void 0),e([M()],gt.prototype,"distanceAccuracyArray",void 0),e([M()],gt.prototype,"dataCaptureLayer",void 0),e([M({readOnly:!0})],gt.prototype,"featureCount",null),e([M()],gt.prototype,"features",void 0),e([M()],gt.prototype,"groundCoordinates",void 0),e([M()],gt.prototype,"heightMeasurementPixels",void 0),e([M()],gt.prototype,"heightGraphic",void 0),e([M()],gt.prototype,"heightMeasurementResult",void 0),e([M()],gt.prototype,"heightMeasurementAccuracy",void 0),e([M()],gt.prototype,"measurementAngle",void 0),e([M()],gt.prototype,"tempDistance",void 0),e([M({readOnly:!0})],gt.prototype,"imageGalleryEnabled",null),e([M()],gt.prototype,"imageGeometryField",void 0),e([M({readOnly:!0})],gt.prototype,"imageLoaded",null),e([M()],gt.prototype,"imageLocationToolState",void 0),e([M({readOnly:!0})],gt.prototype,"invalidCameraHeading",null),e([M()],gt.prototype,"imagePointsInView",null),e([M()],gt.prototype,"isAdditionalCoverageVisible",void 0),e([M()],gt.prototype,"isAdditionalPointSourcesVisible",void 0),e([M()],gt.prototype,"layer",void 0),e([M()],gt.prototype,"layerView",null),e([M({readOnly:!0})],gt.prototype,"layerFloorFilterClause",null),e([M({type:Number})],gt.prototype,"localPort",void 0),e([M()],gt.prototype,"mapImageConversionToolState",void 0),e([M()],gt.prototype,"measureType",void 0),e([M()],gt.prototype,"measurementGraphic",void 0),e([M({readOnly:!0,value:"none"})],gt.prototype,"mode",null),e([M()],gt.prototype,"navigatorCurrentBestFeature",void 0),e([M()],gt.prototype,"oiObjectIdField",void 0),e([M({type:s.ofType(t)})],gt.prototype,"overlayedCameraLocations",void 0),e([M()],gt.prototype,"overlayedMapFeatures",void 0),e([M()],gt.prototype,"pixelCoordinates",void 0),e([M()],gt.prototype,"pointSources",void 0),e([M({readOnly:!0})],gt.prototype,"popupEnabled",null),e([M()],gt.prototype,"previousFeatureAngle",void 0),e([M()],gt.prototype,"referencePoint",null),e([M({readOnly:!0})],gt.prototype,"sectorData",null),e([M()],gt.prototype,"selectedPoint",void 0),e([M({type:Number})],gt.prototype,"sharpness",null),e([M()],gt.prototype,"shouldShowSelectedImage",void 0),e([M()],gt.prototype,"sketch",void 0),e([M()],gt.prototype,"draw",void 0),e([M()],gt.prototype,"sketchAdapter",void 0),e([M({readOnly:!0})],gt.prototype,"sketchGraphicsLayer",null),e([M({readOnly:!0})],gt.prototype,"state",null),e([M({readOnly:!0})],gt.prototype,"thumbnails",null),e([M()],gt.prototype,"updateFootprint",void 0),e([M()],gt.prototype,"updateFootprintPanorama",void 0),e([M({value:null})],gt.prototype,"view",null),e([M()],gt.prototype,"_adapter",void 0),e([M()],gt.prototype,"_sketchGraphicsLayer",null),e([M()],gt.prototype,"_highlightedFeatureHandle",void 0),e([M()],gt.prototype,"_imageViewer",void 0),e([M()],gt.prototype,"_initialCurrentCoverageUpdate",void 0),e([M()],gt.prototype,"_locationPointOnImage",void 0),e([M()],gt.prototype,"_overlays",void 0),e([M({readOnly:!0})],gt.prototype,"_overlaysView",null),e([M()],gt.prototype,"_panoramicViewer",void 0),e([M()],gt.prototype,"_previousCursor",void 0),e([M()],gt.prototype,"_referencePointOnGround",void 0),e([M()],gt.prototype,"_referencePointOnImage",void 0),e([M()],gt.prototype,"_sectorData",void 0),e([M({readOnly:!0})],gt.prototype,"_updatingHandles",void 0),e([M()],gt.prototype,"footprintExtent",void 0),e([M()],gt.prototype,"_featureChangedTask",void 0),gt=e([C("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],gt);const yt=gt;export{yt as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Collection.js";import o from"../../../../core/ReactiveMap.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{SketchHandlerMixin as i}from"../../mixins/SketchHandlerMixin.js";let c=class extends(i(t)){constructor(e){super(e),this.savedGraphics=new r,this.type="data-capture",this.pendingGraphics=new o}get collectionId(){return this.viewModel.collectionId}handleCreate(e){const{state:t,graphic:r,tool:o}=e,s=r?.geometry;if("complete"!==t||!r||!s)return;const{collectionId:a,viewModel:{dataCaptureLayer:i,currentBestFeature:c,imageGeometryField:d,oiObjectIdField:n},pendingGraphics:l}=this;c&&d&&a&&n&&(p(r,s,d,n,c,l,a,i),this.viewModel.emit("after-data-capture-complete",{pendingGraphics:l.get(a)?.toArray()??null}),this.viewModel.sketch?.create(o))}handleDelete(e){const{dataCaptureLayer:t}=this.viewModel;if(!t)return;const{graphics:r}=e;this.pendingGraphics.get(t.id)?.removeMany(r),this.savedGraphics.removeMany(r),this.viewModel.deleteDataCaptureFeatures(d(r,t.objectIdField))}handleDestroy(){const{dataCaptureLayer:e}=this.viewModel;e&&(this.viewModel.stopDataCapture(),this.savedGraphics.removeAll(),this.pendingGraphics=null)}handleUpdate(e){const{toolEventInfo:t,state:r,graphics:o}=e;if(t)this.viewModel.sketch?.undo();else switch(r){case"complete":this.viewModel.emit("deselect-data-capture-features",{graphics:o});break;case"start":this.viewModel.emit("select-data-capture-features",{graphics:o})}}};function p(e,t,o,s,a,i,c,p){e.sourceLayer=p,e.attributes=e.attributes??{},e.attributes[o]=btoa(JSON.stringify({geometry:t.toJSON()})),e.attributes[s]=a.attributes.objectId,i.has(c)||i.set(c,new r);i.get(c).add(e)}function d(e,t){return e.map((({attributes:e})=>t?e[t]:null)).filter(Boolean)}e([s()],c.prototype,"collectionId",null),e([s()],c.prototype,"savedGraphics",void 0),e([s()],c.prototype,"type",void 0),e([s()],c.prototype,"pendingGraphics",void 0),c=e([a("esri.widgets.OrientedImageryViewer.adapters.sketch.DataCaptureAdapter")],c);const n=c;export{n as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Collection.js";import o from"../../../../core/ReactiveMap.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{mapSpaceToImageSpace as i}from"../../dataCaptureUtils.js";import{SketchHandlerMixin as c}from"../../mixins/SketchHandlerMixin.js";let p=class extends(c(t)){constructor(e){super(e),this.savedGraphics=new r,this.type="data-capture",this.pendingGraphics=new o}get collectionId(){return this.viewModel.collectionId}handleCreate(e){const{state:t,graphic:r,tool:o}=e,a=r?.geometry;if("complete"!==t||!r||!a)return;const{collectionId:s,viewModel:{dataCaptureLayer:i,currentBestFeature:c,imageGeometryField:p,oiObjectIdField:n,activeViewer:l,mode:h},pendingGraphics:u}=this,m=l?.imageSize;c&&p&&s&&n&&i&&m&&"none"!==h&&(d(r,a,p,n,c,u,s,m,h,i),this.viewModel.emit("after-data-capture-complete",{pendingGraphics:u.get(s)?.toArray()??null}),this.viewModel.sketch?.create(o))}handleDelete(e){const{dataCaptureLayer:t}=this.viewModel;if(!t)return;const{graphics:r}=e;this.pendingGraphics.get(t.id)?.removeMany(r),this.savedGraphics.removeMany(r),this.viewModel.deleteDataCaptureFeatures(n(r,t.objectIdField))}handleDestroy(){const{dataCaptureLayer:e}=this.viewModel;e&&(this.viewModel.stopDataCapture(),this.savedGraphics.removeAll(),this.pendingGraphics=null)}handleUpdate(e){const{toolEventInfo:t,state:r,graphics:o}=e;if(t)this.viewModel.sketch?.undo();else switch(r){case"complete":this.viewModel.emit("deselect-data-capture-features",{graphics:o});break;case"start":this.viewModel.emit("select-data-capture-features",{graphics:o})}}};function d(e,t,o,a,s,c,p,d,n,l){e.sourceLayer=l,e.attributes=e.attributes??{},e.attributes[o]=btoa(JSON.stringify({geometry:i(t.clone(),n,d).toJSON()})),e.attributes[a]=s.attributes.objectId,c.has(p)||c.set(p,new r);c.get(p).add(e)}function n(e,t){return e.map((({attributes:e})=>t?e[t]:null)).filter(Boolean)}e([a()],p.prototype,"collectionId",null),e([a()],p.prototype,"savedGraphics",void 0),e([a()],p.prototype,"type",void 0),e([a()],p.prototype,"pendingGraphics",void 0),p=e([s("esri.widgets.OrientedImageryViewer.adapters.sketch.DataCaptureAdapter")],p);const l=p;export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Graphic.js";import t from"../../core/Error.js";import{fromJSON as o}from"../../geometry/support/jsonUtils.js";import{or as r}from"../../layers/orientedImagery/transformations/utils.js";import{defaultOIObjectIDField as n,defaultImageGeometryField as i}from"./constants.js";import{createGraphicSymbol as l,dataCaptureFeatureSymbol as y}from"./symbols.js";function m(e,t,o){const n=e.toLowerCase(),i=t.toLowerCase()===n,l=o?.toLowerCase()===n;return r(i,l)}function s(e){return"point"===e||"polygon"===e||"polyline"===e}function a(e,t,o){return s(e.geometryType)&&2===e.fields.filter((({name:e,type:r,alias:l})=>m(o?.length?o:n,e,l)||m(t?.length?t:i,e,l)&&"blob"===r)).length}function f(e){return"feature"===e.type&&p(e)}function p(e){return"point"===e.geometryType||"polygon"===e.geometryType||"polyline"===e.geometryType}function u(e,t,o){if(!e)return;const{renderer:r}=e,n=y(t),i=r?"symbol"in r?r.symbol:"defaultSymbol"in r?r.defaultSymbol:r.getSymbol():null,l=n(i?.color);o[`${t}Symbol`]=(t===e.geometryType?i:null)??l}function c(e,o,r){const l=e.fields.find((({name:e,alias:t,type:r})=>m(o?.length?o:i,e,t)&&"blob"===r)),y=e.fields.find((({name:e,alias:t})=>m(r?.length?r:n,e,t)));if(!l||!y)throw new t("invalid-data-capture-layer","Data capture layer is not configured correctly.",{layer:e,imageGeometryField:l,oiObjectIdField:y});return{imageGeometryField:l,oiObjectIdField:y}}function g(o,r,n,i,y){const m=d(o,r);if(!m)throw new t("InvalidGeometry");return new e({attributes:o,layer:n,symbol:l(m.type,n.geometryType,y),geometry:m,visible:n.visible&&i})}function d(e,t){const{geometry:r}=JSON.parse(atob(e[t]));return o(r)}export{u as configureSketchTool,g as constructGraphicFromImageGeometry,c as extractFieldsFromDataCaptureLayer,a as isValidDataCaptureLayer,f as isValidOverlayLayer,d as parseAndExtractField,p as supportedDigitigedGeometryType};
5
+ import e from"../../Graphic.js";import t from"../../core/Error.js";import n from"../../geometry/Polygon.js";import{fromJSON as r}from"../../geometry/support/jsonUtils.js";import{convertSphereVertexToPixelLocation as o,convertPixelLocationToSphereVertex as a,or as i}from"../../layers/orientedImagery/transformations/utils.js";import{defaultOIObjectIDField as s,defaultImageGeometryField as m}from"./constants.js";import{createGraphicSymbol as p,dataCaptureFeatureSymbol as y}from"./symbols.js";function c(e,t,n){const r=e.toLowerCase(),o=t.toLowerCase()===r,a=n?.toLowerCase()===r;return i(o,a)}function l(e){return"point"===e||"polygon"===e||"polyline"===e}function u(e,t,n){return l(e.geometryType)&&2===e.fields.filter((({name:e,type:r,alias:o})=>c(n?.length?n:s,e,o)||c(t?.length?t:m,e,o)&&"blob"===r)).length}function x(e){return"feature"===e.type&&f(e)}function f(e){return"point"===e.geometryType||"polygon"===e.geometryType||"polyline"===e.geometryType}function b(e,t,n){if(!e)return;const{renderer:r}=e,o=y(t),a=r?"symbol"in r?r.symbol:"defaultSymbol"in r?r.defaultSymbol:r.getSymbol():null,i=o(a?.color);n[`${t}Symbol`]=(t===e.geometryType?a:null)??i}function g(e,n,r){const o=e.fields.find((({name:e,alias:t,type:r})=>c(n?.length?n:m,e,t)&&"blob"===r)),a=e.fields.find((({name:e,alias:t})=>c(r?.length?r:s,e,t)));if(!o||!a)throw new t("invalid-data-capture-layer","Data capture layer is not configured correctly.",{layer:e,imageGeometryField:o,oiObjectIdField:a});return{imageGeometryField:o,oiObjectIdField:a}}function d(n,r,o,a,i,s,m){let y=h(n,r);if(!y)throw new t("InvalidGeometry");return y=T(y,s,i),new e({attributes:n,layer:o,symbol:p(y.type,o.geometryType,m),geometry:y,visible:o.visible&&a})}function h(e,t){const{geometry:n}=JSON.parse(atob(e[t]));return r(n)}function k(e,t,n){switch(t){case"default":return w(e);case"panoramic":return j(e,n)}}function w(e){switch(e.type){case"point":e.x+=.5,e.y=.5-e.y;break;case"polyline":e.paths=e.paths.map((e=>e.map((([e,t])=>[e+.5,.5-t]))));break;case"polygon":e.rings=e.rings.map((e=>e.map((([e,t])=>[e+.5,.5-t]))));break;case"multipoint":e.points=e.points.map((([e,t])=>[e+.5,.5-t]));break;case"extent":e.xmin+=.5,e.xmax+=.5,e.ymin=.5-e.ymin,e.ymax=.5-e.ymax}return e}function j(e,t){switch(e.type){case"point":{const{x:n,y:r}=o(e,t[0],t[1]);e.x=n,e.y=r,delete e.z;break}case"polyline":e.paths=e.paths.map((e=>e.map((e=>{const{x:n,y:r}=o({x:e[0],y:e[1],z:e[2]},t[0],t[1]);return[n,r]}))));break;case"polygon":e.rings=e.rings.map((e=>e.map((e=>{const{x:n,y:r}=o({x:e[0],y:e[1],z:e[2]},t[0],t[1]);return[n,r]}))));break;case"multipoint":e.points=e.points.map((e=>{const{x:n,y:r}=o({x:e[0],y:e[1],z:e[2]},t[0],t[1]);return[n,r]}));break;case"extent":{const{xmin:r,xmax:o,ymin:a,ymax:i}=j(n.fromExtent(e),t).extent;e.xmax=o,e.xmin=r,e.ymax=i,e.ymin=a;break}}return e}function T(e,t,n){switch(t){case"default":return z(e);case"panoramic":return S(e,n)}}function z(e){switch(e.type){case"point":e.x-=.5,e.y=.5-e.y;break;case"polyline":e.paths=e.paths.map((e=>e.map((([e,t])=>[e-.5,.5-t]))));break;case"polygon":e.rings=e.rings.map((e=>e.map((([e,t])=>[e-.5,.5-t]))));break;case"multipoint":e.points=e.points.map((([e,t])=>[e-.5,.5-t]));break;case"extent":e.xmin-=.5,e.xmax-=.5,e.ymin=.5-e.ymin,e.ymax=.5-e.ymax}return e}function S(e,t){switch(e.type){case"point":{const[n,r,o]=a(e,t[0],t[1]);e.x=n,e.y=r,e.z=o;break}case"polyline":e.paths=e.paths.map((e=>e.map((e=>{const[n,r,o]=a({x:e[0],y:e[1]},t[0],t[1]);return[n,r,o]}))));break;case"polygon":e.rings=e.rings.map((e=>e.map((e=>{const[n,r,o]=a({x:e[0],y:e[1]},t[0],t[1]);return[n,r,o]}))));break;case"multipoint":e.points=e.points.map((e=>{const[n,r,o]=a({x:e[0],y:e[1]},t[0],t[1]);return[n,r,o]}));break;case"extent":{const{xmin:r,xmax:o,ymin:a,ymax:i}=S(n.fromExtent(e),t).extent;e.xmax=o,e.xmin=r,e.ymax=i,e.ymin=a}}return e}export{b as configureSketchTool,d as constructGraphicFromImageGeometry,g as extractFieldsFromDataCaptureLayer,u as isValidDataCaptureLayer,x as isValidOverlayLayer,k as mapSpaceToImageSpace,w as mapSpaceToImageSpaceDefault,j as mapSpaceToImageSpacePanoramic,h as parseAndExtractField,T as pixelToMapSpace,z as pixelToMapSpaceDefault,S as pixelToMapSpacePanoramic,f as supportedDigitigedGeometryType};
@@ -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"../../Color.js";import i from"../../core/Accessor.js";import{isSome as r}from"../../core/arrayUtils.js";import{createTask as s}from"../../core/asyncUtils.js";import"../../core/has.js";import{abortMaybe as o,destroyMaybe as n}from"../../core/maybe.js";import{after as a,throwIfAborted as l}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as u}from"../../core/reactiveUtils.js";import{createScreenPointArray as d,createRenderScreenPointArray as c}from"../../core/screenUtils.js";import{convertTime as h,offsetDateUTC as m}from"../../core/timeUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{create as y}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{longitudeToTimezone as g}from"../../views/3d/support/earthUtils.js";import{computeDirectionsOverTime as v}from"../../views/3d/support/sunUtils.js";import{ShadowCastVisualization as w}from"../../views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js";import T from"./DiscreteOptions.js";import{DurationMode as D}from"./DurationMode.js";import b from"./DurationOptions.js";import{ShadowCastState as O}from"./ShadowCastState.js";import{ShadowTooltipViewModel as P}from"./ShadowTooltipViewModel.js";import{ShadowVisualizationType as j}from"./ShadowVisualizationType.js";import z from"./ThresholdOptions.js";import{breadthFirstBinaryPartitioning as U}from"../support/traversalUtils.js";const C=[],V=y(),E=[],R=255,S=h(1,"hours","milliseconds"),A=500;let x=class extends i{constructor(e){super(e),this.view=null,this.tooltip=new P({getDuration:(e,t)=>this.getDuration(e,t)}),this.startTimeOfDay=h(10,"hours","milliseconds"),this.endTimeOfDay=h(16,"hours","milliseconds"),this.visualizationType=j.Threshold,this.thresholdOptions=new z,this.durationOptions=new b,this.discreteOptions=new T,this._running=!0,this._stopPreviewingTask=null,this._forcePreview=!1,this._autoRestoreForcePreviewEnabled=!0,this._utcOffset=null,this.date=new Date}initialize(){this.addHandles([p((()=>({view:this.view,tooltipEnabled:this._tooltipEnabled})),(({view:e,tooltipEnabled:t})=>{this.tooltip.view=e,this.tooltip.enabled=t}),u),p((()=>this._forcePreviewDependencies),(()=>{o(this._stopPreviewingTask),this._forcePreview=!0,this._autoRestoreForcePreviewEnabled&&(this._stopPreviewingTask=s((async e=>{await a(A,e),l(e),this._forcePreview=!1})))}),u),p((()=>({renderer:this.renderer,parameters:this._visualizationParameters})),(e=>N(e.renderer,e.parameters)),u),p((()=>({renderer:this.renderer,parameters:{lightDirections:this._lightDirections}})),(e=>N(e.renderer,e.parameters)),u),p((()=>({renderer:this.renderer,parameters:{enabled:this._running}})),(e=>N(e.renderer,e.parameters)),u),p((()=>({renderer:this.renderer,parameters:{previewing:this._previewing}})),(e=>N(e.renderer,e.parameters)),u)])}destroy(){this.stop(),N(this.renderer,{enabled:!1}),n(this.tooltip)}get state(){return null!=this.view&&this.view.ready&&null!=this._referencePosition?O.Ready:O.Disabled}set date(e){const t=new Date(e);t.setHours(0,0,0,0),this._set("date",t)}get utcOffset(){return this._utcOffset??this._utcOffsetAuto}set utcOffset(e){this._utcOffset=e}get testData(){}get _previewing(){const{view:e}=this;return null==e?.allLayerViews||(this._forcePreview||!e.stationary||e.allLayerViews.some((e=>M(e)&&e.updating)))}get _utcOffsetAuto(){const e=this._referencePosition;return null!=e?g(e[0],!1):0}get _dateUTCOffset(){let e=this.date;return e=m(e,-e.getTimezoneOffset(),"minutes"),e=m(e,-this.utcOffset,"hours"),e}get _startDateTimeUTC(){return m(this._dateUTCOffset,this.startTimeOfDay)}get _endDateTimeUTC(){return m(this._dateUTCOffset,this.endTimeOfDay)}get _referencePosition(){return this.view?.environmentManager?.referencePositionGeographic}get _interval(){const e=this._duration>0?Math.floor(this._duration/R):R,t=this.discreteOptions.interval;switch(this.visualizationType){case j.Threshold:case j.Duration:return e;case j.Discrete:return t>0?t:e}}get _sampleCount(){return this._lightDirections.length}get _duration(){return this.endTimeOfDay-this.startTimeOfDay}get _lightDirections(){const{view:e}=this;if(null==e)return C;const t="global"===e.viewingMode?V:this._referencePosition;if(null==t)return C;const i=this._interval,r=v(this._startDateTimeUTC,this._endDateTimeUTC,i,t,e.state.viewingMode),s=r.length;E.length=0;const o=U(0,s,E),n=new Array(s);for(let a=0;a<s;++a)n[a]=r[o[a]];return n}get _tooltipEnabled(){return this.state===O.Ready&&this.visualizationType!==j.Discrete&&this._running&&!this._previewing}get _visualizationParameters(){if(!this._running)return null;switch(this.visualizationType){case j.Threshold:return this._thresholdVisualizationParameters;case j.Duration:return this._durationVisualizationParameters;case j.Discrete:return this._discreteVisualizationParameters}}get _thresholdVisualizationParameters(){const{value:e,color:i}=this.thresholdOptions,r=this._duration;return{visualization:w.Threshold,color:t.toUnitRGBA(i),threshold:r>0?e/this._duration:0}}get _durationVisualizationParameters(){const{color:e,mode:i}=this.durationOptions,r=this._duration,s=r>0&&i===D.Hourly?S/r:0;return{color:t.toUnitRGBA(e),visualization:w.Gradient,bandsEnabled:s>0,bandSize:s}}get _discreteVisualizationParameters(){return{color:t.toUnitRGBA(this.discreteOptions.color),visualization:w.Gradient,bandsEnabled:!1,bandSize:0}}get _forcePreviewDependencies(){const{view:e}=this;if(null==e)return null;const t=e.slicePlane,i=e.allLayerViews.toArray().filter(M),s=i.map((e=>e.layer)).filter(r),o=i.map((e=>e.visible)),n=s.map((e=>e.visible)),a=s.map((e=>e.opacity)),l=s.filter((e=>"definitionExpression"in e)).map((e=>e.definitionExpression)),p=i.filter((e=>"filter"in e)).map((e=>e.filter));return{slicePlane:t,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewVisibilities:o,layerVisibilities:n,layerOpacities:a,filters:p,definitionExpressions:l}}get renderer(){const{view:e}=this;if(null==e)return null;const t=e._stage;return null==t?null:t.renderer}start(){this.setRunning(!0)}stop(){this.setRunning(!1)}setRunning(e){this._running=e}async getDuration(e,t){const{view:i,renderer:r,_sampleCount:s}=this;if(null==i||null==r||0===s)return 0;const o=i.state.camera.screenToRender(d(e.x,e.y),c());return r.readAccumulatedShadow(o)*this._duration}};function N(e,t){null!=e&&null!=t&&e.setParameters({shadowCast:t})}function M(e){if(e.suspended)return!1;switch(e.type){case"building-scene-3d":case"csv-3d":case"elevation-3d":case"feature-3d":case"geojson-3d":case"graphics-3d":case"integrated-mesh-3d":case"integrated-mesh-3dtiles":case"ogc-feature-3d":case"route-3d":case"scene-layer-3d":case"scene-layer-graphics-3d":case"stream-3d":case"wms-3d":return!0;case"base-dynamic-3d":case"catalog-3d":case"catalog-footprint-3d":case"catalog-dynamic-group-3d":case"dimension-3d":case"imagery-3d":case"imagery-tile-3d":case"line-of-sight-3d":case"map-image-3d":case"point-cloud-3d":case"tile-3d":case"vector-tile-3d":case"viewshed-3d":case"voxel-3d":case"wfs-3d":case"wmts-3d":case"media-3d":default:return!1;case"group":return e.layerViews.toArray().some((e=>M(e)))}}e([f()],x.prototype,"state",null),e([f()],x.prototype,"view",void 0),e([f()],x.prototype,"tooltip",void 0),e([f({type:Date,nonNullable:!0})],x.prototype,"date",null),e([f({nonNullable:!0})],x.prototype,"utcOffset",null),e([f({nonNullable:!0})],x.prototype,"startTimeOfDay",void 0),e([f({nonNullable:!0})],x.prototype,"endTimeOfDay",void 0),e([f({nonNullable:!0})],x.prototype,"visualizationType",void 0),e([f({type:z,nonNullable:!0})],x.prototype,"thresholdOptions",void 0),e([f({type:b,nonNullable:!0})],x.prototype,"durationOptions",void 0),e([f({type:T,nonNullable:!0})],x.prototype,"discreteOptions",void 0),e([f()],x.prototype,"_running",void 0),e([f()],x.prototype,"_stopPreviewingTask",void 0),e([f()],x.prototype,"_forcePreview",void 0),e([f()],x.prototype,"_autoRestoreForcePreviewEnabled",void 0),e([f()],x.prototype,"_previewing",null),e([f()],x.prototype,"_utcOffset",void 0),e([f()],x.prototype,"_utcOffsetAuto",null),e([f()],x.prototype,"_dateUTCOffset",null),e([f()],x.prototype,"_startDateTimeUTC",null),e([f()],x.prototype,"_endDateTimeUTC",null),e([f()],x.prototype,"_referencePosition",null),e([f()],x.prototype,"_interval",null),e([f()],x.prototype,"_sampleCount",null),e([f()],x.prototype,"_duration",null),e([f()],x.prototype,"_lightDirections",null),e([f()],x.prototype,"_tooltipEnabled",null),e([f()],x.prototype,"_visualizationParameters",null),e([f()],x.prototype,"_thresholdVisualizationParameters",null),e([f()],x.prototype,"_durationVisualizationParameters",null),e([f()],x.prototype,"_discreteVisualizationParameters",null),e([f()],x.prototype,"_forcePreviewDependencies",null),e([f()],x.prototype,"renderer",null),x=e([_("esri.widgets.ShadowCast.ShadowCastViewModel")],x);const G=x;export{G as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Color.js";import i from"../../core/Accessor.js";import{isSome as r}from"../../core/arrayUtils.js";import{createTask as s}from"../../core/asyncUtils.js";import"../../core/has.js";import{abortMaybe as o,destroyMaybe as n}from"../../core/maybe.js";import{after as a,throwIfAborted as l}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as u}from"../../core/reactiveUtils.js";import{createScreenPointArray as d,createRenderScreenPointArray as c}from"../../core/screenUtils.js";import{convertTime as h,offsetDateUTC as m}from"../../core/timeUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{create as y}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{longitudeToTimezone as g}from"../../views/3d/support/earthUtils.js";import{computeDirectionsOverTime as v}from"../../views/3d/support/sunUtils.js";import{ShadowCastVisualization as w}from"../../views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js";import T from"./DiscreteOptions.js";import{DurationMode as D}from"./DurationMode.js";import b from"./DurationOptions.js";import{ShadowCastState as O}from"./ShadowCastState.js";import{ShadowTooltipViewModel as P}from"./ShadowTooltipViewModel.js";import{ShadowVisualizationType as j}from"./ShadowVisualizationType.js";import z from"./ThresholdOptions.js";import{breadthFirstBinaryPartitioning as U}from"../support/traversalUtils.js";const C=[],V=y(),E=[],R=255,S=h(1,"hours","milliseconds"),A=500;let x=class extends i{constructor(e){super(e),this.view=null,this.tooltip=new P({getDuration:(e,t)=>this.getDuration(e,t)}),this.startTimeOfDay=h(10,"hours","milliseconds"),this.endTimeOfDay=h(16,"hours","milliseconds"),this.visualizationType=j.Threshold,this.thresholdOptions=new z,this.durationOptions=new b,this.discreteOptions=new T,this._running=!0,this._stopPreviewingTask=null,this._forcePreview=!1,this._autoRestoreForcePreviewEnabled=!0,this._utcOffset=null,this.date=new Date}initialize(){this.addHandles([p((()=>({view:this.view,tooltipEnabled:this._tooltipEnabled})),(({view:e,tooltipEnabled:t})=>{this.tooltip.view=e,this.tooltip.enabled=t}),u),p((()=>this._forcePreviewDependencies),(()=>{o(this._stopPreviewingTask),this._forcePreview=!0,this._autoRestoreForcePreviewEnabled&&(this._stopPreviewingTask=s((async e=>{await a(A,e),l(e),this._forcePreview=!1})))}),u),p((()=>({renderer:this.renderer,parameters:this._visualizationParameters})),(e=>N(e.renderer,e.parameters)),u),p((()=>({renderer:this.renderer,parameters:{lightDirections:this._lightDirections}})),(e=>N(e.renderer,e.parameters)),u),p((()=>({renderer:this.renderer,parameters:{enabled:this._running}})),(e=>N(e.renderer,e.parameters)),u),p((()=>({renderer:this.renderer,parameters:{previewing:this._previewing}})),(e=>N(e.renderer,e.parameters)),u)])}destroy(){this.stop(),N(this.renderer,{enabled:!1}),n(this.tooltip)}get state(){return null!=this.view&&this.view.ready&&null!=this._referencePosition?O.Ready:O.Disabled}set date(e){const t=new Date(e);t.setHours(0,0,0,0),this._set("date",t)}get utcOffset(){return this._utcOffset??this._utcOffsetAuto}set utcOffset(e){this._utcOffset=e}get testData(){}get _previewing(){const{view:e}=this;return null==e?.allLayerViews||(this._forcePreview||!e.stationary||e.allLayerViews.some((e=>M(e)&&e.updating)))}get _utcOffsetAuto(){const e=this._referencePosition;return null!=e?g(e[0],!1):0}get _dateUTCOffset(){let e=this.date;return e=m(e,-e.getTimezoneOffset(),"minutes"),e=m(e,-this.utcOffset,"hours"),e}get _startDateTimeUTC(){return m(this._dateUTCOffset,this.startTimeOfDay)}get _endDateTimeUTC(){return m(this._dateUTCOffset,this.endTimeOfDay)}get _referencePosition(){return this.view?.environmentManager?.referencePositionGeographic}get _interval(){const e=this._duration>0?Math.floor(this._duration/R):R,t=this.discreteOptions.interval;switch(this.visualizationType){case j.Threshold:case j.Duration:return e;case j.Discrete:return t>0?t:e}}get _sampleCount(){return this._lightDirections.length}get _duration(){return this.endTimeOfDay-this.startTimeOfDay}get _lightDirections(){const{view:e}=this;if(null==e)return C;const t="global"===e.viewingMode?V:this._referencePosition;if(null==t)return C;const i=this._interval,r=v(this._startDateTimeUTC,this._endDateTimeUTC,i,t,e.state.viewingMode),s=r.length;E.length=0;const o=U(0,s,E),n=new Array(s);for(let a=0;a<s;++a)n[a]=r[o[a]];return n}get _tooltipEnabled(){return this.state===O.Ready&&this.visualizationType!==j.Discrete&&this._running&&!this._previewing}get _visualizationParameters(){if(!this._running)return null;switch(this.visualizationType){case j.Threshold:return this._thresholdVisualizationParameters;case j.Duration:return this._durationVisualizationParameters;case j.Discrete:return this._discreteVisualizationParameters}}get _thresholdVisualizationParameters(){const{value:e,color:i}=this.thresholdOptions,r=this._duration;return{visualization:w.Threshold,color:t.toUnitRGBA(i),threshold:r>0?e/this._duration:0}}get _durationVisualizationParameters(){const{color:e,mode:i}=this.durationOptions,r=this._duration,s=r>0&&i===D.Hourly?S/r:0;return{color:t.toUnitRGBA(e),visualization:w.Gradient,bandsEnabled:s>0,bandSize:s}}get _discreteVisualizationParameters(){return{color:t.toUnitRGBA(this.discreteOptions.color),visualization:w.Gradient,bandsEnabled:!1,bandSize:0}}get _forcePreviewDependencies(){const{view:e}=this;if(null==e)return null;const t=e.slicePlane,i=e.allLayerViews.toArray().filter(M),s=i.map((e=>e.layer)).filter(r),o=i.map((e=>e.visible)),n=s.map((e=>e.visible)),a=s.map((e=>e.opacity)),l=s.filter((e=>"definitionExpression"in e)).map((e=>e.definitionExpression)),p=i.filter((e=>"filter"in e)).map((e=>e.filter));return{slicePlane:t,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewVisibilities:o,layerVisibilities:n,layerOpacities:a,filters:p,definitionExpressions:l}}get renderer(){const{view:e}=this;if(null==e)return null;const t=e.stage;return null==t?null:t.renderer}start(){this.setRunning(!0)}stop(){this.setRunning(!1)}setRunning(e){this._running=e}async getDuration(e,t){const{view:i,renderer:r,_sampleCount:s}=this;if(null==i||null==r||0===s)return 0;const o=i.state.camera.screenToRender(d(e.x,e.y),c());return r.readAccumulatedShadow(o)*this._duration}};function N(e,t){null!=e&&null!=t&&e.setParameters({shadowCast:t})}function M(e){if(e.suspended)return!1;switch(e.type){case"building-scene-3d":case"csv-3d":case"elevation-3d":case"feature-3d":case"geojson-3d":case"graphics-3d":case"integrated-mesh-3d":case"integrated-mesh-3dtiles":case"ogc-feature-3d":case"route-3d":case"scene-layer-3d":case"scene-layer-graphics-3d":case"stream-3d":case"wms-3d":return!0;case"base-dynamic-3d":case"catalog-3d":case"catalog-footprint-3d":case"catalog-dynamic-group-3d":case"dimension-3d":case"imagery-3d":case"imagery-tile-3d":case"line-of-sight-3d":case"map-image-3d":case"point-cloud-3d":case"tile-3d":case"vector-tile-3d":case"viewshed-3d":case"voxel-3d":case"wfs-3d":case"wmts-3d":case"media-3d":default:return!1;case"group":return e.layerViews.toArray().some((e=>M(e)))}}e([f()],x.prototype,"state",null),e([f()],x.prototype,"view",void 0),e([f()],x.prototype,"tooltip",void 0),e([f({type:Date,nonNullable:!0})],x.prototype,"date",null),e([f({nonNullable:!0})],x.prototype,"utcOffset",null),e([f({nonNullable:!0})],x.prototype,"startTimeOfDay",void 0),e([f({nonNullable:!0})],x.prototype,"endTimeOfDay",void 0),e([f({nonNullable:!0})],x.prototype,"visualizationType",void 0),e([f({type:z,nonNullable:!0})],x.prototype,"thresholdOptions",void 0),e([f({type:b,nonNullable:!0})],x.prototype,"durationOptions",void 0),e([f({type:T,nonNullable:!0})],x.prototype,"discreteOptions",void 0),e([f()],x.prototype,"_running",void 0),e([f()],x.prototype,"_stopPreviewingTask",void 0),e([f()],x.prototype,"_forcePreview",void 0),e([f()],x.prototype,"_autoRestoreForcePreviewEnabled",void 0),e([f()],x.prototype,"_previewing",null),e([f()],x.prototype,"_utcOffset",void 0),e([f()],x.prototype,"_utcOffsetAuto",null),e([f()],x.prototype,"_dateUTCOffset",null),e([f()],x.prototype,"_startDateTimeUTC",null),e([f()],x.prototype,"_endDateTimeUTC",null),e([f()],x.prototype,"_referencePosition",null),e([f()],x.prototype,"_interval",null),e([f()],x.prototype,"_sampleCount",null),e([f()],x.prototype,"_duration",null),e([f()],x.prototype,"_lightDirections",null),e([f()],x.prototype,"_tooltipEnabled",null),e([f()],x.prototype,"_visualizationParameters",null),e([f()],x.prototype,"_thresholdVisualizationParameters",null),e([f()],x.prototype,"_durationVisualizationParameters",null),e([f()],x.prototype,"_discreteVisualizationParameters",null),e([f()],x.prototype,"_forcePreviewDependencies",null),e([f()],x.prototype,"renderer",null),x=e([_("esri.widgets.ShadowCast.ShadowCastViewModel")],x);const G=x;export{G as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2282],{21015:(e,t,_)=>{_.d(t,{R:()=>A});var E=_(78888),n=_(60999),r=_(49186),R=_(74887),o=_(84952);class A{constructor(e){this._streamDataRequester=e}async loadJSON(e,t){return this._load("json",e,t)}async loadBinary(e,t){return(0,o.DB)(e)?((0,R.Te)(t),(0,o.lJ)(e)):this._load("binary",e,t)}async loadImage(e,t){return this._load("image",e,t)}async _load(e,t,_){if(null==this._streamDataRequester)return(await(0,E.A)(t,{responseType:T[e]})).data;const o=await(0,n.Ke)(this._streamDataRequester.request(t,e,_));if(!0===o.ok)return o.value;throw(0,R.QP)(o.error),new r.A("glt-loader-request-error",`Request for resource failed: ${o.error}`)}}const T={image:"image",binary:"array-buffer",json:"json","image+type":void 0}},43609:(e,t,_)=>{_.d(t,{a:()=>r,f:()=>R,n:()=>n});var E=_(34275);function n(e,t){r(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function r(e,t,_=2,n=_){const r=t.length/2;let R=0,o=0;if(!(0,E.iu)(t)||(0,E.dk)(t)){for(let E=0;E<r;++E)e[R]=t[o],e[R+1]=t[o+1],R+=_,o+=n;return}const A=(0,E.a3)(t);if((0,E.JI)(t))for(let E=0;E<r;++E)e[R]=Math.max(t[o]/A,-1),e[R+1]=Math.max(t[o+1]/A,-1),R+=_,o+=n;else for(let E=0;E<r;++E)e[R]=t[o]/A,e[R+1]=t[o+1]/A,R+=_,o+=n}function R(e,t,_,E){const n=e.typedBuffer,r=e.typedBufferStride,R=E?.count??e.count;let o=(E?.dstIndex??0)*r;for(let e=0;e<R;++e)n[o]=t,n[o+1]=_,o+=r}Object.freeze(Object.defineProperty({__proto__:null,fill:R,normalizeIntegerBuffer:r,normalizeIntegerBufferView:n},Symbol.toStringTag,{value:"Module"}))},46140:(e,t,_)=>{_.d(t,{R:()=>n});var E=_(49186);let n=class e{constructor(e,t,_=""){this.major=e,this.minor=t,this._context=_}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}greaterEqual(e,t){return!this.lessThan(e,t)}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",_=this._context&&this._context+" ";throw new E.A(t+"unsupported-version",`Required major ${_}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new e(this.major,this.minor,this._context)}static parse(t,_=""){const[n,r]=t.split("."),R=/^\s*\d+\s*$/;if(!n?.match||!R.test(n))throw new E.A((_&&_+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:t});if(!r?.match||!R.test(r))throw new E.A((_&&_+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:t});const o=parseInt(n,10),A=parseInt(r,10);return new e(o,A,_)}}},51530:(e,t,_)=>{_.d(t,{KB:()=>o,Xi:()=>r,pn:()=>A,x3:()=>R});var E=_(44208),n=_(89192);class r{constructor(e){this.data=e,this.type="encoded-mesh-texture",this.encoding=n.JS.KTX2_ENCODING}}function R(e){return"encoded-mesh-texture"===e?.type}async function o(e){const t=new Blob([e]),_=await t.text();return JSON.parse(_)}async function A(e,t){if(t===n.JS.KTX2_ENCODING)return new r(e);const _=new Blob([e],{type:t});let R=URL.createObjectURL(_);switch(t){case"image/jpeg":R+="#.jpg";break;case"image/png":R+="#.png"}const o=new Image;if((0,E.A)("esri-iPhone"))return new Promise(((e,t)=>{const _=()=>{n(),e(o)},E=e=>{n(),t(e)},n=()=>{URL.revokeObjectURL(R),o.removeEventListener("load",_),o.removeEventListener("error",E)};o.addEventListener("load",_),o.addEventListener("error",E),o.src=R}));try{o.src=R,await o.decode()}catch(e){console.warn("Failed decoding HTMLImageElement")}return URL.revokeObjectURL(R),o}},63907:(e,t,_)=>{var E,n,r,R,o,A,T,N,S,s,i,I,a,u,c,O,f,C,l,D,L,G;_.d(t,{Ab:()=>u,Ac:()=>T,Ap:()=>a,CQ:()=>d,Cj:()=>i,Fq:()=>B,H0:()=>c,Hr:()=>G,MT:()=>S,NV:()=>E,NZ:()=>o,Tb:()=>R,WR:()=>n,Y7:()=>A,_U:()=>C,dn:()=>r,eA:()=>s,ld:()=>O,nI:()=>M,pF:()=>I,pe:()=>N,r6:()=>U,vt:()=>L,yI:()=>P,yQ:()=>f}),function(e){e[e.DEPTH=256]="DEPTH",e[e.STENCIL=1024]="STENCIL",e[e.COLOR=16384]="COLOR"}(E||(E={})),function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(n||(n={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(r||(r={})),function(e){e[e.ADD=32774]="ADD",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.SUBTRACT=32778]="SUBTRACT",e[e.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(R||(R={})),function(e){e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER"}(o||(o={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(A||(A={})),function(e){e[e.CW=2304]="CW",e[e.CCW=2305]="CCW"}(T||(T={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.HALF_FLOAT=5131]="HALF_FLOAT"}(N||(N={})),function(e){e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS"}(S||(S={})),function(e){e[e.ZERO=0]="ZERO",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP"}(s||(s={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(i||(i={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.REPEAT=10497]="REPEAT",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(I||(I={})),function(e){e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY"}(a||(a={})),function(e){e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.RED=6403]="RED",e[e.RG=33319]="RG",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER"}(u||(u={})),function(e){e[e.RGBA4=32854]="RGBA4",e[e.R16F=33325]="R16F",e[e.RG16F=33327]="RG16F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.R32F=33326]="R32F",e[e.RG32F=33328]="RG32F",e[e.RGBA32F=34836]="RGBA32F",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB5_A1=32855]="RGB5_A1",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.RGB16F=34843]="RGB16F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.RGB565=36194]="RGB565",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2=32857]="RGB10_A2",e[e.RGB10_A2UI=36975]="RGB10_A2UI"}(c||(c={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.INT=5124]="INT",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV"}(O||(O={})),function(e){e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(f||(f={})),function(e){e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.STATIC_READ=35045]="STATIC_READ",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.STREAM_COPY=35042]="STREAM_COPY"}(C||(C={})),function(e){e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER"}(l||(l={})),function(e){e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(D||(D={})),function(e){e[e.Texture=0]="Texture",e[e.BufferObject=1]="BufferObject",e[e.VertexArrayObject=2]="VertexArrayObject",e[e.Shader=3]="Shader",e[e.Program=4]="Program",e[e.FramebufferObject=5]="FramebufferObject",e[e.Renderbuffer=6]="Renderbuffer",e[e.TransformFeedback=7]="TransformFeedback",e[e.Sync=8]="Sync",e[e.UNCOUNTED=9]="UNCOUNTED",e[e.LinesOfCode=9]="LinesOfCode",e[e.Uniform=10]="Uniform",e[e.COUNT=11]="COUNT"}(L||(L={})),function(e){e[e.NONE=0]="NONE",e[e.BACK=1029]="BACK"}(G||(G={}));const U=36064,P=36065,B=36066,M=33306;var d,F,m,p,y,H,g;!function(e){e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(d||(d={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT=5124]="INT",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(F||(F={})),function(e){e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS"}(m||(m={})),function(e){e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED"}(p||(p={})),function(e){e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED"}(y||(y={})),function(e){e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(H||(H={})),function(e){e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(g||(g={}))},84498:(e,t,_)=>{_.d(t,{x:()=>R});var E=_(34275),n=_(97146),r=_(63907);function R(e,t){switch(t){case r.WR.TRIANGLES:return"number"==typeof(_=e)?(0,n.tM)(_):(0,E.mg)(_)?new Uint16Array(_):_;case r.WR.TRIANGLE_STRIP:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return[];const _=t-2,E=(0,n.my)(3*_);if("number"==typeof e){let e=0;for(let t=0;t<_;t+=1)t%2==0?(E[e++]=t,E[e++]=t+1,E[e++]=t+2):(E[e++]=t+1,E[e++]=t,E[e++]=t+2)}else{let t=0;for(let n=0;n<_;n+=1)n%2==0?(E[t++]=e[n],E[t++]=e[n+1],E[t++]=e[n+2]):(E[t++]=e[n+1],E[t++]=e[n],E[t++]=e[n+2])}return E}(e);case r.WR.TRIANGLE_FAN:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return new Uint16Array(0);const _=t-2,E=_<=65536?new Uint16Array(3*_):new Uint32Array(3*_);if("number"==typeof e){let e=0;for(let t=0;t<_;++t)E[e++]=0,E[e++]=t+1,E[e++]=t+2;return E}const n=e[0];let r=e[1],R=0;for(let t=0;t<_;++t){const _=e[t+2];E[R++]=n,E[R++]=r,E[R++]=_,r=_}return E}(e)}var _}},89192:(e,t,_)=>{var E,n,r,R,o,A,T,N;_.d(t,{Am:()=>R,C7:()=>r,JS:()=>N,Mg:()=>A,dd:()=>o,it:()=>n,s2:()=>E,sf:()=>T}),function(e){e[e.None=0]="None",e[e.Front=1]="Front",e[e.Back=2]="Back",e[e.COUNT=3]="COUNT"}(E||(E={})),function(e){e[e.Less=0]="Less",e[e.Lequal=1]="Lequal",e[e.COUNT=2]="COUNT"}(n||(n={})),function(e){e[e.BACKGROUND=0]="BACKGROUND",e[e.UPDATE=1]="UPDATE"}(r||(r={})),function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(R||(R={})),function(e){e[e.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",e[e.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(o||(o={})),function(e){e[e.Highlight=0]="Highlight",e[e.MaskOccludee=1]="MaskOccludee"}(A||(A={})),function(e){e[e.Blend=0]="Blend",e[e.Opaque=1]="Opaque",e[e.Mask=2]="Mask",e[e.MaskBlend=3]="MaskBlend",e[e.COUNT=4]="COUNT"}(T||(T={})),function(e){e.DDS_ENCODING="image/vnd-ms.dds",e.KTX2_ENCODING="image/ktx2",e.BASIS_ENCODING="image/x.basis"}(N||(N={}))},90239:(e,t,_)=>{function E(e){switch(e){case"u8":case"i8":return 1;case"u16":case"i16":return 2;case"u32":case"i32":case"f32":return 4;case"f64":return 8}}_.d(t,{GJ:()=>E})},97375:(e,t,_)=>{_.r(t),_.d(t,{loadGLTFMesh:()=>g});var E=_(68197),n=_(40876),r=_(78888),R=_(49186),o=_(91869),A=_(34727),T=_(77690),N=_(29242),S=_(51850),s=_(91829),i=_(16939),I=_(80882),a=_(35063),u=_(51147),c=_(1193),O=_(27615),f=_(13030),C=_(73354),l=_(65686),D=_(90239);Object.freeze(Object.defineProperty({__proto__:null,copy:function(e,t,_){const E=e.typedBuffer,n=e.typedBufferStride,r=t.typedBuffer,R=t.typedBufferStride,o=_?_.count:t.count;let A=(_?.dstIndex??0)*n,T=(_?.srcIndex??0)*R;for(let e=0;e<o;++e){for(let e=0;e<9;++e)E[A+e]=r[T+e];A+=n,T+=R}}},Symbol.toStringTag,{value:"Module"})),Object.freeze(Object.defineProperty({__proto__:null,copy:function(e,t,_){const E=e.typedBuffer,n=e.typedBufferStride,r=t.typedBuffer,R=t.typedBufferStride,o=_?_.count:t.count;let A=(_?.dstIndex??0)*n,T=(_?.srcIndex??0)*R;for(let e=0;e<o;++e){for(let e=0;e<16;++e)E[A+e]=r[T+e];A+=n,T+=R}}},Symbol.toStringTag,{value:"Module"})),_(24045);var L=_(43609);function G(e,t,_=3,E=_){const n=t.length/E;let r=0,R=0;for(let o=0;o<n;++o)e[r]=t[R],e[r+1]=t[R+1],e[r+2]=t[R+2],r+=_,R+=E}function U(e,t,_,E,n){const r=e.typedBuffer,R=e.typedBufferStride,o=n?.count??e.count;let A=(n?.dstIndex??0)*R;for(let e=0;e<o;++e)r[A]=t,r[A+1]=_,r[A+2]=E,A+=R}function P(e,t,_=4){const E=t.typedBuffer,n=t.typedBufferStride,r=t.count;let R=0,o=0;for(let t=0;t<r;++t)e[R]=E[o],e[R+1]=E[o+1],e[R+2]=E[o+2],e[R+3]=E[o+3],R+=_,o+=n}function B(e,t,_,E,n,r){const R=e.typedBuffer,o=e.typedBufferStride,A=r?.count??e.count;let T=(r?.dstIndex??0)*o;for(let e=0;e<A;++e)R[T]=t,R[T+1]=_,R[T+2]=E,R[T+3]=n,T+=o}function M(e,t){return new e(new ArrayBuffer(t*e.ElementCount*(0,D.GJ)(e.ElementType)))}Object.freeze(Object.defineProperty({__proto__:null,copy:G,copyView:function(e,t){G(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)},fill:U},Symbol.toStringTag,{value:"Module"})),Object.freeze(Object.defineProperty({__proto__:null,copy:P,copyView:function(e,t){P(e.typedBuffer,t,e.typedBufferStride)},fill:B},Symbol.toStringTag,{value:"Module"}));var d=_(72258),F=_(21015),m=_(4399),p=_(84498),y=_(51530),H=_(63907);async function g(e,t,_){const n=new F.R(function(e){const t=e?.resolveFile;return t?{busy:!1,request:async(e,_,E)=>{const n=t?.(e)??e,R="image"===_?"image":"binary"===_||"image+type"===_?"array-buffer":"json";return(await(0,r.A)(n,{responseType:R,signal:E?.signal,timeout:0})).data}}:null}(_)),T=(await(0,m.loadGLTF)(n,t,_,!0)).model,N=T.lods.shift(),i=new Map,C=new Map;T.textures.forEach(((e,t)=>i.set(t,function(e){return new a.A({data:((0,y.x3)(e.data),e.data),wrap:V(e.parameters.wrap)})}(e)))),T.materials.forEach(((e,t)=>C.set(t,function(e,t){const _=new E.A(function(e,t){return(0,s.fA)(X(e[0]),X(e[1]),X(e[2]),t)}(e.color,e.opacity)),n=e.emissiveFactor?new E.A(function(e){return(0,S.fA)(X(e[0]),X(e[1]),X(e[2]))}(e.emissiveFactor)):null,r=e=>e?new u.A({scale:e.scale?[e.scale[0],e.scale[1]]:[1,1],rotation:(0,A.KJ)(e.rotation??0),offset:e.offset?[e.offset[0],e.offset[1]]:[0,0]}):null;return new I.A({color:_,colorTexture:t.get(e.colorTexture),normalTexture:t.get(e.normalTexture),emissiveColor:n,emissiveTexture:t.get(e.emissiveTexture),occlusionTexture:t.get(e.occlusionTexture),alphaMode:v(e.alphaMode),alphaCutoff:e.alphaCutoff,doubleSided:e.doubleSided,metallic:e.metallicFactor,roughness:e.roughnessFactor,metallicRoughnessTexture:t.get(e.metallicRoughnessTexture),colorTextureTransform:r(e.colorTextureTransform),normalTextureTransform:r(e.normalTextureTransform),occlusionTextureTransform:r(e.occlusionTextureTransform),emissiveTextureTransform:r(e.emissiveTextureTransform),metallicRoughnessTextureTransform:r(e.metallicRoughnessTextureTransform)})}(e,i))));const l=function(e){let t=0;const _={color:!1,tangent:!1,normal:!1,texCoord0:!1},E=new Map,n=new Map,r=[];for(const R of e.parts){const{position:e,normal:A,color:T,tangent:N,texCoord0:S}=R.attributes,s=`\n ${x(e,E)}/\n ${x(A,E)}/\n ${x(T,E)}/\n ${x(N,E)}/\n ${x(S,E)}/\n ${h(R.transform)}\n `;let i=!1;const I=(0,o.tE)(n,s,(()=>(i=!0,{start:t,length:e.count})));i&&(t+=e.count),A&&(_.normal=!0),T&&(_.color=!0),N&&(_.tangent=!0),S&&(_.texCoord0=!0),r.push({gltf:R,writeVertices:i,region:I})}return{vertexAttributes:{position:M(f.Xm,t),normal:_.normal?M(f.xs,t):null,tangent:_.tangent?M(f.Eq,t):null,color:_.color?M(f.XP,t):null,texCoord0:_.texCoord0?M(f.gH,t):null},parts:r,components:[]}}(N);for(const e of l.parts)b(l,e,C);const{position:D,normal:L,tangent:G,color:U,texCoord0:P}=l.vertexAttributes,B=(0,O.TE)(e,_),p=e.spatialReference.isGeographic?(0,O.TE)(e):B,H=(0,d.UR)({vertexAttributes:{position:D.typedBuffer,normal:L?.typedBuffer,tangent:G?.typedBuffer},vertexSpace:p,spatialReference:e.spatialReference},B,{allowBufferReuse:!0,sourceUnit:_?.unitConversionDisabled?void 0:"meters"});if(!H)throw new R.A("load-gltf-mesh:vertex-space-projection",`Failed to load mesh from glTF because we could not convert the vertex space from ${p.type} to ${B.type}`);return{transform:null,vertexSpace:B,components:l.components,spatialReference:e.spatialReference,vertexAttributes:new c.H({...H,color:U?.typedBuffer,uv:P?.typedBuffer})}}function x(e,t){if(null==e)return"-";const _=e.typedBuffer;return`${(0,o.tE)(t,_.buffer,(()=>t.size))}/${_.byteOffset}/${_.byteLength}`}function h(e){return null!=e?e.toString():"-"}function b(e,t,_){t.writeVertices&&function(e,t){const{position:_,normal:E,tangent:n,color:r,texCoord0:R}=e.vertexAttributes,o=t.region.start,{attributes:S,transform:s}=t.gltf,i=S.position.count;if((0,C.d)(_.slice(o,i),S.position,s),null!=S.normal&&null!=E){const e=(0,T.Ge)((0,N.vt)(),s),t=E.slice(o,i);(0,C.c)(t,S.normal,e),(0,A.or)(e)&&(0,C.e)(t,t)}else null!=E&&U(E,0,0,1,{dstIndex:o,count:i});if(null!=S.tangent&&null!=n){const e=(0,T.z0)((0,N.vt)(),s),t=n.slice(o,i);(0,l.a)(t,S.tangent,e),(0,A.or)(e)&&(0,l.n)(t,t)}else null!=n&&B(n,0,0,1,1,{dstIndex:o,count:i});if(null!=S.texCoord0&&null!=R?(0,L.n)(R.slice(o,i),S.texCoord0):null!=R&&(0,L.f)(R,0,0,{dstIndex:o,count:i}),null!=S.color&&null!=r){const e=S.color,t=r.slice(o,i);if(4===e.elementCount)e instanceof f.Eq?(0,l.l)(t,e,1,255):(e instanceof f.XP||e instanceof f.Uz)&&(0,l.l)(t,e,1/255,255);else{B(t,255,255,255,255);const _=f.eI.fromTypedArray(t.typedBuffer,t.typedBufferStride);e instanceof f.xs?(0,C.l)(_,e,1,255):(e instanceof f.eI||e instanceof f.nS)&&(0,C.l)(_,e,1/255,255)}}else null!=r&&B(r.slice(o,i),255,255,255,255)}(e,t);const{indices:E,attributes:n,primitiveType:r,material:R}=t.gltf;let o=(0,p.x)(E||n.position.count,r);const S=t.region.start;if(S){const e=new Uint32Array(o);for(let t=0;t<o.length;t++)e[t]+=S;o=e}e.components.push(new i.A({name:t.gltf.name,faces:o,material:_.get(R),shading:n.normal?"source":"flat",trustSourceNormals:!0}))}function v(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend"}}function V(e){return{horizontal:w(e.s),vertical:w(e.t)}}function w(e){switch(e){case H.pF.CLAMP_TO_EDGE:return"clamp";case H.pF.MIRRORED_REPEAT:return"mirror";case H.pF.REPEAT:return"repeat"}}function X(e){return e**(1/n.Tf)*255}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8096],{8096:(e,t,s)=>{s.r(t),s.d(t,{toBinaryGLTF:()=>Q});var n,i=s(74887);!function(e){e[e.JSON=1313821514]="JSON",e[e.BIN=5130562]="BIN"}(n||(n={}));class r{static{this.HEADER_SIZE=12}static{this.CHUNK_HEADER_SIZE=8}static{this.MAGIC=1179937895}static{this.VERSION=2}constructor(e,t){if(!e)throw new Error("GLB requires a JSON gltf chunk");this._length=r.HEADER_SIZE,this._length+=r.CHUNK_HEADER_SIZE;const s=function(e){return(new TextEncoder).encode(e).buffer}(e);if(this._length+=_(s.byteLength,4),t&&(this._length+=r.CHUNK_HEADER_SIZE,this._length+=t.byteLength,t.byteLength%4))throw new Error("Expected BIN chunk length to be divisible by 4 at this point");this.buffer=new ArrayBuffer(this._length),this._outView=new DataView(this.buffer),this._writeHeader();const i=this._writeChunk(s,12,n.JSON,32);t&&this._writeChunk(t,i,n.BIN)}_writeHeader(){this._outView.setUint32(0,r.MAGIC,!0),this._outView.setUint32(4,r.VERSION,!0),this._outView.setUint32(8,this._length,!0)}_writeChunk(e,t,s,n=0){const i=_(e.byteLength,4);for(this._outView.setUint32(t,i,!0),this._outView.setUint32(t+=4,s,!0),function(e,t,s,n,i){new Uint8Array(e,s,i).set(new Uint8Array(t,0,i),0)}(this._outView.buffer,e,t+=4,0,e.byteLength),t+=e.byteLength;t%4;)n&&this._outView.setUint8(t,n),t++;return t}}function _(e,t){return t*Math.ceil(e/t)}var a,E,o,R,A,c,T,u,f=s(40876),h=s(53966),N=s(91869),l=s(34727),S=s(67026),I=s(82534),O=s(38954),C=s(51850),d=s(80882),L=s(72258);(u=a||(a={}))[u.External=0]="External",u[u.DataURI=1]="DataURI",u[u.GLB=2]="GLB",function(e){e[e.External=0]="External",e[e.DataURI=1]="DataURI",e[e.GLB=2]="GLB"}(E||(E={})),function(e){e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"}(o||(o={})),function(e){e.SCALAR="SCALAR",e.VEC2="VEC2",e.VEC3="VEC3",e.VEC4="VEC4",e.MAT2="MAT2",e.MAT3="MAT3",e.MAT4="MAT4"}(R||(R={})),function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(A||(A={})),function(e){e.OPAQUE="OPAQUE",e.MASK="MASK",e.BLEND="BLEND"}(c||(c={})),function(e){e[e.NoColor=0]="NoColor",e[e.FaceColor=1]="FaceColor",e[e.VertexColor=2]="VertexColor"}(T||(T={}));var D=s(63907);class M{constructor(e,t,s,n,i){this._buffer=e,this._componentType=s,this._dataType=n,this._data=[],this._isFinalized=!1,this._accessorIndex=-1,this._accessorAttribute=null,this._accessorMin=null,this._accessorMax=null,t.bufferViews||(t.bufferViews=[]),this.index=t.bufferViews.length,this._bufferView={buffer:e.index,byteLength:-1,target:i};const r=this._getElementSize();r>=4&&i!==o.ELEMENT_ARRAY_BUFFER&&(this._bufferView.byteStride=r),t.bufferViews.push(this._bufferView),this._numComponentsForDataType=this._calculateNumComponentsForDataType()}push(e){const t=this._data.length;if(this._data.push(e),this._accessorIndex>=0){const s=t%this._numComponentsForDataType,n=this._accessorMin[s];this._accessorMin[s]="number"!=typeof n?e:Math.min(n,e);const i=this._accessorMax[s];this._accessorMax[s]="number"!=typeof i?e:Math.max(i,e)}}get dataSize(){return this._data.length*this._sizeComponentType()}get byteSize(){return function(e){return 4*Math.ceil(e/4)}(this.dataSize)}getByteOffset(){if(!this._isFinalized)throw new Error("Cannot get BufferView offset until it is finalized");return this._buffer.getByteOffset(this)}get byteOffset(){if(!this._isFinalized)throw new Error("Cannot get BufferView offset until it is finalized");return this._buffer.getByteOffset(this)}_createTypedArray(e,t){switch(this._componentType){case D.pe.BYTE:return new Int8Array(e,t);case D.pe.FLOAT:return new Float32Array(e,t);case D.pe.SHORT:return new Int16Array(e,t);case D.pe.UNSIGNED_BYTE:return new Uint8Array(e,t);case D.pe.UNSIGNED_INT:return new Uint32Array(e,t);case D.pe.UNSIGNED_SHORT:return new Uint16Array(e,t)}}writeOutToBuffer(e,t){this._createTypedArray(e,t).set(this._data)}writeAsync(e){if(this._asyncWritePromise)throw new Error("Can't write multiple bufferView values asynchronously");return this._asyncWritePromise=e.then((e=>{const t=new Uint8Array(e);for(let e=0;e<t.length;++e)this._data.push(t[e]);delete this._asyncWritePromise})),this._asyncWritePromise}startAccessor(e){if(this._accessorIndex>=0)throw new Error("Accessor was started without ending the previous one");this._accessorIndex=this._data.length,this._accessorAttribute=e;const t=this._numComponentsForDataType;this._accessorMin=new Array(t),this._accessorMax=new Array(t)}endAccessor(){if(this._accessorIndex<0)throw new Error("An accessor was not started, but was attempted to be ended");const e=this._getElementSize(),t=this._numComponentsForDataType,s=(this._data.length-this._accessorIndex)/t;if(s%1)throw new Error("An accessor was ended with missing component values");for(let e=0;e<this._accessorMin.length;++e)"number"!=typeof this._accessorMin[e]&&(this._accessorMin[e]=0),"number"!=typeof this._accessorMax[e]&&(this._accessorMax[e]=0);const n={byteOffset:e*(this._accessorIndex/t),componentType:this._componentType,count:s,type:this._dataType,min:this._accessorMin,max:this._accessorMax,name:this._accessorAttribute};switch(this._accessorAttribute){case"TEXCOORD_0":case"TEXCOORD_1":case"COLOR_0":case"WEIGHTS_0":switch(this._componentType){case D.pe.UNSIGNED_BYTE:case D.pe.UNSIGNED_SHORT:n.normalized=!0}}return this._accessorIndex=-1,this._accessorAttribute=null,this._accessorMin=null,this._accessorMax=null,n}get finalized(){return this._finalizedPromise?this._finalizedPromise:this._isFinalized?this._finalizedPromise=Promise.resolve():this._finalizedPromise=new Promise((e=>this._finalizedPromiseResolve=e))}async finalize(){const e=this._bufferView,t=this._buffer.getViewFinalizePromises(this);this._asyncWritePromise&&t.push(this._asyncWritePromise),await Promise.allSettled(t),this._isFinalized=!0,e.byteOffset=this.getByteOffset(),e.byteLength=this.dataSize,this._finalizedPromiseResolve&&this._finalizedPromiseResolve()}_getElementSize(){return this._sizeComponentType()*this._numComponentsForDataType}_sizeComponentType(){switch(this._componentType){case D.pe.BYTE:case D.pe.UNSIGNED_BYTE:return 1;case D.pe.SHORT:case D.pe.UNSIGNED_SHORT:return 2;case D.pe.UNSIGNED_INT:case D.pe.FLOAT:return 4}}_calculateNumComponentsForDataType(){switch(this._dataType){case R.SCALAR:return 1;case R.VEC2:return 2;case R.VEC3:return 3;case R.VEC4:case R.MAT2:return 4;case R.MAT3:return 9;case R.MAT4:return 16}}}class p{constructor(e){this._gltf=e,this._bufferViews=[],this._isFinalized=!1,e.buffers||(e.buffers=[]),this.index=e.buffers.length;const t={byteLength:-1};e.buffers.push(t),this._buffer=t}addBufferView(e,t,s){if(this._finalizePromise)throw new Error("Cannot add buffer view after fiinalizing buffer");const n=new M(this,this._gltf,e,t,s);return this._bufferViews.push(n),n}getByteOffset(e){let t=0;for(const s of this._bufferViews){if(s===e)return t;t+=s.byteSize}throw new Error("Given bufferView was not present in this buffer")}getViewFinalizePromises(e){const t=[];for(const s of this._bufferViews){if(e&&s===e)return t;t.push(s.finalized)}return t}getArrayBuffer(){if(!this._isFinalized)throw new Error("Cannot get ArrayBuffer from Buffer before it is finalized");const e=this._getTotalSize(),t=new ArrayBuffer(e);let s=0;for(const e of this._bufferViews)e.writeOutToBuffer(t,s),s+=e.byteSize;return t}finalize(){if(this._finalizePromise)throw new Error(`Buffer ${this.index} was already finalized`);return this._finalizePromise=Promise.allSettled(this.getViewFinalizePromises()).then((()=>{this._isFinalized=!0;const e=this.getArrayBuffer();this._buffer.byteLength=e.byteLength,this._buffer.uri=e})),this._gltf.extras.promises.push(this._finalizePromise),this._finalizePromise}_getTotalSize(){let e=0;for(const t of this._bufferViews)e+=t.byteSize;return e}}function U(e,t){if(e.components)for(const s of e.components)s.faces&&"smooth"===s.shading&&m(s.faces,t)}function m(e,t){null==t.normal&&(t.normal=new Float32Array(t.position.length));const{position:s,normal:n}=t,i=e.length/3;for(let t=0;t<i;++t){const i=3*e[3*t],r=3*e[3*t+1],_=3*e[3*t+2],a=(0,O.i)(G,s[i],s[i+1],s[i+2]),E=(0,O.i)(P,s[r],s[r+1],s[r+2]),o=(0,O.i)(B,s[_],s[_+1],s[_+2]),R=(0,O.d)(E,E,a),A=(0,O.d)(o,o,a),c=(0,O.e)(R,R,A);n[i]+=c[0],n[i+1]+=c[1],n[i+2]+=c[2],n[r]+=c[0],n[r+1]+=c[1],n[r+2]+=c[2],n[_]+=c[0],n[_+1]+=c[1],n[_+2]+=c[2]}for(let e=0;e<n.length;e+=3)(0,O.i)(g,n[e],n[e+1],n[e+2]),(0,O.n)(g,g),n[e]=g[0],n[e+1]=g[1],n[e+2]=g[2]}const G=(0,C.vt)(),P=(0,C.vt)(),B=(0,C.vt)(),g=(0,C.vt)();s(44208);var F=s(49186),w=s(84952);async function b(e,t){const s=x(e);if(null==s)throw new F.A("imageToArrayBuffer","Unsupported image type");const n=function(e){if(!(e instanceof HTMLImageElement))return"image/png";const t=e.src;if((0,w.DB)(t)){const e=(0,w.r$)(t);return"image/jpeg"===e?.mediaType?e.mediaType:"image/png"}return/\.png$/i.test(t)?"image/png":/\.(jpg|jpeg)$/i.test(t)?"image/jpeg":"image/png"}(e),r=await new Promise((e=>s.toBlob(e,n)));if((0,i.Te)(t),!r)throw new F.A("imageToArrayBuffer","Failed to encode image");const _=await r.arrayBuffer();return(0,i.Te)(t),{data:_,type:n}}function x(e){if(e instanceof HTMLCanvasElement)return e;if(e instanceof HTMLVideoElement)return null;const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const s=t.getContext("2d");return e instanceof HTMLImageElement?s.drawImage(e,0,0,e.width,e.height):e instanceof ImageData&&s.putImageData(e,0,0),t}var y=s(51530);const V=()=>h.A.getLogger("esri.geometry.support.meshUtils.exporters.gltf.gltf");class H{constructor(e,t){this.options=t,this._materialMap=new Array,this._imageMap=new Map,this._textureMap=new Map,this.gltf={asset:{version:"2.0",copyright:e.copyright,generator:e.generator},extras:{output:t.output,binChunkBuffer:null,promises:[]}},this._addScenes(e)}_addScenes(e){this.gltf.scene=e.defaultScene;const t=this.gltf.extras,s=t.output.buffer===a.GLB||t.output.image===E.GLB;s&&(t.binChunkBuffer=new p(this.gltf)),e.forEachScene((e=>{this._addScene(e)})),s&&t.binChunkBuffer.finalize()}_addScene(e){this.gltf.scenes||(this.gltf.scenes=[]);const t={};e.name&&(t.name=e.name),e.forEachNode((e=>{t.nodes||(t.nodes=[]),t.nodes.push(...this._addNodes(e))})),this.gltf.scenes.push(t)}_addNodes(e){this.gltf.nodes||(this.gltf.nodes=[]);const t={};e.name&&(t.name=e.name);const s=e.translation;(0,O.p)(s,C.uY)||(t.translation=(0,C.o8)(s));const n=e.rotation;(0,S.t2)(n,I.zK)||(t.rotation=(0,I.o8)(n));const i=e.scale;(0,O.p)(i,C.Un)||(t.scale=(0,C.o8)(i));const r=this.gltf.nodes.length;if(this.gltf.nodes.push(t),e.mesh&&e.mesh.vertexAttributes.position){const s=this._createMeshes(e.mesh),n=[r];if(1===s.length)this._addMesh(t,s[0]);else for(const e of s){const t={};this._addMesh(t,e),n.push(this.gltf.nodes.length),this.gltf.nodes.push(t)}return n}return e.forEachNode((e=>{t.children||(t.children=[]),t.children.push(...this._addNodes(e))})),[r]}_addMesh(e,t){this.gltf.meshes??=[];const s=this.gltf.meshes.length;this.gltf.meshes.push(t),e.mesh=s}_createMeshes(e){const t=this.gltf.extras,s=t.output.buffer===a.GLB;let n;n=s?t.binChunkBuffer:new p(this.gltf);const i=this.options.origin,r=e.vertexSpace.clone();r.origin=[i.x,i.y,i.z??0];const _=(0,L.UR)({vertexAttributes:e.vertexAttributes,vertexSpace:e.vertexSpace,transform:this.options?.ignoreLocalTransform?null:e.transform,spatialReference:e.spatialReference},r,{targetUnit:this.options.unitConversionDisabled?void 0:"meters"});if(!_)return[];U(e,_),Y(_);const{position:E,normal:A,tangent:c}=_,{uv:T,color:u}=e.vertexAttributes,f=n.addBufferView(D.pe.FLOAT,R.VEC3,o.ARRAY_BUFFER);let h,N,l,S;A&&(h=n.addBufferView(D.pe.FLOAT,R.VEC3,o.ARRAY_BUFFER)),T&&(N=n.addBufferView(D.pe.FLOAT,R.VEC2,o.ARRAY_BUFFER)),c&&(l=n.addBufferView(D.pe.FLOAT,R.VEC4,o.ARRAY_BUFFER)),u&&(S=n.addBufferView(D.pe.FLOAT,R.VEC4,o.ARRAY_BUFFER)),f.startAccessor("POSITION"),h&&h.startAccessor("NORMAL"),N&&N.startAccessor("TEXCOORD_0"),l&&l.startAccessor("TANGENT"),S&&S.startAccessor("COLOR_0");const I=_.position.length/3;for(let e=0;e<I;++e)f.push(E[3*e]),f.push(E[3*e+1]),f.push(E[3*e+2]),h&&null!=A&&(h.push(A[3*e]),h.push(A[3*e+1]),h.push(A[3*e+2])),N&&null!=T&&(N.push(T[2*e]),N.push(T[2*e+1])),l&&null!=c&&(l.push(c[4*e]),l.push(c[4*e+1]),l.push(c[4*e+2]),l.push(c[4*e+3])),S&&null!=u&&(S.push(z(u[4*e]/255)),S.push(z(u[4*e+1]/255)),S.push(z(u[4*e+2]/255)),S.push(u[4*e+3]/255));const O=f.endAccessor(),C=this._addAccessor(f.index,O);let d,M,m,G,P;if(h){const e=h.endAccessor();d=this._addAccessor(h.index,e)}if(N){const e=N.endAccessor();M=this._addAccessor(N.index,e)}if(l){const e=l.endAccessor();m=this._addAccessor(l.index,e)}if(S){const e=S.endAccessor();G=this._addAccessor(S.index,e)}const B=[];return e.components&&e.components.length>0&&e.components[0].faces?(P=n.addBufferView(D.pe.UNSIGNED_INT,R.SCALAR,o.ELEMENT_ARRAY_BUFFER),this._addMeshVertexIndexed(P,e.components,B,C,d,M,m,G)):this._addMeshVertexNonIndexed(e.components,B,C,d,M,m,G),f.finalize(),h&&h.finalize(),N&&N.finalize(),l&&l.finalize(),P&&P.finalize(),S&&S.finalize(),s||n.finalize(),B}_addMaterial(e){if(null==e)return;const t=this._materialMap.indexOf(e);if(-1!==t)return t;this.gltf.materials||(this.gltf.materials=[]);const s={};switch(e.alphaMode){case"mask":s.alphaMode=c.MASK;break;case"auto":case"blend":s.alphaMode=c.BLEND}s.alphaCutoff=e.alphaCutoff,e.doubleSided&&(s.doubleSided=e.doubleSided),s.pbrMetallicRoughness={};const n=e=>{const t=e.toRgba();return t[0]=z(t[0]/255),t[1]=z(t[1]/255),t[2]=z(t[2]/255),t};if(null!=e.color&&(s.pbrMetallicRoughness.baseColorFactor=n(e.color)),null!=e.colorTexture&&(s.pbrMetallicRoughness.baseColorTexture=this._createTextureInfo(e.colorTexture,e.colorTextureTransform)),null!=e.normalTexture&&(s.normalTexture=this._createTextureInfo(e.normalTexture,e.normalTextureTransform)),e instanceof d.A){if(null!=e.emissiveTexture&&(s.emissiveTexture=this._createTextureInfo(e.emissiveTexture,e.emissiveTextureTransform)),null!=e.emissiveColor){const t=n(e.emissiveColor);s.emissiveFactor=[t[0],t[1],t[2]]}null!=e.occlusionTexture&&(s.occlusionTexture=this._createTextureInfo(e.occlusionTexture,e.occlusionTextureTransform)),null!=e.metallicRoughnessTexture&&(s.pbrMetallicRoughness.metallicRoughnessTexture=this._createTextureInfo(e.metallicRoughnessTexture,e.metallicRoughnessTextureTransform)),s.pbrMetallicRoughness.metallicFactor=e.metallic,s.pbrMetallicRoughness.roughnessFactor=e.roughness}else s.pbrMetallicRoughness.metallicFactor=1,s.pbrMetallicRoughness.roughnessFactor=1,V().warnOnce("Meshes exported to GLTF without MeshMaterialMetallicRoughness material will appear different when imported back.");const i=this.gltf.materials.length;return this.gltf.materials.push(s),this._materialMap.push(e),i}_createTextureInfo(e,t){const s={index:this._addTexture(e)};return t?(s.extensions||(s.extensions={}),s.extensions.KHR_texture_transform={scale:t.scale,offset:t.offset,rotation:(0,l.kU)(t.rotation)},s):s}_addTexture(e){const t=this.gltf.textures??[];return this.gltf.textures=t,(0,N.tE)(this._textureMap,e,(()=>{const s={sampler:this._addSampler(e),source:this._addImage(e)},n=t.length;return t.push(s),n}))}_addImage(e){const t=this._imageMap.get(e);if(null!=t)return t;this.gltf.images||(this.gltf.images=[]);const s={};if(e.url)s.uri=e.url;else{const t=e.data;s.extras=t;for(let e=0;e<this.gltf.images.length;++e)if(t===this.gltf.images[e].extras)return e;const n=this.gltf.extras;switch(n.output.image){case E.GLB:{const e=n.binChunkBuffer.addBufferView(D.pe.UNSIGNED_BYTE,R.SCALAR);if((0,y.x3)(t))null!=t.data&&e.writeOutToBuffer(t.data,0);else{const i=b(t,this.options.signal).then((({data:e,type:t})=>(s.mimeType=t,e)));n.promises.push(e.writeAsync(i).then((()=>{e.finalize()})))}s.bufferView=e.index;break}case E.DataURI:if((0,y.x3)(t)){V().warnOnce("Image export for basis compressed textures not available.");break}s.uri=function(e){const t=x(e);return null!=t?t.toDataURL():""}(t);break;default:if((0,y.x3)(t)){V().warnOnce("Image export for basis compressed textures not available.");break}n.promises.push(b(t,this.options.signal).then((({data:e,type:t})=>{s.uri=e,s.mimeType=t})))}}const n=this.gltf.images.length;return this.gltf.images.push(s),this._imageMap.set(e,n),n}_addSampler(e){this.gltf.samplers||(this.gltf.samplers=[]);let t=D.pF.REPEAT,s=D.pF.REPEAT;if("string"==typeof e.wrap)switch(e.wrap){case"clamp":t=D.pF.CLAMP_TO_EDGE,s=D.pF.CLAMP_TO_EDGE;break;case"mirror":t=D.pF.MIRRORED_REPEAT,s=D.pF.MIRRORED_REPEAT}else{switch(e.wrap.vertical){case"clamp":s=D.pF.CLAMP_TO_EDGE;break;case"mirror":s=D.pF.MIRRORED_REPEAT}switch(e.wrap.horizontal){case"clamp":t=D.pF.CLAMP_TO_EDGE;break;case"mirror":t=D.pF.MIRRORED_REPEAT}}const n={wrapS:t,wrapT:s};for(let e=0;e<this.gltf.samplers.length;++e)if(JSON.stringify(n)===JSON.stringify(this.gltf.samplers[e]))return e;const i=this.gltf.samplers.length;return this.gltf.samplers.push(n),i}_addAccessor(e,t){this.gltf.accessors||(this.gltf.accessors=[]);const s={bufferView:e,byteOffset:t.byteOffset,componentType:t.componentType,count:t.count,type:t.type,min:t.min,max:t.max,name:t.name};t.normalized&&(s.normalized=!0);const n=this.gltf.accessors.length;return this.gltf.accessors.push(s),n}_addMeshVertexIndexed(e,t,s,n,i,r,_,a){const E=new Map;for(const o of t){if(e.startAccessor("INDICES"),o.faces)for(let t=0;t<o.faces.length;++t)e.push(o.faces[t]);const t=e.endAccessor(),R={attributes:{POSITION:n},indices:this._addAccessor(e.index,t),material:this._addMaterial(o.material)};i&&"flat"!==o.shading&&(R.attributes.NORMAL=i),r&&(R.attributes.TEXCOORD_0=r),_&&"flat"!==o.shading&&(R.attributes.TANGENT=_),a&&(R.attributes.COLOR_0=a);const A=E.get(o.name);if(A)A.primitives.push(R);else{const e={name:o.name,primitives:[R]};E.set(o.name,e),s.push(e)}}}_addMeshVertexNonIndexed(e,t,s,n,i,r,_){const a={primitives:[]};t.push(a);const E={attributes:{POSITION:s}};n&&(E.attributes.NORMAL=n),i&&(E.attributes.TEXCOORD_0=i),r&&(E.attributes.TANGENT=r),_&&(E.attributes.COLOR_0=_),e&&(E.material=this._addMaterial(e[0].material)),a.primitives.push(E)}}function Y({position:e,normal:t,tangent:s}){v(e,3),v(t,3),v(s,4)}function v(e,t){if(null!=e)for(let s=1,n=2;s<e.length;s+=t,n+=t){const t=e[s],i=e[n];e[s]=i,e[n]=-t}}function z(e){return e**f.Tf}var X=s(4576);class k{constructor(){this.copyright="",this.defaultScene=0,this.generator="",this._scenes=[]}addScene(e){if(this._scenes.includes(e))throw new Error("Scene already added");this._scenes.push(e)}removeScene(e){(0,X.TF)(this._scenes,e)}forEachScene(e){this._scenes.forEach(e)}}class W{constructor(e){this.mesh=e,this.name="",this.translation=(0,C.vt)(),this.rotation=(0,I.vt)(),this.scale=(0,C.o8)(C.Un),this._nodes=[]}addNode(e){if(this._nodes.includes(e))throw new Error("Node already added");this._nodes.push(e)}forEachNode(e){this._nodes.forEach(e)}set rotationAngles(e){(0,S.A6)(this.rotation,e[0],e[1],e[2])}}const K="model.gltf",j="model.glb";async function Z(e,t){const s=new H(e,t).gltf,n=s.extras.promises;let _=1,o=1,R=null;await Promise.allSettled(n),(0,i.Te)(t.signal);const A=t.jsonSpacing??4,c=new Map,T=JSON.stringify(s,((e,s)=>{if("extras"!==e){if(s instanceof ArrayBuffer){if(function(e){if(e.byteLength<8)return!1;const t=new Uint8Array(e);return 137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7]}(s))switch(t.output?.image){case E.DataURI:case E.GLB:break;case E.External:default:{const e=`img${o}.png`;return o++,c.set(e,s),e}}switch(t.output?.buffer){case a.DataURI:return function(e){const t=[],s=new Uint8Array(e);for(let e=0;e<s.length;e++)t.push(String.fromCharCode(s[e]));return"data:application/octet-stream;base64,"+btoa(t.join(""))}(s);case a.GLB:if(R)throw new Error("Already encountered an ArrayBuffer, there should only be one in the GLB format.");return void(R=s);case a.External:default:{const e=`data${_}.bin`;return _++,c.set(e,s),e}}}return s}}),A);return t.output?.buffer===a.GLB||t.output?.image===E.GLB?c.set(j,new r(T,R).buffer):c.set(K,T),c}class J{constructor(){this.name="",this._nodes=[]}addNode(e){if(this._nodes.includes(e))throw new Error("Node already added");this._nodes.push(e)}forEachNode(e){this._nodes.forEach(e)}}async function Q(e,t){const s=new k,n=new J;return s.addScene(n),n.addNode(new W(e)),await async function(e,t){const s=(await Z(e,{output:{buffer:a.GLB,image:E.GLB},jsonSpacing:0,...t})).get(j);if(!(s&&s instanceof ArrayBuffer))throw new Error("failed to export to glb");return s}(s,{origin:e.origin,...t})}},51530:(e,t,s)=>{s.d(t,{KB:()=>a,Xi:()=>r,pn:()=>E,x3:()=>_});var n=s(44208),i=s(89192);class r{constructor(e){this.data=e,this.type="encoded-mesh-texture",this.encoding=i.JS.KTX2_ENCODING}}function _(e){return"encoded-mesh-texture"===e?.type}async function a(e){const t=new Blob([e]),s=await t.text();return JSON.parse(s)}async function E(e,t){if(t===i.JS.KTX2_ENCODING)return new r(e);const s=new Blob([e],{type:t});let _=URL.createObjectURL(s);switch(t){case"image/jpeg":_+="#.jpg";break;case"image/png":_+="#.png"}const a=new Image;if((0,n.A)("esri-iPhone"))return new Promise(((e,t)=>{const s=()=>{i(),e(a)},n=e=>{i(),t(e)},i=()=>{URL.revokeObjectURL(_),a.removeEventListener("load",s),a.removeEventListener("error",n)};a.addEventListener("load",s),a.addEventListener("error",n),a.src=_}));try{a.src=_,await a.decode()}catch(e){console.warn("Failed decoding HTMLImageElement")}return URL.revokeObjectURL(_),a}},63907:(e,t,s)=>{var n,i,r,_,a,E,o,R,A,c,T,u,f,h,N,l,S,I,O,C,d,L;s.d(t,{Ab:()=>h,Ac:()=>o,Ap:()=>f,CQ:()=>m,Cj:()=>T,Fq:()=>p,H0:()=>N,Hr:()=>L,MT:()=>A,NV:()=>n,NZ:()=>a,Tb:()=>_,WR:()=>i,Y7:()=>E,_U:()=>I,dn:()=>r,eA:()=>c,ld:()=>l,nI:()=>U,pF:()=>u,pe:()=>R,r6:()=>D,vt:()=>d,yI:()=>M,yQ:()=>S}),function(e){e[e.DEPTH=256]="DEPTH",e[e.STENCIL=1024]="STENCIL",e[e.COLOR=16384]="COLOR"}(n||(n={})),function(e){e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(i||(i={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(r||(r={})),function(e){e[e.ADD=32774]="ADD",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.SUBTRACT=32778]="SUBTRACT",e[e.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(_||(_={})),function(e){e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER"}(a||(a={})),function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(E||(E={})),function(e){e[e.CW=2304]="CW",e[e.CCW=2305]="CCW"}(o||(o={})),function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.HALF_FLOAT=5131]="HALF_FLOAT"}(R||(R={})),function(e){e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS"}(A||(A={})),function(e){e[e.ZERO=0]="ZERO",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP"}(c||(c={})),function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(T||(T={})),function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.REPEAT=10497]="REPEAT",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(u||(u={})),function(e){e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY"}(f||(f={})),function(e){e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.RED=6403]="RED",e[e.RG=33319]="RG",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER"}(h||(h={})),function(e){e[e.RGBA4=32854]="RGBA4",e[e.R16F=33325]="R16F",e[e.RG16F=33327]="RG16F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.R32F=33326]="R32F",e[e.RG32F=33328]="RG32F",e[e.RGBA32F=34836]="RGBA32F",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB5_A1=32855]="RGB5_A1",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.RGB16F=34843]="RGB16F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.RGB565=36194]="RGB565",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2=32857]="RGB10_A2",e[e.RGB10_A2UI=36975]="RGB10_A2UI"}(N||(N={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.INT=5124]="INT",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV"}(l||(l={})),function(e){e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(S||(S={})),function(e){e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.STATIC_READ=35045]="STATIC_READ",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.STREAM_COPY=35042]="STREAM_COPY"}(I||(I={})),function(e){e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER"}(O||(O={})),function(e){e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(C||(C={})),function(e){e[e.Texture=0]="Texture",e[e.BufferObject=1]="BufferObject",e[e.VertexArrayObject=2]="VertexArrayObject",e[e.Shader=3]="Shader",e[e.Program=4]="Program",e[e.FramebufferObject=5]="FramebufferObject",e[e.Renderbuffer=6]="Renderbuffer",e[e.TransformFeedback=7]="TransformFeedback",e[e.Sync=8]="Sync",e[e.UNCOUNTED=9]="UNCOUNTED",e[e.LinesOfCode=9]="LinesOfCode",e[e.Uniform=10]="Uniform",e[e.COUNT=11]="COUNT"}(d||(d={})),function(e){e[e.NONE=0]="NONE",e[e.BACK=1029]="BACK"}(L||(L={}));const D=36064,M=36065,p=36066,U=33306;var m,G,P,B,g,F,w;!function(e){e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"}(m||(m={})),function(e){e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT=5124]="INT",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(G||(G={})),function(e){e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS"}(P||(P={})),function(e){e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED"}(B||(B={})),function(e){e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED"}(g||(g={})),function(e){e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(F||(F={})),function(e){e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(w||(w={}))},89192:(e,t,s)=>{var n,i,r,_,a,E,o,R;s.d(t,{Am:()=>_,C7:()=>r,JS:()=>R,Mg:()=>E,dd:()=>a,it:()=>i,s2:()=>n,sf:()=>o}),function(e){e[e.None=0]="None",e[e.Front=1]="Front",e[e.Back=2]="Back",e[e.COUNT=3]="COUNT"}(n||(n={})),function(e){e[e.Less=0]="Less",e[e.Lequal=1]="Lequal",e[e.COUNT=2]="COUNT"}(i||(i={})),function(e){e[e.BACKGROUND=0]="BACKGROUND",e[e.UPDATE=1]="UPDATE"}(r||(r={})),function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(_||(_={})),function(e){e[e.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",e[e.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(a||(a={})),function(e){e[e.Highlight=0]="Highlight",e[e.MaskOccludee=1]="MaskOccludee"}(E||(E={})),function(e){e[e.Blend=0]="Blend",e[e.Opaque=1]="Opaque",e[e.Mask=2]="Mask",e[e.MaskBlend=3]="MaskBlend",e[e.COUNT=4]="COUNT"}(o||(o={})),function(e){e.DDS_ENCODING="image/vnd-ms.dds",e.KTX2_ENCODING="image/ktx2",e.BASIS_ENCODING="image/x.basis"}(R||(R={}))}}]);