@arcgis/core 4.33.0-next.20250502 → 4.33.0-next.20250504
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0219c3f9408d3fa3c9a0.js → 03ee9d0407c230b885ed.js} +1 -1
- package/assets/esri/core/workers/chunks/{84f972d7851d982701a0.js → 1ca7e0d519ecbfe6976f.js} +1 -1
- package/assets/esri/core/workers/chunks/3fb25912b274f264c84e.js +1 -0
- package/assets/esri/core/workers/chunks/{9652cfd4668b95036c87.js → 532088a72c3ddc50f3be.js} +1 -1
- package/assets/esri/core/workers/chunks/{653ff3e631fea8ad393a.js → a0db1f3ca29e34dfa16f.js} +12 -12
- package/assets/esri/core/workers/chunks/{581180668e0229dcdc14.js → bf190d672dcbaedc1a41.js} +1 -1
- package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +14 -1
- package/assets/esri/themes/base/widgets/_SelectionList.scss +34 -0
- package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +6 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList.json +1 -1
- package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_en.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_en.json +1 -1
- package/chunks/pe-wasm.js +1 -1
- package/chunks/pe.js +1 -1
- package/geometry/coordinateFormatter.js +1 -1
- package/geometry/support/WKIDUnitConversion.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
- package/views/3d/support/StreamTextureCollection.js +1 -1
- package/views/3d/support/TextureCollection.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
- package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +5 -0
- package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
- package/widgets/OrientedImageryViewer/css.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/SketchHandlerMixin.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/TriangulatedImageMeasurementMixin.js +5 -0
- package/widgets/OrientedImageryViewer/mixins/TriangulatedSketchHandlerMixin.js +5 -0
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList/VisibleElements.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
- package/widgets/support/SelectionToolbar/VisibleElements.js +5 -0
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/assets/esri/core/workers/chunks/e3ef0451dcdc2e966628.js +0 -1
- package/views/3d/webgl-engine/lib/ContentObject.js +0 -5
- package/views/3d/webgl-engine/lib/ContentObjectType.js +0 -5
|
@@ -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 s from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as n}from"../../../../core/uid.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as o,s as l}from"../../../../chunks/vec42.js";import{ZEROS as _,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Evented.js";import"../../../../core/has.js";import{disposeMaybe as i,removeMaybe as r}from"../../../../core/maybe.js";import{generateUID as n}from"../../../../core/uid.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as o,s as l}from"../../../../chunks/vec42.js";import{ZEROS as _,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{textTextureAtlas as d}from"./testUtils.js";import{applyTextureResizeModuloCeil as u}from"./textureUtils.js";import{TaskPriority as m}from"../../../support/Scheduler.js";import{Yield as p}from"../../../support/Yield.js";import{TextureWrapMode as g,TextureSamplingMode as f}from"../../../webgl/enums.js";import{Texture as x}from"../../../webgl/Texture.js";import{TextureDescriptor as v}from"../../../webgl/TextureDescriptor.js";const w=4096;let T=class extends t{constructor(e){super(e),this.id=n(),this.events=new s,this._glTexture=null,this._atlas=new b(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._uvCallbacks=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view.stage,this._stage.addTexture(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._glTexture=i(this._glTexture),this._frameWorker=r(this._frameWorker),this.updating=!1,this.events.emit("unloaded")}get loaded(){return null!=this._glTexture}get glTexture(){return this._glTexture}static get maxSize(){return C=d.stableRendering?k:0,[w-k-C,w-k-C-R]}load(e){if(this._glTexture)return this._glTexture;const t=new v;return t.wrapMode=g.CLAMP_TO_EDGE,t.samplingMode=f.LINEAR_MIPMAP_LINEAR,t.hasMipmap=!0,t.preMultiplyAlpha=!0,t.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._glTexture=new x(e,t,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(m.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._glTexture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=r(this._frameWorker),this._glTexture&&(this._stage.removeTexture(this),this._glTexture=i(this._glTexture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.width=e.width,this._canvas.height=e.height}_resizeAtlas(e,t){const{width:s,height:i}=this._atlas;s===e&&i===t||(this._atlas.width=e,this._atlas.height=t,this._glTexture?.resize(e,t),this._glTexture?.updateData(0,0,0,s,i,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach((e=>this._uvCallbacks.get(e.textRenderer.key)?.forEach((t=>t(e.uv))))),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,t,s,i){const r=this._atlas;if(r.width<s||r.height<i)return!1;let n=r.cursors.get(i);if(!n){if(r.height<r.nextY+i)return!1;n=[new A(r.nextY)],r.cursors.set(i,n),r.nextY+=i}let h=n.find((e=>r.width>=e.x+s));if(null==h){if(r.height<r.nextY+i)return!1;h=new A(r.nextY),r.nextY+=i,n.push(h)}return e.setNewPosition(h),this._elements.set(t,e),this._elementsToRender.set(t,e),h.x+=s,!0}_ensureCallbacks(e){const t=this._uvCallbacks.get(e);if(t)return t;const s=new Set;return this._uvCallbacks.set(e,s),s}_addCallback(e,t){this._ensureCallbacks(e).add(t)}_removeCallback(e,t){const s=this._uvCallbacks.get(e);return!(!s?.delete(t)||0!==s.size)&&(this._uvCallbacks.delete(e),!0)}_processAddition(e){const t=e.textRenderer.key;if(this._needsRepack)return void this._elements.set(t,e);const s=this._atlas,i=e.textRenderer.renderedWidth,r=e.textRenderer.renderedHeight,n=i+k,h=r+k+R;if(!this._addAtlasElement(e,t,n,h)){if(this._canRepack)this._reset();else if(s.width<n){const e=u(Math.max(n,1.5*s.width),w);this._resizeAtlas(e,s.height)}else{const e=s.nextY+h,t=u(Math.max(e,1.5*s.height),w);if(t>s.height)this._resizeAtlas(s.width,t);else if(s.width<w){const e=u(1.5*s.width,w);this._resizeAtlas(e,s.height)}}this._elements.set(t,e)}}_renderElement(e){const t=e.commitNewPosition(),s=e.textRenderer;this._ctx.clearRect(t[0]-k,t[1]-k,s.renderedWidth+2*k,s.renderedHeight+2*k),s.render(this._ctx,t[0],t[1]),this._uvCallbacks.get(s.key)?.forEach((t=>t(e.uv)))}get running(){return this.updating}runTask(e){if(null==this._glTexture)return p;for(;this._needsRepack&&(this._canRepack||this._atlas.height<w&&this._atlas.height<w);){this._canRepack=this._needsRepack=!1;const t=this._elements;this._elements=new Map,t.forEach((e=>this._processAddition(e))),e.madeProgress()}if(this._elementsToRender.size>0){for(const[t,s]of this._elementsToRender){if(e.done)break;this._renderElement(s),this._elementsToRender.delete(t),e.madeProgress()}this._glTexture.setData(this._canvas)}this.updating=this._elementsToRender.size>0}addText(e,t){const s=e.key;this._addCallback(s,t);let i=this._elements.get(s);return i?o(i.uv,_)||t(i.uv):(i=new y(e),this._processAddition(i),this.setDirty()),{remove:()=>this._removeText(e,t)}}_removeText(e,t){const s=e.key;this._elements.get(s)&&this._removeCallback(s,t)&&(this._elements.delete(s),this._elementsToRender.delete(s),this._canRepack=!0)}setDirty(){this._glTexture&&(this.updating=!0)}get test(){}};e([h({constructOnly:!0})],T.prototype,"view",void 0),e([h({type:Boolean})],T.prototype,"updating",void 0),T=e([a("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],T);const k=2,R=2;class y{constructor(e){this.textRenderer=e,this._uv=c(),this._newPosition=[0,0]}get uv(){if(null==this._xOffset||null==this._yOffset)return _;const{renderedWidth:e,renderedHeight:t}=this.textRenderer;return l(this._uv,this._xOffset,this._yOffset+t,this._xOffset+e,this._yOffset)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}}class b{constructor(e,t){this.width=e,this.height=t,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=C}}class A{constructor(e){this.y=e,this.x=C}}let C=0;export{T as TextTextureAtlas};
|
|
@@ -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"../../../../core/has.js";import e from"../../../../core/Error.js";import t from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as a,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{isBlobProtocol as
|
|
5
|
+
import"../../../../core/has.js";import e from"../../../../core/Error.js";import t from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as a,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{generateUID as m}from"../../../../core/uid.js";import{isBlobProtocol as h,isDataProtocol as p}from"../../../../core/urlUtils.js";import{whenVideoPlayable as d}from"../../../../layers/support/videoUtils.js";import{requestImage as _}from"../../../../support/requestImageUtils.js";import{loadImageAsync as u}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as c}from"./basicInterfaces.js";import{createTextureKTX2 as g,createTextureBasis as T,estimateMemoryKTX2 as E,estimateMemoryBasis as f}from"./BasisUtil.js";import{createDDSTexture as x}from"./DDSUtil.js";import{ensureImageMaxSize as y}from"./textureUtils.js";import{assert as A}from"./Util.js";import{TextureWrapMode as D,TextureSamplingMode as I,PixelFormat as F}from"../../../webgl/enums.js";import{Texture as M}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";class C{constructor(e,r){this._data=e,this.id=m(),this.events=new t,this._parameters={...N,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!(h(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=e.paused;if(e.src=e.src,t&&e.autoplay){const t=[];d(e,(e=>t.push(e))).then((()=>{e.play()})).finally((()=>t.forEach((e=>e.remove()))))}}}_startPreloadImageElement(e){p(e.src)||h(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new w;return t.wrapMode=this._parameters.wrap??D.REPEAT,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?I.LINEAR_MIPMAP_LINEAR:I.LINEAR,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture??this._emptyTexture}get loaded(){return null!=this._glTexture}get usedMemory(){return this._glTexture?.usedMemory||L(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._glTexture)return this._glTexture;const t=this._data;return null==t?(this._glTexture=new M(e,this._createDescriptor(e),null),this._glTexture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):n(t)&&this._parameters.encoding===c.DDS_ENCODING?this._loadFromDDSData(e,t):l(t)&&this._parameters.encoding===c.DDS_ENCODING?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&this._parameters.encoding===c.KTX2_ENCODING?this._loadFromKTX2(e,t):(l(t)||n(t))&&this._parameters.encoding===c.BASIS_ENCODING?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_update(e,t){return null==this._glTexture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=x(e,this._createDescriptor(e),t),this._emptyTexture=null,this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>g(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>T(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){A(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this._parameters.components?F.LUMINANCE:3===this._parameters.components?F.RGB:F.RGBA,r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new M(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const s=await _(t,{signal:r});return i(r),this._loadFromImage(e,s)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const s=await u(t,t.src,!1,r);return i(r),this._loadFromImage(e,s)}))}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync((i=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",p),s(d)},h=()=>{r.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},p=t=>{m(),l(t||new e("texture:load-error","Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",p);const d=a(i,(()=>p(o())))}))))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=y(r,e.parameters));const s=P(r);this._parameters.width=s.width,this._parameters.height=s.height;const i=this._createDescriptor(e);return i.pixelFormat=3===this._parameters.components?F.RGB:F.RGBA,i.width=s.width,i.height=s.height,i.compressionHandle=this._parameters.compressionHandle,i.compressionCallback=this._parameters.compressionCallback,this._glTexture=new M(e,i,r),this._emptyTexture=null,this.events.emit("loaded"),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const s=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(s,s),r}unload(){if(this._glTexture=r(this._glTexture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function L(e,t){if(null==e)return 0;if(l(e)||n(e))return t.encoding===c.KTX2_ENCODING?E(e,!!t.mipmap):t.encoding===c.BASIS_ENCODING?f(e,!!t.mipmap):e.byteLength;const{width:r,height:s}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?P(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function P(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const N={wrap:{s:D.REPEAT,t:D.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};export{C as Texture};
|
|
@@ -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/Evented.js";import s from"../../../../core/Logger.js";import{isPromiseLike as o,isAbortError as i}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import s from"../../../../core/Logger.js";import{isPromiseLike as o,isAbortError as i}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{RenderRequestType as a}from"./basicInterfaces.js";import{isUpdatableTexture as d}from"./ITexture.js";import{TextureUpdater as l}from"./TextureUpdater.js";import{TaskPriority as h}from"../../../support/Scheduler.js";let p=class extends t{constructor(e){super({}),this._stage=e,this._textures=new Map,this._loadingCount=0,this.events=new r,this.updater=new l,this._frameTask=e.view.resourceController.scheduler.registerTask(h.TEXTURE_UNLOAD)}normalizeCtorArgs(){return{}}destroy(){this._frameTask.remove(),this._stage.forEachTexture((e=>e.unload()))}get updating(){return this._loadingCount>0||this._frameTask.updating}acquire(e){const t=this._textures.get(e);return t?(t.ref(),t.loadingPromise??t):this._createNewRef(e)}update(){this.updater.run()&&this.events.emit("changed",a.BACKGROUND)}_createNewRef(e){const t=this._stage.getTexture(e);if(null==t)return null;const r=t.events.on("unloaded",(()=>{r.remove(),this._onTextureUnloaded(t)})),n=new c(e,(()=>{this._frameTask.schedule((()=>{n.isUnreferenced&&t.unload()}))}));return this._textures.set(e,n),n.ref(),t.loaded?(this._updateGLTexture(n,t.glTexture),d(t)&&this.updater.add(t),n):(this._loadingCount++,n.loadingPromise=this._stage.schedule((()=>{const e=t.load(this._stage.renderView.renderingContext),r=e=>(this._loadingCount--,n.loadingPromise=null,this._updateGLTexture(n,e),d(t)&&this.updater.add(t),n),u=e=>(this._loadingCount--,n.loadingPromise=null,i(e)||s.getLogger(this).error(e),null);return o(e)?e.then(r,u):r(e)})),n.loadingPromise)}_updateGLTexture(e,t){e.glTexture=t,this.events.emit("changed",a.UPDATE)}_onTextureUnloaded(e){this._textures.delete(e.id),this.updater.remove(e)}};e([n()],p.prototype,"_loadingCount",void 0),e([n()],p.prototype,"_frameTask",void 0),e([n()],p.prototype,"updating",null),p=e([u("esri.views.3d.webgl-engine.lib.TextureRepository")],p);class c{constructor(e,t){this.id=e,this._release=t,this._refCount=0}get isUnreferenced(){return 0===this._refCount}ref(){++this._refCount}release(){--this._refCount,this._refCount>0||(0!==this._refCount?(s.getLogger("esri.views.3d.webgl-engine.lib.TextureRepository.RefCountedTextureImpl").error("Cannot dereference texture that has no references!"),this._refCount=0):this._release())}}export{p as TextureRepository};
|
|
@@ -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{removeUnordered as e}from"../../../../core/arrayUtils.js";import{toConst as t}from"../../../../core/compilerUtils.js";import s from"../../../../core/Evented.js";import i from"../../../../core/Handles.js";import"../../../../core/has.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{
|
|
5
|
+
import{removeUnordered as e}from"../../../../core/arrayUtils.js";import{toConst as t}from"../../../../core/compilerUtils.js";import s from"../../../../core/Evented.js";import i from"../../../../core/Handles.js";import"../../../../core/has.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{generateUID as r}from"../../../../core/uid.js";import{DirtyEventNames as h}from"./DirtyEvents.js";import c from"./Octree.js";import{UpdatePolicy as d}from"./UpdatePolicy.js";class l{constructor(e,t,o=""){this.stage=e,this.apiLayerViewUid=o,this.id=r(),this.events=new s,this.visible=!0,this.sliceable=!1,this._objectsAdded=new Array,this._handles=new i,this._objects=new Map,this._pickable=!0,this.visible=t?.visible??!0,this._pickable=t?.pickable??!0,this.updatePolicy=t?.updatePolicy??d.ASYNC,e.addLayer(this);for(const s of h)this._handles.add(this.events.on(s,(t=>e.handleEvent(s,t))))}destroy(){this._handles.size&&(this._handles.destroy(),this.stage.removeLayer(this),this.invalidateSpatialQueryAccelerator())}get objects(){return this._objects}getObject(e){return t(this._objects.get(e))}set pickable(e){this._pickable=e}get pickable(){return this._pickable&&this.visible}add(e){this._objects.set(e.id,e),e.layer=this,this.events.emit("layerObjectAdded",e),null!=this._octree&&this._objectsAdded.push(e)}remove(t){this._objects.delete(t.id)&&(this.events.emit("layerObjectRemoved",t),t.layer=null,null!=this._octree&&(e(this._objectsAdded,t)||this._octree.remove([t])))}addMany(e){for(const t of e)this._objects.set(t.id,t),t.layer=this;this.events.emit("layerObjectsAdded",e),null!=this._octree&&this._objectsAdded.push(...e)}removeMany(t){const s=new Array;for(const e of t)this._objects.delete(e.id)&&s.push(e);if(0!==s.length&&(this.events.emit("layerObjectsRemoved",s),s.forEach((e=>e.layer=null)),null!=this._octree)){for(let t=0;t<s.length;)e(this._objectsAdded,s[t])?(s[t]=s[s.length-1],s.length-=1):++t;this._octree.remove(s)}}sync(){this.updatePolicy!==d.SYNC&&this.stage.syncLayer(this.id)}notifyObjectBBChanged(e,t){null==this._octree||this._objectsAdded.includes(e)||this._octree.update(e,t)}getSpatialQueryAccelerator(){return null==this._octree&&this._objects.size>50?(this._octree=new c((e=>e.boundingVolumeWorldSpace.bounds)),this._octree.add(this._objects.values())):null!=this._octree&&this._objectsAdded.length>0&&(this._octree.add(this._objectsAdded),this._objectsAdded.length=0),this._octree}invalidateSpatialQueryAccelerator(){this._octree=o(this._octree),this._objectsAdded.length=0}get test(){}}export{l as WebGLLayer};
|
|
@@ -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
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as i}from"../../../../chunks/sphere.js";import{GridLocalOriginFactory as a}from"../lib/GridLocalOriginFactory.js";import n from"../lib/ModelDirtySet.js";import{RenderGeometry as d}from"../lib/RenderGeometry.js";import{assert as c}from"../lib/Util.js";let l=class extends t{constructor(){super(...arguments),this.dirtySet=new n({model:this}),this._originFactory=new a(null),this._textures=new Map,this._layers=new Map}hasTexture(e){return this._textures.has(e.id)}getTexture(e){return null==e?null:this._textures.get(e)}addTexture(e){const t=e.id;c(!this._textures.has(t),"Model/Stage already contains texture to be added"),this._textures.set(t,e)}removeTexture(e){return this._textures.delete(e.id)}addTextures(e){for(const t of e)t&&(c(!this._textures.has(t.id),"Model/Stage already contains object to be added"),this._textures.set(t.id,t))}removeTextures(e){for(const t of e)t&&(c(this._textures.has(t.id),"Model/Stage doesn't contain object to be removed"),this._textures.delete(t.id))}forEachTexture(e){this._textures.forEach((t=>e(t)))}hasLayer(e){return this._layers.has(e.id)}getLayer(e){return null==e?null:this._layers.get(e)}addLayer(e){const t=e.id;c(!this._layers.has(t),"Model/Stage already contains layer to be added"),this._layers.set(t,e)}removeLayer(e){return this._layers.delete(e.id)}getRenderGeometry(e,t){const r=new d(t,{castShadow:e.castShadow,objectShaderTransformation:e.shaderTransformation}),o=t.localOrigin;return r.transformation=e.getCombinedStaticTransformation(t,u),r.localOrigin=o??this._originFactory.getOrigin(i(r.boundingSphere)),r}updateRenderGeometryTransformation(e,t,r){if(null==e)return!1;r.transformation=e.getCombinedStaticTransformation(t,u);const o=this._originFactory.getOrigin(i(r.boundingSphere));return r.localOrigin!==o}get test(){}};e([r({constructOnly:!0})],l.prototype,"dirtySet",void 0),l=e([o("esri.views.3d.webgl-engine.parts.Model")],l);const u=s();export{l as Model};
|
|
@@ -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"../../../intl.js";import{watch as t,initial as r,on as i}from"../../../core/reactiveUtils.js";import{stripHTML as s}from"../../../core/string.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{defaultHighlightName as a,temporaryHighlightName as n}from"../../../views/support/HighlightDefaults.js";import d from"../../Widget.js";import c from"../UtilityNetworkAssociationAddAssociationViewModel.js";import{loadCalciteComponents as p}from"../../support/componentsUtils.js";import u from"../../support/FilterBuilder.js";import{globalCss as h}from"../../support/globalCss.js";import{Heading as m}from"../../support/Heading.js";import _ from"../../support/SelectionToolbar.js";import"../../support/widgetUtils.js";import{messageBundle as f}from"../../support/decorators/messageBundle.js";import{tsx as g}from"../../support/jsxFactory.js";import{fetchMessageBundle as v}from"../../../intl/messages.js";import{substitute as y}from"../../../intl/substitute.js";const b="esri-feature-form-utility-network-association-layers",F={base:b,header:`${b}__header`,headingContent:`${b}__heading-content`,featureObserver:`${b}__feature-observer`,filterContainer:`${b}__filter-container`,filterOptionsContainer:`${b}__filter-options-container`,filterOptionsHeader:`${b}__filter-options-header`,listContainer:`${b}__list-container`,spatialSelectContainer:`${b}__spatial-select-container`,spatialSelectToolbar:`${b}__spatial-select-toolbar`,stickySpinnerContainer:`${b}__sticky-loading-container`,loadingContainer:`${b}__loading-container`};let w=class extends d{constructor(e,t){super(e,t),this.headingLevel=5,this.messagesCommon=null,this.messagesEditor=null,this.messagesFeature=null,this.messagesFeatureForm=null,this.messagesFilterBuilder=null,this.viewModel=new c,this.view=null,this._filterBuilder=new u,this._featureFilterText="",this._layerFilterText="",this._observer=new IntersectionObserver((([e])=>{e?.isIntersecting&&this._increaseFeaturePage()}),{root:window.document}),this._observerNode=null,this._selectionToolbar=new _({layerViewPreferenceEnabled:!1}),this._handleSelectionComplete=async e=>{const{highlightHelper:t}=this.viewModel;await this.viewModel.handleSelectionComplete(e),t?.removeAll(),this._featureSpatialGraphics.length>0&&t?.add(this._featureSpatialGraphics)}}initialize(){this._setupSelectionToolbar(),this.addHandles([t((()=>this.viewModel),(()=>this.reset())),t((()=>[this.viewModel.state,this._observerNode]),(()=>this._onObserverChange())),t((()=>this.selectedLayer),(e=>{this._filterBuilder.layer=e,e||(this.filterOptionsVisible=!1,this._featureFilterText="")}))])}loadDependencies(){return p({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this._filterBuilder.destroy(),this._selectionToolbar.destroy()}get filterOptionsVisible(){return this.viewModel.filterOptionsVisible}set filterOptionsVisible(e){this.viewModel.filterOptionsVisible=e}get selectedLayer(){return this.viewModel.selectedLayer}set selectedLayer(e){this.viewModel.selectedLayer=e}get selectedFeature(){return this.viewModel.selectedFeature}set selectedFeature(e){this.viewModel.selectedFeature=e}get filterWhereClause(){return this.viewModel.filterWhereClause}set filterWhereClause(e){this.viewModel.filterWhereClause=e,e||this._filterBuilder.reset()}get _featureSpatialGraphics(){return this.viewModel.featureSpatialItems.toArray().map((e=>e.feature))}get _filteredFeatureItems(){const{_featureFilterText:e}=this,{featureItems:t,featureSpatialItems:r}=this.viewModel;return(r.length?r:t).map((e=>({label:e.label,graphic:e.feature,layer:e.feature.sourceLayer}))).filter((t=>t.label?.toLowerCase().includes(e)??!1))}get _filteredFeatureItemsPage(){const{featurePage:e,featuresPerPage:t}=this.viewModel,r=e*t;return this._filteredFeatureItems.toArray().slice(0,r)}render(){return g("div",{class:this.classes(F.base,h.widget)},this._renderContent())}applyFilterOptions(){const{selectedLayer:e}=this;this.filterOptionsVisible=!1,e&&(this.filterWhereClause=this._filterBuilder.whereClause)}reset(){this.filterWhereClause=null,this._featureFilterText="",this._layerFilterText="",this.filterOptionsVisible=!1,this._filterBuilder.reset()}_setupSelectionToolbar(){const{_selectionToolbar:e}=this;e.defaultRectangleToolOptions={...e.defaultRectangleToolOptions,persistSelection:!1,selectOnComplete:!0},e.defaultLassoToolOptions={...e.defaultLassoToolOptions,persistSelection:!1,selectOnComplete:!0};const s={createTool:"point",mode:"click",toolName:"",icon:"cursor",toolKey:"point",persistSelection:!1,selectOnComplete:!0};v("esri/widgets/Editor/t9n/Editor").then((t=>{e.toolConfigs=[{...s,toolName:t.selectFeature}]})),this.addHandles([t((()=>this.view),(e=>{this.viewModel.reset(),this._selectionToolbar.view="2d"===e?.type?e:null}),r),t((()=>[this.viewModel,this.viewModel.layerItems.length]),(()=>this._selectionToolbar.sources=this.viewModel.layerItems.toArray())),i((()=>this._selectionToolbar),"complete",this._handleSelectionComplete)])}async _onObserverChange(){this._observerNode&&this._observer.unobserve(this._observerNode);const{state:e}=this.viewModel;this._observerNode&&"ready"===e&&this._observer.observe(this._observerNode)}_increaseFeaturePage(){const{featureCount:e,featurePage:t,featureSpatialItems:r,state:i}=this.viewModel;e||r.length||1===t?"ready"===i&&this.viewModel.featurePage++:this.viewModel.featurePage=1}_renderContent(){const{state:e,filterOptionsVisible:t}=this.viewModel;return"loading"===e?this._renderLoading():t?this._renderFilterOptions():[this._renderSelectionToolbar(),this._renderListContent()]}_renderListContent(){return this._selectionToolbar.activeToolInfo?.operation.processingFinalSelection?this._renderLoading():this.selectedLayer||this.viewModel.featureSpatialItems.length?this._renderFeatures():this._renderLayers()}_renderSelectionToolbar(){const{messagesCommon:e,_selectionToolbar:t}=this,{featureSpatialItems:r,selectedLayer:i}=this.viewModel;if(i||!t.sources?.length)return null;const s=g("div",{class:F.spatialSelectToolbar},t.render()),o=g("calcite-button",{appearance:"transparent",disabled:!r.length,label:e.clear,onclick:()=>this.viewModel.reset()},e.clear);return g("div",{class:F.spatialSelectContainer,key:"spatial-select-toolbar"},s,o)}_renderStickyLoading(){return"querying"===this.viewModel.state?g("div",{class:F.stickySpinnerContainer,key:"sticky-loader"},this._renderLoadingIcon()):null}_renderLoading(){return g("div",{class:F.loadingContainer,key:"loading-container"},this._renderLoadingIcon())}_renderLoadingIcon(){return g("calcite-loader",{inline:!0,label:this.messagesCommon.loading})}_renderFilterOptions(){return g("div",{class:F.filterOptionsContainer},g("div",{class:F.filterOptionsHeader},g("span",null,this.messagesFilterBuilder.widgetLabel),g("calcite-button",{appearance:"transparent",onclick:()=>this._filterBuilder.reset()},this.messagesCommon.clear)),this._filterBuilder.render())}_renderLayers(){const e=this.messagesFeatureForm.associations,t=e.availableLayers,r=e.filterLayers;return g("div",null,this._renderHeader({heading:t,placeholder:r,renderFilterOptions:!1,renderTotal:!1}),g("div",{class:F.listContainer},g("calcite-list",{label:e.associatedFeatures},this._renderLayerItems(),this._renderStickyLoading())))}_renderLayerItems(){const{_layerFilterText:e,viewModel:t,messagesCommon:r}=this,{layerItems:i,tableItems:s}=t;return i.concat(s).map((e=>({label:e.title??r.untitled,layer:e}))).filter((t=>t.label?.toLowerCase().includes(e)??!1)).toArray().map((e=>this._renderLayerItem(e)))}_renderLayerItem(e){const{label:t,layer:r}=e;return g("calcite-list-item",{key:`layer-item-${r.id}`,label:s(t),onCalciteListItemSelect:()=>{this.selectedLayer=r,this._filterBuilder.reset()}},g("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderFeatures(){const{selectedLayer:e,viewModel:t}=this,r=t.featureSpatialItems.length>0,i=this.messagesFeatureForm.associations,s=e?.title??this.messagesCommon.untitled,o=i.filterFeatures;return g("div",null,this._renderHeader({heading:s,placeholder:o,renderFilterOptions:!r,renderTotal:!0}),g("div",{class:F.listContainer},g("calcite-list",{label:i.associatedFeatures},this._renderFeatureItems(),this._renderStickyLoading(),this._renderFeatureObserver())))}_renderFeatureItems(){return this._filteredFeatureItemsPage.map((e=>this._renderFeatureItem(e)))}_renderFeatureItem(e){const{viewModel:t}=this,{highlightHelper:r}=t,{label:i,graphic:o}=e,l=t.featureSpatialItems.length>0?()=>r?.update(o,a):void 0,d=t.featureSpatialItems.length>0?()=>r?.update(o,n):void 0;return g("calcite-list-item",{key:`feature-item-${o.uid}`,label:s(i),onmouseenter:l,onmouseleave:d,onCalciteListItemSelect:()=>{this.selectedFeature={feature:o,label:i}}},g("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_onObserverCreate(e){this._observerNode=e}_renderFeatureObserver(){return g("div",{afterCreate:this._onObserverCreate,bind:this,class:F.featureObserver,key:"feature-observer"})}_renderHeader(e){return g("div",{class:F.header,key:"filter"},this._renderHeading(e.heading),this._renderFilter(e.placeholder,e.renderFilterOptions),e.renderTotal?this._renderTotal():null)}_renderHeading(e){return e?g(m,{key:"title",level:this.headingLevel},g("div",{class:F.headingContent},g("calcite-icon",{icon:"layer"}),e)):null}_renderFilter(e,t){const r=!this.selectedLayer&&!this.viewModel.featureSpatialItems.length,i=r?this._layerFilterText:this._featureFilterText;return g("div",{class:F.filterContainer,key:"filter"},g("calcite-input",{icon:"search",placeholder:e,type:"search",value:i,onCalciteInputInput:e=>{r?this._layerFilterText=e.currentTarget.value.trim().toLowerCase():this._featureFilterText=e.currentTarget.value.trim().toLowerCase()}},t?this._renderFilterOptionsAction():null))}_renderFilterOptionsAction(){const e=this.messagesFeatureForm.associations.filterOptions;return g("calcite-action",{appearance:"transparent",icon:"sliders",indicator:!!this._filterBuilder.whereClause,onclick:()=>{this.viewModel.filterOptionsVisible=!this.viewModel.filterOptionsVisible},scale:"s",slot:"action",text:e,title:e})}_renderTotal(){const{messagesFeature:e,viewModel:t}=this,{featureCount:r,featureSpatialItems:i}=t,s=y(e.numberRecords,{number:i.length?i.length:r});return g("div",{key:"total"},s)}};e([o()],w.prototype,"filterOptionsVisible",null),e([o()],w.prototype,"headingLevel",void 0),e([o(),f("esri/t9n/common")],w.prototype,"messagesCommon",void 0),e([o(),f("esri/widgets/Editor/t9n/Editor")],w.prototype,"messagesEditor",void 0),e([o(),f("esri/widgets/Feature/t9n/Feature")],w.prototype,"messagesFeature",void 0),e([o(),f("esri/widgets/FeatureForm/t9n/FeatureForm")],w.prototype,"messagesFeatureForm",void 0),e([o(),f("esri/widgets/support/FilterBuilder/t9n/FilterBuilder")],w.prototype,"messagesFilterBuilder",void 0),e([o()],w.prototype,"selectedLayer",null),e([o({type:c})],w.prototype,"viewModel",void 0),e([o()],w.prototype,"selectedFeature",null),e([o()],w.prototype,"filterWhereClause",null),e([o()],w.prototype,"view",void 0),e([o()],w.prototype,"_filterBuilder",void 0),e([o()],w.prototype,"_featureFilterText",void 0),e([o()],w.prototype,"_layerFilterText",void 0),e([o()],w.prototype,"_observer",void 0),e([o()],w.prototype,"_featureSpatialGraphics",null),e([o()],w.prototype,"_filteredFeatureItems",null),e([o()],w.prototype,"_filteredFeatureItemsPage",null),e([o()],w.prototype,"_observerNode",void 0),w=e([l("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.UtilityNetworkAssociationItemList")],w);const C=w;export{C as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{watch as t,initial as r,on as i}from"../../../core/reactiveUtils.js";import{stripHTML as s}from"../../../core/string.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{defaultHighlightName as a,temporaryHighlightName as n}from"../../../views/support/HighlightDefaults.js";import d from"../../Widget.js";import c from"../UtilityNetworkAssociationAddAssociationViewModel.js";import{loadCalciteComponents as p}from"../../support/componentsUtils.js";import u from"../../support/FilterBuilder.js";import{globalCss as h}from"../../support/globalCss.js";import{Heading as m}from"../../support/Heading.js";import _ from"../../support/SelectionToolbar.js";import"../../support/widgetUtils.js";import{messageBundle as f}from"../../support/decorators/messageBundle.js";import{tsx as g}from"../../support/jsxFactory.js";import v from"../../support/SelectionToolbar/VisibleElements.js";import{fetchMessageBundle as y}from"../../../intl/messages.js";import{substitute as b}from"../../../intl/substitute.js";const F="esri-feature-form-utility-network-association-layers",w={base:F,header:`${F}__header`,headingContent:`${F}__heading-content`,featureObserver:`${F}__feature-observer`,filterContainer:`${F}__filter-container`,filterOptionsContainer:`${F}__filter-options-container`,filterOptionsHeader:`${F}__filter-options-header`,listContainer:`${F}__list-container`,spatialSelectContainer:`${F}__spatial-select-container`,spatialSelectToolbar:`${F}__spatial-select-toolbar`,stickySpinnerContainer:`${F}__sticky-loading-container`,loadingContainer:`${F}__loading-container`};let C=class extends d{constructor(e,t){super(e,t),this.headingLevel=5,this.messagesCommon=null,this.messagesEditor=null,this.messagesFeature=null,this.messagesFeatureForm=null,this.messagesFilterBuilder=null,this.viewModel=new c,this.view=null,this._filterBuilder=new u,this._featureFilterText="",this._layerFilterText="",this._observer=new IntersectionObserver((([e])=>{e?.isIntersecting&&this._increaseFeaturePage()}),{root:window.document}),this._observerNode=null,this._selectionToolbar=new _({layerViewPreferenceEnabled:!1,visibleElements:new v({chip:!1,pan:!1,pointTool:!1})}),this._handleSelectionComplete=async e=>{const{highlightHelper:t}=this.viewModel;await this.viewModel.handleSelectionComplete(e),t?.removeAll(),this._featureSpatialGraphics.length>0&&t?.add(this._featureSpatialGraphics)}}initialize(){this._setupSelectionToolbar(),this.addHandles([t((()=>this.viewModel),(()=>this.reset())),t((()=>[this.viewModel.state,this._observerNode]),(()=>this._onObserverChange())),t((()=>this.selectedLayer),(e=>{this._filterBuilder.layer=e,e||(this.filterOptionsVisible=!1,this._featureFilterText="")}))])}loadDependencies(){return p({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this._filterBuilder.destroy(),this._selectionToolbar.destroy()}get filterOptionsVisible(){return this.viewModel.filterOptionsVisible}set filterOptionsVisible(e){this.viewModel.filterOptionsVisible=e}get selectedLayer(){return this.viewModel.selectedLayer}set selectedLayer(e){this.viewModel.selectedLayer=e}get selectedFeature(){return this.viewModel.selectedFeature}set selectedFeature(e){this.viewModel.selectedFeature=e}get filterWhereClause(){return this.viewModel.filterWhereClause}set filterWhereClause(e){this.viewModel.filterWhereClause=e,e||this._filterBuilder.reset()}get _featureSpatialGraphics(){return this.viewModel.featureSpatialItems.toArray().map((e=>e.feature))}get _filteredFeatureItems(){const{_featureFilterText:e}=this,{featureItems:t,featureSpatialItems:r}=this.viewModel;return(r.length?r:t).map((e=>({label:e.label,graphic:e.feature,layer:e.feature.sourceLayer}))).filter((t=>t.label?.toLowerCase().includes(e)??!1))}get _filteredFeatureItemsPage(){const{featurePage:e,featuresPerPage:t}=this.viewModel,r=e*t;return this._filteredFeatureItems.toArray().slice(0,r)}render(){return g("div",{class:this.classes(w.base,h.widget)},this._renderContent())}applyFilterOptions(){const{selectedLayer:e}=this;this.filterOptionsVisible=!1,e&&(this.filterWhereClause=this._filterBuilder.whereClause)}reset(){this.filterWhereClause=null,this._featureFilterText="",this._layerFilterText="",this.filterOptionsVisible=!1,this._filterBuilder.reset()}_setupSelectionToolbar(){const{_selectionToolbar:e}=this;e.defaultRectangleToolOptions={...e.defaultRectangleToolOptions,persistSelection:!1,selectOnComplete:!0},e.defaultLassoToolOptions={...e.defaultLassoToolOptions,persistSelection:!1,selectOnComplete:!0};const s={createTool:"point",mode:"click",toolName:"",icon:"cursor",toolKey:"point",persistSelection:!1,selectOnComplete:!0};y("esri/widgets/Editor/t9n/Editor").then((t=>{e.toolConfigs=[{...s,toolName:t.selectFeature}]})),this.addHandles([t((()=>this.view),(e=>{this.viewModel.reset(),this._selectionToolbar.view="2d"===e?.type?e:null}),r),t((()=>[this.viewModel,this.viewModel.layerItems.length]),(()=>this._selectionToolbar.sources=this.viewModel.layerItems.toArray())),i((()=>this._selectionToolbar),"complete",this._handleSelectionComplete)])}async _onObserverChange(){this._observerNode&&this._observer.unobserve(this._observerNode);const{state:e}=this.viewModel;this._observerNode&&"ready"===e&&this._observer.observe(this._observerNode)}_increaseFeaturePage(){const{featureCount:e,featurePage:t,featureSpatialItems:r,state:i}=this.viewModel;e||r.length||1===t?"ready"===i&&this.viewModel.featurePage++:this.viewModel.featurePage=1}_renderContent(){const{state:e,filterOptionsVisible:t}=this.viewModel;return"loading"===e?this._renderLoading():t?this._renderFilterOptions():[this._renderSelectionToolbar(),this._renderListContent()]}_renderListContent(){return this._selectionToolbar.activeToolInfo?.operation.processingFinalSelection?this._renderLoading():this.selectedLayer||this.viewModel.featureSpatialItems.length?this._renderFeatures():this._renderLayers()}_renderSelectionToolbar(){const{messagesCommon:e,_selectionToolbar:t}=this,{featureSpatialItems:r,selectedLayer:i}=this.viewModel;if(i||!t.sources?.length)return null;const s=g("div",{class:w.spatialSelectToolbar},t.render()),o=g("calcite-button",{appearance:"transparent",disabled:!r.length,label:e.clear,onclick:()=>this.viewModel.reset()},e.clear);return g("div",{class:w.spatialSelectContainer,key:"spatial-select-toolbar"},s,o)}_renderStickyLoading(){return"querying"===this.viewModel.state?g("div",{class:w.stickySpinnerContainer,key:"sticky-loader"},this._renderLoadingIcon()):null}_renderLoading(){return g("div",{class:w.loadingContainer,key:"loading-container"},this._renderLoadingIcon())}_renderLoadingIcon(){return g("calcite-loader",{inline:!0,label:this.messagesCommon.loading})}_renderFilterOptions(){return g("div",{class:w.filterOptionsContainer},g("div",{class:w.filterOptionsHeader},g("span",null,this.messagesFilterBuilder.widgetLabel),g("calcite-button",{appearance:"transparent",onclick:()=>this._filterBuilder.reset()},this.messagesCommon.clear)),this._filterBuilder.render())}_renderLayers(){const e=this.messagesFeatureForm.associations,t=e.availableLayers,r=e.filterLayers;return g("div",null,this._renderHeader({heading:t,placeholder:r,renderFilterOptions:!1,renderTotal:!1}),g("div",{class:w.listContainer},g("calcite-list",{label:e.associatedFeatures},this._renderLayerItems(),this._renderStickyLoading())))}_renderLayerItems(){const{_layerFilterText:e,viewModel:t,messagesCommon:r}=this,{layerItems:i,tableItems:s}=t;return i.concat(s).map((e=>({label:e.title??r.untitled,layer:e}))).filter((t=>t.label?.toLowerCase().includes(e)??!1)).toArray().map((e=>this._renderLayerItem(e)))}_renderLayerItem(e){const{label:t,layer:r}=e;return g("calcite-list-item",{key:`layer-item-${r.id}`,label:s(t),onCalciteListItemSelect:()=>{this.selectedLayer=r,this._filterBuilder.reset()}},g("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderFeatures(){const{selectedLayer:e,viewModel:t}=this,r=t.featureSpatialItems.length>0,i=this.messagesFeatureForm.associations,s=e?.title??this.messagesCommon.untitled,o=i.filterFeatures;return g("div",null,this._renderHeader({heading:s,placeholder:o,renderFilterOptions:!r,renderTotal:!0}),g("div",{class:w.listContainer},g("calcite-list",{label:i.associatedFeatures},this._renderFeatureItems(),this._renderStickyLoading(),this._renderFeatureObserver())))}_renderFeatureItems(){return this._filteredFeatureItemsPage.map((e=>this._renderFeatureItem(e)))}_renderFeatureItem(e){const{viewModel:t}=this,{highlightHelper:r}=t,{label:i,graphic:o}=e,l=t.featureSpatialItems.length>0?()=>r?.update(o,a):void 0,d=t.featureSpatialItems.length>0?()=>r?.update(o,n):void 0;return g("calcite-list-item",{key:`feature-item-${o.uid}`,label:s(i),onmouseenter:l,onmouseleave:d,onCalciteListItemSelect:()=>{this.selectedFeature={feature:o,label:i}}},g("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_onObserverCreate(e){this._observerNode=e}_renderFeatureObserver(){return g("div",{afterCreate:this._onObserverCreate,bind:this,class:w.featureObserver,key:"feature-observer"})}_renderHeader(e){return g("div",{class:w.header,key:"filter"},this._renderHeading(e.heading),this._renderFilter(e.placeholder,e.renderFilterOptions),e.renderTotal?this._renderTotal():null)}_renderHeading(e){return e?g(m,{key:"title",level:this.headingLevel},g("div",{class:w.headingContent},g("calcite-icon",{icon:"layer"}),e)):null}_renderFilter(e,t){const r=!this.selectedLayer&&!this.viewModel.featureSpatialItems.length,i=r?this._layerFilterText:this._featureFilterText;return g("div",{class:w.filterContainer,key:"filter"},g("calcite-input",{icon:"search",placeholder:e,type:"search",value:i,onCalciteInputInput:e=>{r?this._layerFilterText=e.currentTarget.value.trim().toLowerCase():this._featureFilterText=e.currentTarget.value.trim().toLowerCase()}},t?this._renderFilterOptionsAction():null))}_renderFilterOptionsAction(){const e=this.messagesFeatureForm.associations.filterOptions;return g("calcite-action",{appearance:"transparent",icon:"sliders",indicator:!!this._filterBuilder.whereClause,onclick:()=>{this.viewModel.filterOptionsVisible=!this.viewModel.filterOptionsVisible},scale:"s",slot:"action",text:e,title:e})}_renderTotal(){const{messagesFeature:e,viewModel:t}=this,{featureCount:r,featureSpatialItems:i}=t,s=b(e.numberRecords,{number:i.length?i.length:r});return g("div",{key:"total"},s)}};e([o()],C.prototype,"filterOptionsVisible",null),e([o()],C.prototype,"headingLevel",void 0),e([o(),f("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([o(),f("esri/widgets/Editor/t9n/Editor")],C.prototype,"messagesEditor",void 0),e([o(),f("esri/widgets/Feature/t9n/Feature")],C.prototype,"messagesFeature",void 0),e([o(),f("esri/widgets/FeatureForm/t9n/FeatureForm")],C.prototype,"messagesFeatureForm",void 0),e([o(),f("esri/widgets/support/FilterBuilder/t9n/FilterBuilder")],C.prototype,"messagesFilterBuilder",void 0),e([o()],C.prototype,"selectedLayer",null),e([o({type:c})],C.prototype,"viewModel",void 0),e([o()],C.prototype,"selectedFeature",null),e([o()],C.prototype,"filterWhereClause",null),e([o()],C.prototype,"view",void 0),e([o()],C.prototype,"_filterBuilder",void 0),e([o()],C.prototype,"_featureFilterText",void 0),e([o()],C.prototype,"_layerFilterText",void 0),e([o()],C.prototype,"_observer",void 0),e([o()],C.prototype,"_featureSpatialGraphics",null),e([o()],C.prototype,"_filteredFeatureItems",null),e([o()],C.prototype,"_filteredFeatureItemsPage",null),e([o()],C.prototype,"_observerNode",void 0),C=e([l("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.UtilityNetworkAssociationItemList")],C);const L=C;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{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{isSome as i,equals as a}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import l from"../../core/Evented.js";import{equalsShallow as c}from"../../core/lang.js";import h from"../../core/Logger.js";import{clamp as u,deg2rad as p}from"../../core/mathUtils.js";import{abortMaybe as m,destroyMaybe as d}from"../../core/maybe.js";import g from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as f,waitTick as v}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as b,on as F,watch as _,syncAndInitial as P,initial as I}from"../../core/reactiveUtils.js";import{sqlAnd as M}from"../../core/sql.js";import{getMetersPerUnitForSR as S}from"../../core/unitUtils.js";import{property as C}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{distance as A}from"../../core/libs/gl-matrix-2/math/vec2.js";import{isSerializable as V}from"../../core/support/jsonUtils.js";import{UpdatingHandles as G}from"../../core/support/UpdatingHandles.js";import{union as R}from"../../geometry/geometryEngineAsync.js";import O from"../../geometry/Multipoint.js";import L from"../../geometry/Point.js";import x from"../../geometry/Polygon.js";import j from"../../geometry/Polyline.js";import{projectWithZConversion as E}from"../../geometry/projection.js";import z from"../../geometry/SpatialReference.js";import{isClockwise as B}from"../../geometry/support/coordsUtils.js";import{geographicToWebMercator as D}from"../../geometry/support/webMercatorUtils.js";import H from"../../layers/GraphicsLayer.js";import{searchImages as T}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as N}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as U,computePolygonForInspection as W,resizePolygon as q,checkIfPolygonContainsSelectedPoint as $}from"../../layers/orientedImagery/core/coverageUtils.js";import{isConstantElevation as J,isElevationSource as Z}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{imageToWorld as K,imageToWorldPanoramic as Q}from"../../layers/orientedImagery/transformations/imageToWorld.js";import X from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as Y}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{getInitialAngle as ee,convertPixelToHeadingPitch as te,getImageToWorldProperties as ie,getUpdateElevationProps as ae,isElevationSampler as re,getImageToWorldPanoramicProperties as se,pointToArray as oe,transformGraphicCoordinatesToPixel as ne,getWorldToImageProperties as le,convertHeadingPitchToSphereVertex as ce,or as he}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as ue,worldToImage as pe}from"../../layers/orientedImagery/transformations/worldToImage.js";import{getFloorFilterClause as me}from"../../layers/support/floorFilterUtils.js";import de from"../../symbols/SimpleLineSymbol.js";import ge from"../../views/draw/Draw.js";import{scale as ye}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as fe}from"../../views/input/InputManager.js";import ve from"../PanoramicViewer.js";import{invalidCameraHeading as we,sectorsInOrder as be,sectorsRadii as Fe}from"./constants.js";import{configureSketchTool as _e,extractFieldsFromDataCaptureLayer as Pe,isValidDataCaptureLayer as Ie,constructGraphicFromImageGeometry as Me}from"./dataCaptureUtils.js";import{isFeatureAttachment as Se,getImageSourceFromAttachment as Ce}from"./galleryUtils.js";import{formatPixels as ke,heightMeasurementPanoramic as Ae,heightMeasurement2D as Ve,calculateHeightAccuracyPanoramic as Ge,calculateHeightAccuracy as Re,pixelAreaMeasurement2D as Oe,pixelAreaMeasurementPanoramic as Le,pixelDistanceMeasurement2D as xe,pixelDistanceMeasurementPanoramic as je,generateCombinations as Ee,getRootOfSumOfSquaredErrors as ze,generateCombinationsPanoramic as Be,calculateLocationAccuracyFromDeviations as De,calculateReferenceImagePointPanoramic as He,calculateAnglePano as Te,calculateTempImagePoint as Ne,calculateAngle as Ue,getModeCorrectedPoint as We,calculateCorrectedPixel as qe,calculateHeightFromTemporaryDistance as $e}from"./imageMeasurementUtils.js";import{crossSymbol as Je,crossSymbol3D as Ze,measurementPolygonSymbol as Ke,polylineSymbolPanoramic as Qe,measurementPolylineSymbol as Xe,sourcePointSymbol as Ye,diamondSymbol as et,diamondSymbol3D as tt,locationSymbol as it,locationSymbol3D as at,activeSourcePointSymbol as rt}from"./symbols.js";import{isNoAttachmentError as st,getContentType as ot,isTifOrMrf as nt,filterOILLayerView as lt,assignElevationSampleToFeatures as ct,isSceneView as ht,isGraphic as ut,calculateSegment as pt,calculateDirection as mt}from"./utils.js";import dt from"./components/ImageViewer.js";import gt from"./components/NavigationNode.js";const yt={click:"view-click",imageClick:"image-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles",sketchHandles:"sketch-handles"},ft=new Set(["JPG","JPEG"]),vt=/\.(\w+)$/,wt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first"),bt=5;let Ft=class extends(l.EventedMixin(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.collectionId=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,i)=>{const{currentBestFeature:a,selectedPoint:r,view:s}=this;if(s?.closePopup(),a&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(i),await this._loadImage(i)}catch(o){y(o)||(this.loadImageError(o),h.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.draw=null,this.sketchAdapter=null,this.updateFootprint=async(e,t)=>{"image-loaded"===this.state&&await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new dt,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._overlays=new H({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new ve,this._previousCursor=null,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._featureToSector=null,this._updatingHandles=new G,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find((({attributes:{imageID:t}})=>t===Number(e)));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:i}=await t;return f(e),this.sketchAdapter=new i({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.loadImageViewer=e=>{this._imageViewer.container=e},this.loadPanoramicViewer=e=>{this._panoramicViewer.container=e},this.afterNavigate=async(e,t,i)=>this.selectBestFeature(t.id,i).then((i=>(this._panoramicViewer.yaw=e.currentHeading-t.heading,this._panoramicViewer.pitch=e.currentPitch-t.pitch,i))),this.queryAndProcessNavigationNode=async(e,t,i)=>{const{layer:a,layerFloorFilterClause:r}=this;if(!a)return null;const{currentHeading:s,currentPitch:o}=e,{attributes:{farDistance:n},geometry:l}=t,{x:c,y:h,spatialReference:u}=l,m=u.isGeographic?1:S(u),d=n/(bt*m),g=d*Math.sin(p(s))*Math.sin(p(o)),y=d*Math.sin(p(o))*Math.cos(p(s)),v=M("1=1",M(a.definitionExpression,r)),w=new L(c+g,h+y,u);this.selectedPoint=w;const b=await T({layerInstanceOrURL:a,point:w,queryParams:{where:v,maximumDistance:a.maximumDistance?a.maximumDistance/m:void 0}},i);return f(i),await this._processFeatureResponse(b,w,{loadBestImage:!1,signal:i?.signal}),f(i),this.afterNavigate(e,t)},this.navigate=async(e,t)=>{const{currentNode:i}=this;if(!i)return null;const a=this.currentNode?.[e];if(!a)return null;const r=this._suitabilities.find((e=>e.feature.attributes.objectId===a.id)),s=this._featureToSector[`${a.id}`],[o,n]=s.split("_"),l=`NEAR_${n}`,c=`FAR_${n}`,h=this._activeSectors?.includes(l),u=this._activeSectors?.includes(c);return r&&(n===s&&!h&&!u||s===l&&!u||s===c)?this.queryAndProcessNavigationNode(i,a,t):this.afterNavigate(i,a,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(f(t),this.currentBestFeature=this.features?.find((({attributes:t})=>`${t.objectId}`==`${e}`)),b((()=>"image-loaded"===this.state),t)),this.toggleImageAttributes=()=>{m(this._openPopupTask),this._openPopupTask=r((async e=>{const{currentBestFeature:i,popupEnabled:a,layer:r,view:s}=this;if(s?.closePopup(),!(s&&i&&a&&r))return;const{attributes:o,geometry:n}=i,l=new t({geometry:n,attributes:o.toJSON(),layer:r});f(e),await s.openPopup({features:[l],location:o.location.clone()})}))},this._createViewClickHandle=()=>{if(this.removeHandles(yt.click),"disabled"===this.state||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,fe.WIDGET),yt.click)},this._createImageClickHandle=()=>{this.removeHandles(yt.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:i,currentBestFeature:a,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&a))return;i.clickAction="pixel-location";let n=null;const l=F((()=>i),"pixel-location",(e=>{this.plotReferencePointOnImage(e),n?.abort(),n=r((async i=>{if(!e)return;const r=await this.getMapPoint(e,{feature:a,imageSize:o,mode:t}).then((e=>{const t=this.view?.spatialReference;return he(!t,e.spatialReference.equals(t))?e:E(e,t)}));f(i),this.plotReferencePointOnGround(r)}))}));this.addHandles(l,yt.imageClick)},this._createImageLocationHandle=()=>{this.removeHandles(yt.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:i,currentBestFeature:a,footprintExtent:s}=this,o=i?.imageSize;if(!(e&&"none"!==t&&o&&s&&a))return;i.clickAction="pixel-location";let n=null;const l=F((()=>i),"pixel-location",(e=>{this.pixelCoordinates=e,this.plotLocationPointOnImage(e),n?.abort(),n=r((async i=>{if(!e)return;let r=await this.getMapPoint(e,{feature:a,imageSize:o,mode:t});f(i);const s=this.view?.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await E(r,s),f(i)),this.groundCoordinates=r;const n=await this.calculateLocationAccuracy(e,r,t,i);f(i),n&&(this.groundCoordinatesAccuracy=n)}))}));this.addHandles(l,yt.imageClick)},this._loadImage=async e=>{const{currentBestFeature:t,layer:i,mode:a}=this;if(this.clearGraphics(),!i||!t||"none"===a)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:u,cameraOrientation:p,location:m}=r,d=(l??0)+(o??0),g=m.spatialReference.isWGS84&&4!==p?.type?D(m):new L(m);let v=s;if(Se(s))try{v=await Ce(i,u,e)}catch(w){if(y(w))return;return st(w)?(h.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${i.objectIdField}: ${u}`)):(h.getLogger(this).error(w,{[i.objectIdField]:u,layer:i}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${i.objectIdField} ${u}`))}try{await this.loadImageFromSource(v,{imageRotation:d,options:e,pitch:c,yaw:n,mode:a,cameraLocation:g}),f(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:i,imageRotation:a,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:l}=new URL(o);let c=s?n.match(vt)?.[1]:e.datasetFormat;if(!c)try{c=await ot(o,{...t.options})}catch(u){y(u)||h.getLogger(this).error("#getContentType()",u)}switch(c??="UNKNOWN FORMAT",i){case"default":this._imageViewer.imageSource={datasetFormat:c.toUpperCase(),url:o.split("?")[0]},this._imageViewer.customParameters=Object.fromEntries(l),this._imageViewer.imageRotation=a??0,await this._imageViewer.loadImage(r);break;case"panoramic":if(ft.has(c.toUpperCase())){const{selectedPoint:e}=this,{pitch:i,yaw:a,cameraLocation:s,viewAngle:n}=t;this._panoramicViewer.imageSource=o;let l=a??0;"number"==typeof n?l=n-l:s&&e&&(l=await ee(s,e)-l),this._panoramicViewer.pitch=i??0,this._panoramicViewer.yaw=l,await this._panoramicViewer.loadImage(r)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:c});break}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");f(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");f(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{e.stopPropagation(),e.preventDefault(),e.mapPoint&&this.plotMapPoint(e.mapPoint)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=r((async t=>{const{pointerType:i,button:a,mapPoint:r}=e;if(("mouse"!==i||0===a)&&r)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))}))},this.plotSelectedPointOnImage=async(e,i)=>{if(await v(i),!e)return;const a=new L({...V(e)?e.toJSON():e});if("default"===this.mode)a.x-=.5,a.y=.5-a.y,a.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:a,symbol:Je}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:i}=this._panoramicViewer;if(!i)return;const[a,r]=i,{heading:s,pitch:o}=te(e,a,r),n=ce(s,o);this._crossSymbol=new t({geometry:new L(n,z.WebMercator),symbol:Ze}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([_((()=>this.view),(()=>{this.load()}),P),_((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),I),_((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),I),_((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),P),_((()=>[this.state,this.imageLocationToolState,this.view]),(()=>{if(this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();this._setMeasurementCursor()}),P),_((()=>this.measureType),(()=>{this.clearPreviousMeasurements()}),P),_((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),P),_((()=>this.currentBestFeature),(async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=r((async i=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:i}]))),await this._featureChangedTask.promise}),{sync:!0}),_((()=>this.mode),(e=>{switch(this.removeHandles(yt.interactionHandles),e){case"default":this.addHandles(_((()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null}),(e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=r((async t=>{await this.updateFootprint(e,{signal:t})})))}),{...P,equals:(e,t)=>a(e,t,c)}),yt.interactionHandles);break;case"panoramic":this.addHandles(_((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:i,vfov:a,hfov:r,pitch:s,yaw:o}=this._panoramicViewer;return e&&i&&!t.includes("loading")?[a,r,o,s]:null}),(e=>{if(!e||this.state.includes("loading"))return;const[t,i,a,s]=e;this.currentNode&&(this.currentNode.currentHeading=a+(this.currentNode.heading??0),this.currentNode.currentPitch=s+(this.currentNode.pitch??0)),m(this._updateFootprintTask),this._updateFootprintTask=r((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:i,yaw:a,pitch:s},{signal:e})}))}),{...P,equals:(e,t)=>a(e,t,c)}),yt.interactionHandles)}}),P),_((()=>[this.brightness,this.contrast,this.sharpness]),(()=>{const{_imageViewer:e,brightness:t,contrast:i,mode:a,sharpness:r}=this;"default"===a&&(e.brightness=t,e.contrast=i,e.sharpness=r)}),P),_((()=>this.activeViewer?.imageRenderer),(()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)})),F((()=>this.features),"change",(()=>{this.navigationNodes.removeAll(),this.features.forEach((e=>{const t=new gt({geometry:e.geometry,attributes:e.attributes});this.navigationNodes.add(t)}))}))]),this.when().finally((()=>{this.notifyChange("state")}))}destroy(){this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=d(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._crossSymbol=d(this._crossSymbol),this._referencePointOnGround=d(this._referencePointOnGround),this._referencePointOnImage=d(this._referencePointOnImage),this._locationPointOnImage=d(this._locationPointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this._panoramicViewer.destroy()}get activeLayer(){return o(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:i}=this;switch(i){case"default":return e;case"panoramic":return t;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every((e=>0===e))??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",u(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",u(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t?.find((t=>t.id===e?.attributes.objectId))}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return nt(t)||Se(t)}get imageLoaded(){return o(h.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===we}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(lt(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?me(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const{horizontalFieldOfView:t,isSpherical:i}=e;return 360===t||i?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?be.map((t=>e[t])):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",u(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t,_updatingHandles:{updating:i},_featureChangedTask:a}=this;if(t)return"disabled";if(!this.isFulfilled()||i||!1===a?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map((({attributes:{imagePath:e,objectId:t,cameraRoll:i,imageRotation:a}})=>{const r=e?.trim();return nt(r)||Se(r)?{url:r,objectId:t,rotation:(i??0)+(a??0)}:null})).filter(i)):null}set view(e){this._set("view",e)}get _sketchGraphicsLayer(){const{mode:e}=this;switch(e){case"panoramic":return new H({elevationInfo:{mode:"absolute-height"}});case"default":return new H;case"none":return}}get _overlaysView(){return this.view?.layerViews.find((({layer:e})=>e===this._overlays))}get _activeSectors(){return be.filter((e=>this._sectorData?.[e]?.length))}async computeHeight(e,t,i=!0){const{currentBestFeature:a,activeViewer:r,layer:s,footprintExtent:o}=this,n=r?.imageSize,l=a?.attributes,c=s?.orientationAccuracy;if(!l||!n||!e||e.length<2||!c)return;const h="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ie(l,n[0],n[1]),u=e.at(0),p=e.at(-1);if(!(h&&u&&p&&c&&o))return;const m=[p,u],d=ke(m,!1),g="panoramic"===t?await Ae(m,h,c,a,!0,!1):await Ve(m,h,c,!0,i);if(!g)return;const y="panoramic"===t?await Ge(c,d,h,g,a,!0):await Re(c,d,h,g,!0);return y?{value:g,accuracy:y}:{value:g}}async calculateAreaMeasurement(e,t,i){if(e.length<3||!this.currentBestFeature||!this.activeViewer?.imageSize||"none"===t)return null;const a="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return f(i),a?"default"===t?await Oe(e,a,!0):await Le(e,a,!0,i):null}async calculateDistanceMeasurement(e,t,i){const{currentBestFeature:a,activeViewer:r}=this;if(e.length<2||!a||!r?.imageSize||"none"===t)return null;const s="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return f(i),s?"default"===t?await xe([e.at(0),e.at(-1)],s,!0):await je([e.at(0),e.at(-1)],s,!0):null}async calculateAccuracy(e,t,i){const{layer:a,currentBestFeature:r,activeViewer:s}=this,o=a?.orientationAccuracy,n=o?.every((e=>0===e))||!o?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!r||!s?.imageSize||n)return null;const l=await this.getMeasurementProperties();if(f(i),!l)return null;const c="area"===t?await Oe(e,l,!0):await xe([e.at(0),e.at(-1)],l,!0);f(i);const{updateElevationProps:h,...u}=l,p=Ee(u,o);if(!p?.length)return null;const m=p.map((e=>({...e,updateElevationProps:h}))).map((async a=>{const r="area"===t?await Oe(e,a,!0):await xe([e.at(0),e.at(-1)],a,!0);if(f(i),r&&c){if("area"===t){const e="number"!=typeof r?r.area:null;return e?Math.abs(e-c.area):null}return Math.abs(r-c)}return null})),d=await Promise.all(m);f(i);const g=d.filter((e=>null!==e));return 0===g.length?null:ze(g)}async calculateLocationAccuracy(e,t,i="default",a){const{layer:r,currentBestFeature:s}=this,o=r?.orientationAccuracy,n=this.view?.spatialReference,l=o?.every((e=>0===e))||!o?.length;if(!s||l)return null;const c="default"===i?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();if(f(a),!c)return null;const{updateElevationProps:h,...u}=c,p="default"===i?Ee(u,o):Be(u,o);if(!p?.length)return null;const m=p.map((e=>({...e,updateElevationProps:h}))).map((async r=>{const{updateElevationProps:s,...o}=r;let l="default"===i?await K(e,o,s):await Q(e,o,s);return f(a),n&&!l.spatialReference.equals(n)&&(l=await E(l,n),f(a)),l&&t?[Math.abs(l.x-t.x),Math.abs(l.y-t.y),l.z&&t.z?Math.abs(l.z-t.z):0]:null})),d=await Promise.all(m);if(f(a),!d?.length)return null;const g=d.map((e=>[e?.[0]??0,e?.[1]??0,e?.[2]??0])),[y,v,w]=De(g);return{x:y,y:v,z:w}}async calculateAccuracyPanoramic(e,t,i){const{layer:a,currentBestFeature:r,activeViewer:s,mode:o}=this,n=a?.orientationAccuracy,l=n?.every((e=>0===e))||!n?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!r||!s?.imageSize||l||"panoramic"!==o)return null;const c=await this.getMeasurementPropertiesPanoramic();if(f(i),!c)return null;const h="area"===t?await Le(e,c,!0):await je([e.at(0),e.at(-1)],c,!0);f(i);const{updateElevationProps:u,...p}=c,m=Be(p,n);if(!m?.length)return null;const d=m.map((e=>({...e,updateElevationProps:u}))).map((async a=>{const r="area"===t?await Le(e,a,!0):await je([e.at(0),e.at(-1)],a,!0);if(f(i),r&&h){if("area"===t){const e="number"!=typeof r?r.area:null;return e?Math.abs(e-h.area):null}return Math.abs(r-h)}return null})),g=await Promise.all(d);f(i);const y=g.filter((e=>null!==e));return 0===y.length?null:ze(y)}async calculateHeightMeasurementInfo(e,t,i){const{currentBestFeature:a,activeViewer:r}=this,s=r?.imageSize;if(!a||!r||!s?.length||"none"===t)return;const{attributes:o}=a,[n]=ke([e],"panoramic"!==t),l="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ie(o,s[0],s[1]);if("panoramic"===t){if(!l)return;const e=await He(n,l,a,i);if(!e)return;e?.heading>180&&(e.heading-=360);const t=Te(n,e),r=A([n.x,n.y],[e.x,e.y]);if(!t||!r)return;return{measurementAngle:t,tempDistance:r}}const c=await Ne(n,l,i);if(!c)return;const h=Ue(n,c),u=A([n.x,n.y],[c.x,c.y]);return h&&u?{measurementAngle:h,tempDistance:u}:void 0}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null)}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:i,dataCaptureLayer:a}=this;if(!i)throw wt();_e(a,e,i),await i.create(e,{...t,defaultZ:0})}async digitizeDelete(){if(!this.sketch)throw wt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw wt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw wt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw wt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw wt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw wt();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:i,mode:a}=this,r=t?.imageSize,s=e?.attributes;if(!s||!r)return;const o=await this.computeHeight(i,a);o?.value&&o?.accuracy&&(this.heightMeasurementResult=o.value,this.heightMeasurementAccuracy=o.accuracy)}filterByFootprints(e,t){const i=[],a=[],r=[];return e.forEach((e=>{const{layer:{coveragePercent:s},attributes:o}=e;let n;const l=S(e.geometry.spatialReference);o.cameraHeight/=l,o.farDistance/=l,o.nearDistance/=l,J(o.elevationSource)&&(o.elevationSource.constantElevation/=l);const{polygon:c,frustum:h}=U(o);if(n=c.clone(),o.isInspection&&(n=W(o)),s&&(n=q(n,s)),!t||$(n,t)){r.push(e);const{geometry:t,objectId:s,cameraHeight:n,cameraHeading:l}=o,u=t.clone();u.z=n,u.imageID=s,this.pointSources.push(u),l!==we&&(i.push(c),h&&a.push(h))}})),{features:r,polygons:i,frustums:a}}getMeasurementProperties(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:i,attributes:a}=e,{elevationSource:r,cameraHeight:s}=a,o=ie(a,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?E(n,z.WebMercator):Promise.resolve(n)).then((e=>(n=e,ae((n.z??0)-s,{elevationSample:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&re(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}getMeasurementPropertiesPanoramic(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:i,attributes:a}=e,{elevationSource:r,cameraHeight:s}=a,o=se(a,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?E(n,z.WebMercator):Promise.resolve(n)).then((e=>(n=e,ae((n.z??0)-s,{elevationSample:i,elevationSource:r,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&re(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t})))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimagery","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then((({features:e})=>t.applyEdits({deleteFeatures:e})))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[be[e]];t?.length&&this._updateCurrentBestFeature(t.at(0))}handleFeatureClick(e){const{sector:t,featureIndexInSector:i}=e;if(isNaN(i))return;const a=this._sectorData?.[t];a?.length&&this._updateCurrentBestFeature(a.at(i))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:i,heightMeasurementPixels:a,mode:r,activeViewer:s}=this,o=s?.imageSize;if(!e.vertices||!o)return;const n=We(e.vertices.at(-1),r,o);if(a.length<1||!n||!i||!t||"none"===r)return;const l=qe(a[0],n,t);if(!l?.length)return;this.heightMeasurementPixels.push(l),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const c=$e(this.heightMeasurementPixels,i);c&&(this.heightMeasurementResult=c)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:i,activeViewer:a,heightMeasurementPixels:r,mode:s}=this;if(!i||!a||!e.vertices?.length||"none"===s)return;const o=a?.imageSize;if(!r.length&&o){const i=We(e.vertices.at(-1),s,o);this.heightMeasurementPixels.push(i);const a=await this.calculateHeightMeasurementInfo(i,s,t);if(!a?.measurementAngle||!a?.tempDistance)return;this.measurementAngle=a.measurementAngle,this.tempDistance=a.tempDistance}}async load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch((e=>{if(!y(e))throw e}))),this}async loadBestImage(e,t){return this.view?.closePopup(),this.displayMessage=null,this.clearPreviousGroundLocation(),this.imageLocationToolState=!1,this.selectedPoint=e.spatialReference.isGeographic?D(e):e.clone(),this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),this._overlays?.removeAll(),this._fetchFeaturesWithController(e,t)}loadImageError(e){h.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:i}=await t;f(e),this.sketch=new i({layer:this._sketchGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:i}=await t;if(f(e),this.sketchAdapter=new i({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async startMeasurement(e,t){await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:i,sketchAdapter:a,activeViewer:r,mode:s}=this;if(!i||!a||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(i.defaultCreateOptions.defaultZ=0),await i.create(e),"panoramic"===s){const{drawOperation:e}=i.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=Ke(o),this.sketch.polylineSymbol="panoramic"===s?Qe:Xe(o))}startHeightMeasurement(){this.heightMeasurementPixels=[],this.displayNewMeasurementButton=!1,this.draw??=new ge({view:this.activeViewer?.imageRenderer});this.draw.create("polyline").on(["cursor-update","vertex-add","draw-complete"],(e=>this.handleDrawEvents(e)))}createPolylineGraphic(){const e=[this.heightMeasurementPixels[0],this.heightMeasurementPixels.at(-1)],i=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[e],spatialReference:i});else{const a=new j({paths:[e],spatialReference:i}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:a,symbol:Xe(r,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}createPolylineGraphicPano(){const e=this.activeViewer?.imageRenderer.spatialReference,i=this.activeViewer?.imageSize;if(!i)return;const a={x:this.heightMeasurementPixels[0][0],y:this.heightMeasurementPixels[0][1]},r={x:this.heightMeasurementPixels.at(-1)[0],y:this.heightMeasurementPixels.at(-1)[1]},{heading:s,pitch:o}=te(a,i[0],i[1]),{heading:n,pitch:l}=te(r,i[0],i[1]),c=[[...ce(s,o)],[...ce(n,l)]];if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[c],spatialReference:e});else{const i=new j({paths:[c],spatialReference:e});this.heightGraphic=new t({geometry:i,symbol:Qe}),this._panoramicViewer.addGraphic(this.heightGraphic,0)}}async handleDrawEvents(e,t){if(this.draw)switch(e.type){case"cursor-update":this.handleDrawCursorUpdateEvents(e);break;case"vertex-add":this.handleDrawVertexAddEvents(e,t);break;case"draw-complete":await this.displayHeightResults()}}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:i,currentBestFeature:a,overlayedCameraLocations:r,layer:s,mode:o,state:n}=this,l=i?.imageSize;if(!l||!a||!s||"none"===o||n.includes("loading"))return;const{polygon:c}=U(a.attributes);if(i.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await s.queryFeatures({where:`${s.objectIdField} <> ${a.attributes.objectId}`,geometry:c,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map((async e=>{const{attributes:i,geometry:r}=e,s=await this.getPixels(r,{feature:a,imageSize:l,mode:o}),n=Ye.clone();return n.outline=new de({color:[0,0,0],width:1}),new t({attributes:i,symbol:n,geometry:s})})));r.addMany(n),i.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,a=!1){const{activeViewer:r,currentBestFeature:o,mode:n,state:l,layer:c}=this,u=r?.imageSize;if(!u||!o||"none"===n||l.includes("loading")||!c)return;const{polygon:p}=U(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:i}=Pe(e,c.imageGeometryField,c.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=i.name}catch(g){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:m}=await e.queryFeatures({geometry:p,returnGeometry:!0,outFields:["*"]}),d=new s((await Promise.all(m.map((async i=>{const r=i.symbol?.clone()??e.renderer?.getSymbol(i)?.clone(),{attributes:s,geometry:l}=i,c=l,{imageGeometryField:p,oiObjectIdField:m}=this;if(p&&m&&Ie(e,p,m)&&`${s[m]}`==`${o.attributes.objectId}`)try{return Me(s,p,e,a,u,n,r)}catch(g){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:g,feature:i,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}switch(c?.type){case"point":{const i=await this.getPixels(c,{feature:o,imageSize:u,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:i,visible:e.visible&&a})}case"polygon":{const{rings:i,spatialReference:l}=c,h=i.map((e=>e.map((([e,t,i])=>new L({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(h.map((async e=>this.getPixels(e,{feature:o,imageSize:u,mode:n}).then((e=>e.map(oe))))));return new t({attributes:s,layer:e,symbol:r,geometry:new x({rings:p,spatialReference:z.WebMercator}),visible:e.visible&&a})}case"polyline":{const{paths:i,spatialReference:l}=c,h=i.map((e=>e.map((([e,t,i])=>new L({x:e,y:t,z:i,spatialReference:l}))))),p=await Promise.all(h.map((async e=>this.getPixels(e,{feature:o,imageSize:u,mode:n}).then((e=>e.map(oe))))));return new t({attributes:s,layer:e,symbol:r,geometry:new j({paths:p,spatialReference:z.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:l}=c,h=i.map((([e,t,i])=>new L({x:e,y:t,z:i,spatialReference:l}))),p=await this.getPixels(h,{feature:o,imageSize:u,mode:n}).then((e=>e.map(oe)));return new t({attributes:s,layer:e,symbol:r,geometry:new O({points:p,spatialReference:z.WebMercator}),visible:e.visible&&a})}}return null})))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,d)}async getPixels(e,t){const{imageSize:i,mode:a}=t,r=(await this.worldToImage(Array.isArray(e)?e:[e])).map((e=>{if("default"===a)return new L({x:e.x-.5,y:.5-e.y,spatialReference:z.WebMercator});const[t,r]=i,{heading:s,pitch:o}=te(e,t,r),n=ce(s,o);return new L(n,z.WebMercator)}));return Array.isArray(e)?r:r[0]}async getMapPoint(e,t){const{feature:i,mode:a,imageSize:r}=t,{elevationSample:s,attributes:o}=i,{elevationSource:n,location:l,elevation:c,cameraHeight:h}=o;let u=l.clone();u.spatialReference.isGeographic&&(u=await E(u,z.WebMercator));const p=await ae(c??(l.z??0)-h,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let m;if("elevationSample"in p&&re(p.elevationSample)&&(i.elevationSample=p.elevationSample),"default"===a){const t=ie(o,r[0],r[1]);m=await K(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}else{const t=se(o,r[0],r[1]);m=await Q(Array.isArray(e)?e:[e],{...t,cameraLocation:u},p)}return Array.isArray(e)?m:m[0]}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new L({...e.toJSON()}),symbol:et}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const i=V(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._referencePointOnImage=new t({geometry:new L({spatialReference:this._imageViewer.imageRenderer.spatialReference,...i}),symbol:et}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:i}=this._panoramicViewer;if(!i)return;const[a,r]=i,{heading:s,pitch:o}=te(e,a,r),n=ce(s,o);this._referencePointOnImage=new t({geometry:new L(n,z.WebMercator),symbol:tt}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}plotLocationPointOnImage(e){if("image-loaded"===this.state)switch(this.clearLocationPointOnImage(),this.mode){case"default":this._plotLocationPointOnDefaultImage(e);break;case"panoramic":this._plotLocationPointOnPanoramicImage(e)}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach((e=>{this._imageViewer.removeManyGraphics(e.toArray())})),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementPixels=[],this.heightMeasurementResult=0,this.tempDistance=null,this.measurementAngle=null,this.heightMeasurementAccuracy=0,this.heightGraphic=null}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:i,savedGraphics:a}=t,r=i.get(e.id),s=r?.toArray();if(!r||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce(((t,{objectId:i,globalId:a,error:r},o)=>{const n=s[o],{attributes:l}=n;return r?t.error.push(n):(i&&(l[e.objectIdField]=i),a&&e.globalIdField&&(l[e.globalIdField]=a),t.success.push(n)),t}),{success:[],error:[]});a.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDataCaptureFeatures(e){const{activeViewer:t,currentBestFeature:a,dataCaptureLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!a||"none"===s)throw new n("orientedimagery","Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("orientedimagery","Data capture layer is not available");const l=await Promise.all(e.map((async e=>{const t=e.clone(),{geometry:i}=t;if(!i)return;const n=i.type,l=r.hasZ,c=r.geometryType,h=n!==c,u=h?await import("./transformers.js"):null,p=u?.default[c],m=h?p?.(i):i;if(m)switch(m.type){case"point":return t.geometry=await this.getMapPoint(ne(s,m,o),{feature:a,imageSize:o,mode:s}),l||(delete t.geometry.z,t.geometry.hasZ=!1),t.geometry.hasM=!1,t;case"polygon":{const e=await Promise.all(m.rings.map((async e=>this.getMapPoint(e.map((([e,t,i])=>ne(s,{x:e,y:t,z:i},o))),{feature:a,imageSize:o,mode:s}))));return t.geometry=new x({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,rings:e.map((e=>e.map(oe)))}),t}case"polyline":{const e=await Promise.all(m.paths.map((async e=>this.getMapPoint(e.map((([e,t,i])=>ne(s,{x:e,y:t,z:i},o))),{feature:a,imageSize:o,mode:s}))));return t.geometry=new j({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,paths:e.map((e=>e.map(oe)))}),t}}}))),c=l.filter(i);return r.applyEdits({addFeatures:c}).then((e=>{const{addFeatureResults:t}=e;let i=0;const a=l.map((e=>{const a=t[i++];return e?a:{error:new n("orientedimagery","Error in saving data capture features"),objectId:null,globalId:null}}));return{...e,addFeatureResults:a}}))}async searchBestImage(e,t){try{const i=await T(e,t);i&&await this._processFeatureResponse(i,e.point,t)}catch(i){y(i)||(this.setMessage("imageLoadError","error",i.message),h.getLogger(this).error("error occurred while finding best image",i))}}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach((t=>{t.visible=e}))}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach((t=>{t.visible=e}))}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}async startDataCapture(e,t){const i=this.activeViewer?.imageRenderer,{oiObjectIdField:a,currentBestFeature:r}=this;if(!i||!r||!a)return;const{attributes:{objectId:o}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],c=[];for(const s of n)`${s.getAttribute(a)}`==`${o}`?l.push(s):c.push(s);this.overlayGraphicsOnImage(e.id,new s(c)),this.collectionId=e.id;const h=await this.loadSketch(t),u=await this.loadDataCaptureAdapter(t);f(t),h.layer.addMany(l),h.layer.blendMode="source-atop",u.savedGraphics.addMany(l);i.ui.find("zoom").visible=!1,i.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=d(this.sketchAdapter),this.sketch=d(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,i=this.activeViewer?.imageRenderer;if(!i||i.destroyed)return;i.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const a=i.ui.find("zoom");a&&(a.visible=!0)}stopMeasurement(){this.heightMeasurementPixels=[],this.draw?.reset(),this.sketch?.cancel()}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach((t=>{this._toggleVisiblity(t,e)}))}toggleOverlayMapFeatures(e,t){const i=this.overlayedMapFeatures.get(e);i&&this._toggleVisiblity(i,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{selectedLocation:t,options:i}=e;let a=!1,r=!1;const s=this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=t.spatialReference.equals(s.spatialReference)?t:await E(t,s.spatialReference);a=s.contains(e);break}case"mesh":{const e=t.spatialReference.equals(s.spatialReference)?t:await E(t,s.spatialReference);r=s.extent.contains(e);break}}if(!a&&!r)return void this.clearReferencePointOnImage();const o=await this.worldToImage(t,i);if(o)return f(i),this.plotReferencePointOnImage(o),{x:o.x,y:o.y};this.clearReferencePointOnImage()}updateSuitabilities(e,t=!0){e.sort(((e,t)=>e.suitability-t.suitability)),this._suitabilities=e;const i=this._suitabilities.map((({feature:e})=>e));this._initialCurrentCoverageUpdate=!0,this._updateFeatures(i,t),this._groupFeaturesBySectors()}async _fetchFeatures(e,t){if(!this.view)return;const i=this.layer;if(i){const a={include:i},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,a);return this._processHitTestResults(i,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(i){if(y(i))return;this.setMessage("imageLoadError","error"),h.getLogger(this).error("error occurred while fetching features",i)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,currentBestFeature:i,features:a,invalidCameraHeading:r}=this;if(!e||!t||!i||!a||r)return void(this._sectorData=null);this._sectorData={};const o={};this._featureToSector=o;for(const u of be)this._sectorData[u]=new s;const n=e.map(((e,t)=>({...e,featureIndex:t})));n.sort(((e,t)=>e.trueSuitability-t.trueSuitability));const l=n.map((({distance:e})=>e)),c=Math.max(...l),h=a.reduce(((e,t)=>Math.max(e,t.attributes.location.z??0)),-1/0);n.forEach((e=>{const{distance:t,angle:i,featureIndex:r}=e,s=t/c*Fe[2],n=pt(t,c),l=mt(i);if(!this._sectorData)return;const u=Fe[3]+s*Math.sin(i*Math.PI/180),p=Fe[3]+s*Math.cos(i*Math.PI/180);let m;const d=a.at(r),g=(d.attributes.location.z??0)/h*Fe[2],y=d===this.currentBestFeature,f=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;if(y&&f)m=-90;else{const e=u-Fe[3],t=p-Fe[3],i=t/Math.sqrt(e**2+t**2);let a=180*Math.acos(i)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(a*=-1),m=a}const v=""===n?l:`${n}_${l}`;y&&(m===this.bestFeatureAngle?this.previousFeatureAngle=m:this.bestFeatureAngle=m,this.navigatorCurrentBestFeature=f?null:{x:u,y:p,direction:l}),o[`${d.attributes.objectId}`]=v;const w=this._sectorData[v];w.add({angle:i,featureIndex:r,x:u,y:p,z:g,objectID:d.attributes.objectId,sector:v,featureIndexInSector:w.length})}))}_plotLocationPointOnDefaultImage(e){const i=V(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,this._locationPointOnImage=new t({geometry:new L({spatialReference:this._imageViewer.imageRenderer.spatialReference,...i}),symbol:it}),this._imageViewer.addGraphic(this._locationPointOnImage,0)}_plotLocationPointOnPanoramicImage(e){const{imageSize:i}=this._panoramicViewer;if(!i)return;const[a,r]=i,{heading:s,pitch:o}=te(e,a,r),n=ce(s,o);this._locationPointOnImage=new t({geometry:new L(n,z.WebMercator),symbol:at}),this._panoramicViewer.addGraphic(this._locationPointOnImage,0)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.setMessage("noImageError","error"),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,i){if(!e[0])return;const a=await R(e);if(this._updateFootprintWithFeatures(t,a),this.view?.supportsGround)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,i)}catch(r){y(r)||h.getLogger(this).error(r)}}async processElevationSample(e,t,i){const{elevationSource:a}=t[0].attributes,r=await this._getElevationSampleFromGround(e,t,i);return r||(a&&this.footprintExtent&&Z(a)?await Y({extent:this.footprintExtent,lod:a.lod,url:a.url,rasterFunction:a.rasterFunction}):void 0)}async _processFeatureResponse(e,t,i){const{features:a}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(a))return;const{features:r,polygons:s,frustums:o}=this.filterByFootprints(a,t);if(!this._checkFeatures(r))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o);const n=await this.processElevationSample(s,r,i);f(i),await this._updateElevationOfSelectedPointAndLocations(r,t,n),f(i),ct(r,n),this._processSuitableFeatures(r,t),this._updateSuitabilities(i?.loadBestImage)}_processSuitableFeatures(e,t){this._suitabilities=N({features:e,selectedPoint:t,camera:ht(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,i){const{screenPoint:a,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(a);if(!o)return;const{layerFloorFilterClause:n}=this,l=e.spatialReference.equals(o.spatialReference)?o:await E(o,e.spatialReference),c=l.spatialReference.isGeographic?D(l):l,h=M("1=1",M(e.definitionExpression,n)),u=c.spatialReference.isGeographic?1:S(c.spatialReference),p={layerInstanceOrURL:e,point:c,queryParams:{where:h,maximumDistance:e.maximumDistance?e.maximumDistance/u:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(p,i)}_resetCursor(){const{activeViewer:e}=this;e&&(e.imageRenderer.cursor=this._previousCursor)}_setMeasurementCursor(){const{activeViewer:e}=this;e&&(this._previousCursor=e.imageRenderer.cursor,e.imageRenderer.cursor="crosshair")}_toggleVisiblity(e,t){e.forEach((e=>{e.visible=t}))}async _updateElevationOfSelectedPointAndLocations(e,t,i,a){const r=re(i),s=await ae((e[0].attributes.location.z??0)-e[0].attributes.cameraHeight,{elevationSample:r?i:void 0,elevationSource:r?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},a);f(a);const[o,...n]=await X([t,...e.map((e=>e.attributes.geometry.clone()))],s);f(a),t.elevation=o.z,e.forEach(((e,t)=>{e.attributes.elevation=n[t].z}))}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0])}_updateFootprintWithFeatures(e,t){const i=[];for(const{geometry:a}of e)t.contains(a)||i.push([a.x,a.y]);i.sort(((e,t)=>+B([e,t]))),t.addRing(i),this.footprintExtent=ye(t.extent,2,2)}_updateSuitabilities(e){const{_suitabilities:t}=this;t&&this.updateSuitabilities(t,e)}async _updatePointsAndPolygons(e){const{pointSources:i,currentBestFeature:a,currentCoverageVisible:r,isAdditionalPointSourcesVisible:s}=this;if(a&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),f(e);for(const e of i)e.imageID===a.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:rt,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:Ye,visible:s}))}}_updateCurrentBestFeature(e){if(!e)return;this.currentBestFeature=this.features?.at(e.featureIndex);const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let i;if(t)i=-90;else{const t=e.x-Fe[3],a=e.y-Fe[3],r=a/Math.sqrt(t**2+a**2);let s=180*Math.acos(r)/Math.PI;(t<0&&a<0||t<0&&a>0)&&(s*=-1),i=s}i===this.bestFeatureAngle?this.previousFeatureAngle=i:this.bestFeatureAngle=i,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=d(this._referencePointOnImage))}clearLocationPointOnImage(){this._locationPointOnImage&&(this._imageViewer.removeGraphic(this._locationPointOnImage),this._panoramicViewer.removeGraphic(this._locationPointOnImage),this._locationPointOnImage=d(this._locationPointOnImage))}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}setMessage(e,t,i,a){this.displayMessage={key:e,type:t,data:i,map:a}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:i,selectedPoint:a,activeViewer:r}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=d(this._crossSymbol)),!a||!t||"image-loaded"!==r?.state||i)return;let s;try{s=await this.worldToImage(a,e),f(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||h.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:a,feature:t})}}async worldToImage(e,t){const{footprintExtent:i}=this,{imageSize:a}=this.activeViewer;if("none"===this.mode||!this.currentBestFeature||!a||!i)return;const{attributes:{location:r,elevationSource:s,cameraHeading:o,elevation:n,cameraHeight:l},elevationSample:c}=this.currentBestFeature;let h=r.clone();const u=await ae(n??(r.z??0)-l,{elevationSample:c,elevationSource:s});this.currentBestFeature.elevationSample=u.elevationSample;const p=Array.isArray(e)?e:[e];let m,d=await Promise.all(p.map((e=>new Promise((t=>{if(!e.hasZ)return t(X(e,u));t(e)})))));if(r.spatialReference.isGeographic&&(h=await E(h,z.WebMercator,t)),d=await Promise.all(d.map((async e=>h.spatialReference.equals(e.spatialReference)?e:await E(e,h.spatialReference,t)))),f(t),"panoramic"===this.mode)m=ue(d,{imageHeight:a[1],imageWidth:a[0],cameraHeading:o,cameraLocation:h});else{const e=le(this.currentBestFeature.attributes,a[0],a[1]);m=pe(d,{...e,cameraLocation:h})}return Array.isArray(e)?m:m[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:i,additionalCameraLocations:a,currentBestFeature:r,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:l,_adapter:c,mode:h}=this,{attributes:{objectId:u},elevationSample:p}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),l){const e=[...i,...a,s].filter(ut);l.supportsGround&&p&&c?.updateGroundElevation&&(this._updateGroundElevation&&c.updateGroundElevation(e,p),"panoramic"===h&&c.updateGroundElevation([this.bestFeatureCurrentFootprint],p)),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Je.clone(),attributes:{imageID:u}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,l?.supportsGround&&p&&c?.updateGroundElevation&&"panoramic"===h&&c.updateGroundElevation([e],p),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([C()],Ft.prototype,"activeLayer",null),e([C({readOnly:!0})],Ft.prototype,"activeViewer",null),e([C()],Ft.prototype,"accuracyParametersMissing",null),e([C()],Ft.prototype,"additionalFeatures",void 0),e([C({type:s.ofType(t)})],Ft.prototype,"additionalCameraLocations",void 0),e([C({type:s.ofType(t)})],Ft.prototype,"additionalFootprints",void 0),e([C()],Ft.prototype,"areaMeasurementResult",void 0),e([C()],Ft.prototype,"areaMeasurementAccuracy",void 0),e([C()],Ft.prototype,"bestFeatureAngle",void 0),e([C()],Ft.prototype,"bestFeatureCurrentFootprint",void 0),e([C({type:t})],Ft.prototype,"bestFeatureFootprint",void 0),e([C({type:Number})],Ft.prototype,"brightness",null),e([C()],Ft.prototype,"collectionId",void 0),e([C({type:Number})],Ft.prototype,"contrast",null),e([C()],Ft.prototype,"conversionProps",void 0),e([C()],Ft.prototype,"coverageFrustums",void 0),e([C()],Ft.prototype,"coveragePolygons",void 0),e([C()],Ft.prototype,"currentBestFeature",void 0),e([C()],Ft.prototype,"currentBestFeatureLocation",void 0),e([C()],Ft.prototype,"currentCoverageVisible",void 0),e([C()],Ft.prototype,"currentNode",null),e([C()],Ft.prototype,"navigationNodes",void 0),e([C({json:{write:!1}})],Ft.prototype,"determineWorkflowForFeature",void 0),e([C()],Ft.prototype,"disabled",void 0),e([C()],Ft.prototype,"displayMessage",void 0),e([C()],Ft.prototype,"displayNewMeasurementButton",void 0),e([C()],Ft.prototype,"distanceMeasurementResult",void 0),e([C()],Ft.prototype,"distanceAccuracyArray",void 0),e([C()],Ft.prototype,"dataCaptureLayer",void 0),e([C({readOnly:!0})],Ft.prototype,"featureCount",null),e([C()],Ft.prototype,"features",void 0),e([C()],Ft.prototype,"groundCoordinates",void 0),e([C()],Ft.prototype,"groundCoordinatesAccuracy",void 0),e([C()],Ft.prototype,"heightMeasurementPixels",void 0),e([C()],Ft.prototype,"heightGraphic",void 0),e([C()],Ft.prototype,"heightMeasurementResult",void 0),e([C()],Ft.prototype,"heightMeasurementAccuracy",void 0),e([C()],Ft.prototype,"measurementAngle",void 0),e([C()],Ft.prototype,"tempDistance",void 0),e([C({readOnly:!0})],Ft.prototype,"imageGalleryEnabled",null),e([C()],Ft.prototype,"imageGeometryField",void 0),e([C({readOnly:!0})],Ft.prototype,"imageLoaded",null),e([C()],Ft.prototype,"imageLocationToolState",void 0),e([C({readOnly:!0})],Ft.prototype,"invalidCameraHeading",null),e([C()],Ft.prototype,"imagePointsInView",null),e([C()],Ft.prototype,"isAdditionalCoverageVisible",void 0),e([C()],Ft.prototype,"isAdditionalPointSourcesVisible",void 0),e([C()],Ft.prototype,"layer",void 0),e([C()],Ft.prototype,"layerView",null),e([C({readOnly:!0})],Ft.prototype,"layerFloorFilterClause",null),e([C({type:Number})],Ft.prototype,"localPort",void 0),e([C()],Ft.prototype,"mapImageConversionToolState",void 0),e([C()],Ft.prototype,"measureType",void 0),e([C()],Ft.prototype,"measurementGraphic",void 0),e([C({readOnly:!0,value:"none"})],Ft.prototype,"mode",null),e([C()],Ft.prototype,"navigatorCurrentBestFeature",void 0),e([C()],Ft.prototype,"oiObjectIdField",void 0),e([C({type:s.ofType(t)})],Ft.prototype,"overlayedCameraLocations",void 0),e([C()],Ft.prototype,"overlayedMapFeatures",void 0),e([C()],Ft.prototype,"pixelCoordinates",void 0),e([C()],Ft.prototype,"pointSources",void 0),e([C({readOnly:!0})],Ft.prototype,"popupEnabled",null),e([C()],Ft.prototype,"previousFeatureAngle",void 0),e([C()],Ft.prototype,"referencePoint",null),e([C({readOnly:!0})],Ft.prototype,"sectorData",null),e([C()],Ft.prototype,"selectedPoint",void 0),e([C({type:Number})],Ft.prototype,"sharpness",null),e([C()],Ft.prototype,"shouldShowSelectedImage",void 0),e([C()],Ft.prototype,"sketch",void 0),e([C()],Ft.prototype,"draw",void 0),e([C()],Ft.prototype,"sketchAdapter",void 0),e([C({readOnly:!0})],Ft.prototype,"sketchGraphicsLayer",null),e([C({readOnly:!0})],Ft.prototype,"state",null),e([C({readOnly:!0})],Ft.prototype,"thumbnails",null),e([C()],Ft.prototype,"updateFootprint",void 0),e([C()],Ft.prototype,"updateFootprintPanorama",void 0),e([C({value:null})],Ft.prototype,"view",null),e([C()],Ft.prototype,"_adapter",void 0),e([C()],Ft.prototype,"_sketchGraphicsLayer",null),e([C()],Ft.prototype,"_highlightedFeatureHandle",void 0),e([C()],Ft.prototype,"_imageViewer",void 0),e([C()],Ft.prototype,"_initialCurrentCoverageUpdate",void 0),e([C()],Ft.prototype,"_locationPointOnImage",void 0),e([C()],Ft.prototype,"_overlays",void 0),e([C({readOnly:!0})],Ft.prototype,"_overlaysView",null),e([C()],Ft.prototype,"_panoramicViewer",void 0),e([C()],Ft.prototype,"_previousCursor",void 0),e([C()],Ft.prototype,"_referencePointOnGround",void 0),e([C()],Ft.prototype,"_referencePointOnImage",void 0),e([C()],Ft.prototype,"_sectorData",void 0),e([C()],Ft.prototype,"_featureToSector",void 0),e([C()],Ft.prototype,"_activeSectors",null),e([C({readOnly:!0})],Ft.prototype,"_updatingHandles",void 0),e([C()],Ft.prototype,"footprintExtent",void 0),e([C()],Ft.prototype,"_featureChangedTask",void 0),Ft=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],Ft);const _t=Ft;export{_t as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{isSome as a,equals as r}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as n}from"../../core/deprecate.js";import o from"../../core/Error.js";import c from"../../core/Evented.js";import{equalsShallow as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as h,deg2rad as m}from"../../core/mathUtils.js";import{abortMaybe as p,destroyMaybe as d}from"../../core/maybe.js";import g from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as v,waitTick as f}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as b,on as F,watch as _,syncAndInitial as M,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 k}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as A}from"../../core/accessorSupport/decorators/subclass.js";import{distance as C}from"../../core/libs/gl-matrix-2/math/vec2.js";import{isSerializable as V}from"../../core/support/jsonUtils.js";import{UpdatingHandles as G}from"../../core/support/UpdatingHandles.js";import{union as R}from"../../geometry/geometryEngineAsync.js";import L from"../../geometry/Multipoint.js";import O from"../../geometry/Point.js";import T from"../../geometry/Polygon.js";import j from"../../geometry/Polyline.js";import{projectWithZConversion as x}from"../../geometry/projection.js";import B from"../../geometry/SpatialReference.js";import{isClockwise as E}from"../../geometry/support/coordsUtils.js";import{geographicToWebMercator as z}from"../../geometry/support/webMercatorUtils.js";import D from"../../layers/GraphicsLayer.js";import{searchImages as H}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as N}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as U,computePolygonForInspection as W,resizePolygon as q,checkIfPolygonContainsSelectedPoint as $}from"../../layers/orientedImagery/core/coverageUtils.js";import{isConstantElevation as J,isElevationSource as Z}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{imageToWorld as K,imageToWorldPanoramic as Q}from"../../layers/orientedImagery/transformations/imageToWorld.js";import X from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as Y}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{getInitialAngle as ee,convertPixelToHeadingPitch as te,getImageToWorldProperties as ae,getUpdateElevationProps as re,isElevationSampler as ie,getImageToWorldPanoramicProperties as se,pointToArray as ne,transformGraphicCoordinatesToPixel as oe,getWorldToImageProperties as ce,convertHeadingPitchToSphereVertex as le,or as ue}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImagePanoramic as he,worldToImage as me}from"../../layers/orientedImagery/transformations/worldToImage.js";import{getFloorFilterClause as pe}from"../../layers/support/floorFilterUtils.js";import de from"../../symbols/SimpleLineSymbol.js";import ge from"../../views/draw/Draw.js";import{scale as ye}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ve}from"../../views/input/InputManager.js";import fe from"../PanoramicViewer.js";import{invalidCameraHeading as we,sectorsInOrder as be,sectorsRadii as Fe}from"./constants.js";import{configureSketchTool as _e,extractFieldsFromDataCaptureLayer as Me,isValidDataCaptureLayer as Pe,constructGraphicFromImageGeometry as Ie}from"./dataCaptureUtils.js";import{isFeatureAttachment as Se,getImageSourceFromAttachment as ke}from"./galleryUtils.js";import{formatPixels as Ae,heightMeasurementPanoramic as Ce,heightMeasurement2D as Ve,calculateHeightAccuracyPanoramic as Ge,calculateHeightAccuracy as Re,pixelAreaMeasurement2D as Le,pixelAreaMeasurementPanoramic as Oe,pixelDistanceMeasurement2D as Te,pixelDistanceMeasurementPanoramic as je,generateCombinations as xe,getRootOfSumOfSquaredErrors as Be,generateCombinationsPanoramic as Ee,calculateLocationAccuracyFromDeviations as ze,calculateReferenceImagePointPanoramic as De,calculateAnglePano as He,calculateTempImagePoint as Ne,calculateAngle as Ue,computeTriangulatedAreaMeasurement as We,computeTriangulatedDistanceMeasurement as qe,getModeCorrectedPoint as $e,calculateCorrectedPixel as Je,calculateHeightFromTemporaryDistance as Ze,computeTriangulatedVector as Ke}from"./imageMeasurementUtils.js";import{crossSymbol as Qe,crossSymbol3D as Xe,measurementPolygonSymbol as Ye,polylineSymbolPanoramic as et,measurementPolylineSymbol as tt,sourcePointSymbol as at,diamondSymbol as rt,diamondSymbol3D as it,locationSymbol as st,locationSymbol3D as nt,activeSourcePointSymbol as ot}from"./symbols.js";import{isNoAttachmentError as ct,getContentType as lt,isTifOrMrf as ut,filterOILLayerView as ht,assignElevationSampleToFeatures as mt,isSceneView as pt,isGraphic as dt,calculateSegment as gt,calculateDirection as yt}from"./utils.js";import vt from"./components/ImageViewer.js";import ft from"./components/NavigationNode.js";import wt from"../Sketch/SketchViewModel.js";const bt={click:"view-click",imageClick:"image-click",triangularImageClick:"triangular-click",interactionHandles:"interaction-handles",footprintHandles:"footprint-handles",sketchHandles:"sketch-handles"},Ft=new Set(["JPG","JPEG"]),_t=/\.(\w+)$/,Mt=()=>new o("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first"),Pt=5;let It=class extends(c.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.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,a)=>{const{currentBestFeature:r,selectedPoint:i,view:s}=this;if(s?.closePopup(),r&&i){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(a),await this._loadImage(a)}catch(n){y(n)||(this.loadImageError(n),u.getLogger(this).error("#loadIImage()","error occured while loading image",n))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,a)=>{if(this.view?.closePopup(),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(a)}catch(r){y(r)||(this.loadImageError(r),u.getLogger(this).error("#loadIImage()","error occured while loading image",r))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.imageMeasurementViewer=new vt,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.measurementVectors=[],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.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedMeasurementAdapter=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.updatingTriangularMeasurementState=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new vt,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._overlays=new D({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new fe,this._previousCursor=null,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._featureToSector=null,this._updatingHandles=new G,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find((({attributes:{imageID:t}})=>t===Number(e)));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:a}=await t;return v(e),this.sketchAdapter=new a({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer.container=e},this.loadPanoramicViewer=e=>{this._panoramicViewer.container=e},this.afterNavigate=async(e,t,a)=>this.selectBestFeature(t.id,a).then((a=>(this._panoramicViewer.yaw=e.currentHeading-t.heading,this._panoramicViewer.pitch=e.currentPitch-t.pitch,a))),this.queryAndProcessNavigationNode=async(e,t,a)=>{const{layer:r,layerFloorFilterClause:i}=this;if(!r)return null;const{currentHeading:s,currentPitch:n}=e,{attributes:{farDistance:o},geometry:c}=t,{x:l,y:u,spatialReference:h}=c,p=h.isGeographic?1:S(h),d=o/(Pt*p),g=d*Math.sin(m(s))*Math.sin(m(n)),y=d*Math.sin(m(n))*Math.cos(m(s)),f=I("1=1",I(r.definitionExpression,i)),w=new O(l+g,u+y,h);this.selectedPoint=w;const b=await H({layerInstanceOrURL:r,point:w,queryParams:{where:f,maximumDistance:r.maximumDistance?r.maximumDistance/p:void 0}},a);return v(a),await this._processFeatureResponse(b,w,{loadBestImage:!1,signal:a?.signal}),v(a),this.afterNavigate(e,t)},this.navigate=async(e,t)=>{const{currentNode:a}=this;if(!a)return null;const r=this.currentNode?.[e];if(!r)return null;const i=this._suitabilities.find((e=>e.feature.attributes.objectId===r.id)),s=this._featureToSector[`${r.id}`],[n,o]=s.split("_"),c=`NEAR_${o}`,l=`FAR_${o}`,u=this._activeSectors?.includes(c),h=this._activeSectors?.includes(l);return i&&(o===s&&!u&&!h||s===c&&!h||s===l)?this.queryAndProcessNavigationNode(a,r,t):this.afterNavigate(a,r,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(v(t),this.currentBestFeature=this.features?.find((({attributes:t})=>`${t.objectId}`==`${e}`)),b((()=>"image-loaded"===this.state),t)),this.toggleImageAttributes=()=>{p(this._openPopupTask),this._openPopupTask=i((async e=>{const{currentBestFeature:a,popupEnabled:r,layer:i,view:s}=this;if(s?.closePopup(),!(s&&a&&r&&i))return;const{attributes:n,geometry:o}=a,c=new t({geometry:o,attributes:n.toJSON(),layer:i});v(e),await s.openPopup({features:[c],location:n.location.clone()})}))},this._createViewClickHandle=()=>{if(this.removeHandles(bt.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,ve.WIDGET),bt.click)},this._createImageClickHandle=()=>{this.removeHandles(bt.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:a,currentBestFeature:r,footprintExtent:s}=this,n=a?.imageSize;if(!(e&&"none"!==t&&n&&s&&r))return;a.clickAction="pixel-location";let o=null;const c=F((()=>a),"pixel-location",(e=>{this.plotReferencePointOnImage(e),o?.abort(),o=i((async a=>{if(!e)return;const i=await this.getMapPoint(e,{feature:r,imageSize:n,mode:t}).then((e=>{const t=this.view?.spatialReference;return ue(!t,e.spatialReference.equals(t))?e:x(e,t)}));v(a),this.plotReferencePointOnGround(i)}))}));this.addHandles(c,bt.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(bt.triangularImageClick);const e=this.imageMeasurementViewer?.imageSize;this.triangularMeasurementActive&&"none"!==this.mode&&e&&this.currentBestFeature&&this.addHandles(this.imageMeasurementViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),bt.triangularImageClick)},this._createImageLocationHandle=()=>{this.removeHandles(bt.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:a,currentBestFeature:r,footprintExtent:s}=this,n=a?.imageSize;if(!(e&&"none"!==t&&n&&s&&r))return;a.clickAction="pixel-location";let o=null;const c=F((()=>a),"pixel-location",(e=>{this.pixelCoordinates=e,this.plotLocationPointOnImage(e),o?.abort(),o=i((async a=>{if(!e)return;let i=await this.getMapPoint(e,{feature:r,imageSize:n,mode:t});v(a);const s=this.view?.spatialReference;s&&!i.spatialReference.equals(s)&&(i=await x(i,s),v(a)),this.groundCoordinates=i;const o=await this.calculateLocationAccuracy(e,i,t,a);v(a),o&&(this.groundCoordinatesAccuracy=o)}))}));this.addHandles(c,bt.imageClick)},this._loadImage=async e=>{const{currentBestFeature:t,layer:a,mode:r}=this;if(this.clearGraphics(),!a||!t||"none"===r)return;const{attributes:i}=t,{imagePath:s,imageRotation:n,cameraHeading:o,cameraRoll:c,cameraPitch:l,objectId:h,cameraOrientation:m,location:p}=i,d=(c??0)+(n??0),g=p.spatialReference.isWGS84&&4!==m?.type?z(p):new O(p);let f=s;if(Se(s))try{f=await ke(a,h,e)}catch(w){if(y(w))return;return ct(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(f,{imageRotation:d,options:e,pitch:l,yaw:o,mode:r,cameraLocation:g}),v(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:a,imageRotation:r,options:i}=t,s="string"==typeof e,n=s?e:e.url,{pathname:o,searchParams:c}=new URL(n);let l=s?o.match(_t)?.[1]:e.datasetFormat;if(!l)try{l=await lt(n,{...t.options})}catch(h){y(h)||u.getLogger(this).error("#getContentType()",h)}switch(l??="UNKNOWN FORMAT",a){case"default":this.triangularMeasurementActive?await this._setImageSource(this.imageMeasurementViewer,l,n,c,r,i):await this._setImageSource(this._imageViewer,l,n,c,r,i);break;case"panoramic":if(Ft.has(l.toUpperCase())){const{selectedPoint:e}=this,{pitch:a,yaw:r,cameraLocation:s,viewAngle:o}=t;this._panoramicViewer.imageSource=n;let c=r??0;"number"==typeof o?c=o-c:s&&e&&(c=await ee(s,e)-c),this._panoramicViewer.pitch=a??0,this._panoramicViewer.yaw=c,await this._panoramicViewer.loadImage(i)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:l});break}},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:a,mode:r}=this;if(this.imageMeasurementViewer.clearGraphics(),!a||!t||"none"===r)return;const{attributes:i}=t,{imagePath:s,imageRotation:n,cameraHeading:o,cameraRoll:c,cameraPitch:l,objectId:h,cameraOrientation:m,location:p}=i,d=(c??0)+(n??0),g=p.spatialReference.isWGS84&&4!==m?.type?z(p):new O(p);let f=s;if(Se(s))try{f=await ke(a,h,e)}catch(w){if(y(w))return;return ct(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(f,{imageRotation:d,options:e,pitch:l,yaw:o,mode:r,cameraLocation:g}),v(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");v(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");v(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._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:a,currentBestFeatureMeasurementImage:r,triangulatedMeasurementGraphic:i}=this;t&&a&&r&&i&&"active"!==t.state&&(t.update([i],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=i((async t=>{const{pointerType:a,button:r,mapPoint:i}=e;if(("mouse"!==a||0===r)&&i)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(i,{signal:t}))}))},this.plotSelectedPointOnImage=async(e,a)=>{if(await f(a),!e)return;const r=new O({...V(e)?e.toJSON():e});if("default"===this.mode)r.x-=.5,r.y=.5-r.y,r.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:r,symbol:Qe}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[r,i]=a,{heading:s,pitch:n}=te(e,r,i),o=le(s,n);this._crossSymbol=new t({geometry:new O(o,B.WebMercator),symbol:Xe}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([_((()=>this.view),(()=>{this.load()}),M),_((()=>this.view?.map),((e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)}),P),_((()=>this.view?.map?.allLayers?.length),(e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)}),P),_((()=>[this.state,this.mapImageConversionToolState,this.view]),(()=>{this._createViewClickHandle(),this._createImageClickHandle()}),M),_((()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage]),(()=>{this._createTriangularImageClickHandle()}),M),_((()=>[this.state,this.imageLocationToolState,this.view]),(()=>{if(this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();this._setMeasurementCursor()}),M),_((()=>this.measureType),(()=>{this.clearPreviousMeasurements()}),M),_((()=>this.bestFeatureAngle),((e,t)=>{this.previousFeatureAngle=t??0}),M),_((()=>this.currentBestFeature),(async(e,t)=>{p(this._featureChangedTask),this._featureChangedTask=i((async a=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:a}]))),await this._featureChangedTask.promise}),{sync:!0}),_((()=>this.currentBestFeatureMeasurementImage),(async(e,t)=>{p(this._featureChangedTask),t&&e!==t&&(this.measurementVectors=[],this.sketchTriangularGraphicsLayer?.graphics.destroyAll()),this._featureChangedTask=i((async a=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:a}),v(a),this._reorderTriangularSketchLayer()}))}),M),_((()=>this.triangularMeasurementActive),(async(e,t)=>{t&&!e&&(this.measurementVectors=[],this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics())})),_((()=>this.mode),(e=>{switch(this.removeHandles(bt.interactionHandles),e){case"default":this.addHandles(_((()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null}),(e=>{e&&(p(this._updateFootprintTask),this._updateFootprintTask=i((async t=>{await this.updateFootprint(e,{signal:t})})))}),{...M,equals:(e,t)=>r(e,t,l)}),bt.interactionHandles);break;case"panoramic":this.addHandles(_((()=>{const{currentBestFeature:e,state:t}=this,{imageSize:a,vfov:r,hfov:i,pitch:s,yaw:n}=this._panoramicViewer;return e&&a&&!t.includes("loading")?[r,i,n,s]:null}),(e=>{if(!e||this.state.includes("loading"))return;const[t,a,r,s]=e;this.currentNode&&(this.currentNode.currentHeading=r+(this.currentNode.heading??0),this.currentNode.currentPitch=s+(this.currentNode.pitch??0)),p(this._updateFootprintTask),this._updateFootprintTask=i((async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:r,pitch:s},{signal:e})}))}),{...M,equals:(e,t)=>r(e,t,l)}),bt.interactionHandles)}}),M),_((()=>[this.brightness,this.contrast,this.sharpness]),(()=>{const{_imageViewer:e,brightness:t,contrast:a,mode:r,sharpness:i}=this;"default"===r&&(e.brightness=t,e.contrast=a,e.sharpness=i)}),M),_((()=>this.activeViewer?.imageRenderer),(()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)})),F((()=>this.features),"change",(()=>{this.navigationNodes.removeAll(),this.features.forEach((e=>{const t=new ft({geometry:e.geometry,attributes:e.attributes});this.navigationNodes.add(t)}))}))]),this.when().finally((()=>{this.notifyChange("state")}))}destroy(){this._updateFootprintTask=p(this._updateFootprintTask),this._clickTask=p(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=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.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy()}get activeLayer(){return n(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){n(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:a}=this;switch(a){case"default":return e;case"panoramic":return t;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every((e=>0===e))??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",h(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",h(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t?.find((t=>t.id===e?.attributes.objectId))}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return ut(t)||Se(t)}get imageLoaded(){return n(u.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===we}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(ht(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?pe(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const{horizontalFieldOfView:t,isSpherical:a}=e;return 360===t||a?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?be.map((t=>e[t])):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",h(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t,_updatingHandles:{updating:a},_featureChangedTask:r}=this;if(t)return"disabled";if(!this.isFulfilled()||a||!1===r?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map((({attributes:{imagePath:e,objectId:t,cameraRoll:a,imageRotation:r}})=>{const i=e?.trim();return ut(i)||Se(i)?{url:i,objectId:t,rotation:(a??0)+(r??0)}:null})).filter(a)):null}set view(e){this._set("view",e)}get _sketchGraphicsLayer(){const{mode:e}=this;switch(e){case"panoramic":return new D({elevationInfo:{mode:"absolute-height"}});case"default":return new D;case"none":return}}get _overlaysView(){return this.view?.layerViews.find((({layer:e})=>e===this._overlays))}get _activeSectors(){return be.filter((e=>this._sectorData?.[e]?.length))}async computeHeight(e,t,a=!0){const{currentBestFeature:r,activeViewer:i,layer:s,footprintExtent:n}=this,o=i?.imageSize,c=r?.attributes,l=s?.orientationAccuracy;if(!c||!o||!e||e.length<2||!l)return;const u="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ae(c,o[0],o[1]),h=e.at(0),m=e.at(-1);if(!(u&&h&&m&&l&&n))return;const p=[m,h],d=Ae(p,!1),g="panoramic"===t?await Ce(p,u,l,r,!0,!1):await Ve(p,u,l,!0,a);if(!g)return;const y="panoramic"===t?await Ge(l,d,u,g,r,!0):await Re(l,d,u,g,!0);return y?{value:g,accuracy:y}:{value:g}}async calculateAreaMeasurement(e,t,a){if(e.length<3||!this.currentBestFeature||!this.activeViewer?.imageSize||"none"===t)return null;const r="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return v(a),r?"default"===t?await Le(e,r,!0):await Oe(e,r,!0,a):null}async calculateDistanceMeasurement(e,t,a){const{currentBestFeature:r,activeViewer:i}=this;if(e.length<2||!r||!i?.imageSize||"none"===t)return null;const s="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return v(a),s?"default"===t?await Te([e.at(0),e.at(-1)],s,!0):await je([e.at(0),e.at(-1)],s,!0):null}async calculateAccuracy(e,t,a){const{layer:r,currentBestFeature:i,activeViewer:s}=this,n=r?.orientationAccuracy,o=n?.every((e=>0===e))||!n?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!i||!s?.imageSize||o)return null;let c=null;if(this.triangularMeasurementActive&&this.currentBestFeatureMeasurementImage&&this.imageMeasurementViewer?c=await this.getMeasurementProperties(this.currentBestFeatureMeasurementImage,this.imageMeasurementViewer):(c=await this.getMeasurementProperties(),v(a)),!c)return null;const l="area"===t?await Le(e,c,!0):await Te([e.at(0),e.at(-1)],c,!0);v(a);const{updateElevationProps:u,...h}=c,m=xe(h,n);if(!m?.length)return null;const p=m.map((e=>({...e,updateElevationProps:u}))).map((async r=>{const i="area"===t?await Le(e,r,!0):await Te([e.at(0),e.at(-1)],r,!0);if(v(a),i&&l){if("area"===t){const e="number"!=typeof i?i.area:null;return e?Math.abs(e-l.area):null}return Math.abs(i-l)}return null})),d=await Promise.all(p);v(a);const g=d.filter((e=>null!==e));return 0===g.length?null:Be(g)}async calculateLocationAccuracy(e,t,a="default",r){const{layer:i,currentBestFeature:s}=this,n=i?.orientationAccuracy,o=this.view?.spatialReference,c=n?.every((e=>0===e))||!n?.length;if(!s||c)return null;const l="default"===a?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();if(v(r),!l)return null;const{updateElevationProps:u,...h}=l,m="default"===a?xe(h,n):Ee(h,n);if(!m?.length)return null;const p=m.map((e=>({...e,updateElevationProps:u}))).map((async i=>{const{updateElevationProps:s,...n}=i;let c="default"===a?await K(e,n,s):await Q(e,n,s);return v(r),o&&!c.spatialReference.equals(o)&&(c=await x(c,o),v(r)),c&&t?[Math.abs(c.x-t.x),Math.abs(c.y-t.y),c.z&&t.z?Math.abs(c.z-t.z):0]:null})),d=await Promise.all(p);if(v(r),!d?.length)return null;const g=d.map((e=>[e?.[0]??0,e?.[1]??0,e?.[2]??0])),[y,f,w]=ze(g);return{x:y,y:f,z:w}}async calculateAccuracyPanoramic(e,t,a){const{layer:r,currentBestFeature:i,activeViewer:s,mode:n}=this,o=r?.orientationAccuracy,c=o?.every((e=>0===e))||!o?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!i||!s?.imageSize||c||"panoramic"!==n)return null;const l=await this.getMeasurementPropertiesPanoramic();if(v(a),!l)return null;const u="area"===t?await Oe(e,l,!0):await je([e.at(0),e.at(-1)],l,!0);v(a);const{updateElevationProps:h,...m}=l,p=Ee(m,o);if(!p?.length)return null;const d=p.map((e=>({...e,updateElevationProps:h}))).map((async r=>{const i="area"===t?await Oe(e,r,!0):await je([e.at(0),e.at(-1)],r,!0);if(v(a),i&&u){if("area"===t){const e="number"!=typeof i?i.area:null;return e?Math.abs(e-u.area):null}return Math.abs(i-u)}return null})),g=await Promise.all(d);v(a);const y=g.filter((e=>null!==e));return 0===y.length?null:Be(y)}async calculateHeightMeasurementInfo(e,t,a){const{currentBestFeature:r,activeViewer:i}=this,s=i?.imageSize;if(!r||!i||!s?.length||"none"===t)return;const{attributes:n}=r,[o]=Ae([e],"panoramic"!==t),c="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ae(n,s[0],s[1]);if("panoramic"===t){if(!c)return;const e=await De(o,c,r,a);if(!e)return;e?.heading>180&&(e.heading-=360);const t=He(o,e),i=C([o.x,o.y],[e.x,e.y]);if(!t||!i)return;return{measurementAngle:t,tempDistance:i}}const l=await Ne(o,c,a);if(!l)return;const u=Ue(o,l),h=C([o.x,o.y],[l.x,l.y]);return u&&h?{measurementAngle:u,tempDistance:h}:void 0}async calculateTriangulatedMeasurements(e){switch(this.measureType){case"distance":{this.triangulatedDistanceMeasurement=await qe(this.measurementVectors);const t=await this.calculateAccuracy(e,"distance");if(t&&this.triangulatedDistanceMeasurement?.distance){const e=Math.atan(t/this.triangulatedDistanceMeasurement.distance);this.triangulatedDistanceAccuracy={distanceAccuracy:t,angleAccuracy:e}}break}case"area":if(this.currentBestFeatureMeasurementImage?.spatialReference){const t=await We(this.measurementVectors,this.currentBestFeatureMeasurementImage.spatialReference);this.triangulatedAreaMeasurement=t,this.triangulatedAreaAccuracy=await this.calculateAccuracy(e,"area")??this.triangulatedAreaAccuracy}}}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:a,dataCaptureLayer:r}=this;if(!a)throw Mt();_e(r,e,a),await a.create(e,{...t,defaultZ:0})}async digitizeDelete(){if(!this.sketch)throw Mt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Mt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Mt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Mt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Mt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Mt();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:a,mode:r}=this,i=t?.imageSize,s=e?.attributes;if(!s||!i)return;const n=await this.computeHeight(a,r);n?.value&&n?.accuracy&&(this.heightMeasurementResult=n.value,this.heightMeasurementAccuracy=n.accuracy)}filterByFootprints(e,t){const a=[],r=[],i=[];return e.forEach((e=>{const{layer:{coveragePercent:s},attributes:n}=e;let o;const c=S(e.geometry.spatialReference);n.cameraHeight/=c,n.farDistance/=c,n.nearDistance/=c,J(n.elevationSource)&&(n.elevationSource.constantElevation/=c);const{polygon:l,frustum:u}=U(n);if(o=l.clone(),n.isInspection&&(o=W(n)),s&&(o=q(o,s)),!t||$(o,t)){i.push(e);const{geometry:t,objectId:s,cameraHeight:o,cameraHeading:c}=n,h=t.clone();h.z=o,h.imageID=s,this.pointSources.push(h),c!==we&&(a.push(l),u&&r.push(u))}})),{features:i,polygons:a,frustums:r}}getMeasurementProperties(e=this.currentBestFeature,t=this.activeViewer){if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:r}=e,{elevationSource:i,cameraHeight:s}=r,n=ae(r,t.imageSize[0],t.imageSize[1]);let o=n.cameraLocation;return(o.spatialReference.isGeographic?x(o,B.WebMercator):Promise.resolve(o)).then((e=>(o=e,re((o.z??0)-s,{elevationSample:a,elevationSource:i,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&ie(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...n,cameraLocation:o,updateElevationProps:t})))}getMeasurementPropertiesPanoramic(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:r}=e,{elevationSource:i,cameraHeight:s}=r,n=se(r,t.imageSize[0],t.imageSize[1]);let o=n.cameraLocation;return(o.spatialReference.isGeographic?x(o,B.WebMercator):Promise.resolve(o)).then((e=>(o=e,re((o.z??0)-s,{elevationSample:a,elevationSource:i,extent:this.footprintExtent})))).then((t=>("elevationSample"in t&&ie(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...n,cameraLocation:o,updateElevationProps:t})))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new o("orientedimagery","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then((({features:e})=>t.applyEdits({deleteFeatures:e})))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[be[e]],a=t?.at(0);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}handleFeatureClick(e){const{sector:t,featureIndexInSector:a}=e;if(isNaN(a))return;const r=this._sectorData?.[t],i=r?.at(a);i&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(i):this._updateCurrentBestFeature(i))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:a,heightMeasurementPixels:r,mode:i,activeViewer:s}=this,n=s?.imageSize;if(!e.vertices||!n)return;const o=$e(e.vertices.at(-1),i,n);if(r.length<1||!o||!a||!t||"none"===i)return;const c=Je(r[0],o,t);if(!c?.length)return;this.heightMeasurementPixels.push(c),"panoramic"===i?this.createPolylineGraphicPano():this.createPolylineGraphic();const l=Ze(this.heightMeasurementPixels,a);l&&(this.heightMeasurementResult=l)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:a,activeViewer:r,heightMeasurementPixels:i,mode:s}=this;if(!a||!r||!e.vertices?.length||"none"===s)return;const n=r?.imageSize;if(!i.length&&n){const a=$e(e.vertices.at(-1),s,n);this.heightMeasurementPixels.push(a);const r=await this.calculateHeightMeasurementInfo(a,s,t);if(!r?.measurementAngle||!r?.tempDistance)return;this.measurementAngle=r.measurementAngle,this.tempDistance=r.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.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.selectedPoint=e.spatialReference.isGeographic?z(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:a}=await t;v(e),this.sketch=new a({layer:this._sketchGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:a}=await t;if(v(e),this.sketchAdapter=new a({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async loadTriangulatedMeasurementAdapter(e){if(!this.triangulatedMeasurementAdapter){const t=import("./adapters/sketch/TriangulatedMeasurementAdapter.js"),{default:a}=await t;if(v(e),this.triangulatedMeasurementAdapter=new a({viewModel:this}),!this.triangulatedMeasurementAdapter.viewModel.isResolved())return}return this.triangulatedMeasurementAdapter}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:a,sketchAdapter:r,activeViewer:i,mode:s}=this;if(!a||!r||!i||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(a.defaultCreateOptions.defaultZ=0),await a.create(e),"panoramic"===s){const{drawOperation:e}=a.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const n=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;n&&this.sketch&&(this.sketch.polygonSymbol=Ye(n),this.sketch.polylineSymbol="panoramic"===s?et:tt(n,2.5))}startHeightMeasurement(){this.heightMeasurementPixels=[],this.displayNewMeasurementButton=!1,this.draw??=new ge({view:this.activeViewer?.imageRenderer});this.draw.create("polyline").on(["cursor-update","vertex-add","draw-complete"],(e=>this.handleDrawEvents(e)))}createPolylineGraphic(){const e=[this.heightMeasurementPixels[0],this.heightMeasurementPixels.at(-1)],a=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[e],spatialReference:a});else{const r=new j({paths:[e],spatialReference:a}),i=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:r,symbol:tt(i,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}createPolylineGraphicPano(){const e=this.activeViewer?.imageRenderer.spatialReference,a=this.activeViewer?.imageSize;if(!a)return;const r={x:this.heightMeasurementPixels[0][0],y:this.heightMeasurementPixels[0][1]},i={x:this.heightMeasurementPixels.at(-1)[0],y:this.heightMeasurementPixels.at(-1)[1]},{heading:s,pitch:n}=te(r,a[0],a[1]),{heading:o,pitch:c}=te(i,a[0],a[1]),l=[[...le(s,n)],[...le(o,c)]];if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[l],spatialReference:e});else{const a=new j({paths:[l],spatialReference:e});this.heightGraphic=new t({geometry:a,symbol:et}),this._panoramicViewer.addGraphic(this.heightGraphic,0)}}async editOverlayedGraphics(e){this.sketchTriangularGraphicsLayer||this._initializeSketchTriangularGraphicsLayer(),this.sketchTriangularGraphicsLayer?.destroyed&&this._handleDestroyedTriangularSketchLayer(),this.sketchTriangularGraphicsLayer.add(e),this.sketchTriangular||(this._initializeSketchTriangular(),await this.loadTriangulatedMeasurementAdapter()),this.updateOverlayedGeometry(e)}updateOverlayedGeometry(e){this.sketchTriangular?.update([e],{tool:"reshape"})}async processMeasurementVectors(e){this.triangularMeasurementActive&&this.currentBestFeature&&(this.measurementVectors?.length<2&&await this.updateMeasurementVectorsArray(e),2===this.measurementVectors.length&&await this.calculateTriangulatedMeasurements(e))}async updateMeasurementVectorsArray(e){const t=this.measurementVectors.length?this.currentBestFeatureMeasurementImage:this.currentBestFeature;if(t){const a=await this.computeMeasurementVector(e,t);a&&this.measurementVectors.push(a)}}async computeMeasurementVector(e,t){const{activeViewer:a,mode:r}=this,i=a?.imageSize;if(!e||!t||!i)return;const s=e.map((e=>[e[0]-.5,-.5-e[1]])),n=this.view?.spatialReference,o=[];for(let c=0;c<s.length;c++){const e={x:s[c][0],y:s[c][1]};let a=await this.getMapPoint(e,{feature:t,imageSize:i,mode:r});n&&!a.spatialReference.equals(n)&&(a=await x(a,n)),o.push(a)}return Ke(o,t)}async handleDrawEvents(e,t){if(this.draw)switch(e.type){case"cursor-update":this.handleDrawCursorUpdateEvents(e);break;case"vertex-add":this.handleDrawVertexAddEvents(e,t);break;case"draw-complete":await this.displayHeightResults()}}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:a,currentBestFeature:r,overlayedCameraLocations:i,layer:s,mode:n,state:o}=this,c=a?.imageSize;if(!c||!r||!s||"none"===n||o.includes("loading"))return;const{polygon:l}=U(r.attributes);if(a.removeManyGraphics(i.toArray()),i.removeAll(),e){const{features:e}=await s.queryFeatures({where:`${s.objectIdField} <> ${r.attributes.objectId}`,geometry:l,returnGeometry:!0,outFields:[s.objectIdField]}),o=await Promise.all(e.map((async e=>{const{attributes:a,geometry:i}=e,s=await this.getPixels(i,{feature:r,imageSize:c,mode:n}),o=at.clone();return o.outline=new de({color:[0,0,0],width:1}),new t({attributes:a,symbol:o,geometry:s})})));i.addMany(o),a.addManyGraphics(i.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,r=!1){const{activeViewer:i,currentBestFeature:n,mode:o,state:c,layer:l}=this,h=i?.imageSize;if(!h||!n||"none"===o||c.includes("loading")||!l)return;const{polygon:m}=U(n.attributes);try{const{imageGeometryField:t,oiObjectIdField:a}=Me(e,l.imageGeometryField,l.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=a.name}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:p}=await e.queryFeatures({geometry:m,returnGeometry:!0,outFields:["*"]}),d=new s((await Promise.all(p.map((async a=>{const i=a.symbol?.clone()??e.renderer?.getSymbol(a)?.clone(),{attributes:s,geometry:c}=a,l=c,{imageGeometryField:m,oiObjectIdField:p}=this;if(m&&p&&Pe(e,m,p)&&`${s[p]}`==`${n.attributes.objectId}`)try{return Ie(s,m,e,r,h,o,i)}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:a,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}switch(l?.type){case"point":{const a=await this.getPixels(l,{feature:n,imageSize:h,mode:o});return new t({attributes:s,layer:e,symbol:i,geometry:a,visible:e.visible&&r})}case"polygon":{const{rings:a,spatialReference:c}=l,u=a.map((e=>e.map((([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c}))))),m=await Promise.all(u.map((async e=>this.getPixels(e,{feature:n,imageSize:h,mode:o}).then((e=>e.map(ne))))));return new t({attributes:s,layer:e,symbol:i,geometry:new T({rings:m,spatialReference:B.WebMercator}),visible:e.visible&&r})}case"polyline":{const{paths:a,spatialReference:c}=l,u=a.map((e=>e.map((([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c}))))),m=await Promise.all(u.map((async e=>this.getPixels(e,{feature:n,imageSize:h,mode:o}).then((e=>e.map(ne))))));return new t({attributes:s,layer:e,symbol:i,geometry:new j({paths:m,spatialReference:B.WebMercator}),visible:e.visible&&r})}case"multipoint":{const{points:a,spatialReference:c}=l,u=a.map((([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c}))),m=await this.getPixels(u,{feature:n,imageSize:h,mode:o}).then((e=>e.map(ne)));return new t({attributes:s,layer:e,symbol:i,geometry:new L({points:m,spatialReference:B.WebMercator}),visible:e.visible&&r})}}return null})))).filter(a));this.overlayGraphicsOnImage(`${e.id}`,d)}async getPixels(e,t){const{imageSize:a,mode:r}=t,i=(await this.worldToImage(Array.isArray(e)?e:[e])).map((e=>{if("default"===r)return new O({x:e.x-.5,y:.5-e.y,spatialReference:B.WebMercator});const[t,i]=a,{heading:s,pitch:n}=te(e,t,i),o=le(s,n);return new O(o,B.WebMercator)}));return Array.isArray(e)?i:i[0]}async getMapPoint(e,t){const{feature:a,mode:r,imageSize:i}=t,{elevationSample:s,attributes:n}=a,{elevationSource:o,location:c,elevation:l,cameraHeight:u}=n;let h=c.clone();h.spatialReference.isGeographic&&(h=await x(h,B.WebMercator));const m=await re(l??(c.z??0)-u,{elevationSample:s,elevationSource:o,extent:this.footprintExtent});let p;if("elevationSample"in m&&ie(m.elevationSample)&&(a.elevationSample=m.elevationSample),"default"===r){const t=ae(n,i[0],i[1]);p=await K(Array.isArray(e)?e:[e],{...t,cameraLocation:h},m)}else{const t=se(n,i[0],i[1]);p=await Q(Array.isArray(e)?e:[e],{...t,cameraLocation:h},m)}return Array.isArray(e)?p:p[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 O({...e.toJSON()}),symbol:rt}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const a=V(e)?e.toJSON():e;a.x-=.5,a.y=.5-a.y,this._referencePointOnImage=new t({geometry:new O({spatialReference:this._imageViewer.imageRenderer.spatialReference,...a}),symbol:rt}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:a}=this._panoramicViewer;if(!a)return;const[r,i]=a,{heading:s,pitch:n}=te(e,r,i),o=le(s,n);this._referencePointOnImage=new t({geometry:new O(o,B.WebMercator),symbol:it}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}plotLocationPointOnImage(e){if("image-loaded"===this.state)switch(this.clearLocationPointOnImage(),this.mode){case"default":this._plotLocationPointOnDefaultImage(e);break;case"panoramic":this._plotLocationPointOnPanoramicImage(e)}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach((e=>{this._imageViewer.removeManyGraphics(e.toArray())})),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=p(this._clickTask)}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementPixels=[],this.measurementVectors=[],this.heightMeasurementResult=0,this.tempDistance=null,this.measurementAngle=null,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:a,savedGraphics:r}=t,i=a.get(e.id),s=i?.toArray();if(!i||!s?.length)return;const{addFeatureResults:n}=await this.saveDataCaptureFeatures(s),o=n.reduce(((t,{objectId:a,globalId:r,error:i},n)=>{const o=s[n],{attributes:c}=o;return i?t.error.push(o):(a&&(c[e.objectIdField]=a),r&&e.globalIdField&&(c[e.globalIdField]=r),t.success.push(o)),t}),{success:[],error:[]});r.addMany(o.success),i.removeAll(),i.addMany(o.error)}async saveDataCaptureFeatures(e){const{activeViewer:t,currentBestFeature:r,dataCaptureLayer:i,mode:s}=this,n=t?.imageSize;if(!n||!r||"none"===s)throw new o("orientedimagery","Image size, current best feature and mode are required to save data capture features");if(!i)throw new o("orientedimagery","Data capture layer is not available");const c=await Promise.all(e.map((async e=>{const t=e.clone(),{geometry:a}=t;if(!a)return;const o=a.type,c=i.hasZ,l=i.geometryType,u=o!==l,h=u?await import("./transformers.js"):null,m=h?.default[l],p=u?m?.(a):a;if(p)switch(p.type){case"point":return t.geometry=await this.getMapPoint(oe(s,p,n),{feature:r,imageSize:n,mode:s}),c||(delete t.geometry.z,t.geometry.hasZ=!1),t.geometry.hasM=!1,t;case"polygon":{const e=await Promise.all(p.rings.map((async e=>this.getMapPoint(e.map((([e,t,a])=>oe(s,{x:e,y:t,z:a},n))),{feature:r,imageSize:n,mode:s}))));return t.geometry=new T({spatialReference:e[0][0].spatialReference,hasZ:c,hasM:!1,rings:e.map((e=>e.map(ne)))}),t}case"polyline":{const e=await Promise.all(p.paths.map((async e=>this.getMapPoint(e.map((([e,t,a])=>oe(s,{x:e,y:t,z:a},n))),{feature:r,imageSize:n,mode:s}))));return t.geometry=new j({spatialReference:e[0][0].spatialReference,hasZ:c,hasM:!1,paths:e.map((e=>e.map(ne)))}),t}}}))),l=c.filter(a);return i.applyEdits({addFeatures:l}).then((e=>{const{addFeatureResults:t}=e;let a=0;const r=c.map((e=>{const r=t[a++];return e?r:{error:new o("orientedimagery","Error in saving data capture features"),objectId:null,globalId:null}}));return{...e,addFeatureResults:r}}))}async searchBestImage(e,t){try{const a=await H(e,t);a&&await this._processFeatureResponse(a,e.point,t)}catch(a){y(a)||(this.setMessage("imageLoadError","error",a.message),u.getLogger(this).error("error occurred while finding best image",a))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find((({attributes:t})=>t.objectId===Number(e)))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach((t=>{t.visible=e}))}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach((t=>{t.visible=e}))}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}async startDataCapture(e,t){const a=this.activeViewer?.imageRenderer,{oiObjectIdField:r,currentBestFeature:i}=this;if(!a||!i||!r)return;const{attributes:{objectId:n}}=i,o=this.overlayedMapFeatures.get(e.id)?.toArray()??[],c=[],l=[];for(const s of o)`${s.getAttribute(r)}`==`${n}`?c.push(s):l.push(s);this.overlayGraphicsOnImage(e.id,new s(l)),this.collectionId=e.id;const u=await this.loadSketch(t),h=await this.loadDataCaptureAdapter(t);v(t),u.layer.addMany(c),u.layer.blendMode="source-atop",h.savedGraphics.addMany(c);a.ui.find("zoom").visible=!1,a.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,a=this.activeViewer?.imageRenderer;if(!a||a.destroyed)return;a.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const r=a.ui.find("zoom");r&&(r.visible=!0)}stopMeasurement(){this.heightMeasurementPixels=[],this.draw?.reset(),this.sketch?.cancel()}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach((t=>{this._toggleVisiblity(t,e)}))}toggleOverlayMapFeatures(e,t){const a=this.overlayedMapFeatures.get(e);a&&this._toggleVisiblity(a,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{selectedLocation:t,options:a}=e;let r=!1,i=!1;const s=this.bestFeatureFootprint?.geometry;switch(s?.type){case"polygon":{const e=t.spatialReference.equals(s.spatialReference)?t:await x(t,s.spatialReference);r=s.contains(e);break}case"mesh":{const e=t.spatialReference.equals(s.spatialReference)?t:await x(t,s.spatialReference);i=s.extent.contains(e);break}}if(!r&&!i)return void this.clearReferencePointOnImage();const n=await this.worldToImage(t,a);if(n)return v(a),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}updateSuitabilities(e,t=!0){e.sort(((e,t)=>e.suitability-t.suitability)),this._suitabilities=e;const a=this._suitabilities.map((({feature:e})=>e));this._initialCurrentCoverageUpdate=!0,this._updateFeatures(a,t),this._groupFeaturesBySectors()}async _fetchFeatures(e,t){if(!this.view)return;const a=this.layer;if(a){const r={include:a},i=this.view.toScreen(e);if(!i)return;const s=await this.view.hitTest(i,r);return this._processHitTestResults(a,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(a){if(y(a))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",a)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,currentBestFeature:a,features:r,invalidCameraHeading:i}=this;if(!e||!t||!a||!r||i)return void(this._sectorData=null);this._sectorData={};const n={};this._featureToSector=n;for(const h of be)this._sectorData[h]=new s;const o=e.map(((e,t)=>({...e,featureIndex:t})));o.sort(((e,t)=>e.trueSuitability-t.trueSuitability));const c=o.map((({distance:e})=>e)),l=Math.max(...c),u=r.reduce(((e,t)=>Math.max(e,t.attributes.location.z??0)),-1/0);o.forEach((e=>{const{distance:t,angle:a,featureIndex:i}=e,s=t/l*Fe[2],o=gt(t,l),c=yt(a);if(!this._sectorData)return;const h=Fe[3]+s*Math.sin(a*Math.PI/180),m=Fe[3]+s*Math.cos(a*Math.PI/180);let p;const d=r.at(i),g=(d.attributes.location.z??0)/u*Fe[2],y=d===this.currentBestFeature,v=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;if(y&&v)p=-90;else{const e=h-Fe[3],t=m-Fe[3],a=t/Math.sqrt(e**2+t**2);let r=180*Math.acos(a)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(r*=-1),p=r}const f=""===o?c:`${o}_${c}`;y&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=v?null:{x:h,y:m,direction:c}),n[`${d.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:a,featureIndex:i,x:h,y:m,z:g,objectID:d.attributes.objectId,sector:f,featureIndexInSector:w.length})}))}_handleDestroyedTriangularSketchLayer(){this.sketchTriangularGraphicsLayer&&(this.imageMeasurementViewer.imageRenderer.map.layers.remove(this.sketchTriangularGraphicsLayer),this.sketchTriangularGraphicsLayer=new D,this.imageMeasurementViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer),this.sketchTriangular&&(this.sketchTriangular.layer=this.sketchTriangularGraphicsLayer,this.sketchTriangular.view=this.imageMeasurementViewer.imageRenderer))}_initializeSketchTriangular(){this.sketchTriangular=new wt({view:this.imageMeasurementViewer.imageRenderer,layer:this.sketchTriangularGraphicsLayer,updateOnGraphicClick:!1,defaultUpdateOptions:{toggleToolOnClick:!1}})}_initializeSketchTriangularGraphicsLayer(){this.sketchTriangularGraphicsLayer=new D,this.imageMeasurementViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer)}_plotLocationPointOnDefaultImage(e){const a=V(e)?e.toJSON():e;a.x-=.5,a.y=.5-a.y,this._locationPointOnImage=new t({geometry:new O({spatialReference:this._imageViewer.imageRenderer.spatialReference,...a}),symbol:st}),this._imageViewer.addGraphic(this._locationPointOnImage,0)}_plotLocationPointOnPanoramicImage(e){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[r,i]=a,{heading:s,pitch:n}=te(e,r,i),o=le(s,n);this._locationPointOnImage=new t({geometry:new O(o,B.WebMercator),symbol:nt}),this._panoramicViewer.addGraphic(this._locationPointOnImage,0)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.setMessage("noImageError","error"),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,a){if(!e[0])return;const r=await R(e);if(this._updateFootprintWithFeatures(t,r),this.view?.supportsGround)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,a)}catch(i){y(i)||u.getLogger(this).error(i)}}async processElevationSample(e,t,a){const{elevationSource:r}=t[0].attributes,i=await this._getElevationSampleFromGround(e,t,a);return i||(r&&this.footprintExtent&&Z(r)?await Y({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction}):void 0)}async _processFeatureResponse(e,t,a){const{features:r}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(r))return;const{features:i,polygons:s,frustums:n}=this.filterByFootprints(r,t);if(!this._checkFeatures(i))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(n);const o=await this.processElevationSample(s,i,a);v(a),await this._updateElevationOfSelectedPointAndLocations(i,t,o),v(a),mt(i,o),this._processSuitableFeatures(i,t),this._updateSuitabilities(a?.loadBestImage)}_processSuitableFeatures(e,t){this._suitabilities=N({features:e,selectedPoint:t,camera:pt(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,a){const{screenPoint:r,results:[i]}=t,s="graphic"===i?.type&&this.shouldShowSelectedImage,n=i?.mapPoint??this.view?.toMap(r);if(!n)return;const{layerFloorFilterClause:o}=this,c=e.spatialReference.equals(n.spatialReference)?n:await x(n,e.spatialReference),l=c.spatialReference.isGeographic?z(c):c,u=I("1=1",I(e.definitionExpression,o)),h=l.spatialReference.isGeographic?1:S(l.spatialReference),m={layerInstanceOrURL:e,point:l,queryParams:{where:u,maximumDistance:e.maximumDistance?e.maximumDistance/h:void 0,objectIds:s?[i.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(m,a)}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}_resetCursor(){const{activeViewer:e,imageMeasurementViewer:t}=this;e&&(e.imageRenderer.cursor=this._previousCursor),t&&(t.imageRenderer.cursor=this._previousCursor)}async _setImageSource(e,t,a,r,i,s){e.imageSource={datasetFormat:t.toUpperCase(),url:a.split("?")[0]},e.customParameters=Object.fromEntries(r),e.imageRotation=i??0,await e.loadImage(s)}_setMeasurementCursor(){const{activeViewer:e,imageMeasurementViewer:t,triangularMeasurementActive:a}=this;e&&(this._previousCursor=e.imageRenderer.cursor,e.imageRenderer.cursor="crosshair"),t&&a&&(t.imageRenderer.cursor="crosshair")}_toggleVisiblity(e,t){e.forEach((e=>{e.visible=t}))}async _updateElevationOfSelectedPointAndLocations(e,t,a,r){const i=ie(a),s=await re((e[0].attributes.location.z??0)-e[0].attributes.cameraHeight,{elevationSample:i?a:void 0,elevationSource:i?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);v(r);const[n,...o]=await X([t,...e.map((e=>e.attributes.geometry.clone()))],s);v(r),t.elevation=n.z,e.forEach(((e,t)=>{e.attributes.elevation=o[t].z}))}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0])}_updateFootprintWithFeatures(e,t){const a=[];for(const{geometry:r}of e)t.contains(r)||a.push([r.x,r.y]);a.sort(((e,t)=>+E([e,t]))),t.addRing(a),this.footprintExtent=ye(t.extent,2,2)}_updateSuitabilities(e){const{_suitabilities:t}=this;t&&this.updateSuitabilities(t,e)}async _updatePointsAndPolygons(e){const{pointSources:a,currentBestFeature:r,currentCoverageVisible:i,isAdditionalPointSourcesVisible:s}=this;if(r&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),v(e);for(const e of a)e.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:ot,visible:i}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:at,visible:s}))}}_updateCurrentBestFeature(e){if(!e)return;this.currentBestFeature=this.features?.at(e.featureIndex);const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let a;if(t)a=-90;else{const t=e.x-Fe[3],r=e.y-Fe[3],i=r/Math.sqrt(t**2+r**2);let s=180*Math.acos(i)/Math.PI;(t<0&&r<0||t<0&&r>0)&&(s*=-1),a=s}a===this.bestFeatureAngle?this.previousFeatureAngle=a:this.bestFeatureAngle=a,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.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,a,r){this.displayMessage={key:e,type:t,data:a,map:r}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:a,selectedPoint:r,activeViewer:i}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=d(this._crossSymbol)),!r||!t||"image-loaded"!==i?.state||a)return;let s;try{s=await this.worldToImage(r,e),v(e),await this.plotSelectedPointOnImage(s,e)}catch(n){y(n)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:n,selectedPoint:r,feature:t})}}async worldToImage(e,t){const{footprintExtent:a}=this,{imageSize:r}=this.activeViewer;if("none"===this.mode||!this.currentBestFeature||!r||!a)return;const{attributes:{location:i,elevationSource:s,cameraHeading:n,elevation:o,cameraHeight:c},elevationSample:l}=this.currentBestFeature;let u=i.clone();const h=await re(o??(i.z??0)-c,{elevationSample:l,elevationSource:s});this.currentBestFeature.elevationSample=h.elevationSample;const m=Array.isArray(e)?e:[e];let p,d=await Promise.all(m.map((e=>new Promise((t=>{if(!e.hasZ)return t(X(e,h));t(e)})))));if(i.spatialReference.isGeographic&&(u=await x(u,B.WebMercator,t)),d=await Promise.all(d.map((async e=>u.spatialReference.equals(e.spatialReference)?e:await x(e,u.spatialReference,t)))),v(t),"panoramic"===this.mode)p=he(d,{imageHeight:r[1],imageWidth:r[0],cameraHeading:n,cameraLocation:u});else{const e=ce(this.currentBestFeature.attributes,r[0],r[1]);p=me(d,{...e,cameraLocation:u})}return Array.isArray(e)?p:p[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:a,additionalCameraLocations:r,currentBestFeature:i,currentBestFeatureLocation:s,currentCoverageVisible:n,selectedPoint:o,view:c,_adapter:l,mode:u}=this,{attributes:{objectId:h},elevationSample:m}=i;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=d(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=n,this.bestFeatureCurrentFootprint=e),c){const e=[...a,...r,s].filter(dt);c.supportsGround&&m&&l?.updateGroundElevation&&(this._updateGroundElevation&&l.updateGroundElevation(e,m),"panoramic"===u&&l.updateGroundElevation([this.bestFeatureCurrentFootprint],m)),this._updateGroundElevation=!1,o&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:o.clone(),symbol:Qe.clone(),attributes:{imageID:h}}))),this._overlays.graphics.addMany(e)}}else if(c){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,c?.supportsGround&&m&&l?.updateGroundElevation&&"panoramic"===u&&l.updateGroundElevation([e],m),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([k()],It.prototype,"activeLayer",null),e([k({readOnly:!0})],It.prototype,"activeViewer",null),e([k()],It.prototype,"accuracyParametersMissing",null),e([k()],It.prototype,"additionalFeatures",void 0),e([k({type:s.ofType(t)})],It.prototype,"additionalCameraLocations",void 0),e([k({type:s.ofType(t)})],It.prototype,"additionalFootprints",void 0),e([k()],It.prototype,"areaMeasurementResult",void 0),e([k()],It.prototype,"areaMeasurementAccuracy",void 0),e([k()],It.prototype,"bestFeatureAngle",void 0),e([k()],It.prototype,"bestFeatureCurrentFootprint",void 0),e([k({type:t})],It.prototype,"bestFeatureFootprint",void 0),e([k({type:Number})],It.prototype,"brightness",null),e([k()],It.prototype,"collectionId",void 0),e([k({type:Number})],It.prototype,"contrast",null),e([k()],It.prototype,"conversionProps",void 0),e([k()],It.prototype,"coverageFrustums",void 0),e([k()],It.prototype,"coveragePolygons",void 0),e([k()],It.prototype,"currentBestFeature",void 0),e([k()],It.prototype,"currentBestFeatureMeasurementImage",void 0),e([k()],It.prototype,"currentBestFeatureLocation",void 0),e([k()],It.prototype,"currentCoverageVisible",void 0),e([k()],It.prototype,"currentNode",null),e([k()],It.prototype,"navigationNodes",void 0),e([k({json:{write:!1}})],It.prototype,"determineWorkflowForFeature",void 0),e([k({json:{write:!1}})],It.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([k()],It.prototype,"disabled",void 0),e([k()],It.prototype,"displayMessage",void 0),e([k()],It.prototype,"displayNewMeasurementButton",void 0),e([k()],It.prototype,"distanceMeasurementResult",void 0),e([k()],It.prototype,"distanceAccuracyArray",void 0),e([k()],It.prototype,"dataCaptureLayer",void 0),e([k({readOnly:!0})],It.prototype,"featureCount",null),e([k()],It.prototype,"features",void 0),e([k()],It.prototype,"groundCoordinates",void 0),e([k()],It.prototype,"groundCoordinatesAccuracy",void 0),e([k()],It.prototype,"heightMeasurementPixels",void 0),e([k()],It.prototype,"heightGraphic",void 0),e([k()],It.prototype,"heightMeasurementResult",void 0),e([k()],It.prototype,"heightMeasurementAccuracy",void 0),e([k()],It.prototype,"measurementAngle",void 0),e([k()],It.prototype,"tempDistance",void 0),e([k({readOnly:!0})],It.prototype,"imageGalleryEnabled",null),e([k()],It.prototype,"imageGeometryField",void 0),e([k({readOnly:!0})],It.prototype,"imageLoaded",null),e([k()],It.prototype,"imageLocationToolState",void 0),e([k({readOnly:!0})],It.prototype,"invalidCameraHeading",null),e([k()],It.prototype,"imagePointsInView",null),e([k()],It.prototype,"imageMeasurementViewer",void 0),e([k()],It.prototype,"isAdditionalCoverageVisible",void 0),e([k()],It.prototype,"isAdditionalPointSourcesVisible",void 0),e([k()],It.prototype,"measurementVectors",void 0),e([k()],It.prototype,"layer",void 0),e([k()],It.prototype,"layerView",null),e([k({readOnly:!0})],It.prototype,"layerFloorFilterClause",null),e([k({type:Number})],It.prototype,"localPort",void 0),e([k()],It.prototype,"mapImageConversionToolState",void 0),e([k()],It.prototype,"measureType",void 0),e([k()],It.prototype,"measurementGraphic",void 0),e([k({readOnly:!0,value:"none"})],It.prototype,"mode",null),e([k()],It.prototype,"navigatorCurrentBestFeature",void 0),e([k()],It.prototype,"oiObjectIdField",void 0),e([k({type:s.ofType(t)})],It.prototype,"overlayedCameraLocations",void 0),e([k()],It.prototype,"overlayedMapFeatures",void 0),e([k()],It.prototype,"pixelCoordinates",void 0),e([k()],It.prototype,"pointSources",void 0),e([k({readOnly:!0})],It.prototype,"popupEnabled",null),e([k()],It.prototype,"previousFeatureAngle",void 0),e([k()],It.prototype,"referencePoint",null),e([k({readOnly:!0})],It.prototype,"sectorData",null),e([k()],It.prototype,"selectedPoint",void 0),e([k({type:Number})],It.prototype,"sharpness",null),e([k()],It.prototype,"shouldShowSelectedImage",void 0),e([k()],It.prototype,"sketch",void 0),e([k()],It.prototype,"sketchTriangular",void 0),e([k()],It.prototype,"sketchTriangularGraphicsLayer",void 0),e([k()],It.prototype,"draw",void 0),e([k()],It.prototype,"sketchAdapter",void 0),e([k({readOnly:!0})],It.prototype,"sketchGraphicsLayer",null),e([k({readOnly:!0})],It.prototype,"state",null),e([k({readOnly:!0})],It.prototype,"thumbnails",null),e([k()],It.prototype,"triangularMeasurementActive",void 0),e([k()],It.prototype,"triangulatedDistanceMeasurement",void 0),e([k()],It.prototype,"triangulatedDistanceAccuracy",void 0),e([k()],It.prototype,"triangulatedAreaMeasurement",void 0),e([k()],It.prototype,"triangulatedAreaAccuracy",void 0),e([k()],It.prototype,"triangulatedMeasurementGraphic",void 0),e([k()],It.prototype,"triangulatedMeasurementAdapter",void 0),e([k()],It.prototype,"updateFootprint",void 0),e([k()],It.prototype,"updateFootprintPanorama",void 0),e([k()],It.prototype,"updatingTriangularMeasurementState",void 0),e([k({value:null})],It.prototype,"view",null),e([k()],It.prototype,"_adapter",void 0),e([k()],It.prototype,"_sketchGraphicsLayer",null),e([k()],It.prototype,"_highlightedFeatureHandle",void 0),e([k()],It.prototype,"_imageViewer",void 0),e([k()],It.prototype,"_initialCurrentCoverageUpdate",void 0),e([k()],It.prototype,"_locationPointOnImage",void 0),e([k()],It.prototype,"_overlays",void 0),e([k({readOnly:!0})],It.prototype,"_overlaysView",null),e([k()],It.prototype,"_panoramicViewer",void 0),e([k()],It.prototype,"_previousCursor",void 0),e([k()],It.prototype,"_referencePointOnGround",void 0),e([k()],It.prototype,"_referencePointOnImage",void 0),e([k()],It.prototype,"_sectorData",void 0),e([k()],It.prototype,"_featureToSector",void 0),e([k()],It.prototype,"_activeSectors",null),e([k({readOnly:!0})],It.prototype,"_updatingHandles",void 0),e([k()],It.prototype,"footprintExtent",void 0),e([k()],It.prototype,"_featureChangedTask",void 0),It=e([A("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],It);const St=It;export{St as default};
|