@arcgis/core 4.33.0-next.20250611 → 4.33.0-next.20250613

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/applications/MapViewer/layerUtils.d.ts +3 -0
  2. package/applications/MapViewer/layerUtils.js +5 -0
  3. package/applications/SceneViewer/layerUtils.d.ts +2 -2
  4. package/arcade.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/{a08ce98672ab94d19613.js → 04e558a970c6a77f243e.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0512ee54f2259a437fdb.js +1 -0
  8. package/assets/esri/core/workers/chunks/{ad4f65d764654c70a117.js → 0f8f217aaf42eb1b9699.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{74276044cb75b51967f2.js → 10eb89a93c8e31f03c95.js} +1 -1
  10. package/assets/esri/core/workers/chunks/273beed633cc37416ad7.js +1 -0
  11. package/assets/esri/core/workers/chunks/{369978472cc9ee6a00b5.js → 28fceb79e5888e0109cc.js} +4 -4
  12. package/assets/esri/core/workers/chunks/{aaa564c84ee8ea36fbb4.js → 49a57dc1e6d1048fa949.js} +1 -1
  13. package/assets/esri/core/workers/chunks/4ab757344cfa254584c3.js +1 -0
  14. package/assets/esri/core/workers/chunks/513dc2467e9b8b8c6df4.js +1 -0
  15. package/assets/esri/core/workers/chunks/5198dc5f8620b47dce79.js +1 -0
  16. package/assets/esri/core/workers/chunks/{e7589c39b13295af8f1d.js → 604f8094992bb642378b.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{ee3940679d794d78b4ea.js → 7687f1071b1d161d6fc8.js} +1 -1
  18. package/assets/esri/core/workers/chunks/77ad62ed93f713a909f0.js +1 -0
  19. package/assets/esri/core/workers/chunks/{3cfc0a5f8a9cb9dc3b8f.js → 7b9eec0090f48e9cdaf1.js} +1 -1
  20. package/assets/esri/core/workers/chunks/7c56740cac444419e5b4.js +1 -0
  21. package/assets/esri/core/workers/chunks/{3b63edcd34f832ac7bd8.js → 7c6b9e2c1dada4668c01.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{af0d7a7cbbaad47a49c6.js → 802c6b1a6cb9264b8e4f.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{183a7dec68c8ba6eb3d6.js → 8281c9ae86fec895f617.js} +1 -1
  24. package/assets/esri/core/workers/chunks/87986f31061c426e761b.js +1 -0
  25. package/assets/esri/core/workers/chunks/8855f1a6224ffbd0bb66.js +1 -0
  26. package/assets/esri/core/workers/chunks/8b1842f0f94c18652d4e.js +1 -0
  27. package/assets/esri/core/workers/chunks/{1c7eda72ecc2880034b9.js → 93c145a738b3f6cf4ee4.js} +1 -1
  28. package/assets/esri/core/workers/chunks/9dd40566d0730f79e504.js +1 -0
  29. package/assets/esri/core/workers/chunks/{6cbe8205a4e0f62da519.js → a5a27e2e9b91fbe12da9.js} +1 -1
  30. package/assets/esri/core/workers/chunks/cc1328cacc4ac07eb548.js +1 -0
  31. package/assets/esri/core/workers/chunks/d0876a713079c669995a.js +1 -0
  32. package/assets/esri/core/workers/chunks/{3145218abe59b5e99ff8.js → d2139307f62ea8bf999a.js} +1 -1
  33. package/assets/esri/core/workers/chunks/d9cdefb1cd8399ffac20.js +1 -0
  34. package/assets/esri/core/workers/chunks/{d5f770302dc686e55ba7.js → daffceecdc71e74d2629.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{3f58da371633967a61ca.js → ddb66fe6fcd0764daa7a.js} +1 -1
  36. package/assets/esri/core/workers/chunks/e02437168d5a55b51831.js +1 -0
  37. package/assets/esri/core/workers/chunks/f5b426f57f87eb9b2f35.js +1 -0
  38. package/assets/esri/core/workers/chunks/fa5715ca3ce95d005b0a.js +1 -0
  39. package/assets/esri/themes/base/widgets/_SelectionList.scss +31 -28
  40. package/assets/esri/themes/dark/main.css +1 -1
  41. package/assets/esri/themes/light/main.css +1 -1
  42. package/assets/esri/themes/light/view.css +1 -1
  43. package/chunks/aiServices.js +1 -1
  44. package/core/accessorSupport/utils.js +1 -1
  45. package/core/object.js +1 -1
  46. package/core/urlUtils.js +1 -1
  47. package/editing/sharedTemplates/executor/builders/bufferPolygonToPolygon.js +1 -1
  48. package/interfaces.d.ts +51 -16
  49. package/layers/mixins/FeatureLayerBase.js +1 -1
  50. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  51. package/layers/support/arcgisLayers.js +1 -1
  52. package/layers/support/fetchService.js +1 -1
  53. package/layers/support/layerUtils.js +1 -1
  54. package/package.json +1 -1
  55. package/portal/support/layersLoader.js +1 -1
  56. package/portal/support/loadUtils.js +1 -1
  57. package/portal/support/portalLayers.js +1 -1
  58. package/renderers/support/DictionaryScriptEvaluator.js +1 -1
  59. package/rest/networks/circuits/support/CircuitVerifyResult.js +1 -1
  60. package/rest/support/TranslateParameters.js +1 -1
  61. package/smartMapping/renderers/size.js +1 -1
  62. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  63. package/smartMapping/support/adapters/support/utils.js +1 -1
  64. package/support/ArcadeExpression.js +1 -1
  65. package/support/revision.js +1 -1
  66. package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
  67. package/views/2d/engine/vectorTiles/style/StyleProperty.js +1 -1
  68. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  69. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  70. package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
  71. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  72. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  73. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  74. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  75. package/views/3d/camera/intersectionUtils.js +1 -1
  76. package/views/analysis/analysisViewUtils.js +1 -1
  77. package/views/ui/UI.js +1 -1
  78. package/webscene/Slide.js +1 -1
  79. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  80. package/widgets/BatchAttributeForm.js +1 -1
  81. package/widgets/Directions/DirectionsVisibleElements.js +1 -1
  82. package/widgets/Directions.js +1 -1
  83. package/widgets/Editor/EditorViewModel.js +1 -1
  84. package/widgets/Editor/UpdateFeatureWorkflowData.js +1 -1
  85. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  86. package/widgets/Editor/UpdateWorkflow.js +1 -1
  87. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  88. package/widgets/Editor.js +1 -1
  89. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  90. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  91. package/widgets/FeatureTable.js +1 -1
  92. package/widgets/FeatureTemplates.js +1 -1
  93. package/widgets/Features/FeaturesViewModel.js +1 -1
  94. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  95. package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
  96. package/widgets/OrientedImageryViewer/components/NavigationNode.js +1 -1
  97. package/widgets/OrientedImageryViewer/components/NavigationSettings.js +1 -1
  98. package/widgets/OrientedImageryViewer/components/NavigationUI.js +1 -1
  99. package/widgets/OrientedImageryViewer/components/NavigationUI360.js +5 -0
  100. package/widgets/OrientedImageryViewer/components/NavigationUIPanoramicViewModel.js +1 -1
  101. package/widgets/OrientedImageryViewer/components/NavigationUIViewModel.js +1 -1
  102. package/widgets/OrientedImageryViewer/components/imageNavigationUtils.js +1 -1
  103. package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
  104. package/widgets/OrientedImageryViewer.js +1 -1
  105. package/widgets/PanoramicViewer.js +1 -1
  106. package/widgets/Search/SearchViewModel.js +1 -1
  107. package/widgets/Search/support/layerSearchUtils.js +1 -1
  108. package/widgets/support/ItemList.js +1 -1
  109. package/widgets/support/SelectionList/FeatureItem.js +1 -1
  110. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  111. package/widgets/support/SelectionList/LayerItem.js +1 -1
  112. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  113. package/widgets/support/SelectionList.js +1 -1
  114. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  115. package/widgets/support/dateUtils.js +1 -1
  116. package/widgets/support/symbolPreviewUtils.js +1 -1
  117. package/assets/esri/core/workers/chunks/0ff6f15d46d7ddf6fe4d.js +0 -1
  118. package/assets/esri/core/workers/chunks/40111357b99235a4cb0f.js +0 -1
  119. package/assets/esri/core/workers/chunks/49089731ecfe7e8bb2f6.js +0 -1
  120. package/assets/esri/core/workers/chunks/4a1f0587a1cc1138faa3.js +0 -1
  121. package/assets/esri/core/workers/chunks/64f5f27e7c5649d79cbc.js +0 -1
  122. package/assets/esri/core/workers/chunks/679d7baea233faf3fdbc.js +0 -1
  123. package/assets/esri/core/workers/chunks/72ea996b03932c0f004f.js +0 -1
  124. package/assets/esri/core/workers/chunks/86c12fcaf8d0c96a52ba.js +0 -1
  125. package/assets/esri/core/workers/chunks/97b69fec3e87f11210ba.js +0 -1
  126. package/assets/esri/core/workers/chunks/b72137c63b7f2a525d9e.js +0 -1
  127. package/assets/esri/core/workers/chunks/c2264451d12f1fbaad22.js +0 -1
  128. package/assets/esri/core/workers/chunks/c23cc0eaaf737af3ac35.js +0 -1
  129. package/assets/esri/core/workers/chunks/c6c86cbe65a58c3093ae.js +0 -1
  130. package/assets/esri/core/workers/chunks/c8856370bae65d9eeb2b.js +0 -1
  131. package/assets/esri/core/workers/chunks/cd4fb107489594c57438.js +0 -1
  132. package/assets/esri/core/workers/chunks/d28d874c1337b69fedc0.js +0 -1
  133. package/assets/esri/core/workers/chunks/fe3703ec198cbfebec30.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import{throwIfAborted as t}from"../../../core/promiseUtils.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 i}from"../../../core/accessorSupport/decorators/subclass.js";import{createCoveragePolygon as s}from"../../../layers/orientedImagery/core/coverageUtils.js";import n from"../../../layers/orientedImagery/core/ExposurePoint.js";import{InvalidDirectionError as a,FeatureSectorNotFoundError as l}from"./errors.js";import{queryNextLocationFeatures as c,querySequenceCount as d,queryAfterSequenceField as u,querySequenceFeaturesAroundPoint as g,queryOffsetSequenceFeatures as p}from"./queries.js";let w=class extends r{constructor(e){super(e),this.viewModel=null}get currentNode(){return this.viewModel.currentNode}get layer(){return this.viewModel.layer}get navigationNodes(){return this.viewModel.navigationNodes}async _queryAndHandleFeatureResponse(e,r,o,i,s){const{error:n,nextLocation:a,response:l}=await c(e,r,o,i,s);if(t(s),n)throw n;this.viewModel.selectedPoint=a,await this.viewModel.processFeatureResponse(l,a,{signal:s?.signal,loadBestImage:!1,skipFilter:!0})}async afterNavigate(e,r,t){return await this.viewModel.selectBestFeature(r.id,t),r}async navigate(e,r){let t;if("direction"in r?t=await this.navigateInDirection(e,r):("step"in r||"goTo"in r)&&(t=await this.navigateInSequence(e,r)),!t)throw new Error("No next node found");return await this.afterNavigate(e,t,r)}async navigateBySkippingSteps(e,r){const{step:t}=r,{layer:o}=this,{floorFilterClause:i}=this.viewModel;if(!o)throw new Error("Layer is not defined");const a=e.attributes.sequenceOrder;if(0===await d(o,i,{signal:r.signal})||!a)throw new Error("No sequence found");const{response:l,error:c}=await u(o,a,t,1,i,{signal:r.signal});if(c)throw new Error("Error querying sequence features");const p=l?.features[0];if(!p)throw new Error("No next node found");const w=n.fromJSON({...p.toJSON(),layer:o}),{response:f,error:h,nextLocation:v}=await g(o,s(w).polygon.centroid,i,{signal:r.signal});if(h)throw new Error("Error querying sequence features");const y=[...f.features];y.push(p),f.features=y,this.viewModel.selectedPoint=null;const m=p.attributes.objectId;return await this.viewModel.processFeatureResponse(f,v,{signal:r.signal,loadBestImage:!1,skipFilter:!0}),this.viewModel.selectedPoint=v,this.viewModel.navigationNodes.find((e=>e.id===m))}async navigateInDirection(e,r){const{viewModel:t}=this,{layer:o,floorFilterClause:i}=t,{direction:s,signal:n}=r,c=e?.[s];if(!c)throw new a(s);const d=t.getFeatureSectorById(c.id);if(!d)throw new l(c);const[u,g]=d.split("_"),p=`NEAR_${g}`,w=`FAR_${g}`,h=t.getActiveSectors();return f(d,h.includes(p),h.includes(w),g,p,w)&&await this._queryAndHandleFeatureResponse(o,e,c,i,{signal:n}),c}async navigateInSequence(e,r){return"step"in r?this.navigateBySkippingSteps(e,r):this.navigateTo(r)}async navigateTo(e){const{goTo:r}=e,{layer:t}=this,{floorFilterClause:o}=this.viewModel;if(!t)throw new Error("Layer is not defined");const i="number"==typeof r?r:1,{response:a,error:l}=await p(t,i,1,"end"===r?"DESC":"ASC",o,{signal:e.signal});if(l)throw new Error("Error querying sequence features");const c=a?.features[0];if(!c)throw new Error("No next node found");const d=n.fromJSON({...c.toJSON(),layer:t}),{polygon:u}=s(d),{response:w,error:f,nextLocation:h}=await g(t,u.centroid,o,{signal:e.signal});if(f)throw new Error("Error querying sequence features");const v=[...w.features];v.push(c),w.features=v,this.viewModel.selectedPoint=null;const y=c.attributes.objectId;return await this.viewModel.processFeatureResponse(w,h,{signal:e.signal,loadBestImage:!1,skipFilter:!0}),this.viewModel.selectedPoint=h,this.viewModel.navigationNodes.find((e=>e.id===y))}};function f(e,r,t,o,i,s){return e===s||e===i&&!t||e===o&&!r&&!t}e([o()],w.prototype,"currentNode",null),e([o()],w.prototype,"layer",null),e([o()],w.prototype,"navigationNodes",null),e([o({constructOnly:!0})],w.prototype,"viewModel",void 0),w=e([i("esri.widgets.OrientedImageryViewer.navigation.NavigationManager")],w);export{w as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import{throwIfAborted as t}from"../../../core/promiseUtils.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 i}from"../../../core/accessorSupport/decorators/subclass.js";import{createCoveragePolygon as s}from"../../../layers/orientedImagery/core/coverageUtils.js";import n from"../../../layers/orientedImagery/core/ExposurePoint.js";import{InvalidDirectionError as a,FeatureSectorNotFoundError as l}from"./errors.js";import{queryNextLocationFeatures as c,querySequenceCount as d,queryAfterSequenceField as u,querySequenceFeaturesAroundPoint as g,queryOffsetSequenceFeatures as p}from"./queries.js";import{translateInDirection2D as w}from"./utils.js";let f=class extends r{constructor(e){super(e),this.viewModel=null}get currentNode(){return this.viewModel.currentNode}get layer(){return this.viewModel.layer}get navigationNodes(){return this.viewModel.navigationNodes}async _queryAndHandleFeatureResponse(e,r,o,i,s){const{error:n,nextLocation:a,response:l}=await c(e,r,o,i,s);if(t(s),n)throw n;this.viewModel.selectedPoint=a,await this.viewModel.processFeatureResponse(l,a,{signal:s?.signal,loadBestImage:!1,skipFilter:!0})}async afterNavigate(e,r,t){return await this.viewModel.selectBestFeature(r.id,t),r}async navigate(e,r){let t;if("direction"in r?t=await this.navigateInDirection(e,r):("step"in r||"goTo"in r)&&(t=await this.navigateInSequence(e,r)),!t)throw new Error("No next node found");return await this.afterNavigate(e,t,r)}async navigateBySkippingSteps(e,r){const{step:t}=r,{layer:o}=this,{floorFilterClause:i}=this.viewModel;if(!o)throw new Error("Layer is not defined");const a=e.attributes.sequenceOrder;if(0===await d(o,i,{signal:r.signal})||!a)throw new Error("No sequence found");const{response:l,error:c}=await u(o,a,t,1,i,{signal:r.signal});if(c)throw new Error("Error querying sequence features");const p=l?.features[0];if(!p)throw new Error("No next node found");const w=n.fromJSON({...p.toJSON(),layer:o}),{response:f,error:h,nextLocation:v}=await g(o,s(w).polygon.centroid,i,{signal:r.signal});if(h)throw new Error("Error querying sequence features");const y=[...f.features];y.push(p),f.features=y,this.viewModel.selectedPoint=null;const m=p.attributes.objectId;return await this.viewModel.processFeatureResponse(f,v,{signal:r.signal,loadBestImage:!1,skipFilter:!0}),this.viewModel.selectedPoint=v,this.viewModel.navigationNodes.find((e=>e.id===m))}async navigateInDirection(e,r){const{viewModel:t}=this,{layer:o,floorFilterClause:i}=t,{direction:s,signal:n}=r,c=e?.[s];if(!c)throw new a(s);const d=t.getFeatureSectorById(c.id);if(!d)throw new l(c);const[u,g]=d.split("_"),p=g??u,f=`NEAR_${p}`,v=`FAR_${p}`,y=t.getActiveSectors();h(d,y.includes(f),y.includes(v),p,f,v)&&await this._queryAndHandleFeatureResponse(o,e,c,i,{signal:n});const{currentHeading:m,currentPitch:M}=e,{attributes:{farDistance:N,isNadir:E,cameraPitch:S},geometry:j}=c,q=N;return this.viewModel.selectedPoint=E||S<10?j.clone():w(j,m,M,q),c}async navigateInSequence(e,r){return"step"in r?this.navigateBySkippingSteps(e,r):this.navigateTo(r)}async navigateTo(e){const{goTo:r}=e,{layer:t}=this,{floorFilterClause:o}=this.viewModel;if(!t)throw new Error("Layer is not defined");const i="number"==typeof r?r:1,{response:a,error:l}=await p(t,i,1,"end"===r?"DESC":"ASC",o,{signal:e.signal});if(l)throw new Error("Error querying sequence features");const c=a?.features[0];if(!c)throw new Error("No next node found");const d=n.fromJSON({...c.toJSON(),layer:t}),{polygon:u}=s(d),{response:w,error:f,nextLocation:h}=await g(t,u.centroid,o,{signal:e.signal});if(f)throw new Error("Error querying sequence features");const v=[...w.features];v.push(c),w.features=v,this.viewModel.selectedPoint=null;const y=c.attributes.objectId;return await this.viewModel.processFeatureResponse(w,h,{signal:e.signal,loadBestImage:!1,skipFilter:!0}),this.viewModel.selectedPoint=h,this.viewModel.navigationNodes.find((e=>e.id===y))}};function h(e,r,t,o,i,s){return e===s||e===i&&!t||e===o&&!r&&!t}e([o()],f.prototype,"currentNode",null),e([o()],f.prototype,"layer",null),e([o()],f.prototype,"navigationNodes",null),e([o({constructOnly:!0})],f.prototype,"viewModel",void 0),f=e([i("esri.widgets.OrientedImageryViewer.navigation.NavigationManager")],f);export{f 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"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import{createTask as i}from"../core/asyncUtils.js";import a from"../core/Collection.js";import{deprecatedProperty as o}from"../core/deprecate.js";import s from"../core/Logger.js";import{isAbortError as n}from"../core/promiseUtils.js";import{watch as r,initial as l,syncAndInitial as c,whenOnce as d}from"../core/reactiveUtils.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{or as m}from"../layers/orientedImagery/transformations/utils.js";import u from"./Expand.js";import v from"./PanoramicViewer.js";import p from"./Widget.js";import{getAllArcPath as y}from"./OrientedImageryViewer/arcUtils.js";import{getDelegatedEvents as w,defaultImageGeometryField as _,defaultOIObjectIDField as M,segmentArcs as T,featureCircleRadius as b,navigationToolDimensionLength as C,sectorsRadii as A}from"./OrientedImageryViewer/constants.js";import{css as I,navigation as f,navigationToolRotationFrom as L,navigationToolRotationTo as k,root as S}from"./OrientedImageryViewer/css.js";import{loadImageForAttachment as V,getThumbnailPixelBlock as O,isFeatureAttachment as E,renderImageWithRotation as F}from"./OrientedImageryViewer/galleryUtils.js";import P from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import x from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import{loadAlertComponents as j,Alert as H}from"./OrientedImageryViewer/components/Alert.js";import D from"./OrientedImageryViewer/components/ImageLocationWidget.js";import G from"./OrientedImageryViewer/components/ImageViewer.js";import $ from"./OrientedImageryViewer/components/NavigationAction.js";import{NavigationActionsCollection as N,NavigationActions as B}from"./OrientedImageryViewer/components/NavigationActions.js";import{NoImageLoadedError as R}from"./OrientedImageryViewer/navigation/errors.js";import{loadCalciteComponents as W}from"./support/componentsUtils.js";import{globalCss as U}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as z}from"./support/decorators/messageBundle.js";import{vmEvent as q}from"./support/decorators/vmEvent.js";import{tsx as Z,tsxFragment as J}from"./support/jsxFactory.js";import{substitute as K}from"../intl/substitute.js";const Q={overlayed:"overlayed"};let X=class extends p{constructor(e,t){super(e,t),this.dataCaptureEnabled=!1,this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.videoEnhancementToolActive=!1,this.imageOverlaysOpened=!1,this.navigationToolActive=!1,this.viewModel=new P,this.messagesCommon=null,this.messagesSketch=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters",this.showCameraLocations=!1,this.showMapFeatures=!1,this.visibleElements=new x,this._imageOverlaysLoaderTask=null,this._imageMeasurementToolsLoaderTask=null,this._navigationSettingsLoaderTask=null,this._clearMeasurements=()=>{this.viewModel.measureType=null,this.viewModel.clearPreviousMeasurements()},this._clearImageLocation=()=>{this.imageLocationToolActive=!1},this._navigationToolExpanded=!1,this._navigationTool=null,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._overlayedLayers=new a,this._previousAction=null,this._handleDataCaptureLayerChange=async e=>{if(this.dataCaptureLayer&&await this.stopDataCapture(!0),this.dataCaptureLayer=this.dataCaptureLayer===e?null:e,this.dataCaptureLayer)return this.startDataCapture(this.dataCaptureLayer)},this._handleNavigationSettingsInputChange=(e,t)=>{this.set(`${e}Threshold`,t)},this._handleOverlayLayerDeselect=e=>{const t=e.layer;t===this.dataCaptureLayer&&(this.stopDataCapture(),this.dataCaptureLayer=null),this.removeOverlayedGraphicsOnImage(`${t.id}`)},this._handleOverlayLayerSelect=e=>{const t=e.layer;this.viewModel.overlayMapFeatures(t,this.showMapFeatures),this.addHandles(r((()=>t.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(t.id,t.visible)})),`${Q.overlayed}-${t.id}`)},this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._onAction=e=>{const{target:t}=e,{dataset:{action:i}}=t,{_previousAction:a}=this,o=a?.dataset.action,s=o?.includes("draw")??!1,n="select-feature"===o,r=o!==i;switch(i){case"draw-point":case"draw-polygon":case"draw-polyline":{a&&m(n,s&&r)&&(a.active=!1),t.active=!t.active;const e=i.replace("draw-","");this.viewModel.digitizeCreate(e),this._previousAction=t.active?t:null;break}case"save":this.viewModel.saveDrawing();break;case"select-feature":s&&(this._previousAction.active=!1),t.active=!t.active,this.viewModel.toggleSelection(t.active),this._previousAction=t.active?t:null;break;case"delete-feature":this.viewModel.digitizeDelete()}},this._onImageOverlayClosed=()=>{this.imageOverlaysOpened=!1},this._onShowCameraLocationsChanged=e=>{this.showCameraLocations=e},this._onShowMapFeaturesChanged=e=>{this.showMapFeatures=e},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._restoreOverlays=async()=>Promise.all(this._overlayedLayers.map((e=>this.viewModel.overlayMapFeatures(e,this.showMapFeatures)))),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._sketchLoaderTask=null,this._settingsToggle=null,this._toggleImageNavigation=async e=>{const t=this.navigationMode;this._closeAllImageTools(),this.navigationMode=t!==e?e:null;const{activeViewer:i}=this.viewModel;if(!i)return;const{mode:a}=this.viewModel;if("default"===a)if("directional"===this.navigationMode){const e=await this._loadNavigationSettings(),{messages:t,messagesCommon:i}=this,a=new e({cameraHeadingThreshold:this.cameraHeadingThreshold,cameraPitchThreshold:this.cameraPitchThreshold,uiStrings:{configureNavigation:t.configureNavigation,preserveHeading:t.preserveHeading,preserveHeadingDescription:t.preserveHeadingDescription,preservePitch:t.preservePitch,preservePitchDescription:t.preservePitchDescription,settings:i.settings,thresholdLabel:t.thresholdLabel},onInputChange:this._handleNavigationSettingsInputChange});this._settingsToggle=new u({content:a,expandIcon:"configure"}),this.viewModel.activeViewer?.ui.add(this._settingsToggle,{position:"top-left"})}else this._settingsToggle&&(this._settingsToggle.expanded=!1,this.viewModel.activeViewer?.ui.remove(this._settingsToggle))},this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this.navigate=async e=>{let t=null;try{const{currentNode:i}=this.viewModel;if(!i)throw new R;t=await this.viewModel.navigate(i,e)}catch(i){n(i)||s.getLogger(this).error("Error occurred while navigating",i)}return t},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([r((()=>[this.viewModel?.bestFeatureAngle,this._navigationTool]),(([e,t])=>{t&&this._updateNavigationTool(t)}),l),r((()=>this.currentCoverageVisible),(e=>this._onCurrentCoverageVisibilityChange(e))),r((()=>this.isAdditionalCoverageVisible),(e=>this._onAdditionalCoverageVisibilityChange(e))),r((()=>this.isAdditionalPointSourcesVisible),(e=>this._onAdditionalCameraLocationsVisibility(e))),r((()=>({features:this.currentBestFeature,showCameraLocations:this.showCameraLocations,state:this.viewModel.state})),(({showCameraLocations:e,state:t})=>{"image-loaded"===t&&this.viewModel.overlayCameraLocations(e)}),c),r((()=>({feature:this.currentBestFeature,showMapFeatures:this.showMapFeatures,state:this.viewModel.state})),(async(e,t)=>{if(e.showMapFeatures!==t?.showMapFeatures&&this.viewModel.toggleAllOverlayMapFeatures(e.showMapFeatures),null!=e.feature&&e.feature!==t?.feature){if(this.viewModel.removeAllOverlayMapFeatures(),await d((()=>"image-loaded"===this.viewModel.state)),this.dataCaptureLayer&&this.stopDataCapture(),await this._restoreOverlays(),!this.dataCaptureLayer)return;await this.startDataCapture(this.dataCaptureLayer),this._previousAction?.active&&(this._previousAction.active=!1,this._previousAction=null)}}),l)])}loadDependencies(){return Promise.all([W({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),shell:()=>import("@esri/calcite-components/dist/components/calcite-shell"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider")}),j()])}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect()}get accuracyParametersMissing(){return this.viewModel.accuracyParametersMissing}get activeLayer(){return o(s.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(s.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeVideoIcon(){const{videoElement:e,videoViewModel:t}=this.viewModel;return e?.loaded&&t?t.videoPaused?"play":"pause":"play"}get activeAudioIcon(){const{videoElement:e,videoViewModel:t}=this.viewModel;return e?.loaded&&t?.videoMuted?"sound-off":"sound"}get cameraHeadingThreshold(){return this.viewModel.cameraHeadingThreshold}set cameraHeadingThreshold(e){this.viewModel.cameraHeadingThreshold=e}get cameraPitchThreshold(){return this.viewModel.cameraPitchThreshold}set cameraPitchThreshold(e){this.viewModel.cameraPitchThreshold=e}get canNavigateSequentially(){const{layer:e}=this;if(!e)return!1;const{fields:t,sequenceOrderField:i}=e;return t.some((({name:e})=>e.toLowerCase()===`${i??"sequenceorder"}`.toLowerCase()))}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get dataCaptureLayer(){return this.viewModel.dataCaptureLayer}set dataCaptureLayer(e){this.viewModel.dataCaptureLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get imageLocationToolActive(){return this.viewModel.imageLocationToolState}set imageLocationToolActive(e){this.viewModel.imageLocationToolState=e}get invalidCameraHeading(){return this.viewModel.invalidCameraHeading}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get measureType(){return this.viewModel.measureType}set measureType(e){this.viewModel.measureType=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get navigationMode(){return this.viewModel.navigationMode}set navigationMode(e){this.viewModel.navigationMode=e}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return"image-loaded"===t&&e}get referencePoint(){return this.viewModel.referencePoint??null}get sketchViewModel(){return this.viewModel.sketch}get triangularMeasurementActive(){return this.viewModel.triangularMeasurementActive}set triangularMeasurementActive(e){this.viewModel.triangularMeasurementActive=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}_renderActionBar(){return Z("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},Z("calcite-action-group",null,this._currentFootprintToggle(),this._additionalFootprintToggle(),this._additionalPointSourcesToggle()),Z("calcite-action-group",null,this._directionToolToggle(),this._mapImageConversionToggle(),this._navigationToolToggle(),this._imageEnhancementsToggle(),this._videoEnhancementsToggle()),Z("calcite-action-group",null,this._measurementToolsToggle(),this._imageGalleryToggle(),this._imageOverlaysToggle(),this._openPopupAction()))}_renderEnhancementSlider({title:e,value:t,handleChange:i}){return Z("div",{class:I.imageEnhancementToolContainer},Z("calcite-label",null,e,Z("calcite-slider",{bind:this,labelTicks:!0,max:10,min:0,ticks:2,value:t,onCalciteSliderInput:i})))}get _activeMeasurementIcon(){const{measureType:e,imageLocationToolActive:t}=this;if(t)return"pin-tear";switch(e){case"area":return"measure-area";case"height":return"measure-building-height-top-base";default:return"measure-line"}}get _activeMeasurementHeading(){const{measureType:e,messages:t,triangularMeasurementActive:i}=this,{groundArea:a,heightAboveGround:o,groundDistance:s,triangulatedAreaHeading:n,triangulatedDistanceHeading:r}=t;if(i)return"area"===e?n:r;switch(e){case"area":return a;case"height":return o;default:return s}}_additionalFootprintToggle(){const{isAdditionalCoverageVisible:e,invalidCameraHeading:t,visibleElements:{additionalFootprintToggle:i}}=this;return i?Z("calcite-action",{active:e,bind:this,class:I.addCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints,title:this.messages.additionalFootprints}):null}_additionalPointSourcesToggle(){const{isAdditionalPointSourcesVisible:e,invalidCameraHeading:t,visibleElements:{additionalCameraLocationsToggle:i}}=this;return i?Z("calcite-action",{active:e,bind:this,class:I.addExpPoints,disabled:t,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations,title:this.messages.additionalCameraLocations}):null}get _measurementToggle(){const{viewModel:{state:e,measureType:t,currentBestFeatureMeasurementImage:i},triangularMeasurementActive:a,id:o}=this;if("image-loaded"!==e||!t||a&&!i)return;this._imageMeasurementToolsLoaderTask||this._loadImageMeasurementResources();const s=this._imageMeasurementToolsLoaderTask?.value;return s?Z("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:this._activeMeasurementHeading,id:`${o}-${t}-measurement`,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearMeasurements},Z(s,{measurementType:t,measurementUnitMessages:this.measurementUnitMessages,messages:this.messages,oiViewModel:this.viewModel})):null}get _renderRoot(){const{viewModel:{state:e},triangularMeasurementActive:t}=this;return Z("calcite-panel",{bind:this,class:t?I.viewerContainerMeasurement:I.viewerContainer,heading:this.visibleElements.title?this.messages.title:void 0,loading:e.includes("loading")&&!t},this.visibleElements.menu?this._renderActionBar():null,Z("calcite-shell",null,Z("calcite-panel",null,this._imageViewer,this._panoramicViewer,this._videoViewer,this._messageBox,this.invalidCameraHeading?this._renderWarning(this.messages.invalidCameraHeadingWarningTitle,this.messages.invalidCameraHeadingWarningDescription):[this._imageGalleryPanel,this._renderNavigation,this._imageOverlaysPanel()],this._imageEnhancementTools,this._videoEnhancementTools,this._renderSketch()),this._imageViewerTriangular,this._measurementToggle,this._locationToggle))}_currentFootprintToggle(){const{currentCoverageVisible:e,invalidCameraHeading:t}=this,{currentFootprintToggle:i}=this.visibleElements;return i?Z("calcite-action",{active:e,bind:this,class:I.currentCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint,title:this.messages.currentFootprint}):null}get _imageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:a,state:o}}=this;return e&&"image-loaded"===o?Z("calcite-panel",{bind:this,class:I.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},Z("div",{class:I.imageEnhancementTools},Z("div",{class:I.imageEnhancementToolContainer},Z("calcite-label",null,this.messages.brightness,Z("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:t,onCalciteSliderInput:this._handleBrightnessChange}))),Z("div",{class:I.imageEnhancementToolContainer},Z("calcite-label",null,this.messages.contrast,Z("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:i,onCalciteSliderInput:this._handleContrastChange}))),Z("div",{class:I.imageEnhancementToolContainer},Z("calcite-label",null,this.messages.sharpness,Z("calcite-slider",{bind:this,labelTicks:!0,max:1,min:0,step:.1,ticks:.5,value:a,onCalciteSliderInput:this._handleSharpnessChange})))),Z("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset,title:this.messagesCommon.reset})):null}get _videoEnhancementTools(){const{videoEnhancementToolActive:e,viewModel:{videoViewModel:t,mode:i},messages:{videoEnhancement:a,brightness:o,contrast:s},messagesCommon:{reset:n}}=this;return e&&"video"===i&&t?Z("calcite-panel",{bind:this,class:I.imageEnhancementWrapper,closable:!0,closed:!e,heading:a,key:a,onCalcitePanelClose:this._toggleVideoEnhancementToolState},Z("div",{class:I.imageEnhancementTools},this._renderEnhancementSlider({title:o,value:t.videoBrightness,handleChange:this._handleVideoBrightnessChange}),this._renderEnhancementSlider({title:s,value:t.videoContrast,handleChange:this._handleVideoContrastChange})),Z("calcite-action",{bind:this,icon:"reset",onclick:this._resetVideoTools,slot:"header-actions-end",text:n})):null}_imageEnhancementsToggle(){const{state:e,mode:t}=this.viewModel,{imageEnhancement:i}=this.visibleElements;return i&&"video"!==t?Z("calcite-action",{active:this.imageEnhancementToolActive,bind:this,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement,title:this.messages.imageEnhancement}):null}_videoEnhancementsToggle(){const{mode:e}=this.viewModel,{videoEnhancement:t}=this.messages;return"video"===e?Z("calcite-action",{active:this.imageEnhancementToolActive,bind:this,disabled:"video"!==e,icon:"sliders-horizontal",onclick:this._toggleVideoEnhancementToolState,text:t,title:t}):null}get _imageGalleryPanel(){const{container:e,galleryOpened:t,imageGalleryEnabled:i}=this;return i&&t&&e?this._imageGalleryContext:null}get _imageGalleryContext(){const{galleryOpened:e,invalidCameraHeading:t}=this;return Z("calcite-panel",{bind:this,class:I.carousel,closable:!0,closed:!e,disabled:t,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},Z("div",{class:I.carouselContainer},this._renderThumbnails))}_imageGalleryToggle(){const{imageGalleryEnabled:e,invalidCameraHeading:t,visibleElements:{imageGallery:i}}=this;return i?Z("calcite-action",{active:this.galleryOpened,bind:this,disabled:!e||t,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery,title:this.messages.imageGallery}):null}get _imageOverlaysComponent(){const{_imageOverlayMessages:e,_imageOverlaysLoaderTask:t,_overlayedLayers:a,dataCaptureEnabled:o,dataCaptureLayer:s,imageOverlaysOpened:n,showCameraLocations:r,showMapFeatures:l,view:c,layer:d}=this;if(!d)return null;const g=d.imageGeometryField?.length?d.imageGeometryField:_,h=d.imageReferenceField?.length?d.imageReferenceField:M;t||(this._imageOverlaysLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/ImageOverlays.js")).default)));const m=this._imageOverlaysLoaderTask?.value;return m?Z(m,{closed:!n,dataCaptureEnabled:o,dataCaptureLayer:s,imageGeometryField:g,imageReferenceField:h,messages:e,overlayedLayers:a,showCameraLocations:r,showMapFeatures:l,view:c,onDataCaptureLayerChanged:this._handleDataCaptureLayerChange,onImageOverlaysClosed:this._onImageOverlayClosed,onLayerDeselected:this._handleOverlayLayerDeselect,onLayerSelected:this._handleOverlayLayerSelect,onShowCameraLocationsChanged:this._onShowCameraLocationsChanged,onShowMapFeaturesChanged:this._onShowMapFeaturesChanged}):null}get _imageOverlayMessages(){return{...this.messages,...this.messagesSketch}}get _imageSketchToolsMessages(){return{...this.messagesSketch,...this.messagesCommon}}_imageOverlaysPanel(){const{imageOverlaysOpened:e,viewModel:{state:t}}=this,i=this.classes({[I.imageOverlaysContainer]:!0,[U.hidden]:!e||"image-loaded"!==t});return Z("div",{class:i,key:this.messages.imageOverlays},this._imageOverlaysComponent)}_imageOverlaysToggle(){const{viewModel:{state:e},imageOverlaysOpened:t,invalidCameraHeading:i,visibleElements:{imageOverlays:a}}=this;return a?Z("calcite-action",{active:t,bind:this,disabled:"image-loaded"!==e||i,icon:"layers",onclick:this._toggleImageOverlays,text:this.messages.imageOverlays,title:this.messages.imageOverlays}):null}get _imageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i,clickAction:a}=this.viewModel,o=null!=e||"default"!==i,{messages:{end:s,next:n,previous:r,start:l}}=this;return Z(G,{afterCreate:t,clickAction:a,navigationEnabled:null!==this.navigationMode,navigationViewModel:this.viewModel,uiStrings:{end:s,next:n,previous:r,start:l},visible:!o})}get _imageViewerTriangular(){const{messages:e,triangularMeasurementActive:t}=this,{displayMessage:i,storeImageMeasurementViewer:a,mode:o,state:s,clickAction:n}=this.viewModel,r=null!=i||"default"!==o,l=this.classes({[I.viewer]:!r,[I.viewerHidden]:r});return t?Z("calcite-panel",{class:I.viewerContainerMeasurement,heading:e.measurementViewerHeading,loading:s.includes("loading")},Z("calcite-panel",{bind:this,class:l},Z(G,{afterCreate:a,clickAction:n,uiStrings:e}))):null}get _videoViewer(){const{mode:e,loadVideoViewer:t,videoViewModel:i}=this.viewModel,a="video"!==e,o=this.classes({[I.viewer]:!a,[I.viewerHidden]:a});return Z("calcite-panel",{bind:this,class:o},Z("div",{afterCreate:t,styles:{height:"100%"}}),Z("calcite-slider",{bind:this,labelHandles:!0,labelTicks:!0,max:i?.videoDuration,minLabel:"0",value:i?.currentTime??0,onCalciteSliderChange:this._sliderChangeHandler}),Z("calcite-action-bar",{expandDisabled:!0,layout:"horizontal"},Z("calcite-action-group",null,Z("calcite-action",{bind:this,icon:this.activeVideoIcon,onclick:()=>i?.playVideoHandler(),text:"Play"})),Z("calcite-action-group",null,Z("calcite-action",{bind:this,icon:"refresh",onclick:()=>i?.rewindVideoHandler(),text:"Rewind"})),Z("calcite-action-group",null,Z("calcite-action",{bind:this,icon:this.activeAudioIcon,onclick:()=>i?.toggleAudio(),text:"Audio"}))))}get _locationToggle(){const{viewModel:{state:e,groundCoordinates:t,groundCoordinatesAccuracy:i,triangulatedPoint:a},imageLocationToolActive:o,triangularMeasurementActive:s,messages:{groundLocation:n,triangulatedLocationHeading:r}}=this;if("image-loaded"===e&&t&&o)return Z("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:s?r:n,id:n,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearImageLocation},Z(D,{accuracy:i,groundCoordinates:s&&a?a:t,messages:this.messages}))}_mapImageConversionToggle(){const{mapImageConversionToolState:e,viewModel:{state:t},invalidCameraHeading:i,visibleElements:{mapImageConversionTool:a}}=this;return a?Z("calcite-action",{active:e,bind:this,disabled:"image-loaded"!==t||i,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool,title:this.messages.mapImageConversionTool}):null}_measurementToolsToggle(){const{_activeMeasurementIcon:e,measureType:t,viewModel:i,accuracyParametersMissing:a,messages:o,triangularMeasurementActive:s,visibleElements:{measurementTools:n}}=this,{state:r,mode:l}=i,{measurementTools:c,groundDistance:d,groundArea:g,heightAboveGround:h,groundLocation:m,triangulatedDistanceHeading:u,triangulatedAreaHeading:v,triangulatedLocationHeading:p}=o;return n?Z("calcite-dropdown",{disabled:a,key:"measurement-tools",maxItems:5,title:c,width:"m"},Z("calcite-action",{bind:this,disabled:"image-loaded"!==r||a,icon:e,slot:"trigger",text:c}),Z("calcite-dropdown-group",null,Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-line",key:"distance-measurement",onclick:e=>this._toggleMeasurementSketch(e,"distance"),selected:"distance"===t&&!s},d),Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-area",key:"area-measurement",onclick:e=>this._toggleMeasurementSketch(e,"area"),selected:"area"===t&&!s},g),Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-building-height-top-base",key:"height-dropdown",onclick:e=>this._toggleMeasurementSketch(e,"height"),selected:"height"===t},h),Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"pin-tear",key:"surface-location",onclick:this._toggleLocationTool,selected:!!this.imageLocationToolActive&&!s},m),"default"===l&&Z(J,null,Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-distance",key:"triangular-measurement-distance",selected:!!s&&"distance"===this.measureType,onCalciteDropdownItemSelect:this._toggleTriangularDistanceMeasurements},u),Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-area",key:"triangular-measurement-area",selected:!!s&&"area"===this.measureType,onCalciteDropdownItemSelect:this._toggleTriangularAreaMeasurements},v),Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-location",key:"triangular-location",selected:!!s&&this.imageLocationToolActive,onCalciteDropdownItemSelect:this._toggleTriangularLocation},p)))):null}get _messageBox(){const{messages:e,viewModel:{displayMessage:t,mode:i}}=this;if(!t||"video"===i)return null;const{data:a,key:o,map:s}=t,n=`${s?K(e[o],s):e[o]}`;return Z("span",{class:I.messageBox},a?`${n} ${a}`:n)}async _loadNavigationSettings(){return this._navigationSettingsLoaderTask||(this._navigationSettingsLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/NavigationSettings.js")).default))),await this._navigationSettingsLoaderTask.promise}_navigationToolToggle(){const{state:e}=this.viewModel,{visibleElements:{navigationTool:t}}=this;return t?Z("calcite-action",{active:this.navigationToolActive,bind:this,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool,title:this.messages.navigationTool}):null}_directionToolToggle(){const{state:e}=this.viewModel,{visibleElements:{directionalNavigation:t,sequentialNavigation:i}}=this,a=new N;t&&a.push(new $({active:"directional"===this.navigationMode,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"i2DExplore",onclick:()=>{this._toggleImageNavigation("directional")},text:this.messages.directionalNavigation,title:this.messages.directionalNavigationDescription})),i&&a.push(new $({active:"sequential"===this.navigationMode,disabled:"image-loaded"!==e||this.invalidCameraHeading||!this.canNavigateSequentially,icon:"reorder-stack",onclick:()=>{this._toggleImageNavigation("sequential")},text:this.messages.sequentialNavigation,title:this.messages.sequentialNavigationDescription}));return t||i?Z(B,{actions:a,activeAction:a.items.find((e=>e.active)),icon:"absolute-direction",label:this.messages.imageNavigation,scale:"m",title:this.messages.imageNavigationDescription}):null}_openPopupAction(){const{showPopupsAction:e}=this.visibleElements;return e?Z("calcite-action",{bind:this,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups,title:this.messages.showPopups}):null}get _panoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i,clickAction:a}=this.viewModel,{messages:{end:o,next:s,previous:n,start:r}}=this,l=null!=e||"panoramic"!==i;return Z(v,{afterCreate:t,clickAction:a,navigationEnabled:null!==this.navigationMode,navigationViewModel:this.viewModel,uiStrings:{end:o,next:s,previous:n,start:r},visible:!l})}_activateTriangulatedImageLocationTool(){this.navigationToolActive=!0,this.imageLocationToolActive=!0}_activateTriangulatedImageLocationWorkflow(e,t){this._closeAllImageTools(),this.imageLocationToolActive=!0,this.triangularMeasurementActive=!e,this.navigationToolActive=!!t||!t}_closeImageToolsAndToggleNavigation(e,t){this._closeAllImageTools(),this.triangularMeasurementActive=!e,this.navigationToolActive=!t}_resetMeasureTypeAndActivateImageLocationTool(){this.measureType=null,this.imageLocationToolActive=!0}_closeAllImageTools(){this.imageEnhancementToolActive=!1,this.navigationToolActive=!1,this.imageOverlaysOpened=!1,this.galleryOpened=!1,this.measureType=null,this.imageLocationToolActive=!1,this.navigationMode=null}_handleBrightnessChange(e){this.viewModel.brightness=e.currentTarget.value??0}_handleVideoBrightnessChange(e){this.viewModel.videoViewModel?.handleVideoBrightnessChange(e.target.value)}_handleContrastChange(e){this.viewModel.contrast=e.currentTarget.value??0}_handleVideoContrastChange(e){this.viewModel.videoViewModel?.handleVideoContrastChange(e.target.value)}_handleSharpnessChange(e){this.viewModel.sharpness=e.currentTarget.value??0}_lazyLoadImage(e,t){e.forEach((async e=>{if(e.isIntersecting){const a=e.target,o=a.getAttribute("data-src"),r=a.getAttribute("data-rotation"),l=a.getAttribute("data-objectid"),c=r?parseFloat(r)%360:0,{layer:d,_galleryController:{signal:g}}=this;if(!o||!l)return;let h;try{h=E(o)?await V(d,l,{signal:g}):await O(o,{signal:g})}catch(i){n(i)||s.getLogger("esri.widgets.OrientedImageryViewer").error("#lazyLoadImage()",i)}finally{t.unobserve(a)}if(!h)return;F(h,a,c)}}))}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_loadImageMeasurementResources(){this._imageMeasurementToolsLoaderTask=i((async()=>{const{default:e}=await import("./OrientedImageryViewer/components/ImageMeasurementWidget.js");return e}))}_loadSketchResources(){this._sketchLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/SketchTools.js")).default))}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderWarning(e,t){const{viewModel:{state:i}}=this;return"image-loaded"===i?Z(H,{icon:"exclamation-mark-triangle-f",kind:"warning",open:!0,title:e,tooltip:t}):null}get _renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:a,state:o}}=this;if(!this.container||!a)return null;let s,n,r,l,c;if(i){const{x:e,y:t,direction:a}=i,[o,d,g,h]=T[a];s=`M ${e} ${t} L ${o} ${d} A ${A[2]} ${A[2]} 0 0 1 ${g} ${h} Z`,n=e,l=t,r=T[a][4],c=T[a][5]}const d=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},g=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:a}=t;i&&a&&this.viewModel.handleFeatureClick({sector:a,featureIndexInSector:+i})},h=e=>{e.removeEventListener("click",g)},m=a.attributes.objectId,u=e?.map((e=>e?.items)).filter(Boolean).flatMap((e=>e?.map((({x:e,y:t,objectID:i,featureIndexInSector:a,sector:o})=>Z("circle",{afterRemoved:h,class:this.classes(I.feature,{selected:m===i}),cx:e,cy:t,"data-feature-index-in-sector":a,"data-sector":o,key:`${I.feature}-${i}`,onclick:g,r:b}))))),v=e=>{e.removeEventListener("click",d)},p=this.classes({[I.navigationWrapper]:!0,[I.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&"image-loaded"===o?Z("div",{bind:this,class:p,key:this.messages.navigationTool},Z("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?f:I.rotateWithAnimation,focusable:"false",height:C,role:"img",width:C,xmlns:"http://www.w3.org/2000/svg"},Z("defs",null,Z("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:n,x2:r,y1:l,y2:c},Z("stop",{class:I.navigationPathOffset0,offset:0}),Z("stop",{class:I.navigationPathOffset1,offset:1}))),Z("g",null,Z("circle",{class:this.classes(I.sector,I.outerSector),cx:A[3],cy:A[3],onclick:this._scaleNavigationTool,r:A[3]}),Z("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[2]}),Z("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[1]}),Z("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[0]}),Z("path",{class:I.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${I.pointer}-west`}),Z("path",{class:this.classes(I.pointer,I.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${I.pointer}-north`}),Z("path",{class:I.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${I.pointer}-east`}),Z("path",{class:I.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${I.pointer}-south`}),Z("path",{class:this.classes(I.sector,I.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:I.sectorSeparator}),y([A[2],A[1],A[0]],A[3],A[3]).map(((t,i)=>Z("path",{afterRemoved:v,class:this.classes(I.sector,e?.[i]?.length?I.sectorEnabled:I.sectorDisabled),d:t,"data-sector":`${i}`,key:`${I.sector}-${i}`,onclick:d}))),Z("path",{class:this.classes(I.sector,I.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:I.sectorCross}),u,a.attributes.cameraPitch>=5&&s?Z("path",{class:I.selectedFeaturePath,d:s,fill:`url(#${this.id}-coverage-fill)`,key:I.selectedFeaturePath}):null))):null}_renderSketch(){const{dataCaptureLayer:e,imageOverlaysOpened:t}=this;if(!e||t)return null;if(this._sketchLoaderTask||this._loadSketchResources(),!this._sketchLoaderTask?.value)return null;const{geometryType:i}=e,a="point"===i?"pin":"polyline"===i?"line":"polygon",o=this._sketchLoaderTask.value;return Z("div",{class:I.sketchTools},Z(o,{icon:a,messages:this._imageSketchToolsMessages,type:i,onAction:this._onAction}))}get _renderThumbnails(){const{currentBestFeature:e,thumbnails:t}=this.viewModel;return e?Z("div",{class:I.carouselContent},t?.items.map((({url:t,objectId:i,rotation:a},o)=>Z("div",{class:`${I.carouselItemWrapper}${e.attributes.objectId===i?"--selected":""}`,key:`${I.carouselItemWrapper}-${o}`},Z("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:I.carouselItem,"data-objectid":`${i}`,"data-rotation":`${a}`,"data-src":t,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight}))))):null}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_resetVideoTools(){this.viewModel?.videoLayer&&(this.viewModel.videoLayer.effect="brightness(1) contrast(1)")}_sliderChangeHandler(e){const t=this.viewModel?.videoElement?.content;t&&(t.currentTime=e.target.value,t.play())}_storeNavigationToolReference(e){this._navigationTool=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation();const t=this.imageEnhancementToolActive;this._closeAllImageTools(),this.imageEnhancementToolActive=!t}_toggleVideoEnhancementToolState(e){e.stopPropagation(),this.videoEnhancementToolActive=!this.videoEnhancementToolActive}_toggleImageOverlays(e){e.stopPropagation();const t=this.imageOverlaysOpened;this._closeAllImageTools(),this.imageOverlaysOpened=!t}_toggleImageGallery(e){e.stopPropagation();const t=this.galleryOpened;this._closeAllImageTools(),this.galleryOpened=!!this.imageGalleryEnabled&&!t}_toggleLocationTool(e){const t=this.imageLocationToolActive;this._closeAllImageTools(),this.imageLocationToolActive=!t,e.stopPropagation()}_toggleMeasurementSketch(e,t){e.stopPropagation();const i=this.measureType;this._closeAllImageTools(),this.measureType=i===t?null:t,this.measureType===t&&(this.viewModel.displayNewMeasurementButton=!0)}_toggleNavigationTool(){const e=this.navigationToolActive;this._closeAllImageTools(),this.navigationToolActive=!e}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_toggleTriangularAreaMeasurements(){this._toggleTriangularMeasurements("area")}_toggleTriangularDistanceMeasurements(){this._toggleTriangularMeasurements("distance")}_toggleTriangularLocation(){const e=this.triangularMeasurementActive,t=this.navigationToolActive;e?null===this.measureType?this.imageLocationToolActive?this._closeImageToolsAndToggleNavigation(e,t):this._activateTriangulatedImageLocationTool():this._resetMeasureTypeAndActivateImageLocationTool():this._activateTriangulatedImageLocationWorkflow(e,t)}_toggleTriangularMeasurements(e){const t=this.triangularMeasurementActive,i=this.viewModel.measureType,a=this.navigationToolActive;t?e===i?(this._closeAllImageTools(),this.triangularMeasurementActive=!t,this.navigationToolActive=!a):(this.imageLocationToolActive=!1,this.measureType=e):(this._closeAllImageTools(),this.measureType=e,this.triangularMeasurementActive=!t,this.navigationToolActive=!!a||!a)}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,a=(i-t+540)%360-180;e.style.setProperty(L,`${t}deg`),e.style.setProperty(k,`${t+a}deg`)}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async overlayMapFeatures(e,t){return this.removeHandles(`${Q.overlayed}-${e.id}`),this.addHandles(r((()=>e.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(e.id,e.visible)})),`${Q.overlayed}-${e.id}`),this._overlayedLayers.add(e),this.viewModel.overlayMapFeatures(e,t&&this.showMapFeatures)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}removeOverlayedGraphicsOnImage(e){this.removeHandles(`${Q.overlayed}-${e}`),this._overlayedLayers.remove(this._overlayedLayers.find((t=>t.id===e))),this.viewModel.removeOverlayedGraphicsOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){return Z("div",{class:this.classes(U.widget,S)},this._renderRoot)}async showImageByObjectId(e,t){return this.viewModel.showImageByObjectId(e,t)}async startDataCapture(e){return this.viewModel.startDataCapture(e)}async stopDataCapture(e){return this.viewModel.stopDataCapture(e)}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([g({readOnly:!0})],X.prototype,"accuracyParametersMissing",null),e([g()],X.prototype,"activeLayer",null),e([g()],X.prototype,"activeVideoIcon",null),e([g()],X.prototype,"activeAudioIcon",null),e([g()],X.prototype,"cameraHeadingThreshold",null),e([g()],X.prototype,"cameraPitchThreshold",null),e([g()],X.prototype,"canNavigateSequentially",null),e([g()],X.prototype,"currentBestFeature",null),e([g()],X.prototype,"currentCoverageVisible",null),e([g()],X.prototype,"dataCaptureEnabled",void 0),e([g()],X.prototype,"dataCaptureLayer",null),e([g()],X.prototype,"disabled",null),e([g()],X.prototype,"features",null),e([g()],X.prototype,"imagePointsInView",null),e([g()],X.prototype,"galleryOpened",void 0),e([g()],X.prototype,"icon",null),e([g()],X.prototype,"imageEnhancementToolActive",void 0),e([g()],X.prototype,"videoEnhancementToolActive",void 0),e([g({readOnly:!0})],X.prototype,"imageGalleryEnabled",null),e([g()],X.prototype,"imageLocationToolActive",null),e([g()],X.prototype,"imageOverlaysOpened",void 0),e([g({readOnly:!0})],X.prototype,"invalidCameraHeading",null),e([g()],X.prototype,"isAdditionalCoverageVisible",null),e([g()],X.prototype,"isAdditionalPointSourcesVisible",null),e([g()],X.prototype,"mapImageConversionToolState",null),e([g()],X.prototype,"measureType",null),e([g()],X.prototype,"layer",null),e([g()],X.prototype,"navigationToolActive",void 0),e([g()],X.prototype,"navigationMode",null),e([q(w()),g({type:P})],X.prototype,"viewModel",void 0),e([g(),z("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],X.prototype,"messages",void 0),e([g(),z("esri/core/t9n/Units")],X.prototype,"measurementUnitMessages",void 0),e([g(),z("esri/t9n/common")],X.prototype,"messagesCommon",void 0),e([g(),z("esri/widgets/Sketch/t9n/Sketch")],X.prototype,"messagesSketch",void 0),e([g()],X.prototype,"pixelMeasurementUnit",void 0),e([g()],X.prototype,"pixelAreaMeasurementUnit",void 0),e([g({readOnly:!0})],X.prototype,"popupEnabled",null),e([g()],X.prototype,"referencePoint",null),e([g()],X.prototype,"showCameraLocations",void 0),e([g()],X.prototype,"showMapFeatures",void 0),e([q(["create","delete","redo","undo","update"]),g({readOnly:!0})],X.prototype,"sketchViewModel",null),e([g()],X.prototype,"triangularMeasurementActive",null),e([g()],X.prototype,"view",null),e([g({type:x,nonNullable:!0})],X.prototype,"visibleElements",void 0),e([g()],X.prototype,"determineWorkflowForFeature",null),e([g()],X.prototype,"updateFootprint",null),e([g()],X.prototype,"_activeMeasurementIcon",null),e([g()],X.prototype,"_activeMeasurementHeading",null),e([g()],X.prototype,"_imageOverlaysLoaderTask",void 0),e([g()],X.prototype,"_imageMeasurementToolsLoaderTask",void 0),e([g()],X.prototype,"_navigationSettingsLoaderTask",void 0),e([g()],X.prototype,"_measurementToggle",null),e([g()],X.prototype,"_renderRoot",null),e([g()],X.prototype,"_imageEnhancementTools",null),e([g()],X.prototype,"_videoEnhancementTools",null),e([g()],X.prototype,"_imageGalleryPanel",null),e([g()],X.prototype,"_imageGalleryContext",null),e([g()],X.prototype,"_imageOverlaysComponent",null),e([g()],X.prototype,"_imageOverlayMessages",null),e([g()],X.prototype,"_imageSketchToolsMessages",null),e([g()],X.prototype,"_imageViewer",null),e([g()],X.prototype,"_imageViewerTriangular",null),e([g()],X.prototype,"_videoViewer",null),e([g()],X.prototype,"_locationToggle",null),e([g()],X.prototype,"_messageBox",null),e([g()],X.prototype,"_navigationToolExpanded",void 0),e([g()],X.prototype,"_navigationTool",void 0),e([g()],X.prototype,"_panoramicViewer",null),e([g()],X.prototype,"_renderNavigation",null),e([g()],X.prototype,"_renderThumbnails",null),e([g()],X.prototype,"_sketchLoaderTask",void 0),X=e([h("esri.widgets.OrientedImageryViewer")],X);const Y=X;export{Y as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import{createTask as i}from"../core/asyncUtils.js";import a from"../core/Collection.js";import{deprecatedProperty as o}from"../core/deprecate.js";import s from"../core/Logger.js";import{isAbortError as n}from"../core/promiseUtils.js";import{watch as r,initial as l,syncAndInitial as d,whenOnce as c}from"../core/reactiveUtils.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{or as m}from"../layers/orientedImagery/transformations/utils.js";import u from"./Expand.js";import v from"./PanoramicViewer.js";import p from"./Widget.js";import{getAllArcPath as y}from"./OrientedImageryViewer/arcUtils.js";import{getDelegatedEvents as w,defaultImageGeometryField as _,defaultOIObjectIDField as T,segmentArcs as M,featureCircleRadius as b,navigationToolDimensionLength as C,sectorsRadii as A}from"./OrientedImageryViewer/constants.js";import{css as I,navigation as f,navigationToolRotationFrom as L,navigationToolRotationTo as k,root as S}from"./OrientedImageryViewer/css.js";import{loadImageForAttachment as V,getThumbnailPixelBlock as O,isFeatureAttachment as E,renderImageWithRotation as F}from"./OrientedImageryViewer/galleryUtils.js";import P from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import x from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import{loadAlertComponents as H,Alert as j}from"./OrientedImageryViewer/components/Alert.js";import D from"./OrientedImageryViewer/components/ImageLocationWidget.js";import G from"./OrientedImageryViewer/components/ImageViewer.js";import $ from"./OrientedImageryViewer/components/NavigationAction.js";import{NavigationActionsCollection as N,NavigationActions as B}from"./OrientedImageryViewer/components/NavigationActions.js";import{NoImageLoadedError as R}from"./OrientedImageryViewer/navigation/errors.js";import{loadCalciteComponents as W}from"./support/componentsUtils.js";import{globalCss as U}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as z}from"./support/decorators/messageBundle.js";import{vmEvent as q}from"./support/decorators/vmEvent.js";import{tsx as Z,tsxFragment as J}from"./support/jsxFactory.js";import{substitute as K}from"../intl/substitute.js";const Q={overlayed:"overlayed"};let X=class extends p{constructor(e,t){super(e,t),this.dataCaptureEnabled=!1,this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.videoEnhancementToolActive=!1,this.imageOverlaysOpened=!1,this.navigationToolActive=!1,this.viewModel=new P,this.messagesCommon=null,this.messagesSketch=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters",this.showCameraLocations=!1,this.showMapFeatures=!1,this.visibleElements=new x,this._imageOverlaysLoaderTask=null,this._imageMeasurementToolsLoaderTask=null,this._navigationSettingsLoaderTask=null,this._clearMeasurements=()=>{this.viewModel.measureType=null,this.viewModel.clearPreviousMeasurements()},this._clearImageLocation=()=>{this.imageLocationToolActive=!1},this._navigationToolExpanded=!1,this._navigationTool=null,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._overlayedLayers=new a,this._previousAction=null,this._handleDataCaptureLayerChange=async e=>{if(this.dataCaptureLayer&&await this.stopDataCapture(!0),this.dataCaptureLayer=this.dataCaptureLayer===e?null:e,this.dataCaptureLayer)return this.startDataCapture(this.dataCaptureLayer)},this._handleNavigationSettingsInputChange=(e,t)=>{this.set(`${e}Threshold`,t)},this._handleNavigationSettingsToggle=e=>{this.viewModel.preserveAngle=e},this._handleOverlayLayerDeselect=e=>{const t=e.layer;t===this.dataCaptureLayer&&(this.stopDataCapture(),this.dataCaptureLayer=null),this.removeOverlayedGraphicsOnImage(`${t.id}`)},this._handleOverlayLayerSelect=e=>{const t=e.layer;this.viewModel.overlayMapFeatures(t,this.showMapFeatures),this.addHandles(r((()=>t.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(t.id,t.visible)})),`${Q.overlayed}-${t.id}`)},this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._onAction=e=>{const{target:t}=e,{dataset:{action:i}}=t,{_previousAction:a}=this,o=a?.dataset.action,s=o?.includes("draw")??!1,n="select-feature"===o,r=o!==i;switch(i){case"draw-point":case"draw-polygon":case"draw-polyline":{a&&m(n,s&&r)&&(a.active=!1),t.active=!t.active;const e=i.replace("draw-","");this.viewModel.digitizeCreate(e),this._previousAction=t.active?t:null;break}case"save":this.viewModel.saveDrawing();break;case"select-feature":s&&(this._previousAction.active=!1),t.active=!t.active,this.viewModel.toggleSelection(t.active),this._previousAction=t.active?t:null;break;case"delete-feature":this.viewModel.digitizeDelete()}},this._onImageOverlayClosed=()=>{this.imageOverlaysOpened=!1},this._onShowCameraLocationsChanged=e=>{this.showCameraLocations=e},this._onShowMapFeaturesChanged=e=>{this.showMapFeatures=e},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._restoreOverlays=async()=>Promise.all(this._overlayedLayers.map((e=>this.viewModel.overlayMapFeatures(e,this.showMapFeatures)))),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._sketchLoaderTask=null,this._settingsToggle=null,this._toggleImageNavigation=async e=>{const t=this.navigationMode;this._closeAllImageTools(),this.navigationMode=t!==e?e:null;const{activeViewer:i}=this.viewModel;if(!i)return;const{mode:a,preserveAngle:o}=this.viewModel;if("default"===a)if("directional"===this.navigationMode){const e=await this._loadNavigationSettings(),t="heading"===o||"both"===o,i="pitch"===o||"both"===o,{messages:a,messagesCommon:s}=this,n=new e({cameraHeadingThreshold:this.cameraHeadingThreshold,cameraPitchThreshold:this.cameraPitchThreshold,uiStrings:{configureNavigation:a.configureNavigation,preserveHeading:a.preserveHeading,preserveHeadingDescription:a.preserveHeadingDescription,preservePitch:a.preservePitch,preservePitchDescription:a.preservePitchDescription,settings:s.settings,thresholdLabel:a.thresholdLabel},onInputChange:this._handleNavigationSettingsInputChange,onToggle:this._handleNavigationSettingsToggle,preserveHeading:t,preservePitch:i});this._settingsToggle=new u({content:n,expandIcon:"configure"}),this.viewModel.activeViewer?.ui.add(this._settingsToggle,{position:"top-left"})}else this._settingsToggle&&(this._settingsToggle.expanded=!1,this.viewModel.activeViewer?.ui.remove(this._settingsToggle))},this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this.navigate=async e=>{let t=null;try{const{currentNode:i}=this.viewModel;if(!i)throw new R;t=await this.viewModel.navigate(i,e)}catch(i){n(i)||s.getLogger(this).error("Error occurred while navigating",i)}return t},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([r((()=>[this.viewModel?.bestFeatureAngle,this._navigationTool]),(([e,t])=>{t&&this._updateNavigationTool(t)}),l),r((()=>this.currentCoverageVisible),(e=>this._onCurrentCoverageVisibilityChange(e))),r((()=>this.isAdditionalCoverageVisible),(e=>this._onAdditionalCoverageVisibilityChange(e))),r((()=>this.isAdditionalPointSourcesVisible),(e=>this._onAdditionalCameraLocationsVisibility(e))),r((()=>({features:this.currentBestFeature,showCameraLocations:this.showCameraLocations,state:this.viewModel.state})),(({showCameraLocations:e,state:t})=>{"image-loaded"===t&&this.viewModel.overlayCameraLocations(e)}),d),r((()=>({feature:this.currentBestFeature,showMapFeatures:this.showMapFeatures,state:this.viewModel.state})),(async(e,t)=>{if(e.showMapFeatures!==t?.showMapFeatures&&this.viewModel.toggleAllOverlayMapFeatures(e.showMapFeatures),null!=e.feature&&e.feature!==t?.feature){if(this.viewModel.removeAllOverlayMapFeatures(),await c((()=>"image-loaded"===this.viewModel.state)),this.dataCaptureLayer&&this.stopDataCapture(),await this._restoreOverlays(),!this.dataCaptureLayer)return;await this.startDataCapture(this.dataCaptureLayer),this._previousAction?.active&&(this._previousAction.active=!1,this._previousAction=null)}}),l)])}loadDependencies(){return Promise.all([W({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),shell:()=>import("@esri/calcite-components/dist/components/calcite-shell"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider")}),H()])}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect()}get accuracyParametersMissing(){return this.viewModel.accuracyParametersMissing}get activeLayer(){return o(s.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(s.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeVideoIcon(){const{videoElement:e,videoViewModel:t}=this.viewModel;return e?.loaded&&t?t.videoPaused?"play":"pause":"play"}get activeAudioIcon(){const{videoElement:e,videoViewModel:t}=this.viewModel;return e?.loaded&&t?.videoMuted?"sound-off":"sound"}get cameraHeadingThreshold(){return this.viewModel.cameraHeadingThreshold}set cameraHeadingThreshold(e){this.viewModel.cameraHeadingThreshold=e}get cameraPitchThreshold(){return this.viewModel.cameraPitchThreshold}set cameraPitchThreshold(e){this.viewModel.cameraPitchThreshold=e}get canNavigateSequentially(){const{layer:e}=this;if(!e)return!1;const{fields:t,sequenceOrderField:i}=e;return t.some((({name:e})=>e.toLowerCase()===`${i??"sequenceorder"}`.toLowerCase()))}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get dataCaptureLayer(){return this.viewModel.dataCaptureLayer}set dataCaptureLayer(e){this.viewModel.dataCaptureLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get imageLocationToolActive(){return this.viewModel.imageLocationToolState}set imageLocationToolActive(e){this.viewModel.imageLocationToolState=e}get invalidCameraHeading(){return this.viewModel.invalidCameraHeading}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get measureType(){return this.viewModel.measureType}set measureType(e){this.viewModel.measureType=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get navigationMode(){return this.viewModel.navigationMode}set navigationMode(e){this.viewModel.navigationMode=e}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return"image-loaded"===t&&e}get referencePoint(){return this.viewModel.referencePoint??null}get sketchViewModel(){return this.viewModel.sketch}get triangularMeasurementActive(){return this.viewModel.triangularMeasurementActive}set triangularMeasurementActive(e){this.viewModel.triangularMeasurementActive=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}_renderActionBar(){return Z("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},Z("calcite-action-group",null,this._currentFootprintToggle(),this._additionalFootprintToggle(),this._additionalPointSourcesToggle()),Z("calcite-action-group",null,this._directionToolToggle(),this._mapImageConversionToggle(),this._navigationToolToggle(),this._imageEnhancementsToggle(),this._videoEnhancementsToggle()),Z("calcite-action-group",null,this._measurementToolsToggle(),this._imageGalleryToggle(),this._imageOverlaysToggle(),this._openPopupAction()))}_renderEnhancementSlider({title:e,value:t,handleChange:i}){return Z("div",{class:I.imageEnhancementToolContainer},Z("calcite-label",null,e,Z("calcite-slider",{bind:this,labelTicks:!0,max:10,min:0,ticks:2,value:t,onCalciteSliderInput:i})))}get _activeMeasurementIcon(){const{measureType:e,imageLocationToolActive:t}=this;if(t)return"pin-tear";switch(e){case"area":return"measure-area";case"height":return"measure-building-height-top-base";default:return"measure-line"}}get _activeMeasurementHeading(){const{measureType:e,messages:t,triangularMeasurementActive:i}=this,{groundArea:a,heightAboveGround:o,groundDistance:s,triangulatedAreaHeading:n,triangulatedDistanceHeading:r}=t;if(i)return"area"===e?n:r;switch(e){case"area":return a;case"height":return o;default:return s}}_additionalFootprintToggle(){const{isAdditionalCoverageVisible:e,invalidCameraHeading:t,visibleElements:{additionalFootprintToggle:i}}=this;return i?Z("calcite-action",{active:e,bind:this,class:I.addCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints,title:this.messages.additionalFootprints}):null}_additionalPointSourcesToggle(){const{isAdditionalPointSourcesVisible:e,invalidCameraHeading:t,visibleElements:{additionalCameraLocationsToggle:i}}=this;return i?Z("calcite-action",{active:e,bind:this,class:I.addExpPoints,disabled:t,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations,title:this.messages.additionalCameraLocations}):null}get _measurementToggle(){const{viewModel:{state:e,measureType:t,currentBestFeatureMeasurementImage:i},triangularMeasurementActive:a,id:o}=this;if("image-loaded"!==e||!t||a&&!i)return;this._imageMeasurementToolsLoaderTask||this._loadImageMeasurementResources();const s=this._imageMeasurementToolsLoaderTask?.value;return s?Z("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:this._activeMeasurementHeading,id:`${o}-${t}-measurement`,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearMeasurements},Z(s,{measurementType:t,measurementUnitMessages:this.measurementUnitMessages,messages:this.messages,oiViewModel:this.viewModel})):null}get _renderRoot(){const{viewModel:{state:e},triangularMeasurementActive:t}=this;return Z("calcite-panel",{bind:this,class:t?I.viewerContainerMeasurement:I.viewerContainer,heading:this.visibleElements.title?this.messages.title:void 0,loading:e.includes("loading")&&!t},this.visibleElements.menu?this._renderActionBar():null,Z("calcite-shell",null,Z("calcite-panel",null,this._imageViewer,this._panoramicViewer,this._videoViewer,this._messageBox,this.invalidCameraHeading?this._renderWarning(this.messages.invalidCameraHeadingWarningTitle,this.messages.invalidCameraHeadingWarningDescription):[this._imageGalleryPanel,this._renderNavigation,this._imageOverlaysPanel()],this._imageEnhancementTools,this._videoEnhancementTools,this._renderSketch()),this._imageViewerTriangular,this._measurementToggle,this._locationToggle))}_currentFootprintToggle(){const{currentCoverageVisible:e,invalidCameraHeading:t}=this,{currentFootprintToggle:i}=this.visibleElements;return i?Z("calcite-action",{active:e,bind:this,class:I.currentCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint,title:this.messages.currentFootprint}):null}get _imageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:a,state:o}}=this;return e&&"image-loaded"===o?Z("calcite-panel",{bind:this,class:I.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},Z("div",{class:I.imageEnhancementTools},Z("div",{class:I.imageEnhancementToolContainer},Z("calcite-label",null,this.messages.brightness,Z("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:t,onCalciteSliderInput:this._handleBrightnessChange}))),Z("div",{class:I.imageEnhancementToolContainer},Z("calcite-label",null,this.messages.contrast,Z("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:i,onCalciteSliderInput:this._handleContrastChange}))),Z("div",{class:I.imageEnhancementToolContainer},Z("calcite-label",null,this.messages.sharpness,Z("calcite-slider",{bind:this,labelTicks:!0,max:1,min:0,step:.1,ticks:.5,value:a,onCalciteSliderInput:this._handleSharpnessChange})))),Z("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset,title:this.messagesCommon.reset})):null}get _videoEnhancementTools(){const{videoEnhancementToolActive:e,viewModel:{videoViewModel:t,mode:i},messages:{videoEnhancement:a,brightness:o,contrast:s},messagesCommon:{reset:n}}=this;return e&&"video"===i&&t?Z("calcite-panel",{bind:this,class:I.imageEnhancementWrapper,closable:!0,closed:!e,heading:a,key:a,onCalcitePanelClose:this._toggleVideoEnhancementToolState},Z("div",{class:I.imageEnhancementTools},this._renderEnhancementSlider({title:o,value:t.videoBrightness,handleChange:this._handleVideoBrightnessChange}),this._renderEnhancementSlider({title:s,value:t.videoContrast,handleChange:this._handleVideoContrastChange})),Z("calcite-action",{bind:this,icon:"reset",onclick:this._resetVideoTools,slot:"header-actions-end",text:n})):null}_imageEnhancementsToggle(){const{state:e,mode:t}=this.viewModel,{imageEnhancement:i}=this.visibleElements;return i&&"video"!==t?Z("calcite-action",{active:this.imageEnhancementToolActive,bind:this,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement,title:this.messages.imageEnhancement}):null}_videoEnhancementsToggle(){const{mode:e}=this.viewModel,{videoEnhancement:t}=this.messages;return"video"===e?Z("calcite-action",{active:this.imageEnhancementToolActive,bind:this,disabled:"video"!==e,icon:"sliders-horizontal",onclick:this._toggleVideoEnhancementToolState,text:t,title:t}):null}get _imageGalleryPanel(){const{container:e,galleryOpened:t,imageGalleryEnabled:i}=this;return i&&t&&e?this._imageGalleryContext:null}get _imageGalleryContext(){const{galleryOpened:e,invalidCameraHeading:t}=this;return Z("calcite-panel",{bind:this,class:I.carousel,closable:!0,closed:!e,disabled:t,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},Z("div",{class:I.carouselContainer},this._renderThumbnails))}_imageGalleryToggle(){const{imageGalleryEnabled:e,invalidCameraHeading:t,visibleElements:{imageGallery:i}}=this;return i?Z("calcite-action",{active:this.galleryOpened,bind:this,disabled:!e||t,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery,title:this.messages.imageGallery}):null}get _imageOverlaysComponent(){const{_imageOverlayMessages:e,_imageOverlaysLoaderTask:t,_overlayedLayers:a,dataCaptureEnabled:o,dataCaptureLayer:s,imageOverlaysOpened:n,showCameraLocations:r,showMapFeatures:l,view:d,layer:c}=this;if(!c)return null;const g=c.imageGeometryField?.length?c.imageGeometryField:_,h=c.imageReferenceField?.length?c.imageReferenceField:T;t||(this._imageOverlaysLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/ImageOverlays.js")).default)));const m=this._imageOverlaysLoaderTask?.value;return m?Z(m,{closed:!n,dataCaptureEnabled:o,dataCaptureLayer:s,imageGeometryField:g,imageReferenceField:h,messages:e,overlayedLayers:a,showCameraLocations:r,showMapFeatures:l,view:d,onDataCaptureLayerChanged:this._handleDataCaptureLayerChange,onImageOverlaysClosed:this._onImageOverlayClosed,onLayerDeselected:this._handleOverlayLayerDeselect,onLayerSelected:this._handleOverlayLayerSelect,onShowCameraLocationsChanged:this._onShowCameraLocationsChanged,onShowMapFeaturesChanged:this._onShowMapFeaturesChanged}):null}get _imageOverlayMessages(){return{...this.messages,...this.messagesSketch}}get _imageSketchToolsMessages(){return{...this.messagesSketch,...this.messagesCommon}}_imageOverlaysPanel(){const{imageOverlaysOpened:e,viewModel:{state:t}}=this,i=this.classes({[I.imageOverlaysContainer]:!0,[U.hidden]:!e||"image-loaded"!==t});return Z("div",{class:i,key:this.messages.imageOverlays},this._imageOverlaysComponent)}_imageOverlaysToggle(){const{viewModel:{state:e},imageOverlaysOpened:t,invalidCameraHeading:i,visibleElements:{imageOverlays:a}}=this;return a?Z("calcite-action",{active:t,bind:this,disabled:"image-loaded"!==e||i,icon:"layers",onclick:this._toggleImageOverlays,text:this.messages.imageOverlays,title:this.messages.imageOverlays}):null}get _imageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i,clickAction:a,state:o}=this.viewModel,s=null!=e||"default"!==i||o.includes("loading"),{messages:{end:n,next:r,previous:l,start:d}}=this;return Z(G,{afterCreate:t,clickAction:a,navigationEnabled:!s&&null!==this.navigationMode,navigationViewModel:this.viewModel,uiStrings:{end:n,next:r,previous:l,start:d},visible:!s})}get _imageViewerTriangular(){const{messages:e,triangularMeasurementActive:t}=this,{displayMessage:i,storeImageMeasurementViewer:a,mode:o,state:s,clickAction:n}=this.viewModel,r=null!=i||"default"!==o,l=this.classes({[I.viewer]:!r,[I.viewerHidden]:r});return t?Z("calcite-panel",{class:I.viewerContainerMeasurement,heading:e.measurementViewerHeading,loading:s.includes("loading")},Z("calcite-panel",{bind:this,class:l},Z(G,{afterCreate:a,clickAction:n,uiStrings:e}))):null}get _videoViewer(){const{mode:e,loadVideoViewer:t,videoViewModel:i}=this.viewModel,a="video"!==e,o=this.classes({[I.viewer]:!a,[I.viewerHidden]:a});return Z("calcite-panel",{bind:this,class:o},Z("div",{afterCreate:t,styles:{height:"100%"}}),Z("calcite-slider",{bind:this,labelHandles:!0,labelTicks:!0,max:i?.videoDuration,minLabel:"0",value:i?.currentTime??0,onCalciteSliderChange:this._sliderChangeHandler}),Z("calcite-action-bar",{expandDisabled:!0,layout:"horizontal"},Z("calcite-action-group",null,Z("calcite-action",{bind:this,icon:this.activeVideoIcon,onclick:()=>i?.playVideoHandler(),text:"Play"})),Z("calcite-action-group",null,Z("calcite-action",{bind:this,icon:"refresh",onclick:()=>i?.rewindVideoHandler(),text:"Rewind"})),Z("calcite-action-group",null,Z("calcite-action",{bind:this,icon:this.activeAudioIcon,onclick:()=>i?.toggleAudio(),text:"Audio"}))))}get _locationToggle(){const{viewModel:{state:e,groundCoordinates:t,groundCoordinatesAccuracy:i,triangulatedPoint:a},imageLocationToolActive:o,triangularMeasurementActive:s,messages:{groundLocation:n,triangulatedLocationHeading:r}}=this;if("image-loaded"===e&&t&&o)return Z("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:s?r:n,id:n,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearImageLocation},Z(D,{accuracy:i,groundCoordinates:s&&a?a:t,messages:this.messages}))}_mapImageConversionToggle(){const{mapImageConversionToolState:e,viewModel:{state:t},invalidCameraHeading:i,visibleElements:{mapImageConversionTool:a}}=this;return a?Z("calcite-action",{active:e,bind:this,disabled:"image-loaded"!==t||i,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool,title:this.messages.mapImageConversionTool}):null}_measurementToolsToggle(){const{_activeMeasurementIcon:e,measureType:t,viewModel:i,accuracyParametersMissing:a,messages:o,triangularMeasurementActive:s,visibleElements:{measurementTools:n}}=this,{state:r,mode:l}=i,{measurementTools:d,groundDistance:c,groundArea:g,heightAboveGround:h,groundLocation:m,triangulatedDistanceHeading:u,triangulatedAreaHeading:v,triangulatedLocationHeading:p}=o;return n?Z("calcite-dropdown",{disabled:a,key:"measurement-tools",maxItems:5,title:d,width:"m"},Z("calcite-action",{bind:this,disabled:"image-loaded"!==r||a,icon:e,slot:"trigger",text:d}),Z("calcite-dropdown-group",null,Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-line",key:"distance-measurement",onclick:e=>this._toggleMeasurementSketch(e,"distance"),selected:"distance"===t&&!s},c),Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-area",key:"area-measurement",onclick:e=>this._toggleMeasurementSketch(e,"area"),selected:"area"===t&&!s},g),Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-building-height-top-base",key:"height-dropdown",onclick:e=>this._toggleMeasurementSketch(e,"height"),selected:"height"===t},h),Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"pin-tear",key:"surface-location",onclick:this._toggleLocationTool,selected:!!this.imageLocationToolActive&&!s},m),"default"===l&&Z(J,null,Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-distance",key:"triangular-measurement-distance",selected:!!s&&"distance"===this.measureType,onCalciteDropdownItemSelect:this._toggleTriangularDistanceMeasurements},u),Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-area",key:"triangular-measurement-area",selected:!!s&&"area"===this.measureType,onCalciteDropdownItemSelect:this._toggleTriangularAreaMeasurements},v),Z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"dual-image-location",key:"triangular-location",selected:!!s&&this.imageLocationToolActive,onCalciteDropdownItemSelect:this._toggleTriangularLocation},p)))):null}get _messageBox(){const{messages:e,viewModel:{displayMessage:t,mode:i}}=this;if(!t||"video"===i)return null;const{data:a,key:o,map:s}=t,n=`${s?K(e[o],s):e[o]}`;return Z("span",{class:I.messageBox},a?`${n} ${a}`:n)}async _loadNavigationSettings(){return this._navigationSettingsLoaderTask||(this._navigationSettingsLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/NavigationSettings.js")).default))),await this._navigationSettingsLoaderTask.promise}_navigationToolToggle(){const{state:e}=this.viewModel,{visibleElements:{navigationTool:t}}=this;return t?Z("calcite-action",{active:this.navigationToolActive,bind:this,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool,title:this.messages.navigationTool}):null}_directionToolToggle(){const{state:e}=this.viewModel,{visibleElements:{directionalNavigation:t,sequentialNavigation:i}}=this,a=new N;t&&a.push(new $({active:"directional"===this.navigationMode,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"i2DExplore",onclick:()=>{this._toggleImageNavigation("directional")},text:this.messages.directionalNavigation,title:this.messages.directionalNavigationDescription})),i&&a.push(new $({active:"sequential"===this.navigationMode,disabled:"image-loaded"!==e||this.invalidCameraHeading||!this.canNavigateSequentially,icon:"reorder-stack",onclick:()=>{this._toggleImageNavigation("sequential")},text:this.messages.sequentialNavigation,title:this.messages.sequentialNavigationDescription}));return t||i?Z(B,{actions:a,activeAction:a.items.find((e=>e.active)),icon:"absolute-direction",label:this.messages.imageNavigation,scale:"m",title:this.messages.imageNavigationDescription}):null}_openPopupAction(){const{showPopupsAction:e}=this.visibleElements;return e?Z("calcite-action",{bind:this,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups,title:this.messages.showPopups}):null}get _panoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i,clickAction:a,state:o}=this.viewModel,{messages:{end:s,next:n,previous:r,start:l}}=this,d=null!=e||"panoramic"!==i||o.includes("loading");return Z(v,{afterCreate:t,clickAction:a,navigationEnabled:!d&&null!==this.navigationMode,navigationViewModel:this.viewModel,uiStrings:{end:s,next:n,previous:r,start:l},visible:!d})}_activateTriangulatedImageLocationTool(){this.navigationToolActive=!0,this.imageLocationToolActive=!0}_activateTriangulatedImageLocationWorkflow(e,t){this._closeAllImageTools(),this.imageLocationToolActive=!0,this.triangularMeasurementActive=!e,this.navigationToolActive=!!t||!t}_closeImageToolsAndToggleNavigation(e,t){this._closeAllImageTools(),this.triangularMeasurementActive=!e,this.navigationToolActive=!t}_resetMeasureTypeAndActivateImageLocationTool(){this.measureType=null,this.imageLocationToolActive=!0}_closeAllImageTools(){this.imageEnhancementToolActive=!1,this.navigationToolActive=!1,this.imageOverlaysOpened=!1,this.galleryOpened=!1,this.measureType=null,this.imageLocationToolActive=!1,this.navigationMode=null,this._settingsToggle&&(this._settingsToggle.expanded=!1,this.viewModel.activeViewer?.ui.remove(this._settingsToggle))}_handleBrightnessChange(e){this.viewModel.brightness=e.currentTarget.value??0}_handleVideoBrightnessChange(e){this.viewModel.videoViewModel?.handleVideoBrightnessChange(e.target.value)}_handleContrastChange(e){this.viewModel.contrast=e.currentTarget.value??0}_handleVideoContrastChange(e){this.viewModel.videoViewModel?.handleVideoContrastChange(e.target.value)}_handleSharpnessChange(e){this.viewModel.sharpness=e.currentTarget.value??0}_lazyLoadImage(e,t){e.forEach((async e=>{if(e.isIntersecting){const a=e.target,o=a.getAttribute("data-src"),r=a.getAttribute("data-rotation"),l=a.getAttribute("data-objectid"),d=r?parseFloat(r)%360:0,{layer:c,_galleryController:{signal:g}}=this;if(!o||!l)return;let h;try{h=E(o)?await V(c,l,{signal:g}):await O(o,{signal:g})}catch(i){n(i)||s.getLogger("esri.widgets.OrientedImageryViewer").error("#lazyLoadImage()",i)}finally{t.unobserve(a)}if(!h)return;F(h,a,d)}}))}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_loadImageMeasurementResources(){this._imageMeasurementToolsLoaderTask=i((async()=>{const{default:e}=await import("./OrientedImageryViewer/components/ImageMeasurementWidget.js");return e}))}_loadSketchResources(){this._sketchLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/SketchTools.js")).default))}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderWarning(e,t){const{viewModel:{state:i}}=this;return"image-loaded"===i?Z(j,{icon:"exclamation-mark-triangle-f",kind:"warning",open:!0,title:e,tooltip:t}):null}get _renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:a,state:o}}=this;if(!this.container||!a)return null;let s,n,r,l,d;if(i){const{x:e,y:t,direction:a}=i,[o,c,g,h]=M[a];s=`M ${e} ${t} L ${o} ${c} A ${A[2]} ${A[2]} 0 0 1 ${g} ${h} Z`,n=e,l=t,r=M[a][4],d=M[a][5]}const c=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},g=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:a}=t;i&&a&&this.viewModel.handleFeatureClick({sector:a,featureIndexInSector:+i})},h=e=>{e.removeEventListener("click",g)},m=a.attributes.objectId,u=e?.map((e=>e?.items)).filter(Boolean).flatMap((e=>e?.map((({x:e,y:t,objectID:i,featureIndexInSector:a,sector:o})=>Z("circle",{afterRemoved:h,class:this.classes(I.feature,{selected:m===i}),cx:e,cy:t,"data-feature-index-in-sector":a,"data-sector":o,key:`${I.feature}-${i}`,onclick:g,r:b}))))),v=e=>{e.removeEventListener("click",c)},p=this.classes({[I.navigationWrapper]:!0,[I.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&"image-loaded"===o?Z("div",{bind:this,class:p,key:this.messages.navigationTool},Z("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?f:I.rotateWithAnimation,focusable:"false",height:C,role:"img",width:C,xmlns:"http://www.w3.org/2000/svg"},Z("defs",null,Z("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:n,x2:r,y1:l,y2:d},Z("stop",{class:I.navigationPathOffset0,offset:0}),Z("stop",{class:I.navigationPathOffset1,offset:1}))),Z("g",null,Z("circle",{class:this.classes(I.sector,I.outerSector),cx:A[3],cy:A[3],onclick:this._scaleNavigationTool,r:A[3]}),Z("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[2]}),Z("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[1]}),Z("circle",{class:I.sector,cx:A[3],cy:A[3],r:A[0]}),Z("path",{class:I.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${I.pointer}-west`}),Z("path",{class:this.classes(I.pointer,I.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${I.pointer}-north`}),Z("path",{class:I.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${I.pointer}-east`}),Z("path",{class:I.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${I.pointer}-south`}),Z("path",{class:this.classes(I.sector,I.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:I.sectorSeparator}),y([A[2],A[1],A[0]],A[3],A[3]).map(((t,i)=>Z("path",{afterRemoved:v,class:this.classes(I.sector,e?.[i]?.length?I.sectorEnabled:I.sectorDisabled),d:t,"data-sector":`${i}`,key:`${I.sector}-${i}`,onclick:c}))),Z("path",{class:this.classes(I.sector,I.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:I.sectorCross}),u,a.attributes.cameraPitch>=5&&s?Z("path",{class:I.selectedFeaturePath,d:s,fill:`url(#${this.id}-coverage-fill)`,key:I.selectedFeaturePath}):null))):null}_renderSketch(){const{dataCaptureLayer:e,imageOverlaysOpened:t}=this;if(!e||t)return null;if(this._sketchLoaderTask||this._loadSketchResources(),!this._sketchLoaderTask?.value)return null;const{geometryType:i}=e,a="point"===i?"pin":"polyline"===i?"line":"polygon",o=this._sketchLoaderTask.value;return Z("div",{class:I.sketchTools},Z(o,{icon:a,messages:this._imageSketchToolsMessages,type:i,onAction:this._onAction}))}get _renderThumbnails(){const{currentBestFeature:e,thumbnails:t}=this.viewModel;return e?Z("div",{class:I.carouselContent},t?.items.map((({url:t,objectId:i,rotation:a},o)=>Z("div",{class:`${I.carouselItemWrapper}${e.attributes.objectId===i?"--selected":""}`,key:`${I.carouselItemWrapper}-${o}`},Z("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:I.carouselItem,"data-objectid":`${i}`,"data-rotation":`${a}`,"data-src":t,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight}))))):null}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_resetVideoTools(){this.viewModel?.videoLayer&&(this.viewModel.videoLayer.effect="brightness(1) contrast(1)")}_sliderChangeHandler(e){const t=this.viewModel?.videoElement?.content;t&&(t.currentTime=e.target.value,t.play())}_storeNavigationToolReference(e){this._navigationTool=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation();const t=this.imageEnhancementToolActive;this._closeAllImageTools(),this.imageEnhancementToolActive=!t}_toggleVideoEnhancementToolState(e){e.stopPropagation(),this.videoEnhancementToolActive=!this.videoEnhancementToolActive}_toggleImageOverlays(e){e.stopPropagation();const t=this.imageOverlaysOpened;this._closeAllImageTools(),this.imageOverlaysOpened=!t}_toggleImageGallery(e){e.stopPropagation();const t=this.galleryOpened;this._closeAllImageTools(),this.galleryOpened=!!this.imageGalleryEnabled&&!t}_toggleLocationTool(e){const t=this.imageLocationToolActive;this._closeAllImageTools(),this.imageLocationToolActive=!t,e.stopPropagation()}_toggleMeasurementSketch(e,t){e.stopPropagation();const i=this.measureType;this._closeAllImageTools(),this.measureType=i===t?null:t,this.measureType===t&&(this.viewModel.displayNewMeasurementButton=!0)}_toggleNavigationTool(){const e=this.navigationToolActive;this._closeAllImageTools(),this.navigationToolActive=!e}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_toggleTriangularAreaMeasurements(){this._toggleTriangularMeasurements("area")}_toggleTriangularDistanceMeasurements(){this._toggleTriangularMeasurements("distance")}_toggleTriangularLocation(){const e=this.triangularMeasurementActive,t=this.navigationToolActive;e?null===this.measureType?this.imageLocationToolActive?this._closeImageToolsAndToggleNavigation(e,t):this._activateTriangulatedImageLocationTool():this._resetMeasureTypeAndActivateImageLocationTool():this._activateTriangulatedImageLocationWorkflow(e,t)}_toggleTriangularMeasurements(e){const t=this.triangularMeasurementActive,i=this.viewModel.measureType,a=this.navigationToolActive;t?e===i?(this._closeAllImageTools(),this.triangularMeasurementActive=!t,this.navigationToolActive=!a):(this.imageLocationToolActive=!1,this.measureType=e):(this._closeAllImageTools(),this.measureType=e,this.triangularMeasurementActive=!t,this.navigationToolActive=!!a||!a)}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,a=(i-t+540)%360-180;e.style.setProperty(L,`${t}deg`),e.style.setProperty(k,`${t+a}deg`)}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async overlayMapFeatures(e,t){return this.removeHandles(`${Q.overlayed}-${e.id}`),this.addHandles(r((()=>e.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(e.id,e.visible)})),`${Q.overlayed}-${e.id}`),this._overlayedLayers.add(e),this.viewModel.overlayMapFeatures(e,t&&this.showMapFeatures)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}removeOverlayedGraphicsOnImage(e){this.removeHandles(`${Q.overlayed}-${e}`),this._overlayedLayers.remove(this._overlayedLayers.find((t=>t.id===e))),this.viewModel.removeOverlayedGraphicsOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){return Z("div",{class:this.classes(U.widget,S)},this._renderRoot)}async showImageByObjectId(e,t){return this.viewModel.showImageByObjectId(e,t)}async startDataCapture(e){return this.viewModel.startDataCapture(e)}async stopDataCapture(e){return this.viewModel.stopDataCapture(e)}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([g({readOnly:!0})],X.prototype,"accuracyParametersMissing",null),e([g()],X.prototype,"activeLayer",null),e([g()],X.prototype,"activeVideoIcon",null),e([g()],X.prototype,"activeAudioIcon",null),e([g()],X.prototype,"cameraHeadingThreshold",null),e([g()],X.prototype,"cameraPitchThreshold",null),e([g()],X.prototype,"canNavigateSequentially",null),e([g()],X.prototype,"currentBestFeature",null),e([g()],X.prototype,"currentCoverageVisible",null),e([g()],X.prototype,"dataCaptureEnabled",void 0),e([g()],X.prototype,"dataCaptureLayer",null),e([g()],X.prototype,"disabled",null),e([g()],X.prototype,"features",null),e([g()],X.prototype,"imagePointsInView",null),e([g()],X.prototype,"galleryOpened",void 0),e([g()],X.prototype,"icon",null),e([g()],X.prototype,"imageEnhancementToolActive",void 0),e([g()],X.prototype,"videoEnhancementToolActive",void 0),e([g({readOnly:!0})],X.prototype,"imageGalleryEnabled",null),e([g()],X.prototype,"imageLocationToolActive",null),e([g()],X.prototype,"imageOverlaysOpened",void 0),e([g({readOnly:!0})],X.prototype,"invalidCameraHeading",null),e([g()],X.prototype,"isAdditionalCoverageVisible",null),e([g()],X.prototype,"isAdditionalPointSourcesVisible",null),e([g()],X.prototype,"mapImageConversionToolState",null),e([g()],X.prototype,"measureType",null),e([g()],X.prototype,"layer",null),e([g()],X.prototype,"navigationToolActive",void 0),e([g()],X.prototype,"navigationMode",null),e([q(w()),g({type:P})],X.prototype,"viewModel",void 0),e([g(),z("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],X.prototype,"messages",void 0),e([g(),z("esri/core/t9n/Units")],X.prototype,"measurementUnitMessages",void 0),e([g(),z("esri/t9n/common")],X.prototype,"messagesCommon",void 0),e([g(),z("esri/widgets/Sketch/t9n/Sketch")],X.prototype,"messagesSketch",void 0),e([g()],X.prototype,"pixelMeasurementUnit",void 0),e([g()],X.prototype,"pixelAreaMeasurementUnit",void 0),e([g({readOnly:!0})],X.prototype,"popupEnabled",null),e([g()],X.prototype,"referencePoint",null),e([g()],X.prototype,"showCameraLocations",void 0),e([g()],X.prototype,"showMapFeatures",void 0),e([q(["create","delete","redo","undo","update"]),g({readOnly:!0})],X.prototype,"sketchViewModel",null),e([g()],X.prototype,"triangularMeasurementActive",null),e([g()],X.prototype,"view",null),e([g({type:x,nonNullable:!0})],X.prototype,"visibleElements",void 0),e([g()],X.prototype,"determineWorkflowForFeature",null),e([g()],X.prototype,"updateFootprint",null),e([g()],X.prototype,"_activeMeasurementIcon",null),e([g()],X.prototype,"_activeMeasurementHeading",null),e([g()],X.prototype,"_imageOverlaysLoaderTask",void 0),e([g()],X.prototype,"_imageMeasurementToolsLoaderTask",void 0),e([g()],X.prototype,"_navigationSettingsLoaderTask",void 0),e([g()],X.prototype,"_measurementToggle",null),e([g()],X.prototype,"_renderRoot",null),e([g()],X.prototype,"_imageEnhancementTools",null),e([g()],X.prototype,"_videoEnhancementTools",null),e([g()],X.prototype,"_imageGalleryPanel",null),e([g()],X.prototype,"_imageGalleryContext",null),e([g()],X.prototype,"_imageOverlaysComponent",null),e([g()],X.prototype,"_imageOverlayMessages",null),e([g()],X.prototype,"_imageSketchToolsMessages",null),e([g()],X.prototype,"_imageViewer",null),e([g()],X.prototype,"_imageViewerTriangular",null),e([g()],X.prototype,"_videoViewer",null),e([g()],X.prototype,"_locationToggle",null),e([g()],X.prototype,"_messageBox",null),e([g()],X.prototype,"_navigationToolExpanded",void 0),e([g()],X.prototype,"_navigationTool",void 0),e([g()],X.prototype,"_panoramicViewer",null),e([g()],X.prototype,"_renderNavigation",null),e([g()],X.prototype,"_renderThumbnails",null),e([g()],X.prototype,"_sketchLoaderTask",void 0),X=e([h("esri.widgets.OrientedImageryViewer")],X);const Y=X;export{Y 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"../Camera.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import a from"./OrientedImageryViewer/components/NavigationUI.js";import n from"./OrientedImageryViewer/components/NavigationUIPanoramicViewModel.js";import{loadSequentialNavigationUIComponents as s,SequentialNavigationUI as l}from"./OrientedImageryViewer/components/SequentialNavigationUI.js";import p from"./PanoramicViewer/PanoramicViewerViewModel.js";import{loadCalciteComponents as c}from"./support/componentsUtils.js";import{globalCss as d}from"./support/globalCss.js";import"./support/widgetUtils.js";import{vmEvent as u}from"./support/decorators/vmEvent.js";import{tsx as v}from"./support/jsxFactory.js";const h="esri-panoramic-viewer";let m=class extends r{constructor(e){super(e),this.navigationEnabled=!1,this.uiStrings=null,this.viewModel=new p,this._afterContainerCreate=e=>{this.imageRenderer.container=e},this.addGraphic=(e,t)=>{this.viewModel.addGraphic(e,t)},this.addManyGraphics=e=>{this.viewModel.addManyGraphics(e)},this.clearGraphics=()=>{this.viewModel.clearGraphics()},this.clearImage=()=>{this.viewModel.clearImage()},this.loadImage=e=>this.viewModel.loadImage(e),this.navigate=async(e,t)=>this.viewModel.navigate(e,t),this.removeGraphic=e=>{this.viewModel.removeGraphic(e)},this.removeManyGraphics=e=>{this.viewModel.removeManyGraphics(e)}}loadDependencies(){return Promise.all([c({panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")}),s()])}get autoLoad(){return this.viewModel.autoLoad}set autoLoad(e){this.viewModel.autoLoad=e}get camera(){return this.viewModel.camera}set camera(e){e&&(this.viewModel.camera=e)}get clickAction(){return this.viewModel.clickAction}set clickAction(e){this.viewModel.clickAction=e}get currentNode(){return this.navigationViewModel?.currentNode}get fov(){return this.camera.fov}set fov(e){this.viewModel.fov=e}get hfov(){return this.viewModel.hfov}get icon(){return"i360-view"}set icon(e){this._overrideIfSome("icon",e)}get imageRenderer(){return this.viewModel.imageRenderer}get imageSize(){return this.viewModel.imageSize}get imageSource(){return this.viewModel.imageSource}set imageSource(e){this.viewModel.imageSource=e}get navigationMode(){return this.navigationViewModel?.navigationMode}get navigationNodes(){return this.navigationViewModel?.navigationNodes}get navigationViewModel(){return this.viewModel.navigationViewModel}set navigationViewModel(e){this.viewModel.navigationViewModel=e}get pitch(){return this.viewModel.pitch}set pitch(e){this.viewModel.pitch=e}get state(){return this.viewModel.state}get ui(){return this.imageRenderer.ui}get vfov(){return this.viewModel.vfov}get yaw(){return this.viewModel.yaw}set yaw(e){this.viewModel.yaw=e}_renderNavigationUI(){switch(this.navigationMode){case"directional":return v(a,{navigate:this.navigate,viewModel:new n({currentNode:this.currentNode,nodes:this.navigationNodes})});case"sequential":return v(l,{layout:"horizontal",uiStrings:this.uiStrings,onAction:e=>{this.navigate(this.currentNode,e)}});default:return null}}render(){return v("calcite-panel",null,v("calcite-panel",{afterCreate:this._afterContainerCreate,bind:this,class:this.classes(d.widget,h)}),this.navigationEnabled?this._renderNavigationUI():null)}static{this.vnodeSelector="calcite-panel"}};e([i({type:Boolean})],m.prototype,"autoLoad",null),e([i({type:t})],m.prototype,"camera",null),e([i()],m.prototype,"clickAction",null),e([i()],m.prototype,"currentNode",null),e([i({type:Number})],m.prototype,"fov",null),e([i({readOnly:!0,type:Number})],m.prototype,"hfov",null),e([i()],m.prototype,"icon",null),e([i({readOnly:!0})],m.prototype,"imageRenderer",null),e([i({readOnly:!0})],m.prototype,"imageSize",null),e([i()],m.prototype,"imageSource",null),e([i({type:Boolean})],m.prototype,"navigationEnabled",void 0),e([i()],m.prototype,"navigationMode",null),e([i()],m.prototype,"navigationNodes",null),e([i()],m.prototype,"navigationViewModel",null),e([i({type:Number})],m.prototype,"pitch",null),e([i({readOnly:!0})],m.prototype,"state",null),e([i()],m.prototype,"ui",null),e([i()],m.prototype,"uiStrings",void 0),e([i({readOnly:!0,type:Number})],m.prototype,"vfov",null),e([u(["click","hittest-response","pixel-location"]),i({type:p})],m.prototype,"viewModel",void 0),e([i({type:Number})],m.prototype,"yaw",null),m=e([o("esri.widgets.PanoramicViewer")],m);const g=m;export{g as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import a from"./OrientedImageryViewer/components/NavigationUI360.js";import{loadSequentialNavigationUIComponents as n,SequentialNavigationUI as s}from"./OrientedImageryViewer/components/SequentialNavigationUI.js";import l from"./PanoramicViewer/PanoramicViewerViewModel.js";import{loadCalciteComponents as p}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import"./support/widgetUtils.js";import{vmEvent as d}from"./support/decorators/vmEvent.js";import{tsx as u}from"./support/jsxFactory.js";const v="esri-panoramic-viewer";let h=class extends r{constructor(e){super(e),this.navigationEnabled=!1,this.uiStrings=null,this.viewModel=new l,this._afterContainerCreate=e=>{this.imageRenderer.container=e},this.addGraphic=(e,t)=>{this.viewModel.addGraphic(e,t)},this.addManyGraphics=e=>{this.viewModel.addManyGraphics(e)},this.clearGraphics=()=>{this.viewModel.clearGraphics()},this.clearImage=()=>{this.viewModel.clearImage()},this.loadImage=e=>this.viewModel.loadImage(e),this.navigate=async(e,t)=>this.viewModel.navigate(e,t),this.removeGraphic=e=>{this.viewModel.removeGraphic(e)},this.removeManyGraphics=e=>{this.viewModel.removeManyGraphics(e)}}loadDependencies(){return Promise.all([p({panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")}),n()])}get autoLoad(){return this.viewModel.autoLoad}set autoLoad(e){this.viewModel.autoLoad=e}get camera(){return this.viewModel.camera}set camera(e){e&&(this.viewModel.camera=e)}get clickAction(){return this.viewModel.clickAction}set clickAction(e){this.viewModel.clickAction=e}get currentNode(){return this.navigationViewModel?.currentNode}get fov(){return this.camera.fov}set fov(e){this.viewModel.fov=e}get hfov(){return this.viewModel.hfov}get icon(){return"i360-view"}set icon(e){this._overrideIfSome("icon",e)}get imageRenderer(){return this.viewModel.imageRenderer}get imageSize(){return this.viewModel.imageSize}get imageSource(){return this.viewModel.imageSource}set imageSource(e){this.viewModel.imageSource=e}get navigationMode(){return this.navigationViewModel?.navigationMode}get navigationNodes(){return this.navigationViewModel?.navigationNodes}get navigationViewModel(){return this.viewModel.navigationViewModel}set navigationViewModel(e){this.viewModel.navigationViewModel=e}get pitch(){return this.viewModel.pitch}set pitch(e){this.viewModel.pitch=e}get state(){return this.viewModel.state}get ui(){return this.imageRenderer.ui}get vfov(){return this.viewModel.vfov}get yaw(){return this.viewModel.yaw}set yaw(e){this.viewModel.yaw=e}get _navigationUI(){return u(a,{currentNode:this.currentNode,navigate:this.navigate,nodes:this.navigationNodes})}get _sequentialNavigationUI(){return u(s,{layout:"horizontal",uiStrings:this.uiStrings,onAction:e=>{this.navigate(this.currentNode,e)}})}_renderNavigationUI(){switch(this.navigationMode){case"directional":return this._navigationUI;case"sequential":return this._sequentialNavigationUI;default:return null}}render(){return u("calcite-panel",null,u("calcite-panel",{afterCreate:this._afterContainerCreate,bind:this,class:this.classes(c.widget,v)}),this.navigationEnabled?this._renderNavigationUI():null)}static{this.vnodeSelector="calcite-panel"}};e([i({type:Boolean})],h.prototype,"autoLoad",null),e([i({type:t})],h.prototype,"camera",null),e([i()],h.prototype,"clickAction",null),e([i()],h.prototype,"currentNode",null),e([i({type:Number})],h.prototype,"fov",null),e([i({readOnly:!0,type:Number})],h.prototype,"hfov",null),e([i()],h.prototype,"icon",null),e([i({readOnly:!0})],h.prototype,"imageRenderer",null),e([i({readOnly:!0})],h.prototype,"imageSize",null),e([i()],h.prototype,"imageSource",null),e([i({type:Boolean})],h.prototype,"navigationEnabled",void 0),e([i()],h.prototype,"navigationMode",null),e([i()],h.prototype,"navigationNodes",null),e([i()],h.prototype,"navigationViewModel",null),e([i({type:Number})],h.prototype,"pitch",null),e([i({readOnly:!0})],h.prototype,"state",null),e([i()],h.prototype,"ui",null),e([i()],h.prototype,"uiStrings",void 0),e([i({readOnly:!0,type:Number})],h.prototype,"vfov",null),e([d(["click","hittest-response","pixel-location"]),i({type:l})],h.prototype,"viewModel",void 0),e([i({type:Number})],h.prototype,"yaw",null),e([i()],h.prototype,"_navigationUI",null),e([i()],h.prototype,"_sequentialNavigationUI",null),h=e([o("esri.widgets.PanoramicViewer")],h);const g=h;export{g 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{getAssetUrl as t}from"../../assets.js";import r from"../../Graphic.js";import s from"../../PopupTemplate.js";import o from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import l from"../../core/Collection.js";import a from"../../core/Error.js";import n from"../../core/Evented.js";import u from"../../core/Logger.js";import{mappedFind as c}from"../../core/maybe.js";import{eachAlways as h,after as p}from"../../core/promiseUtils.js";import{watch as g,initial as d,whenOnce as m}from"../../core/reactiveUtils.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import S from"../../geometry/Point.js";import _ from"../../geometry/SpatialReference.js";import{getPointFromGeometry as v,getPointWithElevation as w}from"../../geometry/support/geometryUtils.js";import{onLocaleChange as b}from"../../intl/locale.js";import{fetchMessageBundle as x}from"../../intl/messages.js";import L from"../../portal/Portal.js";import{isApiKeyApplicable as I}from"../../support/apiKeyUtils.js";import T from"../../symbols/PictureMarkerSymbol.js";import R from"../../symbols/SimpleFillSymbol.js";import E from"../../symbols/SimpleLineSymbol.js";import F from"../../symbols/TextSymbol.js";import{highlightsSupported as j}from"../../views/support/layerViewUtils.js";import P from"./LayerSearchSource.js";import C from"./LocatorSearchSource.js";import G from"./SearchSource.js";import{isArcGISWorldGeocoder as O,meteredArcGISLocatorUrl as A,isProxiedArcGISWorldGeocoder as N,isMeteredArcGISWorldGeocoder as D}from"./support/locatorUtils.js";import{supported as M,getCurrentPosition as V,positionToPoint as k}from"../support/geolocationUtils.js";import J from"../support/GoTo.js";function U(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const H=()=>x("esri/widgets/Search/t9n/Search"),B="highlight",Q=l.ofType({key:e=>e.layer?"layer":"locator",base:G,typeMap:{layer:P,locator:C}}),Z=_.WGS84,q="esri/images/search/search-symbol-32.png",z=/<[\s\S]*?>/g,K=-1;let W=class extends(J(n.EventedMixin(o))){constructor(e){super(e),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new Q,this.defaultSymbols={point:new T({url:t(q),size:24,width:24,height:24}),polyline:new E({color:[130,130,130,1],width:2}),polygon:new R({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=L.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new Q,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const e=await H();this.messages=e,this.defaultPopupTemplate=new s({title:e.searchResult,content:"{Match_addr}"})};e(),this.addHandles([g((()=>[this.includeDefaultSources,this.view,this.portal]),(()=>this._update()),d),b(e)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=K}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:K}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new Q;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get locationEnabled(){return this._get("locationEnabled")||M()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=M();if(e&&!t){const e=new a("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});u.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===K)return r??"";const s=e.at(t);return s?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),s=(async()=>{try{await this.when();const e=await this._getResultsFromSources(r,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(s,e,r);const o=this._getFirstResult(s.results),i=r.location&&o?o.name:r.text,l=i?.replace(z,"");return this._set("searchTerm",l),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",s.results),this._set("resultCount",s.results.reduce(((e,t)=>e+(t.results?.length??0)),0)),this.emit("search-complete",s),await this._selectFirstResult(o),s}finally{this._clearSearching()}})();return this._searching=s,s}async searchNearby(e){if(!this.locationEnabled){const e=new a("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw u.getLogger(this).error(e),e}const t=(async()=>{try{const t=await V(),r=await k({position:t,view:this.view},e);return await this.search(r,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new a("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});throw u.getLogger(this).error(t),t}const{view:t}=this,s=U(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=s?this.allSources.at(s):null;if(!o){const e=new a("select:missing-source","Cannot select without a source.",{source:o});throw u.getLogger(this).error(e),e}const i=o instanceof P?this._getLayerSourcePopupTemplate(o):o.popupTemplate,l=o.resultSymbol||this._getDefaultSymbol(e),n=U(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,c=U(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,p=U(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,g=p?i||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new a("select:missing-feature","Cannot select without a feature.",{feature:d});throw u.getLogger(this).error(e),e}const{attributes:m,geometry:y,layer:f,sourceLayer:S}=d,_=y?v(y):null,b={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=_?w(_,t):Promise.resolve(_)},x=await h(b),L=x.layerViewQuery.value,I=x.elevationQuery.value;l instanceof F&&(l.text=e.name);const T=t&&c?e.target||e.extent:null,R=null!=T?this._goToSearchResult(T):Promise.resolve();await R;const E=L?d:new r({geometry:y,symbol:l,attributes:m,layer:f,sourceLayer:S,popupTemplate:g}),C=t?.popup,G=C&&p&&E.getEffectivePopupTemplate(C.defaultPopupTemplateEnabled);return G&&await t.openPopup({features:[E],location:I}),L&&j(L)&&!G&&this._highlightFeature({graphic:E,layerView:L}),!L&&n&&t&&t.graphics.push(E),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",E),this.emit("select-result",{result:e,source:o,sourceIndex:s}),e}async suggest(e,t,r){const s=e||this.searchTerm;this.emit("suggest-start",{searchTerm:s}),await this._suggestTimer(t,r);const o=await this._suggestImmediate(s,r);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce(((e,t)=>e+(t.results?.length??0)),0)??null),this.emit("suggest-complete",o),o}async when(){await m((()=>!this.updating))}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=h([e?.load(),t?.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}await m((()=>this.messages)),this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map((e=>{if(!1===e.placefinding)return;const t=O(e.url)&&I(e.url)?{url:A}:null,r=C.fromJSON({...e,...t}),s=r.url;if(O(s)||N(s)||D(s)){const e=r.outFields??["Addr_type","Match_addr","StAddr","City"],t=(r.placeholder||this.messages?.placeholder)??"",s="number"==typeof r.defaultZoomScale?r.defaultZoomScale:2500;r.singleLineFieldName="SingleLine",r.outFields=e,r.placeholder=t,r.defaultZoomScale=s}return r.singleLineFieldName?r:void 0})).filter(i)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach((e=>e?.destroy())),this._createdFeatureLayers=[]}_getLayerSources(e,t){const r=this.view?.map;return e.map((e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(i).toArray()}_getTableSources(e,t){const r=this.view?.map;return e.map((e=>{if(!e.id)return;const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(i).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:r,hintText:s,layers:o,tables:i}=t;if(!r)return[];return[...this._getLayerSources(o,s),...this._getTableSources(i,s)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find((e=>e.id===t.subLayer));if(!r)throw new Error;const s=await(r.createFeatureLayer?.());if(!s)throw new Error;return this._createdFeatureLayers.push(s),s}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find((e=>e.id===t.subLayer));if("building-component"!==r?.type)throw new Error;if(await r.load(),null==r.associatedLayer)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,t){if("feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type)return e;if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(r){const t=new a("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return u.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):null}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){const e=this.view?.popup,{resultGraphic:t}=this;if(!e||!t)return;const r="selectedFeature"in e,s=r?e.selectedFeature:null;r&&(s&&s===t)&&e.close()}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return p(r,null,t?.signal)}_createLocationForSearch(e){return e instanceof r&&e.geometry?v(e.geometry):e instanceof S?e:Array.isArray(e)&&2===e.length?new S({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&U(e,"key")&&U(e,"text")&&U(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,i=!e&&s&&o,l=i&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=i&&s.location;return l||a?s:{location:t,text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){return c(e,(({results:e})=>e?.[0]))??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const r=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(s,r),s}_formatSourceResponse(e,t,r){const s=t?.value||[],o=t?.error,i=this.allSources.at(r);if(o){const t={sourceIndex:r,source:i,error:o};e.errors.push(t),u.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:r,source:i,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===K){const s=r&&U(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach(((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)}))}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&U(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new a("search:no-sources-defined","At least one source is required.",{allSources:r});throw u.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getResultsFromSource(e,s,t))})):o.push(this._getResultsFromSource(e,s,t)),h(o)}async _getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new a("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw u.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))})):o.push(this._getSuggestionsFromSource(e,s,t)),h(o)}async _getResultsFromSource(e,t,r){const s=null!=t?this.allSources.at(t):null;if(!s)return null;const{location:o=null}=e,i=this.view?.spatialReference||Z,l=U(s,"maxResults")?s.maxResults:this.maxResults,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch,{view:n}=this;return s.getResults?.({view:n,sourceIndex:t,location:o,suggestResult:e,spatialReference:i,exactMatch:a,maxResults:l},r)}async _getSuggestionsFromSource(e,t,r){const s=this.allSources.at(t);if(!s)return null;e??="";const o=U(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=U(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||Z,i=U(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return U(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return c(this.results??[],(({results:t,sourceIndex:r})=>{const s=t?.includes(e);return s?r:null}))??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const r={target:{target:e},options:{signal:t.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,r=e.feature?.geometry;if(null==r)return null;switch(r.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(B)}async _getLayerView(e){const{view:t}=this;if(!e||!t||"building-component"===e.layer?.type||"subtype-sublayer"===e.layer?.type)return null;const{layer:r}=e;return r?(await t.when(),t.whenLayerView(r)):null}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o}=t,{objectIdField:i}=o,l=(i&&s?.[i])??null,a=r.highlight(l??t);this.addHandles(a,B)}_setResultFloor(e){const{view:t}=this,r=e.feature?.attributes,s=e.feature?.sourceLayer;if(s&&"floorInfo"in s&&s?.floorInfo?.floorField&&r){const e=r[s.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([y()],W.prototype,"_searching",void 0),e([y()],W.prototype,"_updatingPromise",void 0),e([y({readOnly:!0,value:null})],W.prototype,"activeSource",null),e([y()],W.prototype,"activeSourceIndex",null),e([y()],W.prototype,"allPlaceholder",null),e([y({readOnly:!0})],W.prototype,"allSources",null),e([y()],W.prototype,"autoNavigate",void 0),e([y()],W.prototype,"autoSelect",void 0),e([y({type:s})],W.prototype,"defaultPopupTemplate",void 0),e([y({readOnly:!0})],W.prototype,"defaultSources",void 0),e([y()],W.prototype,"defaultSymbols",void 0),e([y()],W.prototype,"includeDefaultSources",void 0),e([y()],W.prototype,"locationEnabled",null),e([y()],W.prototype,"maxInputLength",void 0),e([y()],W.prototype,"maxResults",void 0),e([y()],W.prototype,"maxSuggestions",void 0),e([y()],W.prototype,"messages",void 0),e([y()],W.prototype,"minSuggestCharacters",void 0),e([y({readOnly:!0})],W.prototype,"placeholder",null),e([y()],W.prototype,"popupEnabled",void 0),e([y({type:s})],W.prototype,"popupTemplate",void 0),e([y({type:L})],W.prototype,"portal",void 0),e([y()],W.prototype,"resultCount",void 0),e([y()],W.prototype,"resultGraphicEnabled",void 0),e([y({readOnly:!0})],W.prototype,"resultGraphic",void 0),e([y({readOnly:!0})],W.prototype,"results",void 0),e([y({readOnly:!0})],W.prototype,"selectedSuggestion",void 0),e([y()],W.prototype,"searchAllEnabled",void 0),e([y({readOnly:!0})],W.prototype,"selectedResult",void 0),e([y()],W.prototype,"searchTerm",null),e([y({type:Q})],W.prototype,"sources",void 0),e([y({readOnly:!0})],W.prototype,"state",null),e([y()],W.prototype,"suggestionDelay",void 0),e([y()],W.prototype,"suggestionCount",void 0),e([y({readOnly:!0})],W.prototype,"suggestions",void 0),e([y()],W.prototype,"suggestionsEnabled",void 0),e([y({readOnly:!0})],W.prototype,"updating",null),e([y()],W.prototype,"view",void 0),e([y()],W.prototype,"clear",null),W=e([f("esri.widgets.Search.SearchViewModel")],W);const X=W;export{X as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{getAssetUrl as t}from"../../assets.js";import r from"../../Graphic.js";import s from"../../PopupTemplate.js";import o from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import l from"../../core/Collection.js";import a from"../../core/Error.js";import n from"../../core/Evented.js";import u from"../../core/Logger.js";import{mappedFind as c}from"../../core/maybe.js";import{eachAlways as h,after as p}from"../../core/promiseUtils.js";import{watch as g,initial as d,whenOnce as m}from"../../core/reactiveUtils.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import S from"../../geometry/Point.js";import _ from"../../geometry/SpatialReference.js";import{getPointFromGeometry as v,getPointWithElevation as w}from"../../geometry/support/geometryUtils.js";import{onLocaleChange as b}from"../../intl/locale.js";import{fetchMessageBundle as x}from"../../intl/messages.js";import L from"../../portal/Portal.js";import{isApiKeyApplicable as I}from"../../support/apiKeyUtils.js";import T from"../../symbols/PictureMarkerSymbol.js";import R from"../../symbols/SimpleFillSymbol.js";import E from"../../symbols/SimpleLineSymbol.js";import F from"../../symbols/TextSymbol.js";import{highlightsSupported as j}from"../../views/support/layerViewUtils.js";import P from"./LayerSearchSource.js";import C from"./LocatorSearchSource.js";import G from"./SearchSource.js";import{isArcGISWorldGeocoder as O,meteredArcGISLocatorUrl as A,isProxiedArcGISWorldGeocoder as N,isMeteredArcGISWorldGeocoder as D}from"./support/locatorUtils.js";import{supported as M,getCurrentPosition as V,positionToPoint as k}from"../support/geolocationUtils.js";import J from"../support/GoTo.js";function U(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const H=()=>x("esri/widgets/Search/t9n/Search"),B="highlight",Q=l.ofType({key:e=>e.layer?"layer":"locator",base:G,typeMap:{layer:P,locator:C}}),Z=_.WGS84,q="esri/images/search/search-symbol-32.png",z=/<[\s\S]*?>/g,K=-1;let W=class extends(J(n.EventedMixin(o))){constructor(e){super(e),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new Q,this.defaultSymbols={point:new T({url:t(q),size:24,width:24,height:24}),polyline:new E({color:[130,130,130,1],width:2}),polygon:new R({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=L.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new Q,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const e=await H();this.messages=e,this.defaultPopupTemplate=new s({title:e.searchResult,content:"{Match_addr}"})};e(),this.addHandles([g((()=>[this.includeDefaultSources,this.view,this.portal]),(()=>this._update()),d),b(e)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=K}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:K}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new Q;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get locationEnabled(){return this._get("locationEnabled")||M()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=M();if(e&&!t){const e=new a("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});u.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===K)return r??"";const s=e.at(t);return s?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),s=(async()=>{try{await this.when();const e=await this._getResultsFromSources(r,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(s,e,r);const o=this._getFirstResult(s.results),i=r.location&&o?o.name:r.text,l=i?.replace(z,"");return this._set("searchTerm",l),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",s.results),this._set("resultCount",s.results.reduce(((e,t)=>e+(t.results?.length??0)),0)),this.emit("search-complete",s),await this._selectFirstResult(o),s}finally{this._clearSearching()}})();return this._searching=s,s}async searchNearby(e){if(!this.locationEnabled){const e=new a("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw u.getLogger(this).error(e),e}const t=(async()=>{try{const t=await V(),r=await k({position:t,view:this.view},e);return await this.search(r,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new a("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});throw u.getLogger(this).error(t),t}const{view:t}=this,s=U(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=s?this.allSources.at(s):null;if(!o){const e=new a("select:missing-source","Cannot select without a source.",{source:o});throw u.getLogger(this).error(e),e}const i=o instanceof P?this._getLayerSourcePopupTemplate(o):o.popupTemplate,l=o.resultSymbol||this._getDefaultSymbol(e),n=U(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,c=U(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,p=U(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,g=p?i||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new a("select:missing-feature","Cannot select without a feature.",{feature:d});throw u.getLogger(this).error(e),e}const{attributes:m,geometry:y,layer:f,sourceLayer:S}=d,_=y?v(y):null,b={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=_?w(_,t):Promise.resolve(_)},x=await h(b),L=x.layerViewQuery.value,I=x.elevationQuery.value;l instanceof F&&(l.text=e.name);const T=t&&c?e.target||e.extent:null,R=null!=T?this._goToSearchResult(T):Promise.resolve();await R;const E=L?d:new r({geometry:y,symbol:l,attributes:m,layer:f,sourceLayer:S,popupTemplate:g}),C=t?.popup,G=C&&p&&E.getEffectivePopupTemplate(C.defaultPopupTemplateEnabled);return G&&await t.openPopup({features:[E],location:I}),L&&j(L)&&!G&&this._highlightFeature({graphic:E,layerView:L}),!L&&n&&t&&t.graphics.push(E),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",E),this.emit("select-result",{result:e,source:o,sourceIndex:s}),e}async suggest(e,t,r){const s=e||this.searchTerm;this.emit("suggest-start",{searchTerm:s}),await this._suggestTimer(t,r);const o=await this._suggestImmediate(s,r);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce(((e,t)=>e+(t.results?.length??0)),0)??null),this.emit("suggest-complete",o),o}async when(){await m((()=>!this.updating))}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=h([e?.load(),t?.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}await m((()=>this.messages)),this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map((e=>{if(!1===e.placefinding)return;const t=O(e.url)&&I(e.url)?{url:A}:null,r=C.fromJSON({...e,...t}),s=r.url;if(O(s)||N(s)||D(s)){const e=r.outFields??["Addr_type","Match_addr","StAddr","City"],t=(r.placeholder||this.messages?.placeholder)??"",s="number"==typeof r.defaultZoomScale?r.defaultZoomScale:2500;r.singleLineFieldName="SingleLine",r.outFields=e,r.placeholder=t,r.defaultZoomScale=s}return r.singleLineFieldName?r:void 0})).filter(i)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach((e=>e?.destroy())),this._createdFeatureLayers=[]}_getLayerSources(e,t){const r=this.view?.map;return e.map((e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(i).toArray()}_getTableSources(e,t){const r=this.view?.map;return e.map((e=>{if(!e.id)return;const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=P.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then((e=>{i.layer=e})),i})).filter(i).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:r,hintText:s,layers:o,tables:i}=t;if(!r)return[];return[...this._getLayerSources(o,s),...this._getTableSources(i,s)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find((e=>e.id===t.subLayer));if(!r)throw new Error;const s=await(r.createFeatureLayer?.());if(!s)throw new Error;return this._createdFeatureLayers.push(s),s}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find((e=>e.id===t.subLayer));if("building-component"!==r?.type)throw new Error;if(await r.load(),null==r.associatedLayer)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,t){if("feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type)return e;if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(r){const t=new a("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return u.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):null}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){const e=this.view?.popup,{resultGraphic:t}=this;if(!e||!t)return;const r="selectedFeature"in e,s=r?e.selectedFeature:null;r&&(s&&s===t)&&e.close()}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return p(r,null,t?.signal)}_createLocationForSearch(e){return e instanceof r&&e.geometry?v(e.geometry):e instanceof S?e:Array.isArray(e)&&2===e.length?new S({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&U(e,"key")&&U(e,"text")&&U(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,i=!e&&s&&o,l=i&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=i&&s.location;return l||a?s:{location:t,text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){return c(e,(({results:e})=>e?.[0]))??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const r=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(s,r),s}_formatSourceResponse(e,t,r){const s=t?.value||[],o=t?.error,i=this.allSources.at(r);if(o){const t={sourceIndex:r,source:i,error:o};e.errors.push(t),u.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:r,source:i,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===K){const s=r&&U(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach(((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)}))}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&U(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new a("search:no-sources-defined","At least one source is required.",{allSources:r});throw u.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getResultsFromSource(e,s,t))})):o.push(this._getResultsFromSource(e,s,t)),h(o)}async _getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new a("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw u.getLogger(this).error(e),e}return s===K?r.forEach(((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))})):o.push(this._getSuggestionsFromSource(e,s,t)),h(o)}async _getResultsFromSource(e,t,r){const s=null!=t?this.allSources.at(t):null;if(!s)return null;const{location:o=null}=e,i=this.view?.spatialReference||Z,l=U(s,"maxResults")?s.maxResults:this.maxResults,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch,{view:n}=this;return s.getResults?.({view:n,sourceIndex:t,location:o,suggestResult:e,spatialReference:i,exactMatch:a,maxResults:l},r)}async _getSuggestionsFromSource(e,t,r){const s=this.allSources.at(t);if(!s)return null;e??="";const o=U(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=U(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||Z,i=U(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(s instanceof P&&U(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return U(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return c(this.results??[],(({results:t,sourceIndex:r})=>{const s=t?.includes(e);return s?r:null}))??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const r={target:{target:e},options:{signal:t.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,r=e.feature?.geometry;if(null==r)return null;switch(r.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(B)}async _getLayerView(e){const{view:t}=this;if(!e||!t)return null;const{layer:r,sourceLayer:s}=e,o=r??s;return o&&"building-component"!==o.type&&"subtype-sublayer"!==o.type?(await t.when(),t.whenLayerView(o)):null}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o,sourceLayer:i}=t,l=o??i,{objectIdField:a}=l,n=(a&&s?.[a])??null,u=r.highlight(n??t);this.addHandles(u,B)}_setResultFloor(e){const{view:t}=this,r=e.feature?.attributes,s=e.feature?.sourceLayer;if(s&&"floorInfo"in s&&s?.floorInfo?.floorField&&r){const e=r[s.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([y()],W.prototype,"_searching",void 0),e([y()],W.prototype,"_updatingPromise",void 0),e([y({readOnly:!0,value:null})],W.prototype,"activeSource",null),e([y()],W.prototype,"activeSourceIndex",null),e([y()],W.prototype,"allPlaceholder",null),e([y({readOnly:!0})],W.prototype,"allSources",null),e([y()],W.prototype,"autoNavigate",void 0),e([y()],W.prototype,"autoSelect",void 0),e([y({type:s})],W.prototype,"defaultPopupTemplate",void 0),e([y({readOnly:!0})],W.prototype,"defaultSources",void 0),e([y()],W.prototype,"defaultSymbols",void 0),e([y()],W.prototype,"includeDefaultSources",void 0),e([y()],W.prototype,"locationEnabled",null),e([y()],W.prototype,"maxInputLength",void 0),e([y()],W.prototype,"maxResults",void 0),e([y()],W.prototype,"maxSuggestions",void 0),e([y()],W.prototype,"messages",void 0),e([y()],W.prototype,"minSuggestCharacters",void 0),e([y({readOnly:!0})],W.prototype,"placeholder",null),e([y()],W.prototype,"popupEnabled",void 0),e([y({type:s})],W.prototype,"popupTemplate",void 0),e([y({type:L})],W.prototype,"portal",void 0),e([y()],W.prototype,"resultCount",void 0),e([y()],W.prototype,"resultGraphicEnabled",void 0),e([y({readOnly:!0})],W.prototype,"resultGraphic",void 0),e([y({readOnly:!0})],W.prototype,"results",void 0),e([y({readOnly:!0})],W.prototype,"selectedSuggestion",void 0),e([y()],W.prototype,"searchAllEnabled",void 0),e([y({readOnly:!0})],W.prototype,"selectedResult",void 0),e([y()],W.prototype,"searchTerm",null),e([y({type:Q})],W.prototype,"sources",void 0),e([y({readOnly:!0})],W.prototype,"state",null),e([y()],W.prototype,"suggestionDelay",void 0),e([y()],W.prototype,"suggestionCount",void 0),e([y({readOnly:!0})],W.prototype,"suggestions",void 0),e([y()],W.prototype,"suggestionsEnabled",void 0),e([y({readOnly:!0})],W.prototype,"updating",null),e([y()],W.prototype,"view",void 0),e([y()],W.prototype,"clear",null),W=e([f("esri.widgets.Search.SearchViewModel")],W);const X=W;export{X 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"../../../intl.js";import e from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import r from"../../../core/Logger.js";import{mappedFind as i}from"../../../core/maybe.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import l from"../../../geometry/Polygon.js";import{createExtentFromGeometry as o,scaleExtent as s}from"../../../geometry/support/geometryUtils.js";import u from"../../../rest/support/FullTextSearch.js";import{substitute as a}from"../../../intl/substitute.js";import{formatDate as c}from"../../../intl/date.js";const d=/https?:\/\/services.*\.arcgis\.com/i,f=/(?:\{([^}]+)\})/g,m=()=>r.getLogger("esri.widgets.Search.support.layerSearchUtils");function p(t,r){const{exactMatch:i=!1,location:l,maxResults:o,spatialReference:s,source:u,sourceIndex:a,suggestResult:c,view:d}=t,{layer:f,filter:p,zoomScale:g}=u,b=d?.scale,L=y(u,d),R=r?.signal;return x(f).then((()=>{const e=f.popupTemplate;return e?e.getRequiredFields(f.fieldsIndex):null})).then((t=>{const{objectIdField:r,returnZ:y}=f,x=S(u);if(!I(f,x))throw m().error("invalid-field: displayField is invalid."),new e("getResults():invalid-field","displayField is invalid.");const C=t?.length?t:[x],E=u.outFields||C,D=h(E);E.includes(r)||D||E.push(r),f.floorInfo?.floorField&&E.push(f.floorInfo.floorField);if(!(D||j(f,E)))throw m().error("invalid-field: outField is invalid."),new e("getResults():invalid-field","outField is invalid.");const A=f.createQuery(),{orderByFields:N}=u;if(N&&(A.orderByFields=N),s){A.outSpatialReference=s;const e=1/n(s);e&&(A.maxAllowableOffset=e)}const k="mesh"===f.geometryType||"multipatch"===f.geometryType,O=f.capabilities?.data?.supportsZ&&!k;if(A.returnZ=O&&!1!==y,A.returnGeometry=!0,A.multipatchOption=k?"xyFootprint":null,E&&(A.outFields=E),l)A.geometry=l;else if(c.key)A.objectIds=[c.key];else{const t=u.searchFields||[x];if(!j(f,t))throw m().error("invalid-field: search field is invalid."),new e("getResults():invalid-field","search field is invalid.");T(f)&&(A.num=o),L&&(A.geometry=L);const r=c.text?.trim();if(!r)return[];const n=c.text,{prefix:l="",suffix:s=""}=u,a=q(`${l}${n}${s}`);$(f)&&v(f,t)&&!i&&n&&(A.fullText=w({text:n,searchFields:t}));const d=M({searchTerm:a,layer:f,searchFields:t,filter:p,exactMatch:i,query:A,type:"search"});if(A.where=d,!F(A))return[]}return f.queryFeatures(A,{signal:R}).then((e=>Z(e,d,u,a,x,b,g)))}))}function g(t,r){const{source:i,spatialReference:n,view:l,suggestTerm:o,maxSuggestions:s,sourceIndex:u,exactMatch:a}=t,{layer:c,filter:d}=i,p=r?.signal,g=y(i,l);return x(c).then((()=>{if(!T(c))return[];const t=S(i),r=i.searchFields||[t],l=[];i.suggestionTemplate?i.suggestionTemplate.replaceAll(f,((e,t)=>(l.push(t),e))):l.push(t);const y=h(l);l.includes(c.objectIdField)||y||l.push(c.objectIdField);const x=I(c,t),b=y||j(c,l),L=j(c,r);if(!x)throw m().error("invalid-field: displayField is invalid."),new e("getSuggestions():invalid-field","displayField is invalid.");if(!b)throw m().error("invalid-field: outField is invalid."),new e("getSuggestions():invalid-field","outField is invalid.");if(!L)throw m().error("invalid-field: search field is invalid."),new e("getSuggestions():invalid-field","search field is invalid.");const R=c.createQuery(),{orderByFields:C}=i;C&&(R.orderByFields=C),R.outSpatialReference=n,R.returnGeometry=!1,R.num=s,R.outFields=l,g&&(R.geometry=g);if(!o.trim())return[];const{prefix:E="",suffix:D=""}=i,A=q(`${E}${o}${D}`);$(c)&&v(c,r)&&!a&&o&&(R.fullText=w({text:o,searchFields:r}));const N=M({searchTerm:A,layer:c,searchFields:r,filter:d,exactMatch:a,query:R,type:"suggest"});return R.where=N,F(R)?c.queryFeatures(R,{signal:p}).then((e=>B(e,i,u,t))):[]}))}function y(e,t){const{filter:r,withinViewEnabled:i}=e,n=t?.extent,l=r?.geometry;return l??(i&&n?n:void 0)}function h(e){return e&&e.includes("*")}async function x(e){e&&await e.load()}function F(e){return!(!e.fullText&&!e.where)}function v(e,t){const r=e?.indexes;if(!r||!t?.length)return!1;return r.filter((e=>"FullText"===e.indexType)).some((e=>{const r=e.fields?.split(",").map((e=>e.trim().toLowerCase()))||[];return t.every((e=>r.includes(e.toLowerCase())))}))}function w({text:e,searchFields:t}){return e.trim().split(" ").filter((e=>!!e.trim())).map((e=>new u({onFields:t,searchTerm:e,searchType:"prefix"})))}function $(e){return e?.capabilities?.query?.supportsFullTextSearch??!1}function T(e){return e?.capabilities?.query?.supportsPagination??!1}function b(e){return e?.fieldsIndex?.fields?.find((e=>"string"===e.type))?.name??""}function S(e){return e.displayField||e.layer.displayField||b(e.layer)}function j(e,t){return!(!e||!t?.length)&&t.every((t=>I(e,t)))}function I(e,t){return!!e.getField(t)}function L(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!0;return!1}function R({codedValues:e},t,r){return i(e??[],(e=>{const i=e.name,n=r?i:i.toLowerCase();return(r?t:t.toLowerCase())===n?e.code.toString():null}))??null}function q(e){return e.replaceAll("'","''")}function C(e,t){const r=t?.where;return r?`(${e}) AND (${r})`:e}function E({currentTerm:e,field:t,filter:r,exactMatch:i,url:n,type:l}){const o=t?.type,s=t?.name;if("string"===o||"date"===o||"global-id"===o){const t=d.test(n??""),o=t&&L(e)?"N":"";if(i&&"search"===l)return C(`${s} = ${o}'${e}'`,r);if(t){return C(`${s} LIKE ${o}${`'${e}%'`}`,r)}return C(`${`LOWER(${s})`} LIKE ${o}${`'${e.toLowerCase()}%'`}`,r)}if("oid"===o||"small-integer"===o||"integer"===o||"single"===o||"double"===o){const t=Number(e);return isNaN(t)?null:C(`${s} = ${t}`,r)}return C(`${s} = ${e}`,r)}function D(e,t){return e?` OR (${t})`:`(${t})`}function M({searchTerm:e,layer:t,searchFields:r,filter:i,exactMatch:n,query:l,type:o}){const{definitionExpression:s,url:u}=t;let a="";return!l.fullText&&e&&r&&r.forEach((r=>{const l=t.getField(r),s=t.getFieldDomain?.(r,{excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")}),c=(s&&"coded-value"===s.type?R(s,e,n):null)||e||null;if(null!==c){const e=E({currentTerm:c,field:l,filter:i,exactMatch:n,url:u,type:o});e&&(a+=D(a,e))}})),s&&a?`(${s}) AND (${a})`:s||a}function A(e,t){let r=null;const{codedValues:i}=e;return i&&i.length&&i.some((e=>e.code===t&&(r=e.name,!0))),r}function N(e,t){return e[t]??e[Object.keys(e).find((e=>e.toLowerCase()===t.toLowerCase()))]}function k(e,t,r){const i=e.sourceLayer,{attributes:n}=e,l=i.getFieldDomain?.(r,{feature:e,excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")});if(t)return a(t,n);if(r&&n){const e=i.getField(r),t=N(n,r);return null==t?"":l&&"coded-value"===l.type?A(l,t)??"":"date"===e?.type?c(new Date(t)):"number"==typeof t?t.toString():"string"!=typeof t?"":t.trim()}return""}function O(e,t,r,i){const n=e.sourceLayer,{attributes:l}=e,{objectIdField:o}=n,s=o?l[o]:null;return{text:k(e,t.suggestionTemplate,i),key:s,sourceIndex:r}}function B(e,t,r,i){return e.features.map((e=>O(e,t,r,i)))}function U(e){return null!=e&&null!=e.minScale&&null!=e.maxScale}function V(e,r,i,n,u,a,c){const d=e.clone(),f=e.sourceLayer,m=f?.objectIdField,p=m?e.attributes[m]:null,g=k(e,i.searchTemplate,u);null!=a&&U(f)&&(f.minScale&&f.minScale<a?a=f.minScale:f.maxScale&&f.maxScale>a&&(a=f.maxScale));const y=d.geometry?o(d.geometry,r??void 0,a??void 0):void 0,h="number"==typeof c&&y?s(t(y),r??void 0,c):y,x=e.clone();return null!=h&&(x.geometry=l.fromExtent(h)),{extent:h,target:x,feature:d,key:p,name:g,sourceIndex:n}}function Z(e,t,r,i,n,l,o){return e.features.map((e=>V(e,t,r,i,n,l,o)))}export{w as createFullTextSearchInfos,p as getResults,g as getSuggestions};
5
+ import"../../../intl.js";import e from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import r from"../../../core/Logger.js";import{mappedFind as i}from"../../../core/maybe.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import l from"../../../geometry/Polygon.js";import{createExtentFromGeometry as o,scaleExtent as s}from"../../../geometry/support/geometryUtils.js";import u from"../../../rest/support/FullTextSearch.js";import{substitute as a}from"../../../intl/substitute.js";import{formatDate as c}from"../../../intl/date.js";const d=/https?:\/\/services.*\.arcgis\.com/i,f=/(?:\{([^}]+)\})/g,m=()=>r.getLogger("esri.widgets.Search.support.layerSearchUtils");function p(t,r){const{exactMatch:i=!1,location:l,maxResults:o,spatialReference:s,source:u,sourceIndex:a,suggestResult:c,view:d}=t,{layer:f,filter:p,zoomScale:g}=u,b=d?.scale,L=y(u,d),R=r?.signal;return x(f).then((()=>{const e=f.popupTemplate;return e?e.getRequiredFields(f.fieldsIndex):null})).then((t=>{const{objectIdField:r,returnZ:y}=f,x=S(u);if(!I(f,x))throw m().error("invalid-field: displayField is invalid."),new e("getResults():invalid-field","displayField is invalid.");const C=t?.length?t:[x],E=u.outFields||C,D=h(E);E.includes(r)||D||E.push(r),f.floorInfo?.floorField&&E.push(f.floorInfo.floorField);if(!(D||j(f,E)))throw m().error("invalid-field: outField is invalid."),new e("getResults():invalid-field","outField is invalid.");const A=f.createQuery(),{orderByFields:N}=u;if(N&&(A.orderByFields=N),s){A.outSpatialReference=s;const e=1/n(s);e&&(A.maxAllowableOffset=e)}const k="mesh"===f.geometryType||"multipatch"===f.geometryType,O=f.capabilities?.data?.supportsZ&&!k;if(A.returnZ=O&&!1!==y,A.returnGeometry=!0,A.multipatchOption=k?"xyFootprint":null,E&&(A.outFields=E),l)A.geometry=l;else if(c.key)A.objectIds=[c.key];else{const t=u.searchFields||[x];if(!j(f,t))throw m().error("invalid-field: search field is invalid."),new e("getResults():invalid-field","search field is invalid.");T(f)&&(A.num=o),L&&(A.geometry=L);const r=c.text?.trim();if(!r)return[];const n=c.text,{prefix:l="",suffix:s=""}=u,a=q(`${l}${n}${s}`);$(f)&&v(f,t)&&!i&&n&&(A.fullText=w({text:n,searchFields:t}));const d=M({searchTerm:a,layer:f,searchFields:t,filter:p,exactMatch:i,query:A,type:"search"});if(A.where=d,!F(A))return[]}return f.queryFeatures(A,{signal:R}).then((e=>Z(e,d,u,a,x,b,g)))}))}function g(t,r){const{source:i,spatialReference:n,view:l,suggestTerm:o,maxSuggestions:s,sourceIndex:u,exactMatch:a}=t,{layer:c,filter:d}=i,p=r?.signal,g=y(i,l);return x(c).then((()=>{if(!T(c))return[];const t=S(i),r=i.searchFields||[t],l=[];i.suggestionTemplate?i.suggestionTemplate.replaceAll(f,((e,t)=>(l.push(t),e))):l.push(t);const y=h(l);l.includes(c.objectIdField)||y||l.push(c.objectIdField);const x=I(c,t),b=y||j(c,l),L=j(c,r);if(!x)throw m().error("invalid-field: displayField is invalid."),new e("getSuggestions():invalid-field","displayField is invalid.");if(!b)throw m().error("invalid-field: outField is invalid."),new e("getSuggestions():invalid-field","outField is invalid.");if(!L)throw m().error("invalid-field: search field is invalid."),new e("getSuggestions():invalid-field","search field is invalid.");const R=c.createQuery(),{orderByFields:C}=i;C&&(R.orderByFields=C),R.outSpatialReference=n,R.returnGeometry=!1,R.num=s,R.outFields=l,g&&(R.geometry=g);if(!o.trim())return[];const{prefix:E="",suffix:D=""}=i,A=q(`${E}${o}${D}`);$(c)&&v(c,r)&&!a&&o&&(R.fullText=w({text:o,searchFields:r}));const N=M({searchTerm:A,layer:c,searchFields:r,filter:d,exactMatch:a,query:R,type:"suggest"});return R.where=N,F(R)?c.queryFeatures(R,{signal:p}).then((e=>B(e,i,u,t))):[]}))}function y(e,t){const{filter:r,withinViewEnabled:i}=e,n=t?.extent,l=r?.geometry;return l??(i&&n?n:void 0)}function h(e){return e&&e.includes("*")}async function x(e){e&&await e.load()}function F(e){return!(!e.fullText&&!e.where)}function v(e,t){const r=e?.indexes;if(!r||!t?.length)return!1;return r.filter((e=>"FullText"===e.indexType)).some((e=>{const r=e.fields?.split(",").map((e=>e.trim().toLowerCase()))||[];return t.every((e=>r.includes(e.toLowerCase())))}))}function w({text:e,searchFields:t}){return e.trim().split(" ").filter((e=>!!e.trim())).map((e=>new u({onFields:t,searchTerm:e,searchType:"prefix"})))}function $(e){return e?.capabilities?.query?.supportsFullTextSearch??!1}function T(e){return e?.capabilities?.query?.supportsPagination??!1}function b(e){return e?.fieldsIndex?.fields?.find((e=>"string"===e.type))?.name??""}function S(e){return e.displayField||e.layer.displayField||b(e.layer)}function j(e,t){return!(!e||!t?.length)&&t.every((t=>I(e,t)))}function I(e,t){return!!e.getField(t)}function L(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!0;return!1}function R({codedValues:e},t,r){return i(e??[],(e=>{const i=e.name,n=r?i:i.toLowerCase();return(r?t:t.toLowerCase())===n?e.code.toString():null}))??null}function q(e){return e.replaceAll("'","''")}function C(e,t){const r=t?.where;return r?`(${e}) AND (${r})`:e}function E({currentTerm:e,field:t,filter:r,exactMatch:i,url:n,type:l}){const o=t?.type,s=t?.name;if("string"===o||"date"===o||"global-id"===o){const t=d.test(n??""),o=t&&L(e)?"N":"";if(i&&"search"===l)return C(`${s} = ${o}'${e}'`,r);if(t){return C(`${s} LIKE ${o}${`'${e}%'`}`,r)}return C(`${`LOWER(${s})`} LIKE ${o}${`'${e.toLowerCase()}%'`}`,r)}if("oid"===o||"small-integer"===o||"integer"===o||"single"===o||"double"===o){const t=Number(e);return isNaN(t)?null:C(`${s} = ${t}`,r)}return C(`${s} = ${e}`,r)}function D(e,t){return e?` OR (${t})`:`(${t})`}function M({searchTerm:e,layer:t,searchFields:r,filter:i,exactMatch:n,query:l,type:o}){const{definitionExpression:s,url:u}=t;let a="";return!l.fullText&&e&&r&&r.forEach((r=>{const l=t.getField(r),s=t.getFieldDomain?.(r,{excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")}),c=(s&&"coded-value"===s.type?R(s,e,n):null)||e||null;if(null!==c){const e=E({currentTerm:c,field:l,filter:i,exactMatch:n,url:u,type:o});e&&(a+=D(a,e))}})),s&&a?`(${s}) AND (${a})`:s||a}function A(e,t){let r=null;const{codedValues:i}=e;return i&&i.length&&i.some((e=>e.code===t&&(r=e.name,!0))),r}function N(e,t){return e[t]??e[Object.keys(e).find((e=>e.toLowerCase()===t.toLowerCase()))]}function k(e,t,r){const i=e.sourceLayer,{attributes:n}=e,l=i.getFieldDomain?.(r,{feature:e,excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")});if(t)return a(t,n);if(r&&n){const e=i.getField(r),t=N(n,r);return null==t?"":l&&"coded-value"===l.type?A(l,t)??"":"date"===e?.type?c(new Date(t)):"number"==typeof t?t.toString():"string"!=typeof t?"":t.trim()}return""}function O(e,t,r,i){const n=e.sourceLayer,{attributes:l}=e,{objectIdField:o}=n,s=o?l[o]:null;return{text:k(e,t.suggestionTemplate,i),key:s,sourceIndex:r}}function B(e,t,r,i){return e.features.map((e=>O(e,t,r,i)))}function U(e){return null!=e&&null!=e.minScale&&null!=e.maxScale}function V(e,r,i,n,u,a,c){const d=e.clone();d.layer=e.layer;const f=e.sourceLayer,m=f?.objectIdField,p=m?e.attributes[m]:null,g=k(e,i.searchTemplate,u);null!=a&&U(f)&&(f.minScale&&f.minScale<a?a=f.minScale:f.maxScale&&f.maxScale>a&&(a=f.maxScale));const y=d.geometry?o(d.geometry,r??void 0,a??void 0):void 0,h="number"==typeof c&&y?s(t(y),r??void 0,c):y,x=e.clone();return x.layer=e.layer,null!=h&&(x.geometry=l.fromExtent(h)),{extent:h,target:x,feature:d,key:p,name:g,sourceIndex:n}}function Z(e,t,r,i,n,l,o){return e.features.map((e=>V(e,t,r,i,n,l,o)))}export{w as createFullTextSearchInfos,p as getResults,g as getSuggestions};
@@ -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{Heading as e}from"./Heading.js";import{classes as t}from"./widgetUtils.js";import{tsx as n}from"./jsxFactory.js";const l="esri-item-list",i=`${l}__list-item`,r={filterContainerSticky:`${l}__filter-container--sticky`,group:`${l}__group`,groupHeader:`${l}__group__header`,item:i,itemDisabled:`${i}--disabled`,itemIcon:`${i}-icon`,itemContentEnd:`${i}-content-end`,noMatchesMessage:`${l}__no-matches-message`,scroller:`${l}__scroller`,scrollerEnabled:`${l}__scroller--enabled`},o=4;function s(e){const{disabled:t,filterText:l="",id:i,messages:r,onFilterChange:o,...s}=e;return n("div",{key:i},e.filterEnabled??1?c({disabled:t,filterText:l,id:i,messages:r,onFilterChange:o}):null,d({...s,disabled:t,enableListScroll:e.enableListScroll??!0,filterText:l,messages:r}))}function a(e){return!!e.items}function d(e){const{headingLevel:l,items:i,...o}=e;return 0===i.length?n("div",{class:r.noMatchesMessage,key:"no-matches"},e.messages.noMatches):n("div",{class:t({[r.scroller]:!0,[r.scrollerEnabled]:!!e.enableListScroll}),key:"item-container"},i.map((e=>a(e)?g({...o,group:e,headingLevel:l}):m({...o,grouped:!0,item:e}))))}function c(e){const{disabled:t,messages:l,filterText:i,enableListScroll:o}=e;return n("div",{class:o?void 0:r.filterContainerSticky,key:"filter"},n("calcite-input",{disabled:t,placeholder:l.filterPlaceholder,type:"search",value:i,onCalciteInputInput:t=>{const n=t.currentTarget;e.onFilterChange&&e.onFilterChange(n.value)}}))}function m(e){const{disabled:l,grouped:i,identify:o,item:s,onItemMouseEnter:a,onItemMouseLeave:d,onItemSelect:c,renderIcon:m,renderCustomItem:g,renderItemContent:p,renderItemContentEnd:f,renderItemLabel:v,renderItemDescription:_,renderItemActionEnd:h,renderItemTitle:I,selectedItem:y}=e,C=u(s,o),k=C===u(y,o),$=g?.(e);if($)return $;const L=p?.(s),M=f?.(s),E=h?.(s),S=!(!s.disabled&&!l),T=m?.(s);return n("calcite-list-item",{afterUpdate:e=>{e.selected=k},"aria-level":i?"2":"",class:t({[r.item]:!0,[r.itemDisabled]:S}),"data-item":s,description:L?void 0:_?.(s)??void 0,disabled:S,key:C,label:L?void 0:v?.(s)??s.label??void 0,onblur:e=>d?.(b(e)),onfocus:e=>a?.(b(e)),onmouseenter:e=>a?.(b(e)),onmouseleave:e=>d?.(b(e)),selected:k,title:I?.(s)??void 0,onCalciteListItemSelect:e=>{e.preventDefault(),c?.(b(e))}},T?n("div",{class:r.itemIcon,key:"content-start",slot:"content-start"},T):void 0,L?n("div",{key:"content",slot:"content"},L):null,M?n("div",{class:r.itemContentEnd,key:"content-end",slot:"content-end"},M):null,E??null)}function u(e,t){return e?`${t?.(e)||e.id}__${e.label}`:""}function b(e){return e.currentTarget["data-item"]}function g(t){const{disabled:l,group:i,headingLevel:s=o,selectionMode:a="none",renderCustomGroupContent:d,...c}=t,u=d?.(t);return n("div",{class:r.group,key:i.label??void 0},n(e,{class:r.groupHeader,level:s},i.label),u||n("calcite-list",{disabled:l,label:i.label??"",selectionAppearance:"border",selectionMode:a},i.items.map((e=>m({...c,disabled:l,item:e,grouped:!0})))))}export{s as ItemList,g as renderGroup,m as renderItem};
5
+ import{Heading as e}from"./Heading.js";import{classes as t}from"./widgetUtils.js";import{tsx as n}from"./jsxFactory.js";const l="esri-item-list",i=`${l}__list-item`,r={filterContainerSticky:`${l}__filter-container--sticky`,group:`${l}__group`,groupHeader:`${l}__group__header`,item:i,itemDisabled:`${i}--disabled`,itemIcon:`${i}-icon`,itemContentEnd:`${i}-content-end`,noMatchesMessage:`${l}__no-matches-message`,scroller:`${l}__scroller`,scrollerEnabled:`${l}__scroller--enabled`},o=4;function s(e){const{disabled:t,filterText:l="",id:i,messages:r,onFilterChange:o,...s}=e;return n("div",{key:i},e.filterEnabled??1?c({disabled:t,filterText:l,id:i,messages:r,onFilterChange:o}):null,d({...s,disabled:t,enableListScroll:e.enableListScroll??!0,filterText:l,messages:r}))}function a(e){return!!e.items}function d(e){const{headingLevel:l,items:i,...o}=e;return 0===i.length?n("div",{class:r.noMatchesMessage,key:"no-matches"},e.messages.noMatches):n("div",{class:t({[r.scroller]:!0,[r.scrollerEnabled]:!!e.enableListScroll}),key:"item-container"},i.map((e=>a(e)?g({...o,group:e,headingLevel:l}):m({...o,grouped:!0,item:e}))))}function c(e){const{disabled:t,messages:l,filterText:i,enableListScroll:o}=e;return n("div",{class:o?void 0:r.filterContainerSticky,key:"filter"},n("calcite-input",{disabled:t,placeholder:l.filterPlaceholder,type:"search",value:i,onCalciteInputInput:t=>{const n=t.currentTarget;e.onFilterChange&&e.onFilterChange(n.value)}}))}function m(e){const{disabled:l,identify:i,item:o,onItemMouseEnter:s,onItemMouseLeave:a,onItemSelect:d,renderIcon:c,renderCustomItem:m,renderItemContent:g,renderItemContentEnd:p,renderItemLabel:f,renderItemDescription:v,renderItemActionEnd:_,renderItemTitle:h,selectedItem:I}=e,y=u(o,i),C=y===u(I,i),k=m?.(e);if(k)return k;const $=g?.(o),L=p?.(o),M=_?.(o),E=!(!o.disabled&&!l),S=c?.(o);return n("calcite-list-item",{afterUpdate:e=>{e.selected=C},class:t({[r.item]:!0,[r.itemDisabled]:E}),"data-item":o,description:$?void 0:v?.(o)??void 0,disabled:E,key:y,label:$?void 0:f?.(o)??o.label??void 0,onblur:e=>a?.(b(e)),onfocus:e=>s?.(b(e)),onmouseenter:e=>s?.(b(e)),onmouseleave:e=>a?.(b(e)),selected:C,title:h?.(o)??void 0,onCalciteListItemSelect:e=>{e.preventDefault(),d?.(b(e))}},S?n("div",{class:r.itemIcon,key:"content-start",slot:"content-start"},S):void 0,$?n("div",{key:"content",slot:"content"},$):null,L?n("div",{class:r.itemContentEnd,key:"content-end",slot:"content-end"},L):null,M??null)}function u(e,t){return e?`${t?.(e)||e.id}__${e.label}`:""}function b(e){return e.currentTarget["data-item"]}function g(t){const{disabled:l,group:i,headingLevel:s=o,selectionMode:a="none",renderCustomGroupContent:d,...c}=t,u=d?.(t);return n("div",{class:r.group,key:i.label??void 0},n(e,{class:r.groupHeader,level:s},i.label),u||n("calcite-list",{disabled:l,label:i.label??"",selectionAppearance:"border",selectionMode:a},i.items.map((e=>m({...c,disabled:l,item:e,grouped:!0})))))}export{s as ItemList,g as renderGroup,m as renderItem};
@@ -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 t}from"../../../chunks/tslib.es6.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{fetchThumbnail as r}from"../symbolPreviewUtils.js";import o from"./ItemBase.js";let s=class extends o{constructor(t){super(t),this._title=null,this._thumbnail=null,this.graphic=null,this.layer=null,this.layerItem=null,this.thumbnailSize=24}get key(){return`${this.layer.id}:${this.objectId??this.graphic.uid}`}get metadata(){const{layerItem:t}=this;return{parentTitle:t.title??void 0,groupTitle:t.groupLayerItem?.title??void 0}}get objectId(){return this.graphic.getObjectId()}get title(){return this._title??this.objectId?.toString()}get thumbnail(){return this._thumbnail??void 0}async fetchThumbnail(){return this._thumbnail=await r(this.graphic,this.layer,{maxSize:this.thumbnailSize})}async sync(t){t.push(this._setFeatureTitle())}async _setFeatureTitle(){const{graphic:t,key:e,layer:i,viewModel:r}=this,o=r.featureTitleMap.get(e)||(i?.getFeatureTitle?await i.getFeatureTitle(t,{fetchMissingFields:!1}):null);o&&r.featureTitleMap.set(e,o),this._title=o}};t([e()],s.prototype,"_title",void 0),t([e()],s.prototype,"_thumbnail",void 0),t([e()],s.prototype,"graphic",void 0),t([e()],s.prototype,"key",null),t([e()],s.prototype,"layer",void 0),t([e()],s.prototype,"layerItem",void 0),t([e()],s.prototype,"metadata",null),t([e()],s.prototype,"objectId",null),t([e()],s.prototype,"title",null),t([e()],s.prototype,"thumbnail",null),t([e()],s.prototype,"thumbnailSize",void 0),s=t([i("esri.widgets.support.SelectionList.FeatureItem")],s);const l=s;export{l as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import{isSome as e}from"../../../core/arrayUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{fetchThumbnail as l}from"../symbolPreviewUtils.js";import s from"./ItemBase.js";let o=class extends s{constructor(t){super(t),this._title=null,this._thumbnail=null,this.graphic=null,this.layer=null,this.layerItem=null,this.thumbnailSize=24}get _filterTerms(){return[this.title,this.layerItem.title,this.layerItem.groupLayerItem?.title].filter(e)}get key(){return`${this.layer.id}:${this.objectId??this.graphic.uid}`}get objectId(){return this.graphic.getObjectId()}get title(){return this._title??this.objectId?.toString()}get thumbnail(){return this._thumbnail??void 0}get thumbnailKey(){return`${this.key}-${this.graphic.uid}`}get visible(){const{_filterTerms:t,viewModel:{activeLayerItem:e,filterText:i}}=this;if(e&&e.layer!==this.layer)return!1;if(null==i||""===i||!t.length)return!0;const r=new RegExp(i,"iu");return t.some((t=>r.test(t)))}async fetchThumbnail(t){return this._thumbnail=await l(this.graphic,this.layer,{maxSize:this.thumbnailSize,ariaLabel:t?.ariaLabel})}async sync(t){t.push(this._setFeatureTitle())}async _setFeatureTitle(){const{graphic:t,key:e,layer:i,viewModel:r}=this,l=r.featureTitleMap.get(e)||(i?.getFeatureTitle?await i.getFeatureTitle(t,{fetchMissingFields:!1}):null);l&&r.featureTitleMap.set(e,l),this._title=l}};t([i()],o.prototype,"_filterTerms",null),t([i()],o.prototype,"_title",void 0),t([i()],o.prototype,"_thumbnail",void 0),t([i()],o.prototype,"graphic",void 0),t([i()],o.prototype,"key",null),t([i()],o.prototype,"layer",void 0),t([i()],o.prototype,"layerItem",void 0),t([i()],o.prototype,"objectId",null),t([i()],o.prototype,"title",null),t([i()],o.prototype,"thumbnail",null),t([i()],o.prototype,"thumbnailKey",null),t([i()],o.prototype,"thumbnailSize",void 0),t([i()],o.prototype,"visible",null),o=t([r("esri.widgets.support.SelectionList.FeatureItem")],o);const a=o;export{a 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"../../../core/has.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import s from"./ItemBase.js";let o=class extends s{constructor(e){super(e),this.items=[],this.layer=null}get layers(){const{layer:e}=this;return"group"===e.type?e.layers.toArray().reverse():"subtype-group"===e.type?e.sublayers.toArray().reverse():[]}get maxVisibleFeatureCountExceeded(){return this.items.some((e=>e.maxVisibleFeatureCountExceeded))}get total(){return this.items.reduce(((e,r)=>e+r.total),0)}async sync({controller:e,promises:r}){const{layers:t,viewModel:s}=this;this.items=s.layersToItems({controller:e,groupLayerItem:this,layers:t,promises:r})}};e([r()],o.prototype,"items",void 0),e([r()],o.prototype,"layer",void 0),e([r()],o.prototype,"layers",null),e([r()],o.prototype,"maxVisibleFeatureCountExceeded",null),e([r()],o.prototype,"total",null),o=e([t("esri.widgets.support.SelectionList.GroupLayerItem")],o);const a=o;export{a as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import s from"./ItemBase.js";let o=class extends s{constructor(e){super(e),this.items=[],this.layer=null}get layers(){const{layer:e}=this;return"group"===e.type?e.layers.toArray().reverse():"subtype-group"===e.type?e.sublayers.toArray().reverse():[]}get maxVisibleFeatureCountExceeded(){return this.items.some((e=>e.maxVisibleFeatureCountExceeded))}get total(){return this.items.reduce(((e,t)=>e+t.total),0)}get visible(){return this.items.some((e=>e.visible))}get visibleTotal(){return this.items.reduce(((e,t)=>e+t.visibleTotal),0)}async sync({controller:e,promises:t}){const{layers:r,viewModel:s}=this;this.items=s.layersToItems({controller:e,groupLayerItem:this,layers:r,promises:t})}};e([t()],o.prototype,"items",void 0),e([t()],o.prototype,"layer",void 0),e([t()],o.prototype,"layers",null),e([t()],o.prototype,"maxVisibleFeatureCountExceeded",null),e([t()],o.prototype,"total",null),e([t()],o.prototype,"visible",null),e([t()],o.prototype,"visibleTotal",null),o=e([r("esri.widgets.support.SelectionList.GroupLayerItem")],o);const i=o;export{i 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{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import o from"./FeatureItem.js";import s from"./ItemBase.js";import{getSuggestedQueryOutFields as a}from"../Selector2D/selectorUtils.js";let i=class extends s{constructor(e){super(e),this._onChangeController=null,this.featureItems=[],this.groupLayerItem=null,this.layer=null}get effectiveObjectIds(){return this.objectIds.slice(0,this.maxVisibleFeatureCountPerLayer)}get maxVisibleFeatureCountExceeded(){return this.objectIds.length>this.viewModel.maxVisibleFeatureCountPerLayer}get maxVisibleFeatureCountPerLayer(){return this.viewModel.maxVisibleFeatureCountPerLayer}get objectIds(){return this.viewModel.effectiveSelectionManager?.getSelection(this.layer)??[]}get total(){return this.objectIds.length}cancel(){this._onChangeController?.abort()}async sync({controller:e,promises:t}){this.cancel();const r=this.featureItems.slice(),o=new Map(r.map((e=>[e.objectId,e]))),s=this.effectiveObjectIds.slice(),a=[],i=[];for(const n of s){const e=o.get(n);e?(a.push(e),t.push(e.sync(t))):i.push(n)}if(this._onChangeController=e,i.length>0){const r=await this._createFeatureItems(i,e);for(const e of r)a.push(e),t.push(e.sync(t))}e.signal.aborted||(this.featureItems=a)}async _createFeatureItems(e,t){const{layer:r,layerView:s,viewModel:i}=this,n=new Map;if(s){const r=s.createQuery();r.objectIds=e,r.outFields=["*"],r.returnGeometry=!0;const o=await s.queryFeatures(r,t);for(const e of o.features){const t=e.getObjectId();null!=t&&n.set(t,e)}}if(t.signal.aborted)return[];const l=e.filter((e=>!n.has(e)));if(l.length){const{view:e}=this,o=r.createQuery();o.objectIds=l,o.outSpatialReference=e?.spatialReference,o.outFields=e?a(r,e,!0):["*"],o.returnGeometry=!0;const s=await r.queryFeatures(o,t);for(const t of s.features){const e=t.getObjectId();null!=e&&n.set(e,t)}}return Array.from(n.values()).map((e=>new o({graphic:e,layer:r,layerItem:this,viewModel:i})))}};e([t()],i.prototype,"_onChangeController",void 0),e([t()],i.prototype,"effectiveObjectIds",null),e([t()],i.prototype,"featureItems",void 0),e([t()],i.prototype,"groupLayerItem",void 0),e([t()],i.prototype,"layer",void 0),e([t()],i.prototype,"maxVisibleFeatureCountExceeded",null),e([t()],i.prototype,"maxVisibleFeatureCountPerLayer",null),e([t()],i.prototype,"objectIds",null),e([t()],i.prototype,"total",null),i=e([r("esri.widgets.support.SelectionList.LayerItem")],i);const n=i;export{n as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import o from"./FeatureItem.js";import s from"./ItemBase.js";import{getSuggestedQueryOutFields as i}from"../Selector2D/selectorUtils.js";let a=class extends s{constructor(e){super(e),this._onChangeController=null,this.featureItems=[],this.groupLayerItem=null,this.layer=null}get effectiveObjectIds(){return this.objectIds.slice(0,this.maxVisibleFeatureCountPerLayer)}get maxVisibleFeatureCountExceeded(){const{viewModel:e}=this;return this.objectIds.length>e.maxVisibleFeatureCountPerLayer&&this.visibleTotal===e.maxVisibleFeatureCountPerLayer}get maxVisibleFeatureCountPerLayer(){return this.viewModel.maxVisibleFeatureCountPerLayer}get objectIds(){return this.viewModel.effectiveSelectionManager?.getSelection(this.layer)??[]}get total(){return this.objectIds.length}get visible(){return this.featureItems.some((e=>e.visible))}get visibleTotal(){let e=0;return this.featureItems.forEach((t=>t.visible&&e++)),e}cancel(){this._onChangeController?.abort()}async sync({controller:e,promises:t}){this.cancel();const r=this.featureItems.slice(),o=new Map(r.map((e=>[e.objectId,e]))),s=this.effectiveObjectIds.slice(),i=[],a=[];for(const l of s){const e=o.get(l);e?(i.push(e),t.push(e.sync(t))):a.push(l)}if(this._onChangeController=e,a.length>0){const r=await this._createFeatureItems(a,e);for(const e of r)i.push(e),t.push(e.sync(t))}e.signal.aborted||(this.featureItems=i)}async _createFeatureItems(e,t){const{layer:r,layerView:s,viewModel:a}=this,l=new Map;if(s){const r=s.createQuery();r.objectIds=e,r.outFields=["*"],r.returnGeometry=!0;const o=await s.queryFeatures(r,t);for(const e of o.features){const t=e.getObjectId();null!=t&&l.set(t,e)}}if(t.signal.aborted)return[];const n=e.filter((e=>!l.has(e)));if(n.length){const{view:e}=this,o=r.createQuery();o.objectIds=n,o.outSpatialReference=e?.spatialReference,o.outFields=e?i(r,e,!0):["*"],o.returnGeometry=!0;const s=await r.queryFeatures(o,t);for(const t of s.features){const e=t.getObjectId();null!=e&&l.set(e,t)}}return Array.from(l.values()).map((e=>new o({graphic:e,layer:r,layerItem:this,viewModel:a})))}};e([t()],a.prototype,"_onChangeController",void 0),e([t()],a.prototype,"effectiveObjectIds",null),e([t()],a.prototype,"featureItems",void 0),e([t()],a.prototype,"groupLayerItem",void 0),e([t()],a.prototype,"layer",void 0),e([t()],a.prototype,"maxVisibleFeatureCountExceeded",null),e([t()],a.prototype,"maxVisibleFeatureCountPerLayer",null),e([t()],a.prototype,"objectIds",null),e([t()],a.prototype,"total",null),e([t()],a.prototype,"visible",null),e([t()],a.prototype,"visibleTotal",null),a=e([r("esri.widgets.support.SelectionList.LayerItem")],a);const l=a;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"../../../core/Accessor.js";import o from"../../../core/Logger.js";import{removeMaybe as r}from"../../../core/maybe.js";import{ignoreAbortErrors as i,debounce as s}from"../../../core/promiseUtils.js";import{watch as a,on as l}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../core/support/UpdatingHandles.js";import{isSubtypeGroupLayer as p,isSubtypeSublayer as g}from"../../../layers/support/layerUtils.js";import{isSelectableLayer as y}from"../../../views/support/selectionUtils.js";import{goTo as m}from"../goToUtils.js";import u from"./GroupLayerItem.js";import f from"./LayerItem.js";import{computeEffectiveCount as d,getNestedLayerItems as v,isLayerItem as S,isGroupLayerItem as I,getNestedFeatureItems as C}from"./selectionListUtils.js";const b=100;let _=class extends t{constructor(e){super(e),this._groupItemCache=new Map,this._hoverHighlightHandle=null,this._layerItemCache=new Map,this._allLayerItems=null,this._onChangeAbortController=null,this._updatingHandles=new h,this.featureTitleMap=new Map,this.filterText=void 0,this.layer=null,this.maxVisibleFeatureCountPerLayer=500,this.selectionManager=null,this._onSelectionChangeController=async()=>{this._cancelOnSelectionChange();const e=new AbortController;this._onChangeAbortController=e,await this._updatingHandles.addPromise(i(this._onSelectionChange(e))),this._onChangeAbortController===e&&(this._onChangeAbortController=null);const t=this.layer&&this.effectiveSelectionManager?.getSelection(this.layer);t?.length||(this.layer=null)},this._cancelOnSelectionChange=()=>this._onChangeAbortController?.abort(),this._onSelectionChangeDebounced=s(this._onSelectionChangeController,b)}initialize(){this.addHandles([a((()=>[this.view,this.effectiveSelectionManager]),(()=>this._onSelectionChangeDebounced())),l((()=>this.effectiveSelectionManager?.sources),"change",(()=>this._onSelectionChangeDebounced())),l((()=>this.effectiveSelectionManager),"selection-change",(()=>this._onSelectionChangeDebounced()))])}destroy(){this.removeTemporaryHighlight(),this._updatingHandles.destroy()}get activeLayerItem(){const{layer:e}=this;return e&&this.layerItems.find((t=>t.layer===e))}get allLayerItems(){return this._allLayerItems??[]}get effectiveCount(){return d(this.allLayerItems)}get effectiveSelectionManager(){return this.selectionManager??this.view?.selectionManager}get isUpdating(){return!(!this._onChangeAbortController&&!this._updatingHandles.updating)}get layerItems(){return v(this.allLayerItems)}get layerViewMap(){const e=new Map,{view:t}=this;if(!t)return e;for(const o of t.allLayerViews)if(e.set(o.layer.id,o),p(o.layer))for(const t of o.layer.sublayers)e.set(t.id,o);return e}get maxVisibleFeatureCountExceeded(){return this.allLayerItems.some((e=>e.maxVisibleFeatureCountExceeded))}get selectionSources(){const e=this.effectiveSelectionManager,t=new Set;if(e?.sources)for(const o of e.sources)t.add(o);return t}get state(){const{view:e}=this;return e?e.ready?this.effectiveSelectionManager?"ready":"error":"loading":"disabled"}get viewLayersAndTables(){const{view:e}=this;return e?.map?[...e.map.layers.toArray().reverse(),...e.map.tables.toArray().reverse()]:[]}get visibleLayerCount(){const{effectiveSelectionManager:e}=this;return e&&0!==e.count?1===e.count||this.activeLayerItem?1:this.layerItems.length:0}get visibleFeatureCount(){const{activeLayerItem:e}=this;if(e)return e.maxVisibleFeatureCountExceeded?e.maxVisibleFeatureCountPerLayer:e.total;let t=0;for(const o of this.layerItems)t+=o.maxVisibleFeatureCountExceeded?o.maxVisibleFeatureCountPerLayer:o.total;return t}addTemporaryHighlight({graphic:e,layerView:t}){this.removeTemporaryHighlight(),t&&e&&(this._hoverHighlightHandle=t.highlight(e,{name:"temporary"}))}clear(){this.effectiveSelectionManager?.clear()}deselectFeatureItem(e){const t=e.graphic.getObjectId();null!=t&&this.effectiveSelectionManager?.removeFromSelection(e.layer,[t])}deselectGroupItem(e){e.items.forEach((e=>{S(e)?this.deselectLayerItem(e):this.deselectGroupItem(e)}))}deselectLayerItem(e){this.effectiveSelectionManager?.setSelection(e.layer,[])}deselectItem(e){I(e)?this.deselectGroupItem(e):S(e)?this.deselectLayerItem(e):this.deselectFeatureItem(e)}goToItem(e){S(e)||I(e)?this._goTo(C([e]).map((e=>e.graphic))):this._goTo(e.graphic)}layersToItems(e){const{controller:t,groupLayerItem:o,layers:r,promises:i}=e,{_groupItemCache:s,_layerItemCache:a,effectiveSelectionManager:l,viewLayersAndTables:n}=this,c=r??n;if(!l)return[];const h=[];for(const p of c)switch(p.type){case"subtype-group":case"group":{const e=s.get(p),o=e??new u({layer:p,viewModel:this});e||s.set(p,o),i.push(o.sync({controller:t,promises:i})),h.push(o)}break;default:if(y(p)||g(p)){const e=p,r=l.getSelection(e);if(!r?.length)continue;const s=a.get(e),n=s??new f({groupLayerItem:o,layer:e,viewModel:this});s||a.set(e,n),i.push(n.sync({controller:t,promises:i})),h.push(n)}}return h}removeFromSelection(e){this.effectiveSelectionManager?.removeFromSelection(e.layer,e.objectIds)}removeTemporaryHighlight(){this._hoverHighlightHandle=r(this._hoverHighlightHandle)}selectSingleFeatureItem(e){const t=e.objectId;if(null!=t&&this.effectiveSelectionManager)for(const{layer:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:o,objectIds:o===e.layer?[t]:[]})}selectSingleGroupItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t.parent===e.layer?o:[]})}selectSingleItem(e){I(e)?this.selectSingleGroupItem(e):S(e)?this.selectSingleLayerItem(e):this.selectSingleFeatureItem(e)}selectSingleLayerItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t===e.layer?o:[]})}setSelection(e){this.effectiveSelectionManager?.setSelection(e.layer,e.objectIds)}async _goTo(e){const{view:t}=this;if(t)try{await m(t,e)}catch(r){"AbortError"!==r.name&&o.getLogger(this).warn("Failed to go to feature(s)",r)}}async _onSelectionChange(e){try{this.removeTemporaryHighlight();const t=[],o=this.layersToItems({controller:e,promises:t});t.length>0&&await Promise.all(t),this._onChangeAbortController===e&&(this._allLayerItems=o)}catch(t){o.getLogger(this).warn("Failed updating selection",t)}}};e([n()],_.prototype,"_groupItemCache",void 0),e([n()],_.prototype,"_hoverHighlightHandle",void 0),e([n()],_.prototype,"_layerItemCache",void 0),e([n()],_.prototype,"_allLayerItems",void 0),e([n()],_.prototype,"_onChangeAbortController",void 0),e([n()],_.prototype,"activeLayerItem",null),e([n()],_.prototype,"allLayerItems",null),e([n()],_.prototype,"effectiveCount",null),e([n()],_.prototype,"effectiveSelectionManager",null),e([n()],_.prototype,"featureTitleMap",void 0),e([n()],_.prototype,"filterText",void 0),e([n()],_.prototype,"isUpdating",null),e([n()],_.prototype,"layer",void 0),e([n()],_.prototype,"layerItems",null),e([n()],_.prototype,"layerViewMap",null),e([n()],_.prototype,"maxVisibleFeatureCountExceeded",null),e([n()],_.prototype,"maxVisibleFeatureCountPerLayer",void 0),e([n()],_.prototype,"selectionManager",void 0),e([n()],_.prototype,"selectionSources",null),e([n()],_.prototype,"state",null),e([n()],_.prototype,"view",void 0),e([n()],_.prototype,"viewLayersAndTables",null),e([n()],_.prototype,"visibleLayerCount",null),e([n()],_.prototype,"visibleFeatureCount",null),_=e([c("esri.widgets.support.SelectionList.SelectionListViewModel")],_);const L=_;export{L as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/Logger.js";import{removeMaybe as o}from"../../../core/maybe.js";import{ignoreAbortErrors as i,debounce as s}from"../../../core/promiseUtils.js";import{watch as l,on as a}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../core/support/UpdatingHandles.js";import{isSubtypeGroupLayer as p,isSubtypeSublayer as g}from"../../../layers/support/layerUtils.js";import{isSelectableLayer as m}from"../../../views/support/selectionUtils.js";import{goTo as y}from"../goToUtils.js";import u from"./GroupLayerItem.js";import f from"./LayerItem.js";import{computeEffectiveCount as d,getNestedLayerItems as v,isLayerItem as I,isGroupLayerItem as S,getNestedFeatureItems as C}from"./selectionListUtils.js";const b=100;let _=class extends t{constructor(e){super(e),this._groupItemCache=new Map,this._hoverHighlightHandle=null,this._layerItemCache=new Map,this._allLayerItems=null,this._onChangeAbortController=null,this._updatingHandles=new h,this.featureTitleMap=new Map,this.filterText=void 0,this.layer=null,this.maxVisibleFeatureCountPerLayer=500,this.selectionManager=null,this._onSelectionChangeController=async()=>{this._cancelOnSelectionChange();const e=new AbortController;this._onChangeAbortController=e,await this._updatingHandles.addPromise(i(this._generateListItems(e))),this._onChangeAbortController===e&&(this._onChangeAbortController=null);const t=this.layer&&this.effectiveSelectionManager?.getSelection(this.layer);t?.length||(this.layer=null)},this._cancelOnSelectionChange=()=>this._onChangeAbortController?.abort(),this._onSelectionChangeDebounced=s(this._onSelectionChangeController,b)}initialize(){this.addHandles([l((()=>[this.view,this.effectiveSelectionManager]),(()=>this._onSelectionChange())),a((()=>this.effectiveSelectionManager?.sources),"change",(()=>this._onSelectionChange())),a((()=>this.effectiveSelectionManager),"selection-change",(()=>this._onSelectionChange()))])}destroy(){this.removeTemporaryHighlight(),this._updatingHandles.destroy()}get activeLayerItem(){const{layer:e}=this;return e&&this.layerItems.find((t=>t.layer===e))}get allLayerItems(){return this._allLayerItems??[]}get effectiveCount(){return d(this.allLayerItems)}get effectiveSelectionManager(){return this.selectionManager??this.view?.selectionManager}get isUpdating(){return!(!this._onChangeAbortController&&!this._updatingHandles.updating)}get layerItems(){return v(this.allLayerItems)}get layerViewMap(){const e=new Map,{view:t}=this;if(!t)return e;for(const r of t.allLayerViews)if(e.set(r.layer.id,r),p(r.layer))for(const t of r.layer.sublayers)e.set(t.id,r);return e}get maxVisibleFeatureCountExceeded(){return this.allLayerItems.some((e=>e.maxVisibleFeatureCountExceeded))}get state(){const{view:e}=this;return e?e.ready?this.effectiveSelectionManager?"ready":"error":"loading":"disabled"}get viewLayersAndTables(){const{view:e}=this;return e?.map?[...e.map.layers.toArray().reverse(),...e.map.tables.toArray().reverse()]:[]}get visibleFeatureCount(){return this.activeLayerItem?.visibleTotal??this.visibleFeatureItems.length}get visibleFeatureItems(){return this.layerItems.flatMap((e=>e.featureItems.filter((e=>e.visible))))}get visibleLayerCount(){const{effectiveSelectionManager:e}=this;return e&&0!==e.count?1===e.count||this.activeLayerItem?1:this.layerItems.filter((e=>e.visible)).length:0}addTemporaryHighlight({graphic:e,layerView:t}){this.removeTemporaryHighlight(),t&&e&&(this._hoverHighlightHandle=t.highlight(e,{name:"temporary"}))}clear(){this.effectiveSelectionManager?.clear()}deselectFeatureItem(e){const t=e.graphic.getObjectId();null!=t&&this.effectiveSelectionManager?.removeFromSelection(e.layer,[t])}deselectGroupItem(e){e.items.forEach((e=>{I(e)?this.deselectLayerItem(e):this.deselectGroupItem(e)}))}deselectLayerItem(e){this.effectiveSelectionManager?.setSelection(e.layer,[])}deselectItem(e){S(e)?this.deselectGroupItem(e):I(e)?this.deselectLayerItem(e):this.deselectFeatureItem(e)}goToItem(e){I(e)||S(e)?this._goTo(C([e]).map((e=>e.graphic))):this._goTo(e.graphic)}layersToItems(e){const{controller:t,groupLayerItem:r,layers:o,promises:i}=e,{_groupItemCache:s,_layerItemCache:l,effectiveSelectionManager:a,viewLayersAndTables:n}=this,c=o??n;if(!a)return[];const h=[];for(const p of c)switch(p.type){case"subtype-group":case"group":{const e=s.get(p),r=e??new u({layer:p,viewModel:this});e||s.set(p,r),i.push(r.sync({controller:t,promises:i})),h.push(r)}break;default:if(m(p)||g(p)){const e=p,o=a.getSelection(e);if(!o?.length)continue;const s=l.get(e),n=s??new f({groupLayerItem:r,layer:e,viewModel:this});s||l.set(e,n),i.push(n.sync({controller:t,promises:i})),h.push(n)}}return h}removeFromSelection(e){this.effectiveSelectionManager?.removeFromSelection(e.layer,e.objectIds)}removeTemporaryHighlight(){this._hoverHighlightHandle=o(this._hoverHighlightHandle)}selectSingleFeatureItem(e){const t=e.objectId;if(null!=t&&this.effectiveSelectionManager)for(const{layer:r}of this.effectiveSelectionManager.selections)this.setSelection({layer:r,objectIds:r===e.layer?[t]:[]})}selectSingleGroupItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:r}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t.parent===e.layer?r:[]})}selectSingleItem(e){S(e)?this.selectSingleGroupItem(e):I(e)?this.selectSingleLayerItem(e):this.selectSingleFeatureItem(e)}selectSingleLayerItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:r}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t===e.layer?r:[]})}setSelection(e){this.effectiveSelectionManager?.setSelection(e.layer,e.objectIds)}async _goTo(e){const{view:t}=this;if(t)try{await y(t,e)}catch(o){"AbortError"!==o.name&&r.getLogger(this).warn("Failed to go to feature(s)",o)}}async _generateListItems(e){try{this.removeTemporaryHighlight();const t=[],r=this.layersToItems({controller:e,promises:t});t.length>0&&await Promise.all(t),this._onChangeAbortController===e&&(this._allLayerItems=r)}catch(t){r.getLogger(this).warn("Failed updating selection",t)}}_onSelectionChange(){i(this._onSelectionChangeDebounced())}};e([n()],_.prototype,"_groupItemCache",void 0),e([n()],_.prototype,"_hoverHighlightHandle",void 0),e([n()],_.prototype,"_layerItemCache",void 0),e([n()],_.prototype,"_allLayerItems",void 0),e([n()],_.prototype,"_onChangeAbortController",void 0),e([n()],_.prototype,"activeLayerItem",null),e([n()],_.prototype,"allLayerItems",null),e([n()],_.prototype,"effectiveCount",null),e([n()],_.prototype,"effectiveSelectionManager",null),e([n()],_.prototype,"featureTitleMap",void 0),e([n()],_.prototype,"filterText",void 0),e([n()],_.prototype,"isUpdating",null),e([n()],_.prototype,"layer",void 0),e([n()],_.prototype,"layerItems",null),e([n()],_.prototype,"layerViewMap",null),e([n()],_.prototype,"maxVisibleFeatureCountExceeded",null),e([n()],_.prototype,"maxVisibleFeatureCountPerLayer",void 0),e([n()],_.prototype,"selectionManager",void 0),e([n()],_.prototype,"state",null),e([n()],_.prototype,"view",void 0),e([n()],_.prototype,"viewLayersAndTables",null),e([n()],_.prototype,"visibleFeatureCount",null),e([n()],_.prototype,"visibleFeatureItems",null),e([n()],_.prototype,"visibleLayerCount",null),_=e([c("esri.widgets.support.SelectionList.SelectionListViewModel")],_);const L=_;export{L as default};