@arcgis/core 4.27.0-rc.3 → 4.27.0-rc.4

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 (134) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{0e65e00173b66c7fec2e.js → 09e677ca7532a281d262.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{89001ee8d3f69fa03cc1.js → 0f7ddb063ee0664f2fca.js} +1 -1
  4. package/assets/esri/core/workers/chunks/17ab08f60764244b2cf8.js +1 -0
  5. package/assets/esri/core/workers/chunks/{2446e336b1f7256d4fde.js → 2c587ed66e2586cccb8d.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{00c7b9fb375c9a934158.js → 38c6452dc9cf18e8bca8.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{16db0bc87d87a7313dc4.js → 4806df402845c717c842.js} +1 -1
  8. package/assets/esri/core/workers/chunks/4884432d80e9af947449.js +1 -0
  9. package/assets/esri/core/workers/chunks/588cd91d08cec5207be1.js +1 -0
  10. package/assets/esri/core/workers/chunks/{83e3d104886b48f00397.js → 633c00c02a81397fc8df.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{efb96aefe979a0f5c632.js → 640e8ac3498be30c6614.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{33901eb1574e46abd9af.js → 6c213768715c52625855.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{5e6471dd2a08e66b47d0.js → 6e4940fe3bba014c921b.js} +57 -58
  14. package/assets/esri/core/workers/chunks/{3160af63b860b52db389.js → 6f724f75f85dc3989d60.js} +1 -1
  15. package/assets/esri/core/workers/chunks/8b05fb365336cc42fecc.js +1 -0
  16. package/assets/esri/core/workers/chunks/8eec6da5e862cc33ea2b.js +1 -0
  17. package/assets/esri/core/workers/chunks/90d8f297d9cb359e071d.js +1 -0
  18. package/assets/esri/core/workers/chunks/91785144901dfe56c5e2.js +1 -0
  19. package/assets/esri/core/workers/chunks/{471f6eba213412b82840.js → 927417abea79c955b216.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{adaa9d4239f4e905d011.js → 9d4bd73dd50400e9d328.js} +1 -1
  21. package/assets/esri/core/workers/chunks/a324cc07d486061d0d8e.js +1 -0
  22. package/assets/esri/core/workers/chunks/a40130579791293cefa2.js +1 -0
  23. package/assets/esri/core/workers/chunks/{50f910797c17c3028521.js → a49718c74053314ed741.js} +1 -1
  24. package/assets/esri/core/workers/chunks/ad2891985e0fe45aa8d2.js +1 -0
  25. package/assets/esri/core/workers/chunks/afcba35eea836aea98ca.js +1 -0
  26. package/assets/esri/core/workers/chunks/b3d2e397ea74ebef4423.js +1 -0
  27. package/assets/esri/core/workers/chunks/b5fb9da45cc9dee286f8.js +1 -0
  28. package/assets/esri/core/workers/chunks/b846d4215210aac9f6ef.js +1 -0
  29. package/assets/esri/core/workers/chunks/c7dc821db8c14fec24a7.js +1 -0
  30. package/assets/esri/core/workers/chunks/c9df9a0a4a45f9a53ce9.js +1 -0
  31. package/assets/esri/core/workers/chunks/{45a4041881e6235d73a2.js → d0a9711f48dfa5fee68a.js} +1 -1
  32. package/assets/esri/core/workers/chunks/e23ec4f867c4735eec20.js +1 -0
  33. package/assets/esri/core/workers/chunks/{ff42585e1b1d0c5497af.js → ea16230a0edfc9f756bd.js} +1 -1
  34. package/assets/esri/core/workers/chunks/ef900614353505afb210.js +1 -0
  35. package/assets/esri/themes/base/_View.scss +2 -5
  36. package/assets/esri/themes/base/widgets/_Feature.scss +12 -4
  37. package/assets/esri/themes/dark/main.css +1 -1
  38. package/assets/esri/themes/light/main.css +1 -1
  39. package/assets/esri/themes/light/view.css +1 -1
  40. package/chunks/DefaultMaterial.glsl.js +42 -42
  41. package/chunks/Terrain.glsl.js +7 -7
  42. package/copyright.txt +1 -1
  43. package/geometry/Mesh.js +1 -1
  44. package/geometry/support/meshUtils/bounds.js +1 -1
  45. package/geometry/support/meshUtils/georeference.js +1 -1
  46. package/interfaces.d.ts +3 -3
  47. package/kernel.js +1 -1
  48. package/layers/OrientedImageryLayer.js +1 -1
  49. package/layers/SceneLayer.js +1 -1
  50. package/layers/VideoLayer.js +1 -1
  51. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  52. package/layers/graphics/editingSupport.js +1 -1
  53. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  54. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  55. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  56. package/layers/graphics/sources/support/uploadAssets.js +1 -1
  57. package/layers/mixins/ArcGISImageService.js +1 -1
  58. package/layers/mixins/ImageryTileMixin.js +1 -1
  59. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  60. package/layers/orientedImagery/core/bestImageUtils.js +1 -1
  61. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  62. package/layers/orientedImagery/transformations/groundToImageUtils.js +1 -1
  63. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  64. package/layers/support/SubtypeSublayer.js +1 -1
  65. package/layers/support/capabilities.js +1 -1
  66. package/layers/support/layerUtils.js +1 -1
  67. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  68. package/layers/video/VideoCameraSensorModel.js +5 -0
  69. package/layers/video/VideoController.js +1 -1
  70. package/layers/video/videoUtils.js +1 -1
  71. package/package.json +1 -1
  72. package/portal/PortalItem.js +1 -1
  73. package/renderers/support/colorRampUtils.js +1 -1
  74. package/rest/support/meshFeatureSet.js +1 -1
  75. package/smartMapping/labels/bins.js +5 -0
  76. package/smartMapping/labels/clusters.js +1 -1
  77. package/smartMapping/labels/support/utils.js +5 -0
  78. package/smartMapping/support/binningUtils.js +1 -1
  79. package/support/revision.js +1 -1
  80. package/views/2d/layers/features/schemaUtils.js +1 -1
  81. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  82. package/views/3d/layers/I3SMeshView3D.js +1 -1
  83. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  84. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  85. package/views/3d/layers/SceneLayerWorker.js +1 -1
  86. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  87. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +5 -0
  88. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  89. package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
  90. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  91. package/views/3d/terrain/TerrainRenderer.js +1 -1
  92. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +19 -20
  93. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +2 -2
  94. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +9 -9
  95. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  96. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  97. package/views/DOMContainer.js +1 -1
  98. package/views/PopupView.js +1 -1
  99. package/views/ui/DefaultUI.js +1 -1
  100. package/views/ui/UI.js +1 -1
  101. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  102. package/widgets/Editor/EditorViewModel.js +1 -1
  103. package/widgets/Editor/UpdateWorkflow.js +1 -1
  104. package/widgets/Editor/workflowUtils.js +1 -1
  105. package/widgets/Feature/support/featureUtils.js +1 -1
  106. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  107. package/widgets/FeatureForm/RelationshipInput.js +1 -1
  108. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  109. package/widgets/OrientedImageryViewer.js +1 -1
  110. package/widgets/Popup.js +1 -1
  111. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +1 -1
  112. package/assets/esri/core/workers/chunks/013de5c2955801b329b3.js +0 -1
  113. package/assets/esri/core/workers/chunks/0618fb0058f39ecd363f.js +0 -1
  114. package/assets/esri/core/workers/chunks/07163dcbb871f927a580.js +0 -1
  115. package/assets/esri/core/workers/chunks/0e46687004392c493c06.js +0 -1
  116. package/assets/esri/core/workers/chunks/21328f3dd26abe84a10d.js +0 -1
  117. package/assets/esri/core/workers/chunks/2faa8f08f2fdaac3f4af.js +0 -1
  118. package/assets/esri/core/workers/chunks/624521961fe1f2c4f2c5.js +0 -1
  119. package/assets/esri/core/workers/chunks/6f510f28526c73ab453c.js +0 -1
  120. package/assets/esri/core/workers/chunks/7479dc0c790337af7597.js +0 -1
  121. package/assets/esri/core/workers/chunks/a6ddf80eb324c35076e1.js +0 -1
  122. package/assets/esri/core/workers/chunks/a7fd2a95fde197c06828.js +0 -1
  123. package/assets/esri/core/workers/chunks/b8e6c64792a512df4c4d.js +0 -1
  124. package/assets/esri/core/workers/chunks/bf9e1fde9f6b2b4f10c0.js +0 -1
  125. package/assets/esri/core/workers/chunks/c96db6b7ce47bd343fdb.js +0 -1
  126. package/assets/esri/core/workers/chunks/cfa3b2b1e184681e9af4.js +0 -1
  127. package/assets/esri/core/workers/chunks/d95ca50ca7af4c222036.js +0 -1
  128. package/assets/esri/core/workers/chunks/ee5ee03dd2c7dc940272.js +0 -1
  129. package/assets/esri/core/workers/chunks/f720967ba8c5486a26a2.js +0 -1
  130. package/layers/orientedImagery/core/Affixes.js +0 -5
  131. package/layers/orientedImagery/core/CameraProperties.js +0 -5
  132. package/layers/orientedImagery/core/ImageProperties.js +0 -5
  133. package/layers/orientedImagery/core/ImageryTypes.js +0 -5
  134. package/layers/orientedImagery/core/imageryUtils.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as t}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import s from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import{loadCalciteComponents as n}from"./support/componentsUtils.js";import"./support/widgetUtils.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import{tsx as d}from"./support/jsxFactory.js";import{isDarkTheme as l}from"../support/themeUtils.js";const c={calciteThemeLight:"calcite-mode-light",calciteThemeDark:"calcite-mode-dark",base:"esri-oriented-imagery-viewer",close:"esri-oriented-imagery-viewer__close",header:"esri-oriented-imagery-viewer__header",body:"esri-oriented-imagery-viewer__body",titleContainer:"esri-oriented-imagery-viewer__title-container",title:"esri-oriented-imagery-viewer__title",viewerContainer:"esri-oriented-imagery-viewer__viewer-container",viewer:"esri-oriented-imagery-viewer__viewer",submenu:"esri-oriented-imagery-viewer__submenu",currentCoverage:"esri-oriented-imagery-viewer__body-current-coverage",addExpPoints:"esri-oriented-imagery-viewer__body-additional-camera-locations",addCoverage:"esri-oriented-imagery-viewer__body-additional-coverage",footprint:"esri-oriented-imagery-viewer__body-footprint",messageBox:"esri-oriented-imagery-viewer__message-box"},m={closeButton:!0,coverageMenu:!0,imageMenu:!0,viewerTools:!0,title:!0};let p=class extends o{constructor(e,i){super(e,i),this.isDocked=!1,this.viewModel=new s,this.messagesCommon=null,this.visibleElements={...m},this._actionItems=new Map,this.renderTitleContainer=this.renderTitleContainer.bind(this),this.renderTitle=this.renderTitle.bind(this),this.renderViewerContainer=this.renderViewerContainer.bind(this),this.renderViewer=this.renderViewer.bind(this)}loadDependencies(){return n({tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js"),action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel.js")})}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...m,...e}}_storeActionElement(e){this._actionItems.set(e.text,e)}_toggleAdditionalCameraLocations(){this.viewModel.toggleAdditionalCameraLocations()}_toggleAdditionalCoverage(){this.viewModel.toggleAdditionalCoverage()}_toggleCurrentCoverage(){this.viewModel.toggleCurrentCoverage()}renderActionTooltips(){return[...this._actionItems].map((([e,i])=>d("calcite-tooltip",{key:e,label:e,referenceElement:i},d("span",null,e))))}renderBody(){return d("div",{class:c.body},this.visibleElements.coverageMenu&&this.renderMenuBarContainer(),this.renderViewerContainer())}renderHeader(){return d("div",{class:c.header},this.renderTitleContainer())}renderMenuBarContainer(){const{isCurrentCoverageDisabled:e,isCurrentCoverageVisible:i,isAdditionalCoverageDisabled:t,isAdditionalCoverageVisible:r,isAdditionalPointSourcesDisabled:o,isAdditionalPointSourcesVisible:s}=this.viewModel;return d("calcite-action-bar",{layout:"horizontal",expandDisabled:!0},d("calcite-action-group",{layout:"horizontal"},d("calcite-action",{text:this.messages.currentFootprint,icon:"trapezoid-area",class:c.currentCoverage,bind:this,active:!e&&i,disabled:e,onclick:this._toggleCurrentCoverage,afterCreate:this._storeActionElement}),d("calcite-action",{text:this.messages.additionalFootprints,icon:"trapezoid-area",class:c.addCoverage,bind:this,active:!t&&r,disabled:t,onclick:this._toggleAdditionalCoverage,afterCreate:this._storeActionElement}),d("calcite-action",{text:this.messages.additionalCameraLocations,icon:"circle-area",class:c.addExpPoints,bind:this,disabled:o,active:!o&&s,onclick:this._toggleAdditionalCameraLocations,afterCreate:this._storeActionElement}),this.renderActionTooltips()))}renderMessageBox(){const{displayMessage:e}=this.viewModel;return e?d("span",{class:c.messageBox+"--"+e.type},this.messages[e.key],e?.data):null}renderTitleContainer(){return d("div",{class:c.titleContainer},this.renderTitle())}renderTitle(){return d("span",{class:c.title},this.messages.title)}renderViewerContainer(){return d("div",{class:c.viewerContainer},this.renderViewer(),this.renderMessageBox())}renderViewer(){const{displayMessage:e}=this.viewModel;return d("div",{bind:this,afterCreate:this.viewModel.loadViewer,class:`${c.viewer}${e?"--hide":""}`})}render(){const{isLoading:e}=this.viewModel;return d("calcite-panel",{class:this.classes(`${c.base}--${this.isDocked?"docked":"floating"}`,l()?c.calciteThemeDark:c.calciteThemeLight),bind:this},this.visibleElements.title&&this.renderHeader(),d("calcite-panel",{loading:e},this.renderBody()))}};e([i()],p.prototype,"isDocked",void 0),e([i({type:s})],p.prototype,"viewModel",void 0),e([i(),a("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],p.prototype,"messages",void 0),e([i(),a("esri/t9n/common")],p.prototype,"messagesCommon",void 0),e([i()],p.prototype,"view",null),e([i()],p.prototype,"visibleElements",void 0),e([t("visibleElements")],p.prototype,"castVisibleElements",null),p=e([r("esri.widgets.OrientedImageryViewer")],p);const g=p;export{g as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as t}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import s from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import{loadCalciteComponents as n}from"./support/componentsUtils.js";import"./support/widgetUtils.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import{tsx as d}from"./support/jsxFactory.js";import{isDarkTheme as l}from"../support/themeUtils.js";const c={addCoverage:"esri-oriented-imagery-viewer__body-additional-coverage",addExpPoints:"esri-oriented-imagery-viewer__body-additional-camera-locations",base:"esri-oriented-imagery-viewer",body:"esri-oriented-imagery-viewer__body",calciteThemeDark:"calcite-mode-dark",calciteThemeLight:"calcite-mode-light",close:"esri-oriented-imagery-viewer__close",currentCoverage:"esri-oriented-imagery-viewer__body-current-coverage",footprint:"esri-oriented-imagery-viewer__body-footprint",header:"esri-oriented-imagery-viewer__header",messageBox:"esri-oriented-imagery-viewer__message-box",submenu:"esri-oriented-imagery-viewer__submenu",title:"esri-oriented-imagery-viewer__title",titleContainer:"esri-oriented-imagery-viewer__title-container",viewer:"esri-oriented-imagery-viewer__viewer",viewerContainer:"esri-oriented-imagery-viewer__viewer-container"},m={closeButton:!0,coverageMenu:!0,imageMenu:!0,viewerTools:!0,title:!0};let p=class extends o{constructor(e,i){super(e,i),this.isDocked=!1,this.viewModel=new s,this.messagesCommon=null,this.visibleElements={...m},this._actionItems=new Map,this.renderTitleContainer=this.renderTitleContainer.bind(this),this.renderTitle=this.renderTitle.bind(this),this.renderViewerContainer=this.renderViewerContainer.bind(this),this.renderViewer=this.renderViewer.bind(this)}loadDependencies(){return n({tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js"),action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel.js")})}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...m,...e}}_storeActionElement(e){this._actionItems.set(e.text,e)}_toggleAdditionalCameraLocations(){this.viewModel.toggleAdditionalCameraLocations()}_toggleAdditionalCoverage(){this.viewModel.toggleAdditionalCoverage()}_toggleCurrentCoverage(){this.viewModel.toggleCurrentCoverage()}renderActionTooltips(){return[...this._actionItems].map((([e,i])=>d("calcite-tooltip",{key:e,label:e,referenceElement:i},d("span",null,e))))}renderBody(){return d("div",{class:c.body},this.visibleElements.coverageMenu&&this.renderMenuBarContainer(),this.renderViewerContainer())}renderHeader(){return d("div",{class:c.header},this.renderTitleContainer())}renderMenuBarContainer(){const{isCurrentCoverageDisabled:e,isCurrentCoverageVisible:i,isAdditionalCoverageDisabled:t,isAdditionalCoverageVisible:r,isAdditionalPointSourcesDisabled:o,isAdditionalPointSourcesVisible:s}=this.viewModel;return d("calcite-action-bar",{layout:"horizontal",expandDisabled:!0},d("calcite-action-group",{layout:"horizontal"},d("calcite-action",{text:this.messages.currentFootprint,icon:"trapezoid-area",class:c.currentCoverage,bind:this,active:!e&&i,disabled:e,onclick:this._toggleCurrentCoverage,afterCreate:this._storeActionElement}),d("calcite-action",{text:this.messages.additionalFootprints,icon:"trapezoid-area",class:c.addCoverage,bind:this,active:!t&&r,disabled:t,onclick:this._toggleAdditionalCoverage,afterCreate:this._storeActionElement}),d("calcite-action",{text:this.messages.additionalCameraLocations,icon:"circle-area",class:c.addExpPoints,bind:this,disabled:o,active:!o&&s,onclick:this._toggleAdditionalCameraLocations,afterCreate:this._storeActionElement}),this.renderActionTooltips()))}renderMessageBox(){const{displayMessage:e}=this.viewModel;return e?d("span",{class:c.messageBox+"--"+e.type},this.messages[e.key],e?.data):null}renderTitleContainer(){return d("div",{class:c.titleContainer},this.renderTitle())}renderTitle(){return d("span",{class:c.title},this.messages.title)}renderViewerContainer(){return d("div",{class:c.viewerContainer},this.renderViewer(),this.renderMessageBox())}renderViewer(){const{displayMessage:e}=this.viewModel;return d("div",{bind:this,afterCreate:this.viewModel.loadViewer,class:`${c.viewer}${e?"--hide":""}`})}render(){const{updating:e}=this.viewModel;return d("calcite-panel",{class:this.classes(`${c.base}--${this.isDocked?"docked":"floating"}`,l()?c.calciteThemeDark:c.calciteThemeLight),bind:this},this.visibleElements.title&&this.renderHeader(),d("calcite-panel",{loading:e},this.renderBody()))}};e([i()],p.prototype,"isDocked",void 0),e([i({type:s})],p.prototype,"viewModel",void 0),e([i(),a("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],p.prototype,"messages",void 0),e([i(),a("esri/t9n/common")],p.prototype,"messagesCommon",void 0),e([i()],p.prototype,"view",null),e([i()],p.prototype,"visibleElements",void 0),e([t("visibleElements")],p.prototype,"castVisibleElements",null),p=e([r("esri.widgets.OrientedImageryViewer")],p);const g=p;export{g as default};
package/widgets/Popup.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{eventKey as o}from"../core/events.js";import n from"../core/Handles.js";import s from"../core/Logger.js";import{watch as r,when as l,on as a,whenOnce as c,initial as u}from"../core/reactiveUtils.js";import{throttle as d}from"../core/throttle.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as p}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import m from"./Feature.js";import v from"./Spinner.js";import f from"./Widget.js";import{CSS as _}from"./Feature/resources.js";import{FeatureContentMixin as w}from"./Feature/support/FeatureContentMixin.js";import{getPointFromGeometry as b}from"./Popup/actionUtils.js";import{CSS as M}from"./Popup/css.js";import y from"./Popup/PopupViewModel.js";import{loadCalciteComponents as k}from"./support/componentsUtils.js";import{Heading as A}from"./support/Heading.js";import{accessibleHandler as F}from"./support/decorators/accessibleHandler.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{vmEvent as I}from"./support/decorators/vmEvent.js";import{tsx as O}from"./support/jsxFactory.js";import{storeNode as x,cssTransition as E,isRTL as N}from"./support/widgetUtils.js";import{isDarkTheme as B}from"../support/themeUtils.js";import{substitute as P}from"../intl/substitute.js";const T="selected-index",D=0,S="popup-spinner",L={buttonEnabled:!0,position:"auto",breakpoint:{width:544}},R="esri-popup";function V(e,t){return void 0===t?`${R}__${e}`:`${R}__${e}-${t}`}const j={closeButton:!0,featureNavigation:!0};let U=class extends(w(f)){constructor(e,i){super(e,i),this._blurClose=!1,this._blurContainer=!1,this._containerNode=null,this._mainContainerNode=null,this._featureMenuNode=null,this._actionsMenuNode=null,this._focusClose=!1,this._focusContainer=!1,this._focusDockButton=!1,this._focusFeatureMenuButton=!1,this._focusActionsMenuButton=!1,this._focusFirstFeature=!1,this._focusFirstAction=!1,this._handles=new n,this._pointerOffsetInPx=16,this._spinner=null,this._feature=null,this._featureMenuIntersectionObserverNode=null,this._featureMenuViewportNode=null,this._rootFlowItemNode=null,this._featureMenuIntersectionObserverCallback=([e])=>{e?.isIntersecting&&null!=this.viewModel.featurePage&&this.viewModel.featurePage++},this._featureMenuIntersectionObserver=new IntersectionObserver(this._featureMenuIntersectionObserverCallback,{root:window.document}),this._displaySpinnerThrottled=d((()=>this._displaySpinner()),D),this._exitRelatedRecordsActions=new WeakMap,this._featureSelectionActions=new WeakMap,this._flowItems=new t,this.alignment="auto",this.collapsed=!1,this.collapseEnabled=!0,this.dockEnabled=!1,this.headingLevel=2,this.maxInlineActions=3,this.messages=null,this.messagesCommon=null,this.spinnerEnabled=!0,this.viewModel=new y,this.visibleElements={...j},this._handleOpenRelatedFeature=e=>{this._openRelatedFeature(e)},this._addSelectedFeatureIndexHandle(),this.addHandles([this._displaySpinnerThrottled,r((()=>this.viewModel?.screenLocation),(()=>this._positionContainer())),r((()=>[this.viewModel?.active,this.dockEnabled]),(()=>this._toggleScreenLocationEnabled())),r((()=>this.viewModel?.screenLocation),((e,t)=>{!!e!=!!t&&this.reposition()})),r((()=>[this.viewModel?.view?.padding,this.viewModel?.view?.size,this.viewModel?.active,this.viewModel?.location,this.alignment]),(()=>this.reposition())),r((()=>this.spinnerEnabled),(e=>this._spinnerEnabledChange(e))),r((()=>this.viewModel?.view?.size),((e,t)=>this._updateDockEnabledForViewSize(e,t))),r((()=>this.viewModel?.view),((e,t)=>this._viewChange(e,t))),r((()=>this.viewModel?.view?.ready),((e,t)=>this._viewReadyChange(e??!1,t??!1))),r((()=>[this.viewModel?.waitingForResult,this.viewModel?.location]),(()=>{this._hideSpinner(),this._displaySpinnerThrottled()})),r((()=>this.selectedFeatureWidget),(()=>this._destroyFlowItemWidgets())),r((()=>[this.selectedFeatureWidget?.viewModel?.title,this.selectedFeatureWidget?.viewModel?.state]),(()=>this._setTitleFromFeatureWidget())),r((()=>[this.selectedFeatureWidget?.viewModel?.content,this.selectedFeatureWidget?.viewModel?.state]),(()=>this._setContentFromFeatureWidget())),l((()=>!this.collapsed),(()=>{"xsmall"===this.viewModel?.view?.widthBreakpoint&&this.viewModel.active&&this.collapseEnabled&&this.viewModel.centerAtLocation()})),a((()=>this.viewModel?.allActions),"change",(()=>this._watchActions())),r((()=>this.viewModel?.allActions),(()=>this._watchActions()),u),r((()=>this.viewModel?.featureViewModels),(()=>this._featureMenuViewportScrollTop())),a((()=>this._flowItems),"change",(()=>{this.notifyChange("_activeFlowItemWidget"),this.scheduleRender()})),r((()=>[this._activeFlowItemWidget?.viewModel?.state,this._activeFlowItemWidget?.viewModel?.title]),(()=>this.scheduleRender()))])}loadDependencies(){return k({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}initialize(){this.addHandles(this._displaySpinnerThrottled)}destroy(){this._destroyFlowItemWidgets(),this._destroySelectedFeatureWidget(),this._destroySpinner(),this._handles?.destroy(),this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver?.disconnect()}get actionsMenuId(){return`${this.id}-actions-menu`}get actionsMenuButtonId(){return`${this.id}-actions-menu-button`}get featureMenuId(){return`${this.id}-feature-menu`}get titleId(){return`${this.id}-popup-title`}get contentId(){return`${this.id}-popup-content`}get hasContent(){const{selectedFeatureWidget:e,viewModel:t}=this;if(!e)return!!t?.content;const i=e.viewModel;if(i?.waitingForContent||"error"===i?.state)return!0;const o=i?.content;return Array.isArray(o)?!!o.length:!!o}get featureNavigationVisible(){return this.viewModel.active&&this.viewModel.featureCount>1&&!!this.visibleElements.featureNavigation}get collapsible(){return!!(this.collapseEnabled&&this.viewModel.title&&this.hasContent)}get featureMenuVisible(){return this.featureNavigationVisible&&this.featureMenuOpen}get contentCollapsed(){return this.collapsible&&!this.featureMenuVisible&&this.collapsed}get dividedActions(){return this._divideActions()}get _activeFlowItemWidget(){const{_flowItems:e}=this;return e.at(-1)??null}get actions(){return this.viewModel.actions}set actions(e){this.viewModel.actions=e}set actionsMenuOpen(e){this._set("actionsMenuOpen",!!e)}get actionsMenuOpen(){return!!this.viewModel.active&&this._get("actionsMenuOpen")}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(e){this.viewModel.autoCloseEnabled=e}get autoOpenEnabled(){return i(s.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled}set autoOpenEnabled(e){i(s.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled=e}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(e){this.viewModel.defaultPopupTemplateEnabled=e}get content(){return this.viewModel.content}set content(e){this.viewModel.content=e}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||L}set dockOptions(e){const t={...L},i=this.viewModel?.view?.breakpoints,o={};i&&(o.width=i.xsmall,o.height=i.xsmall);const n={...t,...e},s={...t.breakpoint,...o},{breakpoint:r}=n;"object"==typeof r?n.breakpoint={...s,...r}:r&&(n.breakpoint=s),this._set("dockOptions",n),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(e){this.viewModel.featureMenuOpen=e}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get promises(){return this.viewModel.promises}set promises(e){this.viewModel.promises=e}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(e){this.viewModel.selectedFeatureIndex=e}get selectedFeatureWidget(){const{_feature:e,visibleElements:t,headingLevel:i,_flowItems:o}=this,{selectedFeatureViewModel:n}=this.viewModel,s={...t,title:!1};return n?(e?(e.viewModel=n,e.visibleElements=s):this._feature=new m({flowItems:o,headingLevel:i+1,viewModel:n,visibleElements:s}),this._feature):null}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(e){this.viewModel.updateLocationEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}castVisibleElements(e){return{...j,...e}}blur(){const{active:e}=this.viewModel;e||s.getLogger(this).warn("Popup can only be blurred when currently active."),this.visibleElements.closeButton?this._blurClose=!0:this._blurContainer=!0,this.scheduleRender()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(e,t){return this.viewModel.fetchFeatures(e,t)}focus(){const{active:e}=this.viewModel;e||s.getLogger(this).warn("Popup can only be focused when currently active."),this.visibleElements.closeButton?this._focusClose=!0:this._focusContainer=!0,this.scheduleRender()}next(){return this.viewModel.next()}open(e){this._handles.remove(T);const t=!!e&&!!e.featureMenuOpen,i=!!e&&!!e.actionsMenuOpen,o={collapsed:!!e&&!!e.collapsed,actionsMenuOpen:i,featureMenuOpen:t};"xsmall"===this.viewModel?.view?.widthBreakpoint&&(o.collapsed=!0),this.set(o),this.viewModel.open(e),this._shouldFocus(e),this._addSelectedFeatureIndexHandle()}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(e){return this.viewModel.triggerAction(e)}render(){const{actionsMenuOpen:e,dockEnabled:t,featureMenuVisible:i,dividedActions:o,currentAlignment:n,currentDockPosition:s}=this,{active:r}=this.viewModel,{menuActions:l}=o,a=r&&l.length>1&&e,c=r&&t,u=r&&!t,d=this.selectedFeature?.layer?.title,h=this.selectedFeature?.layer?.id,p={[M.alignTopCenter]:"top-center"===n,[M.alignBottomCenter]:"bottom-center"===n,[M.alignTopLeft]:"top-left"===n,[M.alignBottomLeft]:"bottom-left"===n,[M.alignTopRight]:"top-right"===n,[M.alignBottomRight]:"bottom-right"===n,[M.isDocked]:c,[M.shadow]:u,[M.isDockedTopLeft]:"top-left"===s,[M.isDockedTopCenter]:"top-center"===s,[M.isDockedTopRight]:"top-right"===s,[M.isDockedBottomLeft]:"bottom-left"===s,[M.isDockedBottomCenter]:"bottom-center"===s,[M.isDockedBottomRight]:"bottom-right"===s,[M.isFeatureMenuOpen]:i,[M.isActionsMenuOpen]:a};return O("div",{class:this.classes(M.base,p),role:"presentation","data-layer-title":d,"data-layer-id":h,bind:this,afterCreate:this._positionContainer,afterUpdate:this._positionContainer},r?[this.renderMainContainer(),this.renderPointer()]:null)}renderLoadingIcon(){return O("span",{"aria-hidden":"true",class:this.classes(M.icon,M.iconLoading,M.rotating)})}renderNavigationLoading(){const{messagesCommon:e}=this;return this.viewModel.pendingPromisesCount?O("div",{key:V("loading-container"),role:"presentation",class:M.loadingContainer,"aria-label":e.loading,title:e.loading},this.renderLoadingIcon()):null}renderPreviousButton(){const{messages:e}=this;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._previous,onkeydown:this._previous,class:this.classes(M.button,M.paginationPrevious),"aria-label":e.previous,title:e.previous},O("calcite-icon",{icon:"chevron-left",scale:"s",class:M.paginationIcon}))}renderNextButton(){const{messages:e}=this;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._next,onkeydown:this._next,class:this.classes(M.button,M.paginationNext),"aria-label":e.next,title:e.next},O("calcite-icon",{icon:"chevron-right",scale:"s",class:M.paginationIcon}))}renderFeatureMenuButton(){const{featureMenuOpen:e,featureMenuId:t,messagesCommon:i}=this,{featureCount:o,selectedFeatureIndex:n}=this.viewModel;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._toggleFeatureMenu,onkeydown:this._toggleFeatureMenu,afterCreate:this._focusFeatureMenuButtonNode,afterUpdate:this._focusFeatureMenuButtonNode,class:M.featureMenuButton,"aria-haspopup":"true","aria-controls":t,"aria-expanded":e.toString(),"aria-label":i.menu,title:i.menu},O("calcite-icon",{icon:"list-bullet",scale:"s",class:M.featureMenuButtonIcon}),this._getPageText(o,n))}renderNavigationButtons(){return this.featureNavigationVisible?[this.renderPreviousButton(),this.renderNextButton(),this.renderNavigationLoading()||this.renderFeatureMenuButton()]:[]}renderDockIcon(){const{dockEnabled:e}=this,t=this._wouldDockTo(),i={[M.iconUndock]:e,[M.iconDock]:!e,[M.iconDockToRight]:!e&&("top-right"===t||"bottom-right"===t),[M.iconDockToLeft]:!e&&("top-left"===t||"bottom-left"===t),[M.iconDockToTop]:!e&&"top-center"===t,[M.iconDockToBottom]:!e&&"bottom-center"===t};return O("span",{"aria-hidden":"true",class:this.classes(i,M.icon)})}renderDockButton(){const{dockEnabled:e,messages:t}=this,i=this.viewModel?.view?.widthBreakpoint,o=e?t.undock:t.dock;return"xsmall"!==i&&this.dockOptions?.buttonEnabled?O("div",{role:"button","aria-label":o,title:o,tabIndex:0,bind:this,onclick:this._toggleDockEnabled,onkeydown:this._toggleDockEnabled,afterCreate:this._focusDockButtonNode,afterUpdate:this._focusDockButtonNode,class:this.classes(M.button,M.buttonDock)},this.renderDockIcon()):null}renderTitle(){const{title:e}=this.viewModel,{titleId:t,collapsible:i,contentCollapsed:o,messagesCommon:n}=this,s={[M.headerContainerButton]:i},r=O(A,{level:this.headingLevel,class:M.headerTitle,innerHTML:e??""}),l=i?O("button",{key:`${e}--collapsible`,id:t,title:o?n.expand:n.collapse,bind:this,enterAnimation:this._createFeatureUpdatedAnimation(),class:this.classes(M.headerContainer,s),"aria-expanded":o?"false":"true",onclick:this._toggleCollapsed,type:"button"},r,O("calcite-icon",{class:M.collapseIcon,key:"collapse-icon",icon:o?"chevron-down":"chevron-up",scale:"m"})):O("div",{key:e??"title",id:t,bind:this,enterAnimation:this._createFeatureUpdatedAnimation(),class:this.classes(M.headerContainer,s)},r);return e?l:null}renderCloseIcon(){return O("span",{"aria-hidden":"true",class:this.classes(M.icon,M.iconClose)})}renderCloseButton(){const{visibleElements:e,messagesCommon:t}=this;return e.closeButton?O("div",{role:"button",tabIndex:0,bind:this,onclick:this._close,onkeydown:this._close,class:M.button,"aria-label":t.close,title:t.close,afterCreate:this._closeButtonNodeUpdated,afterUpdate:this._closeButtonNodeUpdated},this.renderCloseIcon()):null}renderHeader(){return O("header",{class:M.header},this.renderTitle(),O("div",{class:M.headerButtons},this.renderDockButton(),this.renderCloseButton()))}renderContentContainer(){const{contentId:e,hasContent:t,contentCollapsed:i,_flowItems:o}=this,{content:n}=this.viewModel,s=o.toArray(),r={[M.contentHasFlows]:!!s.length};return t&&!i?O("div",{key:n??"content",enterAnimation:this._createFeatureUpdatedAnimation(),id:e,class:this.classes(M.content,r)},O("calcite-flow",{bind:this},O("calcite-flow-item",{bind:this,"data-node-ref":"_rootFlowItemNode",afterCreate:x,key:"root-flow-item",onCalciteFlowItemBack:this._handleBackClick},this.renderContent()),s.map((e=>this.renderFlowItem(e)))),s.map((e=>this.renderFlowItemTooltips(e)))):null}renderFlowItem(e){const{messages:t}=this,i=B(),o="graphic"in e&&!e.isTable;return O("calcite-flow-item",{bind:this,class:this.classes({[M.calciteThemeDark]:!i,[M.calciteThemeLight]:i}),heading:e.title??"",description:this._getFlowItemDescription(e),onCalciteFlowItemBack:this._handleBackClick,key:`flow-item-${e.viewModel.uid}`},O("calcite-action",{class:M.actionExit,icon:"move-up",label:t?.exitRelatedRecords,text:t?.exitRelatedRecords,slot:"header-actions-start",bind:this,afterCreate:t=>this._storeExitRelatedRecordsAction(e,t),onclick:this._destroyFlowItemWidgets}),o?O("calcite-action",{class:M.actionSelectFeature,icon:"zoom-to-object",label:t?.selectFeature,text:t?.selectFeature,slot:"header-actions-end",bind:this,afterCreate:t=>this._storeFeatureSelectionAction(e,t),onclick:()=>this._handleOpenRelatedFeature(e)}):null,O("div",{class:this.classes(M.contentFlowItem,{[M.calciteThemeDark]:i,[M.calciteThemeLight]:!i})},e.render()))}renderFlowItemTooltips(e){const{messages:t,_exitRelatedRecordsActions:i,_featureSelectionActions:o}=this,n=B(),s=o.get(e);return[O("calcite-tooltip",{class:this.classes({[M.calciteThemeDark]:!n,[M.calciteThemeLight]:n}),key:`exit-related-records-tooltip-${e.viewModel.uid}`,label:t?.exitRelatedRecords,overlayPositioning:"fixed",referenceElement:i.get(e),placement:"top"},t?.exitRelatedRecords),s?O("calcite-tooltip",{class:this.classes({[M.calciteThemeDark]:!n,[M.calciteThemeLight]:n}),key:`select-related-record-tooltip-${e.viewModel.uid}`,label:t?.selectFeature,overlayPositioning:"fixed",referenceElement:s,placement:"top"},t?.selectFeature):null]}renderActionsMenuButton(){const{actionsMenuId:e,actionsMenuButtonId:t,actionsMenuOpen:i,dividedActions:o,messagesCommon:n}=this,s=i?n.close:n.open,{menuActions:r}=o;return r.length?O("div",{key:V("actions-menu-button"),class:this.classes(M.button,M.actionsMenuButton),role:"button",id:t,"aria-haspopup":"true","aria-controls":i?e:null,tabIndex:0,bind:this,onclick:this._toggleActionsMenu,onkeydown:this._toggleActionsMenu,afterCreate:this._focusActionsMenuButtonNode,afterUpdate:this._focusActionsMenuButtonNode,"aria-label":s,title:s},O("span",{"aria-hidden":"true",class:M.iconActionsMenu})):null}renderMenuActions(){const{actionsMenuId:e,actionsMenuButtonId:t,actionsMenuOpen:i,dividedActions:o}=this,{menuActions:n}=o;return n.length&&i?O("ul",{id:e,role:"menu","aria-labelledby":t,key:V("actions"),class:M.actions,bind:this,onkeyup:this._handleActionMenuKeyup,afterCreate:this._actionsMenuNodeUpdated,afterUpdate:this._actionsMenuNodeUpdated},n.toArray().map((e=>this.renderAction({action:e,type:"menu-item"})))):null}renderInlineActions(){const{inlineActions:e}=this.dividedActions;return e.length?e.toArray().map((e=>this.renderAction({action:e,type:"inline"}))):[]}renderInlineActionsContainer(){const{inlineActions:e,menuActions:t}=this.dividedActions,i=!!e.length,o=!!t.length;return i||o?O("div",{key:"inline-actions-container","data-inline-actions":i.toString(),"data-menu-actions":o.toString(),class:M.inlineActionsContainer},this.renderInlineActions(),this.renderActionsMenuButton(),this.renderMenuActions()):null}renderNavigation(){return this.featureNavigationVisible?O("section",{key:V("navigation"),class:this.classes(M.navigation)},this.renderNavigationButtons()):null}renderFooter(){const{featureNavigationVisible:e,dividedActions:t}=this,{inlineActions:i,menuActions:o}=t,n=!!i.length,s=!!o.length,r={[M.footerHasPagination]:e,[M.footerHasActions]:n,[M.footerHasActionsMenu]:s};return e||n?O("div",{key:V("feature-buttons"),class:this.classes(M.footer,r)},this.renderInlineActionsContainer(),this.renderNavigation()):null}renderFeatureMenuContainer(){const{messages:e}=this,{featureViewModels:t,isLoadingFeature:i}=this.viewModel,o=P(e.selectedFeatures,{total:t.length});return O("section",{key:V("menu"),class:M.featureMenu},O("strong",{class:M.featureMenuHeader},o),O("nav",{bind:this,class:M.featureMenuViewport,"data-node-ref":"_featureMenuViewportNode",afterCreate:x},this.renderFeatureMenu(),O("div",{class:M.featureMenuObserver,bind:this,afterCreate:this._featureMenuIntersectionObserverCreated}),i?O("div",{class:M.featureMenuLoader},this.renderLoadingIcon()):null))}renderPointer(){return this.dockEnabled?null:O("div",{key:V("pointer"),class:M.pointer,role:"presentation"},O("div",{class:this.classes(M.pointerDirection,M.shadow)}))}renderMainContainer(){const{dockEnabled:e,currentAlignment:t,currentDockPosition:i,titleId:o,contentId:n,collapsible:s,hasContent:r,contentCollapsed:l,visibleElements:a}=this,{title:c}=this.viewModel,u="bottom-left"===t||"bottom-center"===t||"bottom-right"===t||"top-left"===i||"top-center"===i||"top-right"===i,d="top-left"===t||"top-center"===t||"top-right"===t||"bottom-left"===i||"bottom-center"===i||"bottom-right"===i,h={[M.shadow]:e,[M.isCollapsible]:s,[M.isCollapsed]:l};return O("div",{class:this.classes(M.main,M.widget,h),tabIndex:a.closeButton?void 0:-1,role:"dialog","aria-live":"polite","aria-labelledby":c?o:"","aria-describedby":r&&!l?n:"",bind:this,onkeyup:this._handleMainKeyup,afterCreate:this._mainContainerNodeUpdated,afterUpdate:this._mainContainerNodeUpdated},u?this.renderFooter():null,u?this.renderFeatureMenuContainer():null,this.renderHeader(),this.renderContentContainer(),d?this.renderFooter():null,d?this.renderFeatureMenuContainer():null)}renderContent(){const e=this.viewModel?.content;return e?"string"==typeof e?O("div",{class:_.contentNode,key:e,innerHTML:e}):this.renderNodeContent(e):null}renderActionText(e){return O("span",{key:"text",class:M.actionText},e)}renderActionCalciteIcon(e,t){return O("calcite-icon",{scale:"s",key:`calcite-icon-${t}`,icon:e,class:M.icon})}renderActionIcon(e){const t=this._getActionClass(e),i=this._getActionImage(e),o={[M.iconLoading]:e.active,[M.rotating]:e.active,[M.icon]:!!t,[M.actionImage]:!e.active&&!!i};return t&&(o[t]=!e.active),O("span",{key:"icon","aria-hidden":"true",class:this.classes(M.icon,o),styles:this._getIconStyles(i)})}renderAction(e){const{action:t,type:i}=e,o=this._getActionTitle(t),n={[M.action]:"toggle"!==t.type,[M.actionToggle]:"toggle"===t.type,[M.actionToggleOn]:"toggle"===t.type&&t.value,[M.buttonDisabled]:t.disabled},s=[t.icon&&!t.active?this.renderActionCalciteIcon(t.icon,t.uid):this.renderActionIcon(t),this.renderActionText(o)],r="menu-item"===i?O("li",{key:t.uid,role:"menuitem",tabIndex:0,title:o,"aria-label":o,class:this.classes(M.button,n),onkeyup:this._handleActionMenuItemKeyup,bind:this,"data-action-uid":t.uid,onclick:this._triggerAction,onkeydown:this._triggerAction},s):O("div",{key:t.uid,role:"button",tabIndex:0,title:o,"aria-label":o,class:this.classes(M.button,n),onkeyup:this._handleActionMenuItemKeyup,bind:this,"data-action-uid":t.uid,onclick:this._triggerAction,onkeydown:this._triggerAction},s);return t.visible?r:null}renderFeatureMenuItem(e,t){const{messages:i,messagesCommon:o}=this,{selectedFeatureIndex:n,selectedFeatureViewModel:s}=this.viewModel,r=e===s,l={[M.featureMenuSelected]:r},a=r?O("span",{key:V(`feature-menu-selected-feature-${n}`),title:i.selectedFeature,"aria-label":i.selectedFeature,class:M.iconCheckMark}):null,c=O("span",{innerHTML:e.title||o.untitled});return O("li",{role:"menuitem",tabIndex:-1,key:V(`feature-menu-feature-${n}`),class:this.classes(l,M.featureMenuItem),bind:this,"data-feature-index":t,onblur:this._removeActiveFeature,onfocus:this._setActiveFeature,onkeyup:this._handleFeatureMenuItemKeyup,onclick:this._selectFeature,onkeydown:this._selectFeature,onmouseover:this._setActiveFeature,onmouseleave:this._removeActiveFeature},O("span",{class:M.featureMenuTitle},c,a))}renderFeatureMenu(){const{featureMenuId:e}=this,{featureViewModels:t}=this.viewModel;return t.length>1?O("ol",{class:M.featureMenuList,id:e,bind:this,afterCreate:this._featureMenuNodeUpdated,afterUpdate:this._featureMenuNodeUpdated,onkeyup:this._handleFeatureMenuKeyup,role:"menu"},t.filter((e=>!!e.graphic)).map(((e,t)=>this.renderFeatureMenuItem(e,t)))):null}_storeFeatureSelectionAction(e,t){this._featureSelectionActions.set(e,t),this.scheduleRender()}_storeExitRelatedRecordsAction(e,t){this._exitRelatedRecordsActions.set(e,t),this.scheduleRender()}_getFlowItemDescription(e){return"featureCountDescription"in e?e.featureCountDescription:e.viewModel.description??""}async _openRelatedFeature(e){await e.viewModel.updateGeometry();const t=e.graphic,i=t?.geometry;if(null==i||null==t)return;this._destroyFlowItemWidgets(),await this.viewModel.zoomTo({target:i});const o=b(i);this.open({features:[t],location:null!=o?o:void 0})}_destroyFlowItemWidgets(){this._flowItems.removeAll().forEach((e=>{"showAllEnabled"in e.viewModel&&(e.viewModel.showAllEnabled=!1),e.viewModel=null,e.destroy()}))}_handleBackClick(){const e=this._flowItems.pop();e&&(this._exitRelatedRecordsActions.delete(e),this._featureSelectionActions.delete(e),"showAllEnabled"in e.viewModel&&(e.viewModel.showAllEnabled=!1),e&&(e.viewModel=null,e.destroy()))}_getActionTitle(e){const{messages:t,selectedFeature:i,messagesCommon:o}=this,{id:n}=e,s=i?.attributes,r=e.title??"",l="zoom-to-feature"===n?P(r,{messages:t}):"remove-selected-feature"===n?P(r,{messages:o}):"zoom-to-clustered-features"===n||"browse-clustered-features"===n?P(r,{messages:t}):e.title;return l&&s?P(l,s):l??""}_getActionClass(e){const{selectedFeature:t}=this,i=t?.attributes,{className:o,image:n}=e,s=n||o?o:M.iconDefaultAction;return s&&i?P(s,i):s??""}_getActionImage(e){if(e.active)return"";const{selectedFeature:t}=this,i=t?.attributes,{image:o}=e;return o&&i?P(o,i):o??""}_createFeatureUpdatedAnimation(){return E("enter",M.hasFeatureUpdated)}_getInlineActionCount(){const{maxInlineActions:e,featureNavigationVisible:t}=this;if("number"!=typeof e)return null;const i=Math.round(e);return Math.max(t?i-1:i,0)}_watchActions(){const{allActions:e}=this.viewModel;this.notifyChange("dividedActions");const t="actions";this._handles.remove(t),e&&e.forEach((e=>{this._handles.add(r((()=>[e.uid,e.active,e.className,e.disabled,e.id,e.title,e.image,e.visible]),(()=>this.scheduleRender())),t)}))}_divideActions(){const{allActions:e}=this.viewModel,i=e.filter((e=>e.visible)),o=this._getInlineActionCount(),n=null===o,s=0===o;return{inlineActions:n?i.slice(0):s?new t:i.slice(0,o),menuActions:n?new t:s?i.slice(0):i.slice(o)}}_featureMenuOpenChanged(e){e?this._focusFirstFeature=!0:this._focusFeatureMenuButton=!0}_actionsMenuOpenChanged(e){e?this._focusFirstAction=!0:this._focusActionsMenuButton=!0}_setTitleFromFeatureWidget(){const{selectedFeatureWidget:e,messagesCommon:t}=this;e&&(this.viewModel.title="error"===e.viewModel?.state?t.errorMessage:e.viewModel?.title||"")}_setContentFromFeatureWidget(){const{selectedFeatureWidget:e}=this;e&&(this.viewModel.content=e)}_unobserveFeatureMenuObserver(){this._featureMenuIntersectionObserverNode&&this._featureMenuIntersectionObserver.unobserve(this._featureMenuIntersectionObserverNode)}_featureMenuIntersectionObserverCreated(e){this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver.observe(e),this._featureMenuIntersectionObserverNode=e}_handleFeatureMenuKeyup(e){"Escape"===o(e)&&(e.stopPropagation(),this._focusFeatureMenuButton=!0,this.featureMenuOpen=!1,this.scheduleRender())}_handleActionMenuKeyup(e){"Escape"===o(e)&&(e.stopPropagation(),this._focusActionsMenuButton=!0,this.actionsMenuOpen=!1,this.scheduleRender())}_setActiveFeature(e){const{viewModel:t}=this,i=W(e.currentTarget);t.activeFeature=t.features[i]||null}_removeActiveFeature(){this.viewModel.activeFeature=null}_handleFeatureMenuItemKeyup(e){const t=o(e),{_featureMenuNode:i}=this,n=W(e.currentTarget);if(!i)return;const s=i.querySelectorAll("li"),r=s.length;if("ArrowUp"!==t)if("ArrowDown"!==t)if("Home"!==t)if("End"!==t);else{e.stopPropagation();s[s.length-1].focus()}else{e.stopPropagation();s[0].focus()}else{e.stopPropagation();s[(n+1+r)%r].focus()}else{e.stopPropagation();s[(n-1+r)%r].focus()}}_handleActionMenuItemKeyup(e){const t=o(e),{_actionsMenuNode:i}=this,n=e.currentTarget.dataset.actionUid,{menuActions:s}=this.dividedActions,r=s.findIndex((e=>e.uid===n));if(!i)return;const l=i.querySelectorAll("li"),a=l.length;if("ArrowUp"!==t)if("ArrowDown"!==t)if("Home"!==t)if("End"!==t);else{e.stopPropagation();l[l.length-1].focus()}else{e.stopPropagation();l[0].focus()}else{e.stopPropagation();l[(r+1+a)%a].focus()}else{e.stopPropagation();l[(r-1+a)%a].focus()}}_handleMainKeyup(e){const t=o(e);"ArrowLeft"===t&&(e.stopPropagation(),this.previous()),"ArrowRight"===t&&(e.stopPropagation(),this.next())}_spinnerEnabledChange(e){if(this._destroySpinner(),!e)return;const t=this.get("viewModel.view");this._createSpinner(t)}_hideSpinner(){const{_spinner:e}=this;e&&(e.location=null,e.hide())}_displaySpinner(){const{_spinner:e}=this;if(!e)return;const{location:t,waitingForResult:i}=this.viewModel;i&&t?e.show({location:t}):e.hide()}_getIconStyles(e){return{"background-image":e?`url(${e})`:""}}async _shouldFocus(e){e?.shouldFocus&&(await c((()=>!0===this.viewModel?.active)),this.focus())}_addSelectedFeatureIndexHandle(){const e=r((()=>this.viewModel?.selectedFeatureIndex),((e,t)=>this._selectedFeatureIndexUpdated(e,t)));this._handles.add(e,T)}_selectedFeatureIndexUpdated(e,t){const{featureCount:i}=this;i&&e!==t&&-1!==e&&(this._destroyFlowItemWidgets(),this.actionsMenuOpen=!1,this.featureMenuOpen=!1,this._mainContainerNode&&(this._mainContainerNode.scrollTop=0),this._rootFlowItemNode&&this._rootFlowItemNode.scrollContentTo({top:0}))}_destroySelectedFeatureWidget(){const{_feature:e}=this;e&&(e.viewModel=null,e&&!e.destroyed&&e.destroy()),this._feature=null}_isScreenLocationWithinView(e,t){return e.x>-1&&e.y>-1&&e.x<=t.width&&e.y<=t.height}_isOutsideView(e){const{popupHeight:t,popupWidth:i,screenLocation:o,side:n,view:s}=e;if(isNaN(i)||isNaN(t)||!s||!o)return!1;const r=s.padding;return"right"===n&&o.x+i/2>s.width-r.right||("left"===n&&o.x-i/2<r.left||("top"===n&&o.y-t<r.top||"bottom"===n&&o.y+t>s.height-r.bottom))}_calculateAutoAlignment(e){if("auto"!==e)return e;const{_pointerOffsetInPx:t,_containerNode:i,_mainContainerNode:o,viewModel:n}=this,{screenLocation:s,view:r}=n;if(null==s||!r||!i)return"top-center";if(!this._isScreenLocationWithinView(s,r))return this._get("currentAlignment")||"top-center";function l(e){return parseInt(e.replaceAll(/[^-\d\.]/g,""),10)}const a=o?window.getComputedStyle(o,null):null,c=a?l(a.getPropertyValue("max-height")):0,u=a?l(a.getPropertyValue("height")):0,{height:d,width:h}=i.getBoundingClientRect(),p=h+t,g=Math.max(d,c,u)+t,m=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"right",view:r}),v=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"left",view:r}),f=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"top",view:r}),_=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"bottom",view:r});return v?f?"bottom-right":"top-right":m?f?"bottom-left":"top-left":f?_?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(e){return"function"==typeof e?e.call(this):e}_getCurrentAlignment(){const{alignment:e,dockEnabled:t}=this;return t||!this.viewModel.active?null:this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(e)))}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(e){const t=["left","right"];return N(this.container)&&t.reverse(),e?.replace(/leading/gi,t[0]).replaceAll(/trailing/gi,t[1])}_callDockPosition(e){return"function"==typeof e?e.call(this):e}_getDockPosition(){return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition(this.dockOptions?.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_wouldDockTo(){return this.dockEnabled?null:this._getDockPosition()}_calculateAutoDockPosition(e){if("auto"!==e)return e;const t=this.viewModel?.view,i=N(this.container)?"top-left":"top-right";if(!t)return i;const o=t.padding||{left:0,right:0,top:0,bottom:0},n=t.width-o.left-o.right,{breakpoints:s}=t;return s&&n<=s.xsmall?"bottom-center":i}_positionContainer(e=this._containerNode){if(e&&(this._containerNode=e),!this._containerNode)return;const{screenLocation:t}=this.viewModel,{width:i}=this._containerNode.getBoundingClientRect(),o=this._calculatePositionStyle(t,i);o&&Object.assign(this._containerNode.style,o)}_calculateFullWidth(e){const{currentAlignment:t,_pointerOffsetInPx:i}=this;return"top-left"===t||"bottom-left"===t||"top-right"===t||"bottom-right"===t?e+i:e}_calculateAlignmentPosition(e,t,i,o){const{currentAlignment:n,_pointerOffsetInPx:s}=this;if(!i)return;const{padding:r}=i,l=o/2,a=i.height-t,c=i.width-e;return"bottom-center"===n?{top:t+s-r.top,left:e-l-r.left}:"top-left"===n?{bottom:a+s-r.bottom,right:c+s-r.right}:"bottom-left"===n?{top:t+s-r.top,right:c+s-r.right}:"top-right"===n?{bottom:a+s-r.bottom,left:e+s-r.left}:"bottom-right"===n?{top:t+s-r.top,left:e+s-r.left}:"top-center"===n?{bottom:a+s-r.bottom,left:e-l-r.left}:void 0}_calculatePositionStyle(e,t){const{dockEnabled:i,view:o}=this;if(!o)return;if(i)return{left:"",top:"",right:"",bottom:""};if(null==e||!t)return;const n=this._calculateFullWidth(t),s=this._calculateAlignmentPosition(e.x,e.y,o,n);return s?{top:void 0!==s.top?`${s.top}px`:"auto",left:void 0!==s.left?`${s.left}px`:"auto",bottom:void 0!==s.bottom?`${s.bottom}px`:"auto",right:void 0!==s.right?`${s.right}px`:"auto"}:void 0}_viewChange(e,t){e&&t&&(this.close(),this.clear())}_viewReadyChange(e,t){if(e){const e=this.get("viewModel.view");this._wireUpView(e)}else t&&(this.close(),this.clear())}_wireUpView(e){if(this._destroySpinner(),!e)return;const{spinnerEnabled:t}=this;t&&this._createSpinner(e),this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(e,t,i){const[o,n]=e,[s,r]=t,{width:l=0,height:a=0}=i??{};return o<=l&&s>l||o>l&&s<=l||n<=a&&r>a||n>a&&r<=a}_updateDockEnabledForViewSize(e,t){if(!e||!t)return;const i=this.get("viewModel.view.padding")||{left:0,right:0,top:0,bottom:0},o=i.left+i.right,n=i.top+i.bottom,s=[],r=[];s[0]=e[0]-o,s[1]=e[1]-n,r[0]=t[0]-o,r[1]=t[1]-n;const{dockOptions:l}=this,a=l.breakpoint;this._dockingThresholdCrossed(s,r,a)&&this._setDockEnabledForViewSize(l),this._setCurrentDockPosition()}_focusDockButtonNode(e){this._focusDockButton&&(this._focusDockButton=!1,e.focus())}_closeButtonNodeUpdated(e){return this._focusClose?(this._focusClose=!1,void e.focus()):this._blurClose?(this._blurClose=!1,void e.blur()):void 0}_mainContainerNodeUpdated(e){return this._mainContainerNode=e,this._focusContainer?(this._focusContainer=!1,void e.focus()):this._blurContainer?(this._blurContainer=!1,void e.blur()):void 0}_featureMenuNodeUpdated(e){if(this._featureMenuNode=e,!e||!this._focusFirstFeature)return;this._focusFirstFeature=!1;const t=e.querySelectorAll("li");if(t.length){t[0].focus()}}_actionsMenuNodeUpdated(e){if(this._actionsMenuNode=e,!e||!this._focusFirstAction)return;this._focusFirstAction=!1;const t=e.querySelectorAll("li");if(t.length){t[0].focus()}}_focusFeatureMenuButtonNode(e){this._focusFeatureMenuButton&&(this._focusFeatureMenuButton=!1,e.focus())}_focusActionsMenuButtonNode(e){this._focusActionsMenuButton&&(this._focusActionsMenuButton=!1,e.focus())}_featureMenuViewportScrollTop(){this._featureMenuViewportNode&&(this._featureMenuViewportNode.scrollTop=0)}_toggleScreenLocationEnabled(){const{dockEnabled:e,viewModel:t}=this;if(!t)return;const i=t.active&&!e;t.screenLocationEnabled=i}_shouldDockAtCurrentViewSize(e){const t=e.breakpoint,i=this.viewModel?.view?.ui;if(!i)return!1;const{width:o,height:n}=i;if(isNaN(o)||isNaN(n))return!1;if(!t)return!1;const s=t.hasOwnProperty("width")&&o<=(t.width??0),r=t.hasOwnProperty("height")&&n<=(t.height??0);return s||r}_setDockEnabledForViewSize(e){e.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(e))}_getPageText(e,t){return this.featureNavigationVisible?P(this.messages.pageText,{index:t+1,total:e}):null}_destroySpinner(){const{_spinner:e,view:t}=this;e&&(t&&t.ui&&t.ui.remove(e,S),e.destroy(),this._spinner=null)}_createSpinner(e){e&&(this._spinner=new v({view:e}),e.ui.add(this._spinner,{key:S,position:"manual"}))}_toggleCollapsed(){this.collapsed=!this.collapsed}_close(){this.close(),this.view&&this.view.focus()}_toggleDockEnabled(){this.dockEnabled=!this.dockEnabled,this._focusDockButton=!0,this.scheduleRender()}_toggleFeatureMenu(){const e=!this.featureMenuOpen;this._featureMenuOpenChanged(e),this.actionsMenuOpen=!1,this.featureMenuOpen=e}_toggleActionsMenu(){const e=!this.actionsMenuOpen;this._actionsMenuOpenChanged(e),this.featureMenuOpen=!1,this.actionsMenuOpen=e}_triggerAction(e){const t=e.currentTarget.dataset.actionUid,{allActions:i}=this.viewModel,o=i.findIndex((e=>e.uid===t)),n=i.at(o);n&&"toggle"===n.type&&(n.value=!n.value),this.actionsMenuOpen=!1,this.viewModel.triggerAction(o)}_selectFeature(e){const t=W(e.currentTarget);null==t||isNaN(t)||(this.viewModel.selectedFeatureIndex=t),this.featureMenuOpen=!1,this._focusFeatureMenuButton=!0,this.scheduleRender()}_next(){this.next()}_previous(){this.previous()}};function W(e){return e?.["data-feature-index"]}e([h({readOnly:!0})],U.prototype,"actionsMenuId",null),e([h({readOnly:!0})],U.prototype,"actionsMenuButtonId",null),e([h({readOnly:!0})],U.prototype,"featureMenuId",null),e([h({readOnly:!0})],U.prototype,"titleId",null),e([h({readOnly:!0})],U.prototype,"contentId",null),e([h({readOnly:!0})],U.prototype,"hasContent",null),e([h({readOnly:!0})],U.prototype,"featureNavigationVisible",null),e([h({readOnly:!0})],U.prototype,"collapsible",null),e([h({readOnly:!0})],U.prototype,"featureMenuVisible",null),e([h({readOnly:!0})],U.prototype,"contentCollapsed",null),e([h({readOnly:!0})],U.prototype,"dividedActions",null),e([h({readOnly:!0,dependsOn:["_flowItems.length"]})],U.prototype,"_activeFlowItemWidget",null),e([h()],U.prototype,"actions",null),e([h()],U.prototype,"actionsMenuOpen",null),e([h()],U.prototype,"alignment",void 0),e([h()],U.prototype,"autoCloseEnabled",null),e([h()],U.prototype,"autoOpenEnabled",null),e([h()],U.prototype,"defaultPopupTemplateEnabled",null),e([h()],U.prototype,"content",null),e([h()],U.prototype,"collapsed",void 0),e([h()],U.prototype,"collapseEnabled",void 0),e([h({readOnly:!0})],U.prototype,"currentAlignment",null),e([h({readOnly:!0})],U.prototype,"currentDockPosition",null),e([h()],U.prototype,"dockOptions",null),e([h()],U.prototype,"dockEnabled",void 0),e([h({readOnly:!0})],U.prototype,"featureCount",null),e([h()],U.prototype,"featureMenuOpen",null),e([h()],U.prototype,"features",null),e([h()],U.prototype,"goToOverride",null),e([h()],U.prototype,"headingLevel",void 0),e([h()],U.prototype,"highlightEnabled",null),e([h()],U.prototype,"location",null),e([h()],U.prototype,"label",null),e([h()],U.prototype,"maxInlineActions",void 0),e([h(),C("esri/widgets/Popup/t9n/Popup")],U.prototype,"messages",void 0),e([h(),C("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([h()],U.prototype,"promises",null),e([h({readOnly:!0})],U.prototype,"selectedFeature",null),e([h()],U.prototype,"selectedFeatureIndex",null),e([h({readOnly:!0})],U.prototype,"selectedFeatureWidget",null),e([h()],U.prototype,"spinnerEnabled",void 0),e([h()],U.prototype,"title",null),e([h()],U.prototype,"updateLocationEnabled",null),e([h()],U.prototype,"view",null),e([h({type:y}),I(["triggerAction","trigger-action"])],U.prototype,"viewModel",void 0),e([h()],U.prototype,"visible",null),e([h()],U.prototype,"visibleElements",void 0),e([p("visibleElements")],U.prototype,"castVisibleElements",null),e([F()],U.prototype,"_close",null),e([F()],U.prototype,"_toggleDockEnabled",null),e([F()],U.prototype,"_toggleFeatureMenu",null),e([F()],U.prototype,"_toggleActionsMenu",null),e([F()],U.prototype,"_triggerAction",null),e([F()],U.prototype,"_selectFeature",null),e([F()],U.prototype,"_next",null),e([F()],U.prototype,"_previous",null),U=e([g("esri.widgets.Popup")],U);const H=U;export{H as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{eventKey as o}from"../core/events.js";import n from"../core/Handles.js";import s from"../core/Logger.js";import{watch as r,when as l,on as a,whenOnce as c,initial as u}from"../core/reactiveUtils.js";import{throttle as d}from"../core/throttle.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as p}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import m from"./Feature.js";import v from"./Spinner.js";import f from"./Widget.js";import{CSS as _}from"./Feature/resources.js";import{FeatureContentMixin as w}from"./Feature/support/FeatureContentMixin.js";import{getPointFromGeometry as b}from"./Popup/actionUtils.js";import{CSS as M}from"./Popup/css.js";import y from"./Popup/PopupViewModel.js";import{loadCalciteComponents as k}from"./support/componentsUtils.js";import{Heading as A}from"./support/Heading.js";import{accessibleHandler as F}from"./support/decorators/accessibleHandler.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{vmEvent as I}from"./support/decorators/vmEvent.js";import{tsx as O}from"./support/jsxFactory.js";import{storeNode as x,cssTransition as E,isRTL as N}from"./support/widgetUtils.js";import{isDarkTheme as B}from"../support/themeUtils.js";import{substitute as P}from"../intl/substitute.js";const T="selected-index",D=0,S="popup-spinner",L={buttonEnabled:!0,position:"auto",breakpoint:{width:544}},R="esri-popup";function V(e,t){return void 0===t?`${R}__${e}`:`${R}__${e}-${t}`}const j={closeButton:!0,featureNavigation:!0};let U=class extends(w(f)){constructor(e,i){super(e,i),this._blurClose=!1,this._blurContainer=!1,this._containerNode=null,this._mainContainerNode=null,this._featureMenuNode=null,this._actionsMenuNode=null,this._focusClose=!1,this._focusContainer=!1,this._focusDockButton=!1,this._focusFeatureMenuButton=!1,this._focusActionsMenuButton=!1,this._focusFirstFeature=!1,this._focusFirstAction=!1,this._handles=new n,this._pointerOffsetInPx=16,this._spinner=null,this._feature=null,this._featureMenuIntersectionObserverNode=null,this._featureMenuViewportNode=null,this._rootFlowItemNode=null,this._featureMenuIntersectionObserverCallback=([e])=>{e?.isIntersecting&&null!=this.viewModel.featurePage&&this.viewModel.featurePage++},this._featureMenuIntersectionObserver=new IntersectionObserver(this._featureMenuIntersectionObserverCallback,{root:window.document}),this._displaySpinnerThrottled=d((()=>this._displaySpinner()),D),this._exitRelatedRecordsActions=new WeakMap,this._featureSelectionActions=new WeakMap,this._flowItems=new t,this.alignment="auto",this.collapsed=!1,this.collapseEnabled=!0,this.dockEnabled=!1,this.headingLevel=2,this.maxInlineActions=3,this.messages=null,this.messagesCommon=null,this.spinnerEnabled=!0,this.viewModel=new y,this.visibleElements={...j},this._handleOpenRelatedFeature=e=>{this._openRelatedFeature(e)},this._addSelectedFeatureIndexHandle(),this.addHandles([this._displaySpinnerThrottled,r((()=>this.viewModel?.screenLocation),(()=>this._positionContainer())),r((()=>[this.viewModel?.active,this.dockEnabled]),(()=>this._toggleScreenLocationEnabled())),r((()=>this.viewModel?.screenLocation),((e,t)=>{!!e!=!!t&&this.reposition()})),r((()=>[this.viewModel?.view?.padding,this.viewModel?.view?.size,this.viewModel?.active,this.viewModel?.location,this.alignment]),(()=>this.reposition())),r((()=>this.spinnerEnabled),(e=>this._spinnerEnabledChange(e))),r((()=>this.viewModel?.view?.size),((e,t)=>this._updateDockEnabledForViewSize(e,t))),r((()=>this.viewModel?.view),((e,t)=>this._viewChange(e,t))),r((()=>this.viewModel?.view?.ready),((e,t)=>this._viewReadyChange(e??!1,t??!1))),r((()=>[this.viewModel?.waitingForResult,this.viewModel?.location]),(()=>{this._hideSpinner(),this._displaySpinnerThrottled()})),r((()=>this.selectedFeatureWidget),(()=>this._destroyFlowItemWidgets())),r((()=>[this.selectedFeatureWidget?.viewModel?.title,this.selectedFeatureWidget?.viewModel?.state]),(()=>this._setTitleFromFeatureWidget())),r((()=>[this.selectedFeatureWidget?.viewModel?.content,this.selectedFeatureWidget?.viewModel?.state]),(()=>this._setContentFromFeatureWidget())),l((()=>!this.collapsed),(()=>{"xsmall"===this.viewModel?.view?.widthBreakpoint&&this.viewModel.active&&this.collapseEnabled&&this.viewModel.centerAtLocation()})),a((()=>this.viewModel?.allActions),"change",(()=>this._watchActions())),r((()=>this.viewModel?.allActions),(()=>this._watchActions()),u),r((()=>this.viewModel?.featureViewModels),(()=>this._featureMenuViewportScrollTop())),a((()=>this._flowItems),"change",(()=>{this.notifyChange("_activeFlowItemWidget"),this.scheduleRender()})),r((()=>[this._activeFlowItemWidget?.viewModel?.state,this._activeFlowItemWidget?.viewModel?.title]),(()=>this.scheduleRender()))])}loadDependencies(){return k({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}initialize(){this.addHandles(this._displaySpinnerThrottled)}destroy(){this._destroyFlowItemWidgets(),this._destroySelectedFeatureWidget(),this._destroySpinner(),this._handles?.destroy(),this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver?.disconnect()}get actionsMenuId(){return`${this.id}-actions-menu`}get actionsMenuButtonId(){return`${this.id}-actions-menu-button`}get featureMenuId(){return`${this.id}-feature-menu`}get titleId(){return`${this.id}-popup-title`}get contentId(){return`${this.id}-popup-content`}get hasContent(){const{selectedFeatureWidget:e,viewModel:t}=this;if(!e)return!!t?.content;const i=e.viewModel;if(i?.waitingForContent||"error"===i?.state)return!0;const o=i?.content;return Array.isArray(o)?!!o.length:!!o}get featureNavigationVisible(){return this.viewModel.active&&this.viewModel.featureCount>1&&!!this.visibleElements.featureNavigation}get collapsible(){return!!(this.collapseEnabled&&this.viewModel.title&&this.hasContent)}get featureMenuVisible(){return this.featureNavigationVisible&&this.featureMenuOpen}get contentCollapsed(){return this.collapsible&&!this.featureMenuVisible&&this.collapsed}get dividedActions(){return this._divideActions()}get _activeFlowItemWidget(){const{_flowItems:e}=this;return e.at(-1)??null}get actions(){return this.viewModel.actions}set actions(e){this.viewModel.actions=e}set actionsMenuOpen(e){this._set("actionsMenuOpen",!!e)}get actionsMenuOpen(){return!!this.viewModel.active&&this._get("actionsMenuOpen")}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(e){this.viewModel.autoCloseEnabled=e}get autoOpenEnabled(){return i(s.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled}set autoOpenEnabled(e){i(s.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled=e}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(e){this.viewModel.defaultPopupTemplateEnabled=e}get content(){return this.viewModel.content}set content(e){this.viewModel.content=e}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||L}set dockOptions(e){const t={...L},i=this.viewModel?.view?.breakpoints,o={};i&&(o.width=i.xsmall,o.height=i.xsmall);const n={...t,...e},s={...t.breakpoint,...o},{breakpoint:r}=n;"object"==typeof r?n.breakpoint={...s,...r}:r&&(n.breakpoint=s),this._set("dockOptions",n),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(e){this.viewModel.featureMenuOpen=e}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get promises(){return this.viewModel.promises}set promises(e){this.viewModel.promises=e}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(e){this.viewModel.selectedFeatureIndex=e}get selectedFeatureWidget(){const{_feature:e,visibleElements:t,headingLevel:i,_flowItems:o}=this,{selectedFeatureViewModel:n}=this.viewModel,s={...t,title:!1};return n?(e?(e.viewModel=n,e.visibleElements=s):this._feature=new m({flowItems:o,headingLevel:i+1,viewModel:n,visibleElements:s}),this._feature):null}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(e){this.viewModel.updateLocationEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}castVisibleElements(e){return{...j,...e}}blur(){const{active:e}=this.viewModel;e||s.getLogger(this).warn("Popup can only be blurred when currently active."),this.visibleElements.closeButton?this._blurClose=!0:this._blurContainer=!0,this.scheduleRender()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(e,t){return this.viewModel.fetchFeatures(e,t)}focus(){const{active:e}=this.viewModel;e||s.getLogger(this).warn("Popup can only be focused when currently active."),this.visibleElements.closeButton?this._focusClose=!0:this._focusContainer=!0,this.scheduleRender()}next(){return this.viewModel.next()}open(e){this._handles.remove(T);const t=!!e&&!!e.featureMenuOpen,i=!!e&&!!e.actionsMenuOpen,o={collapsed:!!e&&!!e.collapsed,actionsMenuOpen:i,featureMenuOpen:t};"xsmall"===this.viewModel?.view?.widthBreakpoint&&(o.collapsed=!0),this.set(o),this.viewModel.open(e),this._shouldFocus(e),this._addSelectedFeatureIndexHandle()}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(e){return this.viewModel.triggerAction(e)}render(){const{actionsMenuOpen:e,dockEnabled:t,featureMenuVisible:i,dividedActions:o,currentAlignment:n,currentDockPosition:s}=this,{active:r}=this.viewModel,{menuActions:l}=o,a=r&&l.length>1&&e,c=r&&t,u=r&&!t,d=this.selectedFeature?.layer?.title,h=this.selectedFeature?.layer?.id,p={[M.alignTopCenter]:"top-center"===n,[M.alignBottomCenter]:"bottom-center"===n,[M.alignTopLeft]:"top-left"===n,[M.alignBottomLeft]:"bottom-left"===n,[M.alignTopRight]:"top-right"===n,[M.alignBottomRight]:"bottom-right"===n,[M.isDocked]:c,[M.shadow]:u,[M.isDockedTopLeft]:"top-left"===s,[M.isDockedTopCenter]:"top-center"===s,[M.isDockedTopRight]:"top-right"===s,[M.isDockedBottomLeft]:"bottom-left"===s,[M.isDockedBottomCenter]:"bottom-center"===s,[M.isDockedBottomRight]:"bottom-right"===s,[M.isFeatureMenuOpen]:i,[M.isActionsMenuOpen]:a};return O("div",{class:this.classes(M.base,p),role:"presentation","data-layer-title":d,"data-layer-id":h,bind:this,afterCreate:this._positionContainer,afterUpdate:this._positionContainer},r?[this.renderMainContainer(),this.renderPointer()]:null)}renderLoadingIcon(){return O("span",{"aria-hidden":"true",class:this.classes(M.icon,M.iconLoading,M.rotating)})}renderNavigationLoading(){const{messagesCommon:e}=this;return this.viewModel.pendingPromisesCount?O("div",{key:V("loading-container"),role:"presentation",class:M.loadingContainer,"aria-label":e.loading,title:e.loading},this.renderLoadingIcon()):null}renderPreviousButton(){const{messages:e}=this;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._previous,onkeydown:this._previous,class:this.classes(M.button,M.paginationPrevious),"aria-label":e.previous,title:e.previous},O("calcite-icon",{icon:"chevron-left",scale:"s",class:M.paginationIcon}))}renderNextButton(){const{messages:e}=this;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._next,onkeydown:this._next,class:this.classes(M.button,M.paginationNext),"aria-label":e.next,title:e.next},O("calcite-icon",{icon:"chevron-right",scale:"s",class:M.paginationIcon}))}renderFeatureMenuButton(){const{featureMenuOpen:e,featureMenuId:t,messagesCommon:i}=this,{featureCount:o,selectedFeatureIndex:n}=this.viewModel;return O("div",{role:"button",tabIndex:0,bind:this,onclick:this._toggleFeatureMenu,onkeydown:this._toggleFeatureMenu,afterCreate:this._focusFeatureMenuButtonNode,afterUpdate:this._focusFeatureMenuButtonNode,class:M.featureMenuButton,"aria-haspopup":"true","aria-controls":t,"aria-expanded":e.toString(),"aria-label":i.menu,title:i.menu},O("calcite-icon",{icon:"list-bullet",scale:"s",class:M.featureMenuButtonIcon}),this._getPageText(o,n))}renderNavigationButtons(){return this.featureNavigationVisible?[this.renderPreviousButton(),this.renderNextButton(),this.renderNavigationLoading()||this.renderFeatureMenuButton()]:[]}renderDockIcon(){const{dockEnabled:e}=this,t=this._wouldDockTo(),i={[M.iconUndock]:e,[M.iconDock]:!e,[M.iconDockToRight]:!e&&("top-right"===t||"bottom-right"===t),[M.iconDockToLeft]:!e&&("top-left"===t||"bottom-left"===t),[M.iconDockToTop]:!e&&"top-center"===t,[M.iconDockToBottom]:!e&&"bottom-center"===t};return O("span",{"aria-hidden":"true",class:this.classes(i,M.icon)})}renderDockButton(){const{dockEnabled:e,messages:t}=this,i=this.viewModel?.view?.widthBreakpoint,o=e?t.undock:t.dock;return"xsmall"!==i&&this.dockOptions?.buttonEnabled?O("div",{role:"button","aria-label":o,title:o,tabIndex:0,bind:this,onclick:this._toggleDockEnabled,onkeydown:this._toggleDockEnabled,afterCreate:this._focusDockButtonNode,afterUpdate:this._focusDockButtonNode,class:this.classes(M.button,M.buttonDock)},this.renderDockIcon()):null}renderTitle(){const{title:e}=this.viewModel,{titleId:t,collapsible:i,contentCollapsed:o,messagesCommon:n}=this,s={[M.headerContainerButton]:i},r=O(A,{level:this.headingLevel,class:M.headerTitle,innerHTML:e??""}),l=i?O("button",{key:`${e}--collapsible`,id:t,title:o?n.expand:n.collapse,bind:this,enterAnimation:this._createFeatureUpdatedAnimation(),class:this.classes(M.headerContainer,s),"aria-expanded":o?"false":"true",onclick:this._toggleCollapsed,type:"button"},r,O("calcite-icon",{class:M.collapseIcon,key:"collapse-icon",icon:o?"chevron-down":"chevron-up",scale:"m"})):O("div",{key:e??"title",id:t,bind:this,enterAnimation:this._createFeatureUpdatedAnimation(),class:this.classes(M.headerContainer,s)},r);return e?l:null}renderCloseIcon(){return O("span",{"aria-hidden":"true",class:this.classes(M.icon,M.iconClose)})}renderCloseButton(){const{visibleElements:e,messagesCommon:t}=this;return e.closeButton?O("div",{role:"button",tabIndex:0,bind:this,onclick:this._close,onkeydown:this._close,class:M.button,"aria-label":t.close,title:t.close,afterCreate:this._closeButtonNodeUpdated,afterUpdate:this._closeButtonNodeUpdated},this.renderCloseIcon()):null}renderHeader(){return O("header",{class:M.header},this.renderTitle(),O("div",{class:M.headerButtons},this.renderDockButton(),this.renderCloseButton()))}renderContentContainer(){const{contentId:e,hasContent:t,contentCollapsed:i,_flowItems:o}=this,{content:n}=this.viewModel,s=o.toArray(),r={[M.contentHasFlows]:!!s.length};return t&&!i?O("div",{key:n??"content",enterAnimation:this._createFeatureUpdatedAnimation(),id:e,class:this.classes(M.content,r)},O("calcite-flow",{bind:this},O("calcite-flow-item",{bind:this,"data-node-ref":"_rootFlowItemNode",afterCreate:x,key:"root-flow-item",onCalciteFlowItemBack:this._handleBackClick},this.renderContent()),s.map((e=>this.renderFlowItem(e)))),s.map((e=>this.renderFlowItemTooltips(e)))):null}renderFlowItem(e){const{messages:t}=this,i=B(),o="graphic"in e&&!e.isTable;return O("calcite-flow-item",{bind:this,class:this.classes({[M.calciteThemeDark]:!i,[M.calciteThemeLight]:i}),heading:e.title??"",description:this._getFlowItemDescription(e),onCalciteFlowItemBack:this._handleBackClick,key:`flow-item-${e.viewModel.uid}`},O("calcite-action",{class:M.actionExit,icon:"move-up",label:t?.exitRelatedRecords,text:t?.exitRelatedRecords,slot:"header-actions-start",bind:this,afterCreate:t=>this._storeExitRelatedRecordsAction(e,t),onclick:this._destroyFlowItemWidgets}),o?O("calcite-action",{class:M.actionSelectFeature,icon:"zoom-to-object",label:t?.selectFeature,text:t?.selectFeature,slot:"header-actions-end",bind:this,afterCreate:t=>this._storeFeatureSelectionAction(e,t),onclick:()=>this._handleOpenRelatedFeature(e)}):null,O("div",{class:this.classes(M.contentFlowItem,{[M.calciteThemeDark]:i,[M.calciteThemeLight]:!i})},e.render()))}renderFlowItemTooltips(e){const{messages:t,_exitRelatedRecordsActions:i,_featureSelectionActions:o}=this,n=B(),s=o.get(e);return[O("calcite-tooltip",{class:this.classes({[M.calciteThemeDark]:!n,[M.calciteThemeLight]:n}),key:`exit-related-records-tooltip-${e.viewModel.uid}`,label:t?.exitRelatedRecords,overlayPositioning:"fixed",referenceElement:i.get(e),placement:"top"},t?.exitRelatedRecords),s?O("calcite-tooltip",{class:this.classes({[M.calciteThemeDark]:!n,[M.calciteThemeLight]:n}),key:`select-related-record-tooltip-${e.viewModel.uid}`,label:t?.selectFeature,overlayPositioning:"fixed",referenceElement:s,placement:"top"},t?.selectFeature):null]}renderActionsMenuButton(){const{actionsMenuId:e,actionsMenuButtonId:t,actionsMenuOpen:i,dividedActions:o,messagesCommon:n}=this,s=i?n.close:n.open,{menuActions:r}=o;return r.length?O("div",{key:V("actions-menu-button"),class:this.classes(M.button,M.actionsMenuButton),role:"button",id:t,"aria-haspopup":"true","aria-controls":i?e:null,tabIndex:0,bind:this,onclick:this._toggleActionsMenu,onkeydown:this._toggleActionsMenu,afterCreate:this._focusActionsMenuButtonNode,afterUpdate:this._focusActionsMenuButtonNode,"aria-label":s,title:s},O("span",{"aria-hidden":"true",class:M.iconActionsMenu})):null}renderMenuActions(){const{actionsMenuId:e,actionsMenuButtonId:t,actionsMenuOpen:i,dividedActions:o}=this,{menuActions:n}=o;return n.length&&i?O("ul",{id:e,role:"menu","aria-labelledby":t,key:V("actions"),class:M.actions,bind:this,onkeyup:this._handleActionMenuKeyup,afterCreate:this._actionsMenuNodeUpdated,afterUpdate:this._actionsMenuNodeUpdated},n.toArray().map((e=>this.renderAction({action:e,type:"menu-item"})))):null}renderInlineActions(){const{inlineActions:e}=this.dividedActions;return e.length?e.toArray().map((e=>this.renderAction({action:e,type:"inline"}))):[]}renderInlineActionsContainer(){const{inlineActions:e,menuActions:t}=this.dividedActions,i=!!e.length,o=!!t.length;return i||o?O("div",{key:"inline-actions-container","data-inline-actions":i.toString(),"data-menu-actions":o.toString(),class:M.inlineActionsContainer},this.renderInlineActions(),this.renderActionsMenuButton(),this.renderMenuActions()):null}renderNavigation(){return this.featureNavigationVisible?O("section",{key:V("navigation"),class:this.classes(M.navigation)},this.renderNavigationButtons()):null}renderFooter(){const{featureNavigationVisible:e,dividedActions:t}=this,{inlineActions:i,menuActions:o}=t,n=!!i.length,s=!!o.length,r={[M.footerHasPagination]:e,[M.footerHasActions]:n,[M.footerHasActionsMenu]:s};return e||n?O("div",{key:V("feature-buttons"),class:this.classes(M.footer,r)},this.renderInlineActionsContainer(),this.renderNavigation()):null}renderFeatureMenuContainer(){const{messages:e}=this,{featureViewModels:t,isLoadingFeature:i}=this.viewModel,o=P(e.selectedFeatures,{total:t.length});return O("section",{key:V("menu"),class:M.featureMenu},O("strong",{class:M.featureMenuHeader},o),O("nav",{bind:this,class:M.featureMenuViewport,"data-node-ref":"_featureMenuViewportNode",afterCreate:x},this.renderFeatureMenu(),O("div",{class:M.featureMenuObserver,bind:this,afterCreate:this._featureMenuIntersectionObserverCreated}),i?O("div",{class:M.featureMenuLoader},this.renderLoadingIcon()):null))}renderPointer(){return this.dockEnabled?null:O("div",{key:V("pointer"),class:M.pointer,role:"presentation"},O("div",{class:this.classes(M.pointerDirection,M.shadow)}))}renderMainContainer(){const{dockEnabled:e,currentAlignment:t,currentDockPosition:i,titleId:o,contentId:n,collapsible:s,hasContent:r,contentCollapsed:l,visibleElements:a}=this,{title:c}=this.viewModel,u="bottom-left"===t||"bottom-center"===t||"bottom-right"===t||"top-left"===i||"top-center"===i||"top-right"===i,d="top-left"===t||"top-center"===t||"top-right"===t||"bottom-left"===i||"bottom-center"===i||"bottom-right"===i,h={[M.shadow]:e,[M.isCollapsible]:s,[M.isCollapsed]:l};return O("div",{class:this.classes(M.main,M.widget,h),tabIndex:a.closeButton?void 0:-1,role:"dialog","aria-live":"polite","aria-labelledby":c?o:"","aria-describedby":r&&!l?n:"",bind:this,onkeyup:this._handleMainKeyup,afterCreate:this._mainContainerNodeUpdated,afterUpdate:this._mainContainerNodeUpdated},u?this.renderFooter():null,u?this.renderFeatureMenuContainer():null,this.renderHeader(),this.renderContentContainer(),d?this.renderFooter():null,d?this.renderFeatureMenuContainer():null)}renderContent(){const e=this.viewModel?.content;return e?"string"==typeof e?O("div",{class:_.contentNode,key:e,innerHTML:e}):this.renderNodeContent(e):null}renderActionText(e){return O("span",{key:"text",class:M.actionText},e)}renderActionCalciteIcon(e,t){return O("calcite-icon",{scale:"s",key:`calcite-icon-${t}`,icon:e,class:M.icon})}renderActionIcon(e){const t=this._getActionClass(e),i=this._getActionImage(e),o={[M.iconLoading]:e.active,[M.rotating]:e.active,[M.icon]:!!t,[M.actionImage]:!e.active&&!!i};return t&&(o[t]=!e.active),O("span",{key:"icon","aria-hidden":"true",class:this.classes(M.icon,o),styles:this._getIconStyles(i)})}renderAction(e){const{action:t,type:i}=e,o=this._getActionTitle(t),n={[M.action]:"toggle"!==t.type,[M.actionToggle]:"toggle"===t.type,[M.actionToggleOn]:"toggle"===t.type&&t.value,[M.buttonDisabled]:t.disabled},s=[t.icon&&!t.active?this.renderActionCalciteIcon(t.icon,t.uid):this.renderActionIcon(t),this.renderActionText(o)],r="menu-item"===i?O("li",{key:t.uid,role:"menuitem",tabIndex:0,title:o,"aria-label":o,class:this.classes(M.button,n),onkeyup:this._handleActionMenuItemKeyup,bind:this,"data-action-uid":t.uid,onclick:this._triggerAction,onkeydown:this._triggerAction},s):O("div",{key:t.uid,role:"button",tabIndex:0,title:o,"aria-label":o,class:this.classes(M.button,n),onkeyup:this._handleActionMenuItemKeyup,bind:this,"data-action-uid":t.uid,onclick:this._triggerAction,onkeydown:this._triggerAction},s);return t.visible?r:null}renderFeatureMenuItem(e,t){const{messages:i,messagesCommon:o}=this,{selectedFeatureIndex:n,selectedFeatureViewModel:s}=this.viewModel,r=e===s,l={[M.featureMenuSelected]:r},a=r?O("span",{key:V(`feature-menu-selected-feature-${n}`),title:i.selectedFeature,"aria-label":i.selectedFeature,class:M.iconCheckMark}):null,c=O("span",{innerHTML:e.title||o.untitled});return O("li",{role:"menuitem",tabIndex:-1,key:V(`feature-menu-feature-${n}`),class:this.classes(l,M.featureMenuItem),bind:this,"data-feature-index":t,onblur:this._removeActiveFeature,onfocus:this._setActiveFeature,onkeyup:this._handleFeatureMenuItemKeyup,onclick:this._selectFeature,onkeydown:this._selectFeature,onmouseover:this._setActiveFeature,onmouseleave:this._removeActiveFeature},O("span",{class:M.featureMenuTitle},c,a))}renderFeatureMenu(){const{featureMenuId:e}=this,{featureViewModels:t}=this.viewModel;return t.length>1?O("ol",{class:M.featureMenuList,id:e,bind:this,afterCreate:this._featureMenuNodeUpdated,afterUpdate:this._featureMenuNodeUpdated,onkeyup:this._handleFeatureMenuKeyup,role:"menu"},t.filter((e=>!!e.graphic)).map(((e,t)=>this.renderFeatureMenuItem(e,t)))):null}_storeFeatureSelectionAction(e,t){this._featureSelectionActions.set(e,t),this.scheduleRender()}_storeExitRelatedRecordsAction(e,t){this._exitRelatedRecordsActions.set(e,t),this.scheduleRender()}_getFlowItemDescription(e){return"featureCountDescription"in e?e.featureCountDescription:e.viewModel.description??""}async _openRelatedFeature(e){await e.viewModel.updateGeometry();const t=e.graphic,i=t?.geometry;if(null==i||null==t)return;this._destroyFlowItemWidgets(),await this.viewModel.zoomTo({target:i});const o=b(i);this.open({features:[t],location:null!=o?o:void 0})}_destroyFlowItemWidgets(){this._flowItems.removeAll().forEach((e=>{"showAllEnabled"in e.viewModel&&(e.viewModel.showAllEnabled=!1),e.viewModel=null,e.destroy()}))}_handleBackClick(){const e=this._flowItems.pop();e&&(this._exitRelatedRecordsActions.delete(e),this._featureSelectionActions.delete(e),"showAllEnabled"in e.viewModel&&(e.viewModel.showAllEnabled=!1),e&&(e.viewModel=null,e.destroy()))}_getActionTitle(e){const{messages:t,selectedFeature:i,messagesCommon:o}=this,{id:n}=e,s=i?.attributes,r=e.title??"",l="zoom-to-feature"===n?P(r,{messages:t}):"remove-selected-feature"===n?P(r,{messages:o}):"zoom-to-clustered-features"===n||"browse-clustered-features"===n?P(r,{messages:t}):e.title;return l&&s?P(l,s):l??""}_getActionClass(e){const{selectedFeature:t}=this,i=t?.attributes,{className:o,image:n}=e,s=n||o?o:M.iconDefaultAction;return s&&i?P(s,i):s??""}_getActionImage(e){if(e.active)return"";const{selectedFeature:t}=this,i=t?.attributes,{image:o}=e;return o&&i?P(o,i):o??""}_createFeatureUpdatedAnimation(){return E("enter",M.hasFeatureUpdated)}_getInlineActionCount(){const{maxInlineActions:e,featureNavigationVisible:t}=this;if("number"!=typeof e)return null;const i=Math.round(e);return Math.max(t?i-1:i,0)}_watchActions(){const{allActions:e}=this.viewModel;this.notifyChange("dividedActions");const t="actions";this._handles.remove(t),e&&e.forEach((e=>{this._handles.add(r((()=>[e.uid,e.active,e.className,e.disabled,e.id,e.title,e.image,e.visible]),(()=>this.scheduleRender())),t)}))}_divideActions(){const{allActions:e}=this.viewModel,i=e.filter((e=>e.visible)),o=this._getInlineActionCount(),n=null===o,s=0===o;return{inlineActions:n?i.slice(0):s?new t:i.slice(0,o),menuActions:n?new t:s?i.slice(0):i.slice(o)}}_featureMenuOpenChanged(e){e?this._focusFirstFeature=!0:this._focusFeatureMenuButton=!0}_actionsMenuOpenChanged(e){e?this._focusFirstAction=!0:this._focusActionsMenuButton=!0}_setTitleFromFeatureWidget(){const{selectedFeatureWidget:e,messagesCommon:t}=this;e&&(this.viewModel.title="error"===e.viewModel?.state?t.errorMessage:e.viewModel?.title||"")}_setContentFromFeatureWidget(){const{selectedFeatureWidget:e}=this;e&&(this.viewModel.content=e)}_unobserveFeatureMenuObserver(){this._featureMenuIntersectionObserverNode&&this._featureMenuIntersectionObserver.unobserve(this._featureMenuIntersectionObserverNode)}_featureMenuIntersectionObserverCreated(e){this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver.observe(e),this._featureMenuIntersectionObserverNode=e}_handleFeatureMenuKeyup(e){"Escape"===o(e)&&(e.stopPropagation(),this._focusFeatureMenuButton=!0,this.featureMenuOpen=!1,this.scheduleRender())}_handleActionMenuKeyup(e){"Escape"===o(e)&&(e.stopPropagation(),this._focusActionsMenuButton=!0,this.actionsMenuOpen=!1,this.scheduleRender())}_setActiveFeature(e){const{viewModel:t}=this,i=W(e.currentTarget);t.activeFeature=t.features[i]||null}_removeActiveFeature(){this.viewModel.activeFeature=null}_handleFeatureMenuItemKeyup(e){const t=o(e),{_featureMenuNode:i}=this,n=W(e.currentTarget);if(!i)return;const s=i.querySelectorAll("li"),r=s.length;if("ArrowUp"!==t)if("ArrowDown"!==t)if("Home"!==t)if("End"!==t);else{e.stopPropagation();s[s.length-1].focus()}else{e.stopPropagation();s[0].focus()}else{e.stopPropagation();s[(n+1+r)%r].focus()}else{e.stopPropagation();s[(n-1+r)%r].focus()}}_handleActionMenuItemKeyup(e){const t=o(e),{_actionsMenuNode:i}=this,n=e.currentTarget.dataset.actionUid,{menuActions:s}=this.dividedActions,r=s.findIndex((e=>e.uid===n));if(!i)return;const l=i.querySelectorAll("li"),a=l.length;if("ArrowUp"!==t)if("ArrowDown"!==t)if("Home"!==t)if("End"!==t);else{e.stopPropagation();l[l.length-1].focus()}else{e.stopPropagation();l[0].focus()}else{e.stopPropagation();l[(r+1+a)%a].focus()}else{e.stopPropagation();l[(r-1+a)%a].focus()}}_handleMainKeyup(e){const t=o(e);"ArrowLeft"===t&&(e.stopPropagation(),this.previous()),"ArrowRight"===t&&(e.stopPropagation(),this.next())}_spinnerEnabledChange(e){if(this._destroySpinner(),!e)return;const t=this.get("viewModel.view");this._createSpinner(t)}_hideSpinner(){const{_spinner:e}=this;e&&(e.location=null,e.hide())}_displaySpinner(){const{_spinner:e}=this;if(!e)return;const{location:t,waitingForResult:i}=this.viewModel;i&&t?e.show({location:t}):e.hide()}_getIconStyles(e){return{"background-image":e?`url(${e})`:""}}async _shouldFocus(e){e?.shouldFocus&&(await c((()=>!0===this.viewModel?.active)),this.focus())}_addSelectedFeatureIndexHandle(){const e=r((()=>this.viewModel?.selectedFeatureIndex),((e,t)=>this._selectedFeatureIndexUpdated(e,t)));this._handles.add(e,T)}_selectedFeatureIndexUpdated(e,t){const{featureCount:i}=this;i&&e!==t&&-1!==e&&(this._destroyFlowItemWidgets(),this.actionsMenuOpen=!1,this.featureMenuOpen=!1,this._mainContainerNode&&(this._mainContainerNode.scrollTop=0),this._rootFlowItemNode&&this._rootFlowItemNode.scrollContentTo({top:0}))}_destroySelectedFeatureWidget(){const{_feature:e}=this;e&&(e.viewModel=null,e&&!e.destroyed&&e.destroy()),this._feature=null}_isScreenLocationWithinView(e,t){return e.x>-1&&e.y>-1&&e.x<=t.width&&e.y<=t.height}_isOutsideView(e){const{popupHeight:t,popupWidth:i,screenLocation:o,side:n,view:s}=e;if(isNaN(i)||isNaN(t)||!s||!o)return!1;const r=s.padding;return"right"===n&&o.x+i/2>s.width-r.right||("left"===n&&o.x-i/2<r.left||("top"===n&&o.y-t<r.top||"bottom"===n&&o.y+t>s.height-r.bottom))}_calculateAutoAlignment(e){if("auto"!==e)return e;const{_pointerOffsetInPx:t,_containerNode:i,_mainContainerNode:o,viewModel:n}=this,{screenLocation:s,view:r}=n;if(null==s||!r||!i)return"top-center";if(!this._isScreenLocationWithinView(s,r))return this._get("currentAlignment")||"top-center";function l(e){return parseInt(e.replaceAll(/[^-\d\.]/g,""),10)}const a=o?window.getComputedStyle(o,null):null,c=a?l(a.getPropertyValue("max-height")):0,u=a?l(a.getPropertyValue("height")):0,{height:d,width:h}=i.getBoundingClientRect(),p=h+t,g=Math.max(d,c,u)+t,m=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"right",view:r}),v=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"left",view:r}),f=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"top",view:r}),_=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:s,side:"bottom",view:r});return v?f?"bottom-right":"top-right":m?f?"bottom-left":"top-left":f?_?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(e){return"function"==typeof e?e.call(this):e}_getCurrentAlignment(){const{alignment:e,dockEnabled:t}=this;return t||!this.viewModel.active?null:this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(e)))}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(e){const t=["left","right"];return N(this.container)&&t.reverse(),e?.replace(/leading/gi,t[0]).replaceAll(/trailing/gi,t[1])}_callDockPosition(e){return"function"==typeof e?e.call(this):e}_getDockPosition(){return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition(this.dockOptions?.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_wouldDockTo(){return this.dockEnabled?null:this._getDockPosition()}_calculateAutoDockPosition(e){if("auto"!==e)return e;const t=this.viewModel?.view,i=N(this.container)?"top-left":"top-right";if(!t)return i;const o=t.padding||{left:0,right:0,top:0,bottom:0},n=t.width-o.left-o.right,{breakpoints:s}=t;return s&&n<=s.xsmall?"bottom-center":i}_positionContainer(e=this._containerNode){if(e&&(this._containerNode=e),!this._containerNode)return;const{screenLocation:t}=this.viewModel,{width:i}=this._containerNode.getBoundingClientRect(),o=this._calculatePositionStyle(t,i);o&&Object.assign(this._containerNode.style,o)}_calculateFullWidth(e){const{currentAlignment:t,_pointerOffsetInPx:i}=this;return"top-left"===t||"bottom-left"===t||"top-right"===t||"bottom-right"===t?e+i:e}_calculateAlignmentPosition(e,t,i,o){const{currentAlignment:n,_pointerOffsetInPx:s}=this;if(!i)return;const{padding:r}=i,l=o/2,a=i.height-t,c=i.width-e;return"bottom-center"===n?{top:t+s-r.top,left:e-l-r.left}:"top-left"===n?{bottom:a+s-r.bottom,right:c+s-r.right}:"bottom-left"===n?{top:t+s-r.top,right:c+s-r.right}:"top-right"===n?{bottom:a+s-r.bottom,left:e+s-r.left}:"bottom-right"===n?{top:t+s-r.top,left:e+s-r.left}:"top-center"===n?{bottom:a+s-r.bottom,left:e-l-r.left}:void 0}_calculatePositionStyle(e,t){const{dockEnabled:i,view:o}=this;if(!o)return;if(i)return{left:"",top:"",right:"",bottom:""};if(null==e||!t)return;const n=this._calculateFullWidth(t),s=this._calculateAlignmentPosition(e.x,e.y,o,n);return s?{top:void 0!==s.top?`${s.top}px`:"auto",left:void 0!==s.left?`${s.left}px`:"auto",bottom:void 0!==s.bottom?`${s.bottom}px`:"auto",right:void 0!==s.right?`${s.right}px`:"auto"}:void 0}_viewChange(e,t){e&&t&&(this.close(),this.clear())}_viewReadyChange(e,t){if(e){const e=this.get("viewModel.view");this._wireUpView(e)}else t&&(this.close(),this.clear())}_wireUpView(e){if(this._destroySpinner(),!e)return;const{spinnerEnabled:t}=this;t&&this._createSpinner(e),this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(e,t,i){const[o,n]=e,[s,r]=t,{width:l=0,height:a=0}=i??{};return o<=l&&s>l||o>l&&s<=l||n<=a&&r>a||n>a&&r<=a}_updateDockEnabledForViewSize(e,t){if(!e||!t)return;const i=this.get("viewModel.view.padding")||{left:0,right:0,top:0,bottom:0},o=i.left+i.right,n=i.top+i.bottom,s=[],r=[];s[0]=e[0]-o,s[1]=e[1]-n,r[0]=t[0]-o,r[1]=t[1]-n;const{dockOptions:l}=this,a=l.breakpoint;this._dockingThresholdCrossed(s,r,a)&&this._setDockEnabledForViewSize(l),this._setCurrentDockPosition()}_focusDockButtonNode(e){this._focusDockButton&&(this._focusDockButton=!1,e.focus())}_closeButtonNodeUpdated(e){return this._focusClose?(this._focusClose=!1,void e.focus()):this._blurClose?(this._blurClose=!1,void e.blur()):void 0}_mainContainerNodeUpdated(e){return this._mainContainerNode=e,this._focusContainer?(this._focusContainer=!1,void e.focus()):this._blurContainer?(this._blurContainer=!1,void e.blur()):void 0}_featureMenuNodeUpdated(e){if(this._featureMenuNode=e,!e||!this._focusFirstFeature)return;this._focusFirstFeature=!1;const t=e.querySelectorAll("li");if(t.length){t[0].focus()}}_actionsMenuNodeUpdated(e){if(this._actionsMenuNode=e,!e||!this._focusFirstAction)return;this._focusFirstAction=!1;const t=e.querySelectorAll("li");if(t.length){t[0].focus()}}_focusFeatureMenuButtonNode(e){this._focusFeatureMenuButton&&(this._focusFeatureMenuButton=!1,e.focus())}_focusActionsMenuButtonNode(e){this._focusActionsMenuButton&&(this._focusActionsMenuButton=!1,e.focus())}_featureMenuViewportScrollTop(){this._featureMenuViewportNode&&(this._featureMenuViewportNode.scrollTop=0)}_toggleScreenLocationEnabled(){const{dockEnabled:e,viewModel:t}=this;if(!t)return;const i=t.active&&!e;t.screenLocationEnabled=i}_shouldDockAtCurrentViewSize(e){const t=e.breakpoint,i=this.viewModel?.view?.ui;if(!i)return!1;const{width:o,height:n}=i;if(isNaN(o)||isNaN(n))return!1;if(!t)return!1;const s=t.hasOwnProperty("width")&&o<=(t.width??0),r=t.hasOwnProperty("height")&&n<=(t.height??0);return s||r}_setDockEnabledForViewSize(e){e.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(e))}_getPageText(e,t){return this.featureNavigationVisible?P(this.messages.pageText,{index:t+1,total:e}):null}_destroySpinner(){this._spinner&&(this.view?.ui?.remove(this._spinner,S),this._spinner.destroy(),this._spinner=null)}_createSpinner(e){e&&(this._spinner=new v({view:e}),e.ui.add(this._spinner,{key:S,position:"manual",internal:!0}))}_toggleCollapsed(){this.collapsed=!this.collapsed}_close(){this.close(),this.view&&this.view.focus()}_toggleDockEnabled(){this.dockEnabled=!this.dockEnabled,this._focusDockButton=!0,this.scheduleRender()}_toggleFeatureMenu(){const e=!this.featureMenuOpen;this._featureMenuOpenChanged(e),this.actionsMenuOpen=!1,this.featureMenuOpen=e}_toggleActionsMenu(){const e=!this.actionsMenuOpen;this._actionsMenuOpenChanged(e),this.featureMenuOpen=!1,this.actionsMenuOpen=e}_triggerAction(e){const t=e.currentTarget.dataset.actionUid,{allActions:i}=this.viewModel,o=i.findIndex((e=>e.uid===t)),n=i.at(o);n&&"toggle"===n.type&&(n.value=!n.value),this.actionsMenuOpen=!1,this.viewModel.triggerAction(o)}_selectFeature(e){const t=W(e.currentTarget);null==t||isNaN(t)||(this.viewModel.selectedFeatureIndex=t),this.featureMenuOpen=!1,this._focusFeatureMenuButton=!0,this.scheduleRender()}_next(){this.next()}_previous(){this.previous()}};function W(e){return e?.["data-feature-index"]}e([h({readOnly:!0})],U.prototype,"actionsMenuId",null),e([h({readOnly:!0})],U.prototype,"actionsMenuButtonId",null),e([h({readOnly:!0})],U.prototype,"featureMenuId",null),e([h({readOnly:!0})],U.prototype,"titleId",null),e([h({readOnly:!0})],U.prototype,"contentId",null),e([h({readOnly:!0})],U.prototype,"hasContent",null),e([h({readOnly:!0})],U.prototype,"featureNavigationVisible",null),e([h({readOnly:!0})],U.prototype,"collapsible",null),e([h({readOnly:!0})],U.prototype,"featureMenuVisible",null),e([h({readOnly:!0})],U.prototype,"contentCollapsed",null),e([h({readOnly:!0})],U.prototype,"dividedActions",null),e([h({readOnly:!0,dependsOn:["_flowItems.length"]})],U.prototype,"_activeFlowItemWidget",null),e([h()],U.prototype,"actions",null),e([h()],U.prototype,"actionsMenuOpen",null),e([h()],U.prototype,"alignment",void 0),e([h()],U.prototype,"autoCloseEnabled",null),e([h()],U.prototype,"autoOpenEnabled",null),e([h()],U.prototype,"defaultPopupTemplateEnabled",null),e([h()],U.prototype,"content",null),e([h()],U.prototype,"collapsed",void 0),e([h()],U.prototype,"collapseEnabled",void 0),e([h({readOnly:!0})],U.prototype,"currentAlignment",null),e([h({readOnly:!0})],U.prototype,"currentDockPosition",null),e([h()],U.prototype,"dockOptions",null),e([h()],U.prototype,"dockEnabled",void 0),e([h({readOnly:!0})],U.prototype,"featureCount",null),e([h()],U.prototype,"featureMenuOpen",null),e([h()],U.prototype,"features",null),e([h()],U.prototype,"goToOverride",null),e([h()],U.prototype,"headingLevel",void 0),e([h()],U.prototype,"highlightEnabled",null),e([h()],U.prototype,"location",null),e([h()],U.prototype,"label",null),e([h()],U.prototype,"maxInlineActions",void 0),e([h(),C("esri/widgets/Popup/t9n/Popup")],U.prototype,"messages",void 0),e([h(),C("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([h()],U.prototype,"promises",null),e([h({readOnly:!0})],U.prototype,"selectedFeature",null),e([h()],U.prototype,"selectedFeatureIndex",null),e([h({readOnly:!0})],U.prototype,"selectedFeatureWidget",null),e([h()],U.prototype,"spinnerEnabled",void 0),e([h()],U.prototype,"title",null),e([h()],U.prototype,"updateLocationEnabled",null),e([h()],U.prototype,"view",null),e([h({type:y}),I(["triggerAction","trigger-action"])],U.prototype,"viewModel",void 0),e([h()],U.prototype,"visible",null),e([h()],U.prototype,"visibleElements",void 0),e([p("visibleElements")],U.prototype,"castVisibleElements",null),e([F()],U.prototype,"_close",null),e([F()],U.prototype,"_toggleDockEnabled",null),e([F()],U.prototype,"_toggleFeatureMenu",null),e([F()],U.prototype,"_toggleActionsMenu",null),e([F()],U.prototype,"_triggerAction",null),e([F()],U.prototype,"_selectFeature",null),e([F()],U.prototype,"_next",null),e([F()],U.prototype,"_previous",null),U=e([g("esri.widgets.Popup")],U);const H=U;export{H 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import"../../intl.js";import e from"../../core/Accessor.js";import i from"../../core/Collection.js";import r from"../../core/Error.js";import{HandleOwnerMixin as s}from"../../core/HandleOwner.js";import{watch as o,on as a}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import d from"../../geometry/Extent.js";import{isFeatureLayer as y}from"../../layers/support/layerUtils.js";import c from"../../rest/networks/support/ValidateNetworkTopologyParameters.js";import{onLocaleChange as p}from"../../intl/locale.js";import{fetchMessageBundle as h}from"../../intl/messages.js";const m={noDirtyAreasInExtent:-2147208940,noUtilityNetworkExtension:-2147208474,cannotAcquireVersionLock_v10:-2147217146,cannotAcquireVersionLock_v11:-2147220947};let u=class extends(s(e)){constructor(t){super(t),this._activeOperationDidSucceed=!1,this._initialValidationsFinished=!1,this._dirtyAreasLayer=null,this.executionError="",this.extentToValidate="current",this.loadErrors=new i}initialize(){const t=async()=>{this.messages||(this.messages=await h("esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology"))};t().then((()=>{this.utilityNetwork||this.loadErrors.push(this.messages.info.noUtilityNetwork),this.addHandles([o((()=>this.utilityNetwork),(async t=>{t&&"utility"===t.type?(t.loaded||await t.load(),await this._onUtilityNetworkLoad(),this._initialValidationsFinished=!0):this.loadErrors.push(this.messages.info.noUtilityNetwork)}),{initial:!0}),a((()=>this.view?.map.layers),"change",(()=>{const{loadErrors:t,messages:e}=this,i=e.info,r=t.find((t=>t===i.noUtilityNetwork)),s=t.find((t=>t===i.noUtilityNetworkServiceUserTypeExtension));r||(t.removeAll(),s&&t.push(i.noUtilityNetworkServiceUserTypeExtension),this._setDirtyAreasLayer())})),p(t)])}))}get state(){return this.loadErrors.length?"disabled":this.executionError?"failed":this.updatingHandles.updating?"executing":this._activeOperationDidSucceed?"success":this._initialValidationsFinished?"ready":"loading"}set utilityNetwork(t){this._get("utilityNetwork")!==t&&(this._initialValidationsFinished=!1,this.loadErrors.removeAll(),this._dirtyAreasLayer=null,this._set("utilityNetwork",t))}get view(){return this._get("view")}set view(t){this._set("view",t)}async validateTopology(){const{messages:t,utilityNetwork:e,view:i}=this;if(!this.loadErrors.length){let s;this._activeOperationDidSucceed=!1,this._set("executionError",""),s="current"===this.extentToValidate?{xmin:i.extent.xmin,ymin:i.extent.ymin,xmax:i.extent.xmax,ymax:i.extent.ymax,spatialReference:{wkid:i.spatialReference.wkid,latestWkid:i.spatialReference.latestWkid}}:{xmin:e.fullExtent?.xmin,ymin:e.fullExtent?.ymin,xmax:e.fullExtent?.xmax,ymax:e.fullExtent?.ymax,spatialReference:{wkid:e.spatialReference.wkid,latestWkid:e.spatialReference.latestWkid}},this.updatingHandles.addPromise(e.validateTopology(new c({gdbVersion:this._dirtyAreasLayer.gdbVersion,validateArea:new d(s)})).then((()=>{this._activeOperationDidSucceed=!0}),(e=>{let i="Error: "+e;e instanceof r&&e.details&&e.details.raw&&(e.details.raw.extendedCode===m.noDirtyAreasInExtent?i=t.info.noDirtyAreasInExtent:e.details.raw.extendedCode!==m.cannotAcquireVersionLock_v10&&e.details.raw.extendedCode!==m.cannotAcquireVersionLock_v11||(i=t.info.cannotAcquireVersionLock)),this._set("executionError",i)})))}}_setDirtyAreasLayer(){const t=this.view.map.layers;if(t){const e=t.items.filter((t=>y(t))).find((t=>t.parsedUrl?.path===this.utilityNetwork.networkSystemLayers.dirtyAreasLayerUrl));e?this._dirtyAreasLayer=e:this.loadErrors.push(this.messages.info.noDirtyAreasLayer)}}async _onUtilityNetworkLoad(){await this._checkUtilityNetworkExtension(),this._setDirtyAreasLayer()}async _checkUtilityNetworkExtension(){await this.utilityNetwork.queryNamedTraceConfigurations({globalIds:["{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}"]}).catch((t=>{t.details.raw.extendedCode===m.noUtilityNetworkExtension?this.loadErrors.push(this.messages.info.noUtilityNetworkServiceUserTypeExtension):this.loadErrors.push(t.message)}))}};t([n()],u.prototype,"_initialValidationsFinished",void 0),t([n()],u.prototype,"_dirtyAreasLayer",void 0),t([n({readOnly:!0})],u.prototype,"executionError",void 0),t([n()],u.prototype,"extentToValidate",void 0),t([n()],u.prototype,"loadErrors",void 0),t([n()],u.prototype,"messages",void 0),t([n({readOnly:!0})],u.prototype,"state",null),t([n()],u.prototype,"utilityNetwork",null),t([n()],u.prototype,"view",null),u=t([l("esri.widgets.UtilityNetworkValidateTopology.UtilityNetworkValidateTopologyViewModel")],u);const w=u;export{w as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import"../../intl.js";import e from"../../core/Accessor.js";import i from"../../core/Collection.js";import r from"../../core/Error.js";import{HandleOwnerMixin as s}from"../../core/HandleOwner.js";import o from"../../core/Logger.js";import{watch as a,on as n}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import y from"../../geometry/Extent.js";import{isFeatureLayer as c}from"../../layers/support/layerUtils.js";import h from"../../rest/networks/support/ValidateNetworkTopologyParameters.js";import{onLocaleChange as p}from"../../intl/locale.js";import{fetchMessageBundle as w}from"../../intl/messages.js";const m={noDirtyAreasInExtent:-2147208940,noUtilityNetworkExtension:-2147208474,cannotAcquireVersionLock_v10:-2147217146,cannotAcquireVersionLock_v11:-2147220947};let u=class extends(s(e)){constructor(t){super(t),this._activeOperationDidSucceed=!1,this._initialValidationsFinished=!1,this._dirtyAreasLayer=null,this._noViewPropertyErrorMessage="Property 'view' is missing on UtilityNetworkValidateTopologyViewModel.",this._validView=!1,this.executionError="",this.extentToValidate="current",this.loadErrors=new i}initialize(){const t=async()=>{this.messages||(this.messages=await w("esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology"))};t().then((()=>{this.view||(this.view=null),this.utilityNetwork||(this.utilityNetwork=null),this.addHandles([a((()=>[this.view,this.utilityNetwork]),(async()=>{const{loadErrors:t,messages:e}=this,i=e.info;if(this._initialValidationsFinished=!1,t.removeAll(),this._validView=!0,this._dirtyAreasLayer=null,this.view&&"2d"===this.view.type||(this._validView=!1,o.getLogger(this).error(new r("validateNetworkTopology:missing-property",this._noViewPropertyErrorMessage))),this.utilityNetwork&&"utility"===this.utilityNetwork.type){this.utilityNetwork.loaded||await this.utilityNetwork.load(),await this._checkUtilityNetworkExtension();const e=1===t.length&&this.loadErrors.find((t=>t===i.noUtilityNetworkServiceUserTypeExtension));t.length&&!e||this._setDirtyAreasLayer(),this._validView&&(this._initialValidationsFinished=!0)}else this.loadErrors.push(i.noUtilityNetwork)}),{initial:!0}),n((()=>this.view?.map?.layers),"change",(()=>{const{loadErrors:t,messages:e}=this,i=e.info,r=t.find((t=>t===i.noUtilityNetwork)),s=t.find((t=>t===i.noUtilityNetworkServiceUserTypeExtension));this._initialValidationsFinished=!1,r||(t.removeAll(),s&&t.push(i.noUtilityNetworkServiceUserTypeExtension),this._setDirtyAreasLayer()),this._validView&&(this._initialValidationsFinished=!0)})),p(t)])}))}get state(){return this.loadErrors.length?"disabled":this.executionError?"failed":this.updatingHandles.updating?"executing":this._activeOperationDidSucceed?"success":this._initialValidationsFinished?"ready":"loading"}set utilityNetwork(t){this._get("utilityNetwork")!==t&&this._set("utilityNetwork",t)}set view(t){this._get("view")!==t&&this._set("view",t)}async validateTopology(){const{messages:t,utilityNetwork:e,view:i}=this;if(!this.loadErrors.length){let s;this._activeOperationDidSucceed=!1,this._set("executionError",""),s="current"===this.extentToValidate?{xmin:i?.extent.xmin,ymin:i?.extent.ymin,xmax:i?.extent.xmax,ymax:i?.extent.ymax,spatialReference:{wkid:i?.spatialReference.wkid,latestWkid:i?.spatialReference.latestWkid}}:{xmin:e?.fullExtent?.xmin,ymin:e?.fullExtent?.ymin,xmax:e?.fullExtent?.xmax,ymax:e?.fullExtent?.ymax,spatialReference:{wkid:e?.spatialReference.wkid,latestWkid:e?.spatialReference.latestWkid}},this.updatingHandles.addPromise(e?.validateTopology(new h({gdbVersion:this._dirtyAreasLayer.gdbVersion,validateArea:new y(s)})).then((()=>{this._activeOperationDidSucceed=!0}),(e=>{let i="Error: "+e;e instanceof r&&e.details&&e.details.raw&&(e.details.raw.extendedCode===m.noDirtyAreasInExtent?i=t.info.noDirtyAreasInExtent:e.details.raw.extendedCode!==m.cannotAcquireVersionLock_v10&&e.details.raw.extendedCode!==m.cannotAcquireVersionLock_v11||(i=t.info.cannotAcquireVersionLock)),this._set("executionError",i)})))}}_setDirtyAreasLayer(){const t=this.view?.map.layers;if(t){const e=t.items.filter((t=>c(t))).find((t=>t.parsedUrl?.path===this.utilityNetwork?.networkSystemLayers.dirtyAreasLayerUrl));e?this._dirtyAreasLayer=e:this.loadErrors.push(this.messages.info.noDirtyAreasLayer)}}async _checkUtilityNetworkExtension(){await(this.utilityNetwork?.queryNamedTraceConfigurations({globalIds:["{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}"]}).catch((t=>{t.details.raw.extendedCode===m.noUtilityNetworkExtension?this.loadErrors.push(this.messages.info.noUtilityNetworkServiceUserTypeExtension):this.loadErrors.push(t.message)})))}};t([l()],u.prototype,"_initialValidationsFinished",void 0),t([l()],u.prototype,"_dirtyAreasLayer",void 0),t([l({readOnly:!0})],u.prototype,"executionError",void 0),t([l()],u.prototype,"extentToValidate",void 0),t([l()],u.prototype,"loadErrors",void 0),t([l()],u.prototype,"messages",void 0),t([l({readOnly:!0})],u.prototype,"state",null),t([l()],u.prototype,"utilityNetwork",null),t([l()],u.prototype,"view",null),u=t([d("esri.widgets.UtilityNetworkValidateTopology.UtilityNetworkValidateTopologyViewModel")],u);const A=u;export{A as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2653],{84552:(e,t,r)=>{r.d(t,{Z:()=>d});var i=r(43697),n=r(2368),s=r(96674),o=r(35463),a=r(5600),l=(r(75215),r(67676),r(80442),r(36030)),u=r(52011),p=r(78981);let c=class extends((0,n.J)(s.wq)){constructor(e){super(e),this.unit="milliseconds",this.value=0}toMilliseconds(){return(0,o.rJ)(this.value,this.unit,"milliseconds")}};(0,i._)([(0,l.J)(p.v,{nonNullable:!0})],c.prototype,"unit",void 0),(0,i._)([(0,a.Cb)({type:Number,json:{write:!0},nonNullable:!0})],c.prototype,"value",void 0),c=(0,i._)([(0,u.j)("esri.TimeInterval")],c);const d=c},3920:(e,t,r)=>{r.d(t,{p:()=>u,r:()=>p});var i=r(43697),n=r(92036),s=r(61247),o=r(5600),a=r(52011),l=r(72762);const u=e=>{let t=class extends e{constructor(){super(...arguments),this._handles=new s.Z,this._updatingHandles=new l.t}destroy(){this.destroyed||(this._handles.destroy(),this._updatingHandles.destroy())}get handles(){return this._handles}get updatingHandles(){return this._updatingHandles}};return(0,i._)([(0,o.Cb)({readOnly:!0})],t.prototype,"handles",null),(0,i._)([(0,o.Cb)({readOnly:!0})],t.prototype,"updatingHandles",null),t=(0,i._)([(0,a.j)("esri.core.HandleOwner")],t),t};let p=class extends(u(n.Z)){};p=(0,i._)([(0,a.j)("esri.core.HandleOwner")],p)},72762:(e,t,r)=>{r.d(t,{t:()=>c});var i=r(43697),n=r(92036),s=r(61247),o=r(50758),a=r(17445),l=r(1654),u=r(5600),p=r(52011);let c=class extends n.Z{constructor(){super(...arguments),this.updating=!1,this._handleId=0,this._handles=new s.Z,this._scheduleHandleId=0,this._pendingPromises=new Set}destroy(){this.removeAll(),this._handles.destroy()}add(e,t,r={}){return this._installWatch(e,t,r,a.YP)}addWhen(e,t,r={}){return this._installWatch(e,t,r,a.gx)}addOnCollectionChange(e,t,{initial:r=!1,final:i=!1}={}){const n=++this._handleId;return this._handles.add([(0,a.on)(e,"after-changes",this._createSyncUpdatingCallback(),a.Z_),(0,a.on)(e,"change",t,{onListenerAdd:r?e=>t({added:e.toArray(),removed:[]}):void 0,onListenerRemove:i?e=>t({added:[],removed:e.toArray()}):void 0})],n),(0,o.kB)((()=>this._handles.remove(n)))}addPromise(e){if(null==e)return e;const t=++this._handleId;this._handles.add({remove:()=>{this._pendingPromises.delete(e)&&(0!==this._pendingPromises.size||this._handles.has(d)||this._set("updating",!1))}},t),this._pendingPromises.add(e),this._set("updating",!0);const r=()=>this._handles.remove(t);return e.then(r,r),e}removeAll(){this._pendingPromises.clear(),this._handles.removeAll(),this._set("updating",!1)}_installWatch(e,t,r={},i){const n=++this._handleId;r.sync||this._installSyncUpdatingWatch(e,n);const s=i(e,t,r);return this._handles.add(s,n),(0,o.kB)((()=>this._handles.remove(n)))}_installSyncUpdatingWatch(e,t){const r=this._createSyncUpdatingCallback(),i=(0,a.YP)(e,r,{sync:!0,equals:()=>!1});return this._handles.add(i,t),i}_createSyncUpdatingCallback(){return()=>{this._handles.remove(d),++this._scheduleHandleId;const e=this._scheduleHandleId;this._get("updating")||this._set("updating",!0),this._handles.add((0,l.Os)((()=>{e===this._scheduleHandleId&&(this._set("updating",this._pendingPromises.size>0),this._handles.remove(d))})),d)}}};(0,i._)([(0,u.Cb)({readOnly:!0})],c.prototype,"updating",void 0),c=(0,i._)([(0,p.j)("esri.core.support.WatchUpdatingTracking")],c);const d=-42},12653:(e,t,r)=>{r.r(t),r.d(t,{default:()=>B});var i=r(43697),n=(r(66577),r(51773)),s=(r(16050),r(12501),r(28756),r(92271),r(72529),r(5499),r(84382),r(81571),r(91423),r(32400)),o=r(16453),a=r(78286),l=r(81271),u=r(5600),p=r(75215),c=(r(67676),r(80442)),d=r(52011),y=r(30556),f=r(86973),m=r(87085),h=r(20102),g=r(3920),w=r(83379),b=r(95330),v=r(78346),_=r(25278),S=r(51432),C=r(74889),x=r(6570);let F=class extends((0,g.p)(w.Z)){constructor(){super(...arguments),this._connection=null,this.capabilities=(0,_.MS)(!1,!1),this.type="wfs",this.refresh=(0,b.Ds)((async e=>{await this.load();const{extent:t}=await this._connection.invoke("refresh",e);return t&&(this.sourceJSON.extent=t),{dataChanged:!0,updates:{extent:this.sourceJSON.extent}}}))}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this._startWorker({signal:t})),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeatures(e,t={}){await this.load(t);const r=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t);return C.Z.fromJSON(r)}async queryFeaturesJSON(e,t={}){return await this.load(t),this._connection.invoke("queryFeatures",e?e.toJSON():null,t)}async queryFeatureCount(e,t={}){return await this.load(t),this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t)}async queryObjectIds(e,t={}){return await this.load(t),this._connection.invoke("queryObjectIds",e?e.toJSON():null,t)}async queryExtent(e,t={}){await this.load(t);const r=await this._connection.invoke("queryExtent",e?e.toJSON():null,t);return{count:r.count,extent:x.Z.fromJSON(r.extent)}}async querySnapping(e,t={}){return await this.load(t),this._connection.invoke("querySnapping",e,t)}async _createLoadOptions(e){const{url:t,customParameters:r,name:i,namespaceUri:n,spatialReference:s,fields:o,geometryType:a,swapXY:l}=this.layer;if(!t)throw new h.Z("wfs-layer:missing-url","WFSLayer must be created with a url");this.wfsCapabilities||(this.wfsCapabilities=await(0,S.FU)(t,{customParameters:r,...e}));const u=["fields","geometryType","name","namespaceUri","spatialReference","swapXY"].some((e=>null==this.layer[e])),p=u?await(0,S.be)(this.wfsCapabilities,i,n,{spatialReference:s,customParameters:r,signal:e?.signal}):{...(0,S.eB)(o??[]),geometryType:a,name:i,namespaceUri:n,spatialReference:s,swapXY:l},c=(0,S.ft)(this.wfsCapabilities.readFeatureTypes(),p.name,p.namespaceUri),d=f.M.toJSON(p.geometryType);return{customParameters:r,featureType:c,fields:p.fields?.map((e=>e.toJSON()))??[],geometryField:p.geometryField,geometryType:d,getFeatureUrl:this.wfsCapabilities.operations.GetFeature.url,getFeatureOutputFormat:this.wfsCapabilities.operations.GetFeature.outputFormat,objectIdField:p.objectIdField,spatialReference:p.spatialReference.toJSON(),swapXY:!!p.swapXY}}async _startWorker(e){const[t,r]=await(0,b.as)([this._createLoadOptions(e),(0,v.bA)("WFSSourceWorker",{...e,strategy:(0,c.Z)("feature-layers-workers")?"dedicated":"local"})]),i=t.error||r.error||null,n=r.value||null;if(i)throw n&&n.close(),i;const s=t.value;this._connection=r.value;const o=(await this._connection.invoke("load",s,e)).extent;this.sourceJSON={extent:o,fields:s.fields,geometryType:s.geometryType,objectIdField:s.objectIdField,geometryField:s.geometryField,drawingInfo:(0,_.bU)(s.geometryType),name:s.featureType.title,wfsInfo:{name:s.featureType.name,featureUrl:s.getFeatureUrl,maxFeatures:3e3,swapXY:s.swapXY,supportedSpatialReferences:s.featureType.supportedSpatialReferences,version:"2.0.0",wfsNamespace:s.featureType.namespaceUri}}}};(0,i._)([(0,u.Cb)()],F.prototype,"capabilities",void 0),(0,i._)([(0,u.Cb)({constructOnly:!0})],F.prototype,"layer",void 0),(0,i._)([(0,u.Cb)()],F.prototype,"sourceJSON",void 0),(0,i._)([(0,u.Cb)()],F.prototype,"type",void 0),(0,i._)([(0,u.Cb)()],F.prototype,"wfsCapabilities",void 0),F=(0,i._)([(0,d.j)("esri.layers.graphics.sources.WFSSource")],F);var T,I=r(71612),P=r(17017),E=r(69637),R=r(6404),j=r(38009),O=r(68825),U=r(16859),N=r(34760),Z=r(72965),k=r(28294),M=r(21506),q=r(1231),G=r(53518),L=r(35671),D=r(54306),A=r(30707),H=r(14165),J=r(32163),$=r(82971);const z=(0,G.v)();let W=T=class extends((0,O.c)((0,P.N)((0,R.M)((0,E.b)((0,I.h)((0,k.n)((0,N.Q)((0,Z.M)((0,j.q)((0,U.I)((0,o.R)(m.Z)))))))))))){static fromWFSLayerInfo(e){const{customParameters:t,fields:r,geometryField:i,geometryType:n,name:s,namespaceUri:o,objectIdField:a,spatialReference:l,swapXY:u,url:p,wfsCapabilities:c}=e;return new T({customParameters:t,fields:r,geometryField:i,geometryType:n,name:s,namespaceUri:o,objectIdField:a,spatialReference:l,swapXY:u,url:p,wfsCapabilities:c})}constructor(e){super(e),this.copyright=null,this.customParameters=null,this.definitionExpression=null,this.displayField=null,this.elevationInfo=null,this.featureUrl=void 0,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="WFS",this.maxFeatures=3e3,this.mode=0,this.name=null,this.namespaceUri=null,this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new F({layer:this}),this.spatialReference=$.Z.WGS84,this.spatialReferences=[4326],this.swapXY=void 0,this.title="WFS",this.type="wfs",this.url=null,this.version=void 0}destroy(){this.source?.destroy()}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WFS"]},e).then((()=>this.source.load(e))).then((()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo","spatialReference","name","namespaceUri"],"service"),(0,L.YN)(this.renderer,this.fieldsIndex),(0,L.UF)(this.timeInfo,this.fieldsIndex)}))),Promise.resolve(this)}get capabilities(){return this.source?.capabilities}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}writeFields(e,t,r){const i=e.filter((e=>e.name!==S.M8));this.geometryField&&i.unshift(new q.Z({name:this.geometryField,alias:this.geometryField,type:"geometry"})),(0,a.RB)(r,i.map((e=>e.toJSON())),t)}get parsedUrl(){return(0,l.mN)(this.url)}set renderer(e){(0,L.YN)(e,this.fieldsIndex),this._set("renderer",e)}get wfsCapabilities(){return this.source?.wfsCapabilities}set wfsCapabilities(e){this.source&&(this.source.wfsCapabilities=e)}createPopupTemplate(e){return(0,J.eZ)(this,e)}createQuery(){const e=new H.Z;e.returnGeometry=!0,e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:t,timeExtent:r}=this;return e.timeExtent=null!=t&&null!=r?r.offset(-t.value,t.unit):r||null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex?.get(e)}queryFeatures(e,t){return this.load().then((()=>this.source.queryFeatures(H.Z.from(e)||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}))}queryObjectIds(e,t){return this.load().then((()=>this.source.queryObjectIds(H.Z.from(e)||this.createQuery(),t)))}queryFeatureCount(e,t){return this.load().then((()=>this.source.queryFeatureCount(H.Z.from(e)||this.createQuery(),t)))}queryExtent(e,t){return this.load().then((()=>this.source.queryExtent(H.Z.from(e)||this.createQuery(),t)))}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return null!=t&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};(0,i._)([(0,u.Cb)({readOnly:!0})],W.prototype,"capabilities",null),(0,i._)([(0,u.Cb)({type:String})],W.prototype,"copyright",void 0),(0,i._)([(0,u.Cb)({readOnly:!0})],W.prototype,"createQueryVersion",null),(0,i._)([(0,u.Cb)({json:{name:"wfsInfo.customParameters",write:{overridePolicy:e=>({enabled:!!(e&&Object.keys(e).length>0),ignoreOrigin:!0})}}})],W.prototype,"customParameters",void 0),(0,i._)([(0,u.Cb)({readOnly:!0})],W.prototype,"defaultPopupTemplate",null),(0,i._)([(0,u.Cb)({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],W.prototype,"definitionExpression",void 0),(0,i._)([(0,u.Cb)({type:String})],W.prototype,"displayField",void 0),(0,i._)([(0,u.Cb)(M.PV)],W.prototype,"elevationInfo",void 0),(0,i._)([(0,u.Cb)({type:String,readOnly:!0,json:{name:"wfsInfo.featureUrl",write:{ignoreOrigin:!0,isRequired:!0}}})],W.prototype,"featureUrl",void 0),(0,i._)([(0,u.Cb)({type:[q.Z],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],W.prototype,"fields",void 0),(0,i._)([(0,y.c)("fields")],W.prototype,"writeFields",null),(0,i._)([(0,u.Cb)(z.fieldsIndex)],W.prototype,"fieldsIndex",void 0),(0,i._)([(0,u.Cb)({type:x.Z,json:{name:"extent"}})],W.prototype,"fullExtent",void 0),(0,i._)([(0,u.Cb)()],W.prototype,"geometryField",void 0),(0,i._)([(0,u.Cb)({type:String,json:{read:{source:"layerDefinition.geometryType",reader:f.M.read},write:{target:"layerDefinition.geometryType",writer:f.M.write,ignoreOrigin:!0},origins:{service:{read:f.M.read}}}})],W.prototype,"geometryType",void 0),(0,i._)([(0,u.Cb)({type:String})],W.prototype,"id",void 0),(0,i._)([(0,u.Cb)(M.iR)],W.prototype,"labelsVisible",void 0),(0,i._)([(0,u.Cb)({type:[D.Z],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:A.r},write:!0}})],W.prototype,"labelingInfo",void 0),(0,i._)([(0,u.Cb)(M.rn)],W.prototype,"legendEnabled",void 0),(0,i._)([(0,u.Cb)({type:["show","hide"]})],W.prototype,"listMode",void 0),(0,i._)([(0,u.Cb)({type:String})],W.prototype,"objectIdField",void 0),(0,i._)([(0,u.Cb)({type:["WFS"]})],W.prototype,"operationalLayerType",void 0),(0,i._)([(0,u.Cb)({type:p.z8,json:{name:"wfsInfo.maxFeatures",write:{ignoreOrigin:!0,isRequired:!0}}})],W.prototype,"maxFeatures",void 0),(0,i._)([(0,u.Cb)({type:[0],readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],W.prototype,"mode",void 0),(0,i._)([(0,u.Cb)({type:String,json:{name:"wfsInfo.name",write:{ignoreOrigin:!0,isRequired:!0}}})],W.prototype,"name",void 0),(0,i._)([(0,u.Cb)({type:String,json:{name:"wfsInfo.wfsNamespace",write:{ignoreOrigin:!0,isRequired:!0}}})],W.prototype,"namespaceUri",void 0),(0,i._)([(0,u.Cb)(M.bT)],W.prototype,"opacity",void 0),(0,i._)([(0,u.Cb)(z.outFields)],W.prototype,"outFields",void 0),(0,i._)([(0,u.Cb)({readOnly:!0})],W.prototype,"parsedUrl",null),(0,i._)([(0,u.Cb)(M.C_)],W.prototype,"popupEnabled",void 0),(0,i._)([(0,u.Cb)({type:n.Z,json:{name:"popupInfo",write:!0}})],W.prototype,"popupTemplate",void 0),(0,i._)([(0,u.Cb)({types:s.A,json:{origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:s.o,name:"layerDefinition.drawingInfo.renderer",write:!0}},name:"layerDefinition.drawingInfo.renderer",write:{ignoreOrigin:!0}}})],W.prototype,"renderer",null),(0,i._)([(0,u.Cb)(M.YI)],W.prototype,"screenSizePerspectiveEnabled",void 0),(0,i._)([(0,u.Cb)({readOnly:!0})],W.prototype,"source",void 0),(0,i._)([(0,u.Cb)({type:$.Z,json:{name:"layerDefinition.spatialReference",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"extent.spatialReference"}}}})],W.prototype,"spatialReference",void 0),(0,i._)([(0,u.Cb)({readOnly:!0,type:[p.z8],json:{name:"wfsInfo.supportedSpatialReferences",write:{ignoreOrigin:!0,isRequired:!0}}})],W.prototype,"spatialReferences",void 0),(0,i._)([(0,u.Cb)({type:Boolean,value:!1,json:{name:"wfsInfo.swapXY",write:{ignoreOrigin:!0,isRequired:!0}}})],W.prototype,"swapXY",void 0),(0,i._)([(0,u.Cb)({json:{write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"name"}}}})],W.prototype,"title",void 0),(0,i._)([(0,u.Cb)({json:{read:!1},readOnly:!0})],W.prototype,"type",void 0),(0,i._)([(0,u.Cb)(M.HQ)],W.prototype,"url",void 0),(0,i._)([(0,u.Cb)({type:String,readOnly:!0,json:{name:"wfsInfo.version",write:{ignoreOrigin:!0,isRequired:!0}}})],W.prototype,"version",void 0),(0,i._)([(0,u.Cb)()],W.prototype,"wfsCapabilities",null),W=T=(0,i._)([(0,d.j)("esri.layers.WFSLayer")],W);const B=W},61159:(e,t,r)=>{r.d(t,{g:()=>i});const i={supportsStatistics:!0,supportsPercentileStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsCentroid:!0,supportsCacheHint:!1,supportsDistance:!0,supportsDistinct:!0,supportsExtent:!0,supportsGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryGeometry:!0,supportsResultType:!1,supportsSqlExpression:!0,supportsMaxRecordCountFactor:!1,supportsStandardizedQueriesOnly:!0,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!0,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!0,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,maxRecordCountFactor:void 0,maxRecordCount:void 0,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}},92722:(e,t,r)=>{r.d(t,{O3:()=>_,lG:()=>C,my:()=>S,q9:()=>l});var i=r(20102),n=r(70272),s=r(5428),o=r(35671);const a={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function l(e){return a[e]}function*u(e){switch(e.type){case"Feature":yield e;break;case"FeatureCollection":for(const t of e.features)t&&(yield t)}}function*p(e){if(e)switch(e.type){case"Point":yield e.coordinates;break;case"LineString":case"MultiPoint":yield*e.coordinates;break;case"MultiLineString":case"Polygon":for(const t of e.coordinates)yield*t;break;case"MultiPolygon":for(const t of e.coordinates)for(const e of t)yield*e}}function c(e){for(const t of e)if(t.length>2)return!0;return!1}function d(e){let t=0;for(let r=0;r<e.length;r++){const i=e[r],n=e[(r+1)%e.length];t+=i[0]*n[1]-n[0]*i[1]}return t<=0}function y(e){const t=e[0],r=e[e.length-1];return t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]||e.push(t),e}function f(e,t,r){switch(t.type){case"LineString":case"MultiPoint":return function(e,t,r){return g(e,t.coordinates,r),e}(e,t,r);case"MultiLineString":return function(e,t,r){for(const i of t.coordinates)g(e,i,r);return e}(e,t,r);case"MultiPolygon":return function(e,t,r){for(const i of t.coordinates){m(e,i[0],r);for(let t=1;t<i.length;t++)h(e,i[t],r)}return e}(e,t,r);case"Point":return function(e,t,r){return b(e,t.coordinates,r),e}(e,t,r);case"Polygon":return function(e,t,r){const i=t.coordinates;m(e,i[0],r);for(let t=1;t<i.length;t++)h(e,i[t],r);return e}(e,t,r)}}function m(e,t,r){const i=y(t);!function(e){return!d(e)}(i)?g(e,i,r):w(e,i,r)}function h(e,t,r){const i=y(t);!function(e){return d(e)}(i)?g(e,i,r):w(e,i,r)}function g(e,t,r){for(const i of t)b(e,i,r);e.lengths.push(t.length)}function w(e,t,r){for(let i=t.length-1;i>=0;i--)b(e,t[i],r);e.lengths.push(t.length)}function b(e,t,r){const[i,n,s]=t;e.coords.push(i,n),r.hasZ&&e.coords.push(s||0)}function v(e){switch(typeof e){case"string":return"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function _(e){if(!e)throw new i.Z("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==e.type&&"FeatureCollection"!==e.type)throw new i.Z("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:e});const{crs:t}=e;if(!t)return;const r="string"==typeof t?t:"name"===t.type?t.properties.name:"EPSG"===t.type?t.properties.code:null,n=new RegExp(".*(CRS84H?|4326)$","i");if(!r||!n.test(r))throw new i.Z("geojson-layer:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:t})}function S(e,t={}){const r=[],i=new Set,n=new Set;let s,a=!1,d=null,y=!1,{geometryType:f=null}=t,m=!1;for(const t of u(e)){const{geometry:e,properties:u,id:h}=t;if((!e||(f||(f=l(e.type)),l(e.type)===f))&&(a||(a=c(p(e))),y||(y=null!=h,y&&(s=typeof h,u&&(d=Object.keys(u).filter((e=>u[e]===h))))),u&&d&&y&&null!=h&&(d.length>1?d=d.filter((e=>u[e]===h)):1===d.length&&(d=u[d[0]]===h?d:[])),!m&&u)){let e=!0;for(const t in u){if(i.has(t))continue;const s=u[t];if(null==s){e=!1,n.add(t);continue}const a=v(s);if("unknown"===a){n.add(t);continue}n.delete(t),i.add(t);const l=(0,o.q6)(t);l&&r.push({name:l,alias:t,type:a})}m=e}}const h=(0,o.q6)(1===d?.length&&d[0]||null)??void 0;if(h)for(const e of r)if(e.name===h&&(0,o.H7)(e)){e.type="esriFieldTypeOID";break}return{fields:r,geometryType:f,hasZ:a,objectIdFieldName:h,objectIdFieldType:s,unknownFields:Array.from(n)}}function C(e,t){return Array.from(function*(e,t={}){const{geometryType:r,objectIdField:i}=t;for(const o of e){const{geometry:e,properties:a,id:u}=o;if(e&&l(e.type)!==r)continue;const p=a||{};let c;i&&(c=p[i],null==u||c||(p[i]=c=u));const d=new n.u_(e?f(new s.Z,e,t):null,p,null,c??void 0);yield d}}(u(e),t))}},25278:(e,t,r)=>{r.d(t,{Dm:()=>p,Hq:()=>c,MS:()=>d,bU:()=>a});var i=r(80442),n=r(22974),s=r(61159),o=r(58333);function a(e){return{renderer:{type:"simple",symbol:"esriGeometryPoint"===e||"esriGeometryMultipoint"===e?o.I4:"esriGeometryPolyline"===e?o.ET:o.lF}}}const l=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/;let u=1;function p(e,t){if((0,i.Z)("esri-csp-restrictions"))return()=>({[t]:null,...e});try{let r=`this.${t} = null;`;for(const t in e)r+=`this${l.test(t)?`.${t}`:`["${t}"]`} = ${JSON.stringify(e[t])};`;const i=new Function(`\n return class AttributesClass$${u++} {\n constructor() {\n ${r};\n }\n }\n `)();return()=>new i}catch(r){return()=>({[t]:null,...e})}}function c(e={}){return[{name:"New Feature",description:"",prototype:{attributes:(0,n.d9)(e)}}]}function d(e,t){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:t,supportsDelete:t,supportsEditing:t,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:t,supportsExceedsLimitStatistics:!0},query:s.g,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsGeometryUpdate:t,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsAsyncApplyEdits:!1}}}},17017:(e,t,r)=>{r.d(t,{N:()=>o});var i=r(43697),n=r(5600),s=(r(75215),r(67676),r(80442),r(52011));const o=e=>{let t=class extends e{constructor(){super(...arguments),this.customParameters=null}};return(0,i._)([(0,n.Cb)({type:Object,json:{write:{overridePolicy:e=>({enabled:!!(e&&Object.keys(e).length>0)})}}})],t.prototype,"customParameters",void 0),t=(0,i._)([(0,s.j)("esri.layers.mixins.CustomParametersMixin")],t),t}},69637:(e,t,r)=>{r.d(t,{b:()=>I});var i,n=r(43697),s=r(5600),o=(r(75215),r(67676),r(80442),r(52011)),a=r(20102),l=r(96674),u=r(78286),p=r(67760),c=r(66577),d=r(92835),y=r(35454),f=r(22974),m=r(14165);const h=new y.X({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),g=new y.X({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let w=i=class extends l.wq{constructor(e){super(e),this.where=null,this.geometry=null,this.spatialRelationship="intersects",this.distance=void 0,this.objectIds=null,this.units=null,this.timeExtent=null}createQuery(e={}){const{where:t,geometry:r,spatialRelationship:i,timeExtent:n,objectIds:s,units:o,distance:a}=this;return new m.Z({geometry:(0,f.d9)(r),objectIds:(0,f.d9)(s),spatialRelationship:i,timeExtent:(0,f.d9)(n),where:t,units:o,distance:a,...e})}clone(){const{where:e,geometry:t,spatialRelationship:r,timeExtent:n,objectIds:s,units:o,distance:a}=this;return new i({geometry:(0,f.d9)(t),objectIds:(0,f.d9)(s),spatialRelationship:r,timeExtent:(0,f.d9)(n),where:e,units:o,distance:a})}};(0,n._)([(0,s.Cb)({type:String,json:{write:!0}})],w.prototype,"where",void 0),(0,n._)([(0,s.Cb)({types:c.qM,json:{write:!0}})],w.prototype,"geometry",void 0),(0,n._)([(0,s.Cb)({type:h.apiValues,json:{name:"spatialRel",read:{reader:h.read},write:{allowNull:!1,writer:h.write,overridePolicy(){return{enabled:null!=this.geometry}}}}})],w.prototype,"spatialRelationship",void 0),(0,n._)([(0,s.Cb)({type:Number,json:{write:{overridePolicy(e){return{enabled:null!=e&&null!=this.geometry}}}}})],w.prototype,"distance",void 0),(0,n._)([(0,s.Cb)({type:[Number],json:{write:!0}})],w.prototype,"objectIds",void 0),(0,n._)([(0,s.Cb)({type:g.apiValues,json:{read:g.read,write:{writer:g.write,overridePolicy(e){return{enabled:null!=e&&null!=this.geometry}}}}})],w.prototype,"units",void 0),(0,n._)([(0,s.Cb)({type:d.Z,json:{write:!0}})],w.prototype,"timeExtent",void 0),w=i=(0,n._)([(0,o.j)("esri.layers.support.FeatureFilter")],w);const b=w;var v;const _={read:{reader:p.ij},write:{writer:p.cW,overridePolicy(){return{allowNull:null!=this.excludedEffect,isRequired:null==this.excludedEffect}}}},S={read:{reader:p.ij},write:{writer:p.cW,overridePolicy(){return{allowNull:null!=this.includedEffect,isRequired:null==this.includedEffect}}}},C={name:"showExcludedLabels",default:!0};let x=v=class extends l.wq{constructor(e){super(e),this.filter=null,this.includedEffect=null,this.excludedEffect=null,this.excludedLabelsVisible=!1}write(e,t){const r=super.write(e,t);if(t?.origin){if(r.filter){const e=Object.keys(r.filter);if(e.length>1||"where"!==e[0])return t.messages?.push(new a.Z("web-document-write:unsupported-feature-effect","Invalid feature effect 'filter'. A filter can only contain a 'where' property",{layer:t.layer,effect:this})),null}if("showExcludedLabels"in r)return t.messages?.push(new a.Z("web-document-write:unsupported-feature-effect","Invalid value for property 'excludedLabelsVisible' which should always be 'true'",{layer:t.layer,effect:this})),null}return r}clone(){return new v({filter:null!=this.filter?this.filter.clone():null,includedEffect:this.includedEffect,excludedEffect:this.excludedEffect,excludedLabelsVisible:this.excludedLabelsVisible})}};(0,n._)([(0,s.Cb)({type:b,json:{write:{allowNull:!0,writer(e,t,r,i){const n=e?.write({},i);n&&0!==Object.keys(n).length?(0,u.RB)(r,n,t):(0,u.RB)(r,null,t)}}}})],x.prototype,"filter",void 0),(0,n._)([(0,s.Cb)({json:{write:!0,origins:{"web-map":_,"portal-item":_}}})],x.prototype,"includedEffect",void 0),(0,n._)([(0,s.Cb)({json:{write:!0,origins:{"web-map":S,"portal-item":S}}})],x.prototype,"excludedEffect",void 0),(0,n._)([(0,s.Cb)({type:Boolean,json:{write:!0,name:"showExcludedLabels",origins:{"web-map":C,"portal-item":C}}})],x.prototype,"excludedLabelsVisible",void 0),x=v=(0,n._)([(0,o.j)("esri.layers.support.FeatureEffect")],x);const F=x,T={write:{allowNull:!0}},I=e=>{let t=class extends e{constructor(){super(...arguments),this.featureEffect=null}};return(0,n._)([(0,s.Cb)({type:F,json:{origins:{"web-map":T,"portal-item":T}}})],t.prototype,"featureEffect",void 0),t=(0,n._)([(0,o.j)("esri.layers.mixins.FeatureEffectLayer")],t),t}},68825:(e,t,r)=>{r.d(t,{c:()=>m});var i,n=r(43697),s=r(78286),o=r(5600),a=(r(75215),r(67676),r(80442),r(52011)),l=r(35454),u=r(96674);const p=new l.X({asc:"ascending",desc:"descending"});let c=i=class extends u.wq{constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new i({field:this.field,valueExpression:this.valueExpression,order:this.order})}};(0,n._)([(0,o.Cb)({type:String,json:{write:!0}})],c.prototype,"field",void 0),(0,n._)([(0,o.Cb)({type:String,json:{write:!0}})],c.prototype,"valueExpression",void 0),(0,n._)([(0,o.Cb)({type:p.apiValues,json:{read:p.read,write:p.write}})],c.prototype,"order",void 0),c=i=(0,n._)([(0,a.j)("esri.layers.support.OrderByInfo")],c);const d=c;function y(e,t,r){if(!e)return null;const i=e.find((e=>!!e.field));if(!i)return null;const n=new d;return n.read(i,r),[n]}function f(e,t,r,i){const n=e.find((e=>!!e.field));n&&(0,s.RB)(r,[n.toJSON()],t)}const m=e=>{let t=class extends e{constructor(){super(...arguments),this.orderBy=null}};return(0,n._)([(0,o.Cb)({type:[d],json:{origins:{"web-scene":{write:!1,read:!1}},read:{source:"layerDefinition.orderBy",reader:y},write:{target:"layerDefinition.orderBy",writer:f}}})],t.prototype,"orderBy",void 0),t=(0,n._)([(0,a.j)("esri.layers.mixins.OrderedLayer")],t),t}},16859:(e,t,r)=>{r.d(t,{I:()=>S});var i=r(43697),n=r(68773),s=r(40330),o=r(3172),a=r(66643),l=r(20102),u=r(92604),p=r(70586),c=r(95330),d=r(81271),y=r(5600),f=(r(75215),r(67676),r(80442),r(71715)),m=r(52011),h=r(30556),g=r(84230),w=r(48522),b=r(15235),v=r(86082),_=r(14661);const S=e=>{let t=class extends e{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=(0,p.SC)(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,r){if(t.itemId)return new b.default({id:t.itemId,portal:r&&r.portal})}writePortalItem(e,t){e&&e.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem&&this.portalItem.id)try{const{load:i}=await r.e(8062).then(r.bind(r,18062));return(0,c.k_)(t),await i({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData,layerModuleTypeMap:e.layerModuleTypeMap},t)}catch(e){throw(0,c.D_)(e)||u.Z.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch((e=>((0,c.r9)(e),!0))))}async _setUserPrivileges(e,t){if(!n.default.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(t);if(this.url)try{const{features:{edit:r,fullEdit:i},content:{updateItem:n}}=await this._fetchUserPrivileges(e,t);this._set("userHasEditingPrivileges",r),this._set("userHasFullEditingPrivileges",i),this._set("userHasUpdateItemPrivileges",n)}catch(e){(0,c.r9)(e)}}async _fetchUserPrivileges(e,t){let r=this.portalItem;if(!e||!r||!r.loaded||r.sourceUrl)return this._fetchFallbackUserPrivileges(t);const i=e===r.id;if(i&&r.portal.user)return(0,_.Ss)(r);let n,o;if(i)n=r.portal.url;else try{n=await(0,g.oP)(this.url,t)}catch(e){(0,c.r9)(e)}if(!n||!(0,d.Zo)(n,r.portal.url))return this._fetchFallbackUserPrivileges(t);try{const e=null!=t?t.signal:null;o=await(s.id?.getCredential(`${n}/sharing`,{prompt:!1,signal:e}))}catch(e){(0,c.r9)(e)}if(!o)return{features:{edit:!0,fullEdit:!1},content:{updateItem:!1}};try{if(i?await r.reload():(r=new b.default({id:e,portal:{url:n}}),await r.load(t)),r.portal.user)return(0,_.Ss)(r)}catch(e){(0,c.r9)(e)}return{features:{edit:!0,fullEdit:!1},content:{updateItem:!1}}}async _fetchFallbackUserPrivileges(e){let t=!0;try{t=await this._fetchUserHasEditingPrivileges(e)}catch(e){(0,c.r9)(e)}return{features:{edit:t,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(e){const t=this.url?s.id?.findCredential(this.url):null;if(!t)return!0;const r=C.credential===t?C.user:await this._fetchEditingUser(e);return C.credential=t,C.user=r,null==r||null==r.privileges||r.privileges.includes("features:user:edit")}async _fetchEditingUser(e){const t=this.portalItem?.portal?.user;if(t)return t;const r=s.id.findServerInfo(this.url??"");if(!r?.owningSystemUrl)return null;const i=`${r.owningSystemUrl}/sharing/rest`,n=w.Z.getDefault();if(n&&n.loaded&&(0,d.Fv)(n.restUrl)===(0,d.Fv)(i))return n.user;const l=`${i}/community/self`,u=null!=e?e.signal:null,p=await(0,a.q6)((0,o.default)(l,{authMode:"no-prompt",query:{f:"json"},signal:u}));return p.ok?v.default.fromJSON(p.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const r=t&&t.portal,i=this.portalItem&&this.portalItem.id&&(this.portalItem.portal||w.Z.getDefault());return r&&i&&!(0,d.tm)(i.restUrl,r.restUrl)?(t.messages&&t.messages.push(new l.Z("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,i._)([(0,y.Cb)({type:b.default})],t.prototype,"portalItem",null),(0,i._)([(0,f.r)("web-document","portalItem",["itemId"])],t.prototype,"readPortalItem",null),(0,i._)([(0,h.c)("web-document","portalItem",{itemId:{type:String}})],t.prototype,"writePortalItem",null),(0,i._)([(0,y.Cb)({clonable:!1})],t.prototype,"resourceReferences",void 0),(0,i._)([(0,y.Cb)({type:Boolean,readOnly:!0})],t.prototype,"userHasEditingPrivileges",void 0),(0,i._)([(0,y.Cb)({type:Boolean,readOnly:!0})],t.prototype,"userHasFullEditingPrivileges",void 0),(0,i._)([(0,y.Cb)({type:Boolean,readOnly:!0})],t.prototype,"userHasUpdateItemPrivileges",void 0),t=(0,i._)([(0,m.j)("esri.layers.mixins.PortalLayer")],t),t},C={credential:null,user:null}},28294:(e,t,r)=>{r.d(t,{n:()=>d});var i=r(43697),n=r(92835),s=r(84552),o=r(5600),a=(r(75215),r(67676),r(80442),r(71715)),l=r(52011),u=r(35671),p=r(76259),c=r(78981);const d=e=>{let t=class extends e{constructor(){super(...arguments),this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0}readOffset(e,t){const r=t.timeInfo.exportOptions;if(!r)return null;const i=r.timeOffset,n=c.v.fromJSON(r.timeOffsetUnits);return i&&n?new s.Z({value:i,unit:n}):null}set timeInfo(e){(0,u.UF)(e,this.fieldsIndex),this._set("timeInfo",e)}};return(0,i._)([(0,o.Cb)({type:n.Z,json:{write:!1}})],t.prototype,"timeExtent",void 0),(0,i._)([(0,o.Cb)({type:s.Z})],t.prototype,"timeOffset",void 0),(0,i._)([(0,a.r)("service","timeOffset",["timeInfo.exportOptions"])],t.prototype,"readOffset",null),(0,i._)([(0,o.Cb)({value:null,type:p.Z,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],t.prototype,"timeInfo",null),(0,i._)([(0,o.Cb)({type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation"},origins:{"web-scene":{read:!1,write:!1}}}})],t.prototype,"useViewTime",void 0),t=(0,i._)([(0,l.j)("esri.layers.mixins.TemporalLayer")],t),t}},51432:(e,t,r)=>{r.d(t,{M8:()=>v,ft:()=>N,FU:()=>j,Bm:()=>L,be:()=>Z,eB:()=>k}),r(66577);var i=r(3172),n=r(20102),s=r(66374),o=r(95330),a=r(81271),l=r(44547),u=r(8744),p=r(86973),c=r(92722);function d(e){return function(e){const t=y.exec(e);if(!t?.groups)return null;const r=t.groups,i=+r.year,n=+r.month-1,s=+r.day,o=+(r.hours??"0"),a=+(r.minutes??"0"),l=+(r.seconds??"0");if(o>23)return null;if(a>59)return null;if(l>59)return null;const u=r.ms??"0",p=u?+u.padEnd(3,"0").substring(0,3):0;let c;if(r.isUTC)c=Date.UTC(i,n,s,o,a,l,p);else if(r.offsetSign){const e=+r.offsetHours,t=+r.offsetMinutes;c=6e4*("+"===r.offsetSign?-1:1)*(60*e+t)+Date.UTC(i,n,s,o,a,l,p)}else c=new Date(i,n,s,o,a,l,p).getTime();return Number.isNaN(c)?null:c}(e)??function(e){const t=new Date(e).getTime();return Number.isNaN(t)?null:t}(e)}const y=/^(?:(?<year>-?\d{4,})-(?<month>\d{2})-(?<day>\d{2}))(?:T(?<hours>\d{2}):(?<minutes>\d{2}):(?<seconds>\d{2})(?:\.(?<ms>\d+))?)?(?:(?<isUTC>Z)|(?:(?<offsetSign>\+|-)(?<offsetHours>\d{2}):(?<offsetMinutes>\d{2})))?$/;var f=r(88724),m=r(1231),h=r(82971),g=r(6570);const w="xlink:href",b="2.0.0",v="__esri_wfs_id__",_="wfs-layer:getWFSLayerTypeInfo-error",S="wfs-layer:empty-service",C="wfs-layer:feature-type-not-found",x="wfs-layer:geojson-not-supported",F="wfs-layer:kvp-encoding-not-supported",T="wfs-layer:malformed-json",I="wfs-layer:unknown-geometry-type",P="wfs-layer:unknown-field-type",E="wfs-layer:unsupported-spatial-reference",R="wfs-layer:unsupported-wfs-version";async function j(e,t){const r=function(e){const t=A(e);(function(e){const t=e.firstElementChild?.getAttribute("version");if(t&&t!==b)throw new n.Z(R,`Unsupported WFS version ${t}. Supported version: ${b}`)})(t),J(t);const r=t.firstElementChild,i=(0,s.Fs)(function(e){return(0,f.H)(e,{FeatureTypeList:{FeatureType:e=>{const t={typeName:"undefined:undefined",name:"",title:"",description:"",extent:null,namespacePrefix:"",namespaceUri:"",supportedSpatialReferences:[]},r=new Set([4326]),i=e=>{const t=parseInt(e.textContent?.match(/(?<wkid>\d+$)/i)?.groups?.wkid??"",10);Number.isNaN(t)||r.add(t)};return(0,f.h)(e,{Name:e=>{const{name:r,prefix:i}=H(e.textContent);t.typeName=`${i}:${r}`,t.name=r,t.namespacePrefix=i,t.namespaceUri=e.lookupNamespaceURI(i)},Abstract:e=>{t.description=e.textContent},Title:e=>{t.title=e.textContent},WGS84BoundingBox:e=>{t.extent=function(e){let t,r,i,n;for(const s of e.children)switch(s.localName){case"LowerCorner":[t,r]=s.textContent.split(" ").map((e=>Number.parseFloat(e)));break;case"UpperCorner":[i,n]=s.textContent.split(" ").map((e=>Number.parseFloat(e)))}return{xmin:t,ymin:r,xmax:i,ymax:n,spatialReference:u.Zn}}(e)},DefaultSRS:i,DefaultCRS:i,OtherSRS:i,OtherCRS:i}),t.title||(t.title=t.name),t.supportedSpatialReferences.push(...r),t}}})}(r));return{operations:U(r),get featureTypes(){return Array.from(i())},readFeatureTypes:i}}((await(0,i.default)(e,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"GetCapabilities",VERSION:b,...t?.customParameters},signal:t?.signal})).data);return function(e,t){(0,a.$U)(e)&&((0,a.D6)(e,t.operations.DescribeFeatureType.url,!0)&&(t.operations.DescribeFeatureType.url=(0,a.hO)(t.operations.DescribeFeatureType.url)),(0,a.D6)(e,t.operations.GetFeature.url,!0)&&(t.operations.GetFeature.url=(0,a.hO)(t.operations.GetFeature.url)))}(e,r),r}const O=new Set(["json","application/json","geojson","application/json; subtype=geojson"]);function U(e){let t=!1;const r={GetCapabilities:{url:""},DescribeFeatureType:{url:""},GetFeature:{url:"",outputFormat:null,supportsPagination:!1}};if((0,f.h)(e,{OperationsMetadata:{Operation:e=>{switch(e.getAttribute("name")){case"GetCapabilities":return{DCP:{HTTP:{Get:e=>{r.GetCapabilities.url=e.getAttribute(w)}}}};case"DescribeFeatureType":return{DCP:{HTTP:{Get:e=>{r.DescribeFeatureType.url=e.getAttribute(w)}}}};case"GetFeature":return{DCP:{HTTP:{Get:e=>{r.GetFeature.url=e.getAttribute(w)}}},Parameter:e=>{if("outputFormat"===e.getAttribute("name"))return{AllowedValues:{Value:e=>{const t=e.textContent;t&&O.has(t.toLowerCase())&&(r.GetFeature.outputFormat=t)}}}}}}},Constraint:e=>{switch(e.getAttribute("name")){case"KVPEncoding":return{DefaultValue:e=>{t="true"===e.textContent.toLowerCase()}};case"ImplementsResultPaging":return{DefaultValue:e=>{r.GetFeature.supportsPagination="true"===e.textContent.toLowerCase()}}}}}}),!t)throw new n.Z(F,"WFS service doesn't support key/value pair (KVP) encoding");if(null==r.GetFeature.outputFormat)throw new n.Z(x,"WFS service doesn't support GeoJSON output format");return r}function N(e,t,r){return(0,s.sE)(e,(e=>r?e.name===t&&e.namespaceUri===r:e.typeName===t||e.name===t))}async function Z(e,t,r,i={}){const{featureType:s,extent:a}=await async function(e,t,r,i={}){const{spatialReference:s=h.Z.WGS84}=i,o=e.readFeatureTypes(),a=t?N(o,t,r):o.next().value;if(null==a)throw t?new n.Z(C,`The type '${t}' could not be found in the service`):new n.Z(S,"The service is empty");let p=new g.Z({...a.extent,spatialReference:s});if(!(0,u.fS)(s,u.Zn))try{await(0,l.initializeProjection)(u.Zn,s,void 0,i),p=(0,l.iV)(p,u.Zn)}catch{throw new n.Z(E,"Projection not supported")}return{extent:p,spatialReference:s,featureType:a}}(e,t,r,i),{fields:p,geometryType:c,swapXY:d,objectIdField:y,geometryField:f}=await async function(e,t,r={}){const[i,s]=await(0,o.as)([q(e.operations.DescribeFeatureType.url,t,r),M(e,t,r)]);if(i.error||s.error)throw new n.Z(_,`An error occurred while getting info about the feature type '${t}'`,{error:i.error||s.error});const{fields:a,errors:l}=i.value??{},u=i.value?.geometryType||s.value?.geometryType,p=s.value?.swapXY??!1;if(null==u)throw new n.Z(I,`The geometry type could not be determined for type '${t}`,{typeName:t,geometryType:u,fields:a,errors:l});return{...k(a??[]),geometryType:u,swapXY:p}}(e,s.typeName,i);return{url:e.operations.GetCapabilities.url,name:s.name,namespaceUri:s.namespaceUri,fields:p,geometryField:f,geometryType:c,objectIdField:y,spatialReference:i.spatialReference??h.Z.WGS84,extent:a,swapXY:d,wfsCapabilities:e,customParameters:i.customParameters}}function k(e){const t=e.find((e=>"geometry"===e.type));let r=e.find((e=>"oid"===e.type));return e=e.filter((e=>"geometry"!==e.type)),r||(r=new m.Z({name:v,type:"oid",alias:v}),e.unshift(r)),{geometryField:t?.name??null,objectIdField:r.name,fields:e}}async function M(e,t,r={}){let n,s=!1;const[o,a]=await Promise.all([L(e.operations.GetFeature.url,t,e.operations.GetFeature.outputFormat,{...r,count:1}),(0,i.default)(e.operations.GetFeature.url,{responseType:"text",query:D(t,void 0,{...r,count:1}),signal:r?.signal})]),l="FeatureCollection"===o.type&&o.features[0]?.geometry;if(l){let e;switch(n=p.M.fromJSON((0,c.q9)(l.type)),l.type){case"Point":e=l.coordinates;break;case"LineString":case"MultiPoint":e=l.coordinates[0];break;case"MultiLineString":case"Polygon":e=l.coordinates[0][0];break;case"MultiPolygon":e=l.coordinates[0][0][0]}const t=/<[^>]*pos[^>]*> *(-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?)/.exec(a.data);if(t){const r=e[0].toFixed(3),i=e[1].toFixed(3),n=parseFloat(t[1]).toFixed(3);r===parseFloat(t[2]).toFixed(3)&&i===n&&(s=!0)}}return{geometryType:n,swapXY:s}}async function q(e,t,r){return function(e,t){const{name:r}=H(e),i=A(t);J(i);const o=(0,s.sE)((0,f.H)(i.firstElementChild,{element:e=>({name:e.getAttribute("name"),typeName:H(e.getAttribute("type")).name})}),(({name:e})=>e===r));if(null!=o){const e=(0,s.sE)((0,f.H)(i.firstElementChild,{complexType:e=>e}),(e=>e.getAttribute("name")===o.typeName));if(null!=e)return function(e){const t=[],r=[];let i;const s=(0,f.H)(e,{complexContent:{extension:{sequence:{element:e=>e}}}});for(const o of s){const s=o.getAttribute("name");if(!s)continue;let a,l;if(o.hasAttribute("type")?a=H(o.getAttribute("type")).name:(0,f.h)(o,{simpleType:{restriction:e=>(a=H(e.getAttribute("base")).name,{maxLength:e=>{l=+e.getAttribute("value")}})}}),!a)continue;const u="true"===o.getAttribute("nillable");let p=!1;switch(a.toLowerCase()){case"integer":case"nonpositiveinteger":case"negativeinteger":case"long":case"int":case"short":case"byte":case"nonnegativeinteger":case"unsignedlong":case"unsignedint":case"unsignedshort":case"unsignedbyte":case"positiveinteger":r.push(new m.Z({name:s,alias:s,type:"integer",nullable:u}));break;case"float":case"double":case"decimal":r.push(new m.Z({name:s,alias:s,type:"double",nullable:u}));break;case"boolean":case"string":case"gyearmonth":case"gyear":case"gmonthday":case"gday":case"gmonth":case"anyuri":case"qname":case"notation":case"normalizedstring":case"token":case"language":case"idrefs":case"entities":case"nmtoken":case"nmtokens":case"name":case"ncname":case"id":case"idref":case"entity":case"duration":case"time":r.push(new m.Z({name:s,alias:s,type:"string",nullable:u,length:l??255}));break;case"datetime":case"date":r.push(new m.Z({name:s,alias:s,type:"date",nullable:u,length:l??36}));break;case"pointpropertytype":i="point",p=!0;break;case"multipointpropertytype":i="multipoint",p=!0;break;case"curvepropertytype":case"multicurvepropertytype":case"multilinestringpropertytype":i="polyline",p=!0;break;case"surfacepropertytype":case"multisurfacepropertytype":case"multipolygonpropertytype":i="polygon",p=!0;break;case"geometrypropertytype":case"multigeometrypropertytype":p=!0,t.push(new n.Z(I,`geometry type '${a}' is not supported`,{type:(new XMLSerializer).serializeToString(e)}));break;default:t.push(new n.Z(P,`Unknown field type '${a}'`,{type:(new XMLSerializer).serializeToString(e)}))}p&&r.push(new m.Z({name:s,alias:s,type:"geometry",nullable:u}))}for(const e of r)if("integer"===e.type&&!e.nullable&&G.has(e.name.toLowerCase())){e.type="oid";break}return{geometryType:i,fields:r,errors:t}}(e)}throw new n.Z(C,`Type '${e}' not found in document`,{document:(new XMLSerializer).serializeToString(i)})}(t,(await(0,i.default)(e,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"DescribeFeatureType",VERSION:b,TYPENAME:t,...r?.customParameters},signal:r?.signal})).data)}const G=new Set(["objectid","fid"]);async function L(e,t,r,s){let{data:o}=await(0,i.default)(e,{responseType:"text",query:D(t,r,s),signal:s?.signal});o=o.replaceAll(/": +(-?\d+),(\d+)(,)?/g,'": $1.$2$3');try{if(s?.dateFields?.length){const e=new Set(s.dateFields);return JSON.parse(o,((t,r)=>e.has(t)?d(r):r))}return JSON.parse(o)}catch(e){throw new n.Z(T,"Error while parsing the response",{response:o,error:e})}}function D(e,t,r){return{SERVICE:"WFS",REQUEST:"GetFeature",VERSION:b,TYPENAMES:e,OUTPUTFORMAT:t,SRSNAME:"EPSG:4326",STARTINDEX:r?.startIndex,COUNT:r?.count,...r?.customParameters}}function A(e){return(new DOMParser).parseFromString(e.trim(),"text/xml")}function H(e){const[t,r]=e.split(":");return{prefix:r?t:"",name:r??t}}function J(e){let t="",r="";if((0,f.h)(e.firstElementChild,{Exception:e=>(t=e.getAttribute("exceptionCode"),{ExceptionText:e=>{r=e.textContent}})}),t)throw new n.Z(`wfs-layer:${t}`,r)}},88724:(e,t,r)=>{function i(e,t){if(e&&t)for(const r of e.children)if(r.localName in t){const e=t[r.localName];if("function"==typeof e){const t=e(r);t&&i(r,t)}else i(r,e)}}function*n(e,t){for(const r of e.children)if(r.localName in t){const e=t[r.localName];"function"==typeof e?yield e(r):yield*n(r,e)}}r.d(t,{H:()=>n,h:()=>i})},76259:(e,t,r)=>{r.d(t,{Z:()=>m});var i=r(43697),n=r(92835),s=r(84552),o=r(2368),a=r(96674),l=r(5600),u=(r(75215),r(67676),r(80442),r(71715)),p=r(52011),c=r(30556),d=r(80216);function y(e,t){return s.Z.fromJSON({value:e,unit:t})}let f=class extends((0,o.J)(a.wq)){constructor(e){super(e),this.cumulative=!1,this.endField=null,this.fullTimeExtent=null,this.hasLiveData=!1,this.interval=null,this.startField=null,this.timeReference=null,this.trackIdField=null,this.useTime=!0}readFullTimeExtent(e,t){if(!t.timeExtent||!Array.isArray(t.timeExtent)||2!==t.timeExtent.length)return null;const r=new Date(t.timeExtent[0]),i=new Date(t.timeExtent[1]);return new n.Z({start:r,end:i})}writeFullTimeExtent(e,t){e&&null!=e.start&&null!=e.end?t.timeExtent=[e.start.getTime(),e.end.getTime()]:t.timeExtent=null}readInterval(e,t){return t.timeInterval&&t.timeIntervalUnits?y(t.timeInterval,t.timeIntervalUnits):t.defaultTimeInterval&&t.defaultTimeIntervalUnits?y(t.defaultTimeInterval,t.defaultTimeIntervalUnits):null}writeInterval(e,t){t.timeInterval=e?.toJSON().value??null,t.timeIntervalUnits=e?.toJSON().unit??null}};(0,i._)([(0,l.Cb)({type:Boolean,json:{name:"exportOptions.timeDataCumulative",write:!0}})],f.prototype,"cumulative",void 0),(0,i._)([(0,l.Cb)({type:String,json:{name:"endTimeField",write:{enabled:!0,allowNull:!0}}})],f.prototype,"endField",void 0),(0,i._)([(0,l.Cb)({type:n.Z,json:{write:{enabled:!0,allowNull:!0}}})],f.prototype,"fullTimeExtent",void 0),(0,i._)([(0,u.r)("fullTimeExtent",["timeExtent"])],f.prototype,"readFullTimeExtent",null),(0,i._)([(0,c.c)("fullTimeExtent")],f.prototype,"writeFullTimeExtent",null),(0,i._)([(0,l.Cb)({type:Boolean,json:{write:!0}})],f.prototype,"hasLiveData",void 0),(0,i._)([(0,l.Cb)({type:s.Z,json:{write:{enabled:!0,allowNull:!0}}})],f.prototype,"interval",void 0),(0,i._)([(0,u.r)("interval",["timeInterval","timeIntervalUnits","defaultTimeInterval","defaultTimeIntervalUnits"])],f.prototype,"readInterval",null),(0,i._)([(0,c.c)("interval")],f.prototype,"writeInterval",null),(0,i._)([(0,l.Cb)({type:String,json:{name:"startTimeField",write:{enabled:!0,allowNull:!0}}})],f.prototype,"startField",void 0),(0,i._)([(0,l.Cb)({type:d.Z,json:{write:{enabled:!0,allowNull:!0}}})],f.prototype,"timeReference",void 0),(0,i._)([(0,l.Cb)({type:String,json:{write:{enabled:!0,allowNull:!0}}})],f.prototype,"trackIdField",void 0),(0,i._)([(0,l.Cb)({type:Boolean,json:{name:"exportOptions.useTime",write:!0}})],f.prototype,"useTime",void 0),f=(0,i._)([(0,p.j)("esri.layers.support.TimeInfo")],f);const m=f},30707:(e,t,r)=>{r.d(t,{a:()=>c,r:()=>u});var i=r(20102),n=r(22974),s=r(92604),o=r(54306);const a=s.Z.getLogger("esri.layers.support.labelingInfo"),l=/\[([^\[\]]+)\]/gi;function u(e,t,r){return e?e.map((e=>{const i=new o.Z;if(i.read(e,r),i.labelExpression){const e=t.fields||t.layerDefinition&&t.layerDefinition.fields||this.fields;i.labelExpression=i.labelExpression.replaceAll(l,((t,r)=>`[${function(e,t){if(!t)return e;const r=e.toLowerCase();for(let e=0;e<t.length;e++){const i=t[e].name;if(i.toLowerCase()===r)return i}return e}(r,e)}]`))}return i})):null}const p={esriGeometryPoint:["above-right","above-center","above-left","center-center","center-left","center-right","below-center","below-left","below-right"],esriGeometryPolygon:["always-horizontal"],esriGeometryPolyline:["center-along"],esriGeometryMultipoint:null};function c(e,t){const r=(0,n.d9)(e);return r.some((e=>function(e,t){const r=e.labelPlacement,n=p[t];if(!e.symbol)return a.warn("No ILabelClass symbol specified."),!0;if(!n)return a.error(new i.Z("labeling:unsupported-geometry-type",`Unable to create labels for layer, geometry type '${t}' is not supported`)),!0;if(!n.includes(r)){const i=n[0];r&&a.warn(`Found invalid label placement type ${r} for ${t}. Defaulting to ${i}`),e.labelPlacement=i}return!1}(e,t)))?[]:r}},78981:(e,t,r)=>{r.d(t,{v:()=>i});const i=(0,r(35454).w)()({esriTimeUnitsMilliseconds:"milliseconds",esriTimeUnitsSeconds:"seconds",esriTimeUnitsMinutes:"minutes",esriTimeUnitsHours:"hours",esriTimeUnitsDays:"days",esriTimeUnitsWeeks:"weeks",esriTimeUnitsMonths:"months",esriTimeUnitsYears:"years",esriTimeUnitsDecades:"decades",esriTimeUnitsCenturies:"centuries",esriTimeUnitsUnknown:void 0})},74889:(e,t,r)=>{r.d(t,{Z:()=>b});var i,n=r(43697),s=r(66577),o=r(38171),a=r(35454),l=r(96674),u=r(22974),p=r(5600),c=(r(75215),r(71715)),d=r(52011),y=r(30556),f=r(82971),m=r(33955),h=r(1231);const g=new a.X({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let w=i=class extends l.wq{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){const r=f.Z.fromJSON(t.spatialReference),i=[];for(let t=0;t<e.length;t++){const n=e[t],s=o.Z.fromJSON(n),a=n.geometry&&n.geometry.spatialReference;null==s.geometry||a||(s.geometry.spatialReference=r);const l=n.aggregateGeometries,u=s.aggregateGeometries;if(l&&null!=u)for(const e in u){const t=u[e],i=l[e],n=i?.spatialReference;null==t||n||(t.spatialReference=r)}i.push(s)}return i}writeGeometryType(e,t,r,i){if(e)return void g.write(e,t,r,i);const{features:n}=this;if(n)for(const e of n)if(e&&null!=e.geometry)return void g.write(e.geometry.type,t,r,i)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,i=(0,m.im)(e);return i&&!r&&t.spatialReference&&(i.spatialReference=f.Z.fromJSON(t.spatialReference)),i}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const e of r)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new i(this.cloneProperties())}cloneProperties(){return(0,u.d9)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let r=0;r<t.features.length;r++){const i=t.features[r];if(i.geometry){const t=e&&e[r];i.geometry=t&&t.toJSON()||i.geometry}}return t}quantize(e){const{scale:[t,r],translate:[i,n]}=e,s=this.features,o=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-i)/t)),(e=>Math.round((n-e)/r)));for(let e=0,t=s.length;e<t;e++)o?.(s[e].geometry)||(s.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[i,n],scale:[s,o]}=r;let a=null,l=null;if(this.hasZ&&null!=r?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=r;a=r=>r*t+e}if(this.hasM&&null!=r?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=r;l=r=>null==r?r:r*t+e}const u=this._getHydrationFunction(e,(e=>e*s+i),(e=>n-e*o),a,l);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}_quantizePoints(e,t,r){let i,n;const s=[];for(let o=0,a=e.length;o<a;o++){const a=e[o];if(o>0){const e=t(a[0]),o=r(a[1]);e===i&&o===n||(s.push([e-i,o-n]),i=e,n=o)}else i=t(a[0]),n=r(a[1]),s.push([i,n])}return s.length>0?s:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const i=(0,m.oU)(e)?e.rings:e.paths,n=[];for(let e=0,s=i.length;e<s;e++){const s=i[e],o=this._quantizePoints(s,t,r);o&&n.push(o)}return n.length>0?((0,m.oU)(e)?e.rings=n:e.paths=n,e):null}:"multipoint"===e?e=>{const i=this._quantizePoints(e.points,t,r);return i&&i.length>0?(e.points=i,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r,i,n){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y),i&&(e.z=i(e.z))}:"polyline"===e||"polygon"===e?e=>{const s=(0,m.oU)(e)?e.rings:e.paths;let o,a;for(let e=0,i=s.length;e<i;e++){const i=s[e];for(let e=0,n=i.length;e<n;e++){const n=i[e];e>0?(o+=n[0],a+=n[1]):(o=n[0],a=n[1]),n[0]=t(o),n[1]=r(a)}}if(i&&n)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2]),r[3]=n(r[3])}}else if(i)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2])}}else if(n)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=n(r[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax),i&&null!=e.zmax&&null!=e.zmin&&(e.zmax=i(e.zmax),e.zmin=i(e.zmin)),n&&null!=e.mmax&&null!=e.mmin&&(e.mmax=n(e.mmax),e.mmin=n(e.mmin))}:"multipoint"===e?e=>{const s=e.points;let o,a;for(let e=0,i=s.length;e<i;e++){const i=s[e];e>0?(o+=i[0],a+=i[1]):(o=i[0],a=i[1]),i[0]=t(o),i[1]=r(a)}if(i&&n)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=i(t[2]),t[3]=n(t[3])}else if(i)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=i(t[2])}else if(n)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=n(t[2])}}:null}};(0,n._)([(0,p.Cb)({type:String,json:{write:!0}})],w.prototype,"displayFieldName",void 0),(0,n._)([(0,p.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],w.prototype,"exceededTransferLimit",void 0),(0,n._)([(0,p.Cb)({type:[o.Z],json:{write:!0}})],w.prototype,"features",void 0),(0,n._)([(0,c.r)("features")],w.prototype,"readFeatures",null),(0,n._)([(0,p.Cb)({type:[h.Z],json:{write:!0}})],w.prototype,"fields",void 0),(0,n._)([(0,p.Cb)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],w.prototype,"geometryType",void 0),(0,n._)([(0,y.c)("geometryType")],w.prototype,"writeGeometryType",null),(0,n._)([(0,p.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],w.prototype,"hasM",void 0),(0,n._)([(0,p.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],w.prototype,"hasZ",void 0),(0,n._)([(0,p.Cb)({types:s.qM,json:{write:!0}})],w.prototype,"queryGeometry",void 0),(0,n._)([(0,c.r)("queryGeometry")],w.prototype,"readQueryGeometry",null),(0,n._)([(0,p.Cb)({type:f.Z,json:{write:!0}})],w.prototype,"spatialReference",void 0),(0,n._)([(0,y.c)("spatialReference")],w.prototype,"writeSpatialReference",null),(0,n._)([(0,p.Cb)({json:{write:!0}})],w.prototype,"transform",void 0),w=i=(0,n._)([(0,d.j)("esri.rest.support.FeatureSet")],w),w.prototype.toJSON.isDefaultToJSON=!0;const b=w},58333:(e,t,r)=>{r.d(t,{ET:()=>s,I4:()=>n,eG:()=>l,lF:()=>o,lj:()=>p,qP:()=>a,wW:()=>u});const i=[252,146,31,255],n={type:"esriSMS",style:"esriSMSCircle",size:6,color:i,outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[153,153,153,255]}},s={type:"esriSLS",style:"esriSLSSolid",width:.75,color:i},o={type:"esriSFS",style:"esriSFSSolid",color:[252,146,31,196],outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[255,255,255,191]}},a={type:"esriTS",color:[255,255,255,255],font:{family:"arial-unicode-ms",size:10,weight:"bold"},horizontalAlignment:"center",kerning:!0,haloColor:[0,0,0,255],haloSize:1,rotated:!1,text:"",xoffset:0,yoffset:0,angle:0},l={type:"esriSMS",style:"esriSMSCircle",color:[0,0,0,255],outline:null,size:10.5},u={type:"esriSLS",style:"esriSLSSolid",color:[0,0,0,255],width:1.5},p={type:"esriSFS",style:"esriSFSSolid",color:[0,0,0,255],outline:null}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[6946],{36946:(e,t,s)=>{s.d(t,{uploadAssets:()=>h});var a=s(3172),r=s(20102),o=s(92604),n=s(95330),i=s(81271),l=s(41123),u=s(84470),p=s(66677);const c=1e6,d=20*c,f=2e9,y=3;async function m({data:e,name:t,description:s},r,o){let l=null;try{const u=(0,i.v_)(r,"uploads"),m=(0,i.v_)(u,"info"),{data:w}=await(0,a.default)(m,{query:{f:"json"},responseType:"json"});(0,n.k_)(o);const h=(0,p.M8)(r),g=w.maxUploadFileSize*c,T=h?f:g,b=h?Math.min(d,g):d;if(e.size>T)throw new Error("Data too large");const _=(0,i.v_)(u,"register"),{data:$}=await(0,a.default)(_,{query:{f:"json",itemName:t,description:s},responseType:"json",method:"post"});if((0,n.k_)(o),!$.success)throw new Error("Registration failed");const{itemID:v}=$.item;l=(0,i.v_)(u,v);const E=(0,i.v_)(l,"uploadPart"),F=Math.ceil(e.size/b),k=new Array;for(let t=0;t<F;++t)k.push(e.slice(t*b,Math.min((t+1)*b,e.size)));const j=k.slice().reverse(),N=new Array,D=async()=>{for(;0!==j.length;){const e=k.length-j.length,t=j.pop(),s=new FormData;s.append("f","json"),s.append("file",t),s.append("partId",`${e}`);const{data:r}=await(0,a.default)(E,{timeout:0,body:s,responseType:"json",method:"post"});if((0,n.k_)(o),!r.success)throw new Error("Part upload failed")}};for(let e=0;e<y&&0!==j.length;++e)N.push(D());await Promise.all(N);const S=(0,i.v_)(l,"commit"),{data:U}=await(0,a.default)(S,{query:{f:"json",parts:k.map(((e,t)=>t)).join(",")},responseType:"json",method:"post"});if((0,n.k_)(o),!U.success)throw new Error("Commit failed");return U.item}catch(e){if(null!=l){const e=(0,i.v_)(l,"delete");await(0,a.default)(e,{query:{f:"json"},responseType:"json",method:"post"})}throw e}}var w=s(2981);async function h(e,t,s){return e.length?Promise.all(e.map((e=>async function(e,{layer:t,ongoingUploads:s},a){const o=s.get(e);if(o)return o;if(!function(e){return!!e.infoFor3D&&!!e.url}(t))throw new r.Z(`${t.type}-layer:upload-failure`,"Layer does not support asset uploads.",new Error);if(function(e,t){const{parsedUrl:s}=t;return null!=s&&e.metadata.externalSources.some((e=>(0,u.JG)(e,s)))}(e,t))return e;const i=async function(e,t,s){const{metadata:a}=e,{displaySource:o}=a,i=g(o?.source,t),u=!!i,p=a.externalSources.length>0,c=u?async function(e,t,s){return{source:await b(e,t,s),original:!0}}(i,t,s):p?async function(e,t,s){const a=v(t),{externalSources:o}=e.metadata,n=function(e,t){for(const s of e){const e=g(s.source,t);if(e)return e}return null}(o,t);if(!n)throw new r.Z(`${t.type}-layer:upload-failure`,"Could not find an external source that is supported by the service.",new Error);const i=await b(n,t,s);return e.addExternalSources([{source:i,original:!0}]),{source:await $(i,t,a)}}(e,t,s):async function(e,t,s){const a=async function(e,t,s){const a=v(t),r=await e.load(s),o=await r.toBinaryGLTF({ignoreLocalTransform:!0});(0,n.k_)(s);const i=await o.buffer();return(0,n.k_)(s),{blob:new Blob([i.data],{type:i.type}),assetName:`${(0,l.z)()}.glb`,assetType:a}}(e,t,s);return{source:await _([a],t,s),extent:e.extent.clone(),original:!0}}(e,t,s),d=await c;return(0,n.k_)(s),e.addExternalSources([d]),e}(e,t,a);s.set(e,i);try{await i}finally{s.delete(e)}return e}(e,t,s)))):[]}function g(e,t){if(!e)return null;const{infoFor3D:{supportedFormats:s,editFormats:a}}=t,r=(0,u.zE)(e),o=new Array;let n=!1;for(let e=0;e<r.length;++e){const t=T(r[e],s);if(!t)return null;a.includes(t.assetType)&&(n=!0),o.push(t)}return n?o:null}function T(e,t){const s=(0,u.vj)(e,t);return s?{asset:e,assetType:s}:null}async function b(e,t,s){return _(e.map((e=>async function(e,t){const{asset:s,assetType:a}=e;if(s instanceof File)return{blob:s,assetName:s.name,assetType:a};const r=await s.toBlob(t);return(0,n.k_)(t),{blob:r,assetName:s.assetName,assetType:a}}(e,s))),t,s)}async function _(e,t,s){const l=await Promise.all(e.map((async e=>{const a=async function(e,t,s){const{blob:a,assetType:l,assetName:u}=e;let p=null;try{const e=await m({data:a,name:u},t.url,s);(0,n.k_)(s),p={assetType:l,assetUploadId:e.itemID}}catch(e){(0,n.r9)(e),o.Z.getLogger("esri.layers.graphics.sources.support.uploadAssets").warnOnce(`Service ${t.url} does not support the REST Uploads API.`)}if(!p){const e=await(0,i.IR)(a);if((0,n.k_)(s),!e.isBase64)throw new r.Z(`${t.type}-layer:uploadAssets-failure`,"Expected gltf data in base64 format after conversion.",new Error);p={assetType:l,assetData:e.data}}if(!p)throw new r.Z(`${t.type}-layer:uploadAssets-failure`,"Unable to prepare uploadAsset request options.",new Error);return{item:p,assetName:u}}(await e,t,s);return(0,n.k_)(s),a})));(0,n.k_)(s);const{uploadResults:p}=await async function(e,t,s){const o=await(0,a.default)((0,i.v_)(t.parsedUrl.path,"uploadAssets"),{timeout:0,query:{f:"json",assets:JSON.stringify(e)},method:"post",responseType:"json"});if((0,n.k_)(s),o.data.uploadResults.length!==e.length)throw new r.Z(`${t.type}-layer:uploadAssets-failure`,`Bad response. Uploaded ${e.length} items and received ${o.data.uploadResults.length} results.`,new Error);return o.data}(l.map((({item:e})=>e)),t,s);return(0,n.k_)(s),e.map(((e,s)=>function(e,t,s){const{success:a}=t;if(!a){const{error:a}=t;throw new r.Z(`${s.type}-layer:upload-failure`,`Failed to upload mesh file ${e.assetName}. Error code: ${a.code}. Error message: ${a.messages}`,new Error)}const{assetHash:o}=t,{assetName:n,item:{assetType:i}}=e,{infoFor3D:{supportedFormats:l}}=s,p=(0,w.d1)(i,l);if(!p)throw new r.Z(`${s.type}-layer:upload-failure`,`The service allowed us to upload an asset of FormatID ${i}, but it does not list it in its supported formats.`,new Error);return new u.CP(n,p,[new u.LL(`${s.parsedUrl.path}/assets/${o}`,o)])}(l[s],p[s],t)))}async function $(e,t,s){const o=e.map((({assetName:e,parts:t})=>({assetName:e,assetHash:t[0].partHash}))),n=(await(0,a.default)((0,i.v_)(t.parsedUrl.path,"convert3D"),{query:{f:"json",assets:JSON.stringify(o),transportType:"esriTransportTypeUrl",targetFormat:s},responseType:"json",timeout:0})).data,{infoFor3D:{supportedFormats:l}}=t;return n.assets.map((e=>{const s=(0,w.S0)(e.contentType,l);if(!s)throw new r.Z(`${t.type}-layer:upload-failure`,`The service allowed us to upload an asset of FormatID ${s}, but it does not list it in its supported formats.`,new Error);return new u.CP(e.assetName,e.contentType,[new u.LL(e.assetURL,e.assetHash)])}))}function v(e){const{infoFor3D:t}=e,s=(0,w.S0)("model/gltf-binary",t.supportedFormats)??(0,w.Ow)("glb",t.supportedFormats);if(!s)throw new r.Z(`${e.type}-layer:upload-failure`,"Layer does not support glb.",new Error);return s}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5235],{15235:(e,t,i)=>{i.r(t),i.d(t,{default:()=>O});var r=i(43697),o=i(99880),a=i(40330),s=i(20102),n=i(96674),l=i(22974),p=i(83379),c=i(70586),d=i(81271),u=i(5600),h=i(75215),m=i(71715),g=i(52011),y=i(6570),b=i(48522),v=i(92036),w=i(92604),f=i(90578);i(67676),i(80442);let k=class extends v.Z{constructor(e){super(e),this.portalItem=null}normalizeCtorArgs(e){return e&&e.portalItem&&e.path?{...e,path:this._normalizePath(e.path,e.portalItem)}:e}set path(e){null!=e&&(0,d.YP)(e)?w.Z.getLogger(this).error("portalitemresource:invalid-path","A portal item resource path must be relative"):this._set("path",e)}_castPath(e){return this._normalizePath(e,this.portalItem)}get url(){return this.portalItem&&this.path?`${this.portalItem.itemUrl}/resources/${this.path}`:null}get cdnUrl(){return this.portalItem&&this.path?`${this.portalItem.itemCdnUrl}/resources/${this.path}`:null}get itemRelativeUrl(){return this.portalItem&&this.path?`./resources/${this.path}`:null}fetch(e="json",t){const i=this.cdnUrl;if(null==i)throw new s.Z("portal-item-resource:fetch","Portal item resource does not refer to a valid item or path");return this.portalItem.portal.request(i,{responseType:e,query:{token:this.portalItem.apiKey},signal:t?.signal})}async update(e,t){const{addOrUpdateResource:r}=await i.e(7873).then(i.bind(i,97873));return r(this,"update",e,t)}hasPath(){return null!=this.path}_normalizePath(e,t){return null==e?e:(e=e.replace(/^\/+/,""),null!=t&&(0,d.YP)(e)&&(e=(0,d.PF)(e,t.itemUrl)),e?.replace(/^\/+/,"").replace(/^(\.\/)?resources\//,""))}};(0,r._)([(0,u.Cb)()],k.prototype,"portalItem",void 0),(0,r._)([(0,u.Cb)({type:String,value:null})],k.prototype,"path",null),(0,r._)([(0,f.p)("path")],k.prototype,"_castPath",null),(0,r._)([(0,u.Cb)({type:String,readOnly:!0})],k.prototype,"url",null),(0,r._)([(0,u.Cb)({type:String,readOnly:!0})],k.prototype,"cdnUrl",null),(0,r._)([(0,u.Cb)({type:String,readOnly:!0})],k.prototype,"itemRelativeUrl",null),k=(0,r._)([(0,g.j)("esri.portal.PortalItemResource")],k);const C=k;let S=class extends v.Z{constructor(e){super(e),this.created=null,this.rating=null}};(0,r._)([(0,u.Cb)()],S.prototype,"created",void 0),(0,r._)([(0,u.Cb)()],S.prototype,"rating",void 0),S=(0,r._)([(0,g.j)("esri.portal.PortalRating")],S);const _=S;var I;const x=new Set(["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","GeoJson","CSV","KML","WFS","WMTS","WMS","Feed"]),U=new Set(["KML","GeoJson","CSV"]);let R=I=class extends((0,n.eC)(p.Z)){static from(e){return(0,h.TJ)(I,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geocoding Service"===e?i="Locator":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e&&e.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e&&(i="Insights Report"),i}readExtent(e){return e&&e.length?new y.Z(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type&&this.type.toLowerCase()||"",t=this.typeKeywords||[];let i,r=!1,a=!1,s=!1,n=!1,l=!1,p=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(r=t.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(a=t.includes("Table"),s=t.includes("Route Layer"),n=t.includes("Markup"),l=t.includes("Spatiotemporal"),p=t.includes("UtilityNetwork"),i=l&&a?"spatiotemporaltable":a?"table":s?"routelayer":n?"markup":l?"spatiotemporal":r?"featureshosted":p?"utilitynetwork":"features"):i="map service"===e||"wms"===e||"wmts"===e?r||t.includes("Tiled")||"wmts"===e?"maptiles":"mapimages":"scene service"===e?t.includes("Line")?"sceneweblayerline":t.includes("3DObject")?"sceneweblayermultipatch":t.includes("Point")?"sceneweblayerpoint":t.includes("IntegratedMesh")?"sceneweblayermesh":t.includes("PointCloud")?"sceneweblayerpointcloud":t.includes("Polygon")?"sceneweblayerpolygon":t.includes("Building")?"sceneweblayerbuilding":t.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?t.includes("Elevation 3D Layer")?"elevationlayer":t.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"video service"===e?t.includes("Live Stream")?"livestreamvideolayer":"videolayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"geoprocessing service"===e?t.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"layers"):i="web map"===e||"cityengine web scene"===e?"maps":"web scene"===e?t.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&t.includes("configurableApp")?"instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?"apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&t.includes("ArcGIS Pro")||"explorer map"===e&&t.indexOf("Explorer Document")?"mapsgray":"service definition"===e||"csv"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?"datafiles":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?"appsgray":"360 vr experience"===e?"360vr":"arcgis pro add in"===e||"arcgis pro configuration"===e?"addindesktop":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"form"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"image"===e||"workflow manager package"===e||"explorer map"===e&&t.includes("Explorer Mapping Application")||t.includes("Document")?"datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?"toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?"layersgray":"scene package"===e?"scenepackage":"mobile scene package"===e?"mobilescenepackage":"tile package"===e||"compact tile package"===e?"tilepackage":"task file"===e?"taskfile":"report template"===e?"report-template":"statistical data collection"===e?"statisticaldatacollection":"insights workbook"===e?"workbook":"insights model"===e?"insightsmodel":"insights page"===e?"insightspage":"insights theme"===e?"insightstheme":"hub initiative"===e?"hubinitiative":"hubpage"===e?"hubpage":"hub event"===e?"hubevent":"hub site application"===e?"hubsite":"hub project"===e?"hubproject":"relational database connection"===e?"relationaldatabaseconnection":"big data file share"===e?"datastorecollection":"image collection"===e?"imagecollection":"style"===e?"style":"desktop style"===e?"desktopstyle":"dashboard"===e?"dashboard":"raster function template"===e?"rasterprocessingtemplate":"vector tile package"===e?"vectortilepackage":"ortho mapping project"===e?"orthomappingproject":"ortho mapping template"===e?"orthomappingtemplate":"solution"===e?"solutions":"geopackage"===e?"geopackage":"deep learning package"===e?"deeplearningpackage":"real time analytic"===e?"realtimeanalytics":"big data analytic"===e?"bigdataanalytics":"feed"===e?"feed":"excalibur imagery project"===e?"excaliburimageryproject":"notebook"===e?"notebook":"storymap"===e?"storymap":"survey123 add in"===e?"survey123addin":"mission"===e?"mission":"mission report"===e?"missionreport":"quickcapture project"===e?"quickcaptureproject":"pro report"===e?"proreport":"pro report template"===e?"proreporttemplate":"urban model"===e?"urbanmodel":"web experience"===e?"experiencebuilder":"web experience template"===e?"webexperiencetemplate":"experience builder widget"===e?"experiencebuilderwidget":"experience builder widget package"===e?"experiencebuilderwidgetpackage":"workflow"===e?"workflow":"insights script"===e?"insightsscript":"kernel gateway connection"===e?"kernelgatewayconnection":"hub initiative template"===e?"hubinitiativetemplate":"storymap theme"===e?"storymaptheme":"knowledge graph"===e?"knowledgegraph":"native application"===e?"nativeapp":"native application installer"===e?"nativeappinstaller":"link chart"===e?"linkchart":"investigation"===e?"investigation":"ogcfeatureserver"===e?"features":"pro project"===e?"proproject":"insights workbook package"===e?"insightsworkbookpackage":"apache parquet"===e?"apacheparquet":"notebook code snippets"===e||"notebook code snippet library"===e?"notebookcodesnippets":"suitability model"===e?"suitabilitymodel":"esri classifier definition"===e?"classifierdefinition":"esri classification schema"===e?"classificationschema":"insights data engineering workbook"===e?"dataengineeringworkbook":"insights data engineering model"===e?"dataengineeringmodel":"deep learning studio project"===e?"deeplearningproject":"discussion"===e?"discussion":"allsource project"===e?"allsourceproject":"api key"===e?"apikey":"data pipeline"===e?"datapipelines":"maps",i?(0,o.V)("esri/images/portal/"+i+"16.png"):null}get isLayer(){return null!=this.type&&x.has(this.type)}get itemCdnUrl(){let e=this.itemUrl;return e&&a.id&&!a.id.findCredential(e)&&(e=a.id._normalizeAGOLorgDomain(e),e=e.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),e=e.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),e=e.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),e}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.get("portal.restUrl");if(!e)return null;const t=this.owner||this.get("portal.user.username");return t?`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`:null}load(e){const t=this.portal??(this.portal=b.Z.getDefault()),i=t.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}};return e instanceof _&&(e=e.rating),null==e||isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new _({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:(0,l.d9)(this.applicationProxies),avgRating:this.avgRating,categories:(0,l.d9)(this.categories),created:(0,l.d9)(this.created),culture:this.culture,description:this.description,extent:(0,l.d9)(this.extent),groupCategories:(0,l.d9)(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:(0,l.d9)(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:(0,l.d9)(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:(0,l.d9)(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:(0,l.d9)(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new I({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const t of["tags","typeKeywords","categories"])e[t]=e[t]?.join(", ");const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}async deleteRating(){await(0,c.s3)(this.portal).request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return(0,c.s3)(this.portal).request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await(0,c.s3)(this.portal).request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new _(t)):null}fetchRelatedItems(e,t){return(0,c.s3)(this.portal).requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},I)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return(0,c.s3)(this.portal).request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>(0,c.s3)(this.portal).signIn())).then((()=>{const t=e&&e.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new s.Z("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new s.Z("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:i}=this;await(0,c.s3)(t).signIn();const{copyResources:r,folder:o,tags:a,title:n}=e||{},l={method:"post",query:{copyPrivateResources:"all"===r,folder:"string"==typeof o?o:o?.id,includeResources:!!r,tags:a?.join(","),title:n}},{itemId:p}=await t.request(`${i}/copy`,l);return new I({id:p,portal:t})}updateThumbnail(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)(0,d.HK)(t)?r.query={data:t}:r.query={url:(0,d.hF)(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then((()=>this.reload()))})):Promise.reject(new s.Z("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:r}=await i.e(7873).then(i.bind(i,97873));return r(this,e,t)}async addResource(e,t,r){const{addOrUpdateResource:o}=await i.e(7873).then(i.bind(i,97873));return e.portalItem=this,o(e,"add",t,r)}async removeResource(e,t){const{removeResource:r}=await i.e(7873).then(i.bind(i,97873));if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new s.Z("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return r(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await i.e(7873).then(i.bind(i,97873));return t(this,e)}resourceFromPath(e){return new C({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:(0,l.d9)(this.categories),created:this.created&&this.created.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified&&this.modified.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:(0,l.d9)(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:(0,l.d9)(this.typeKeywords),url:this.url};return(0,l.yd)(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new I({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};(0,r._)([(0,u.Cb)({type:["private","shared","org","public"]})],R.prototype,"access",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"accessInformation",void 0),(0,r._)([(0,u.Cb)({type:String})],R.prototype,"apiKey",void 0),(0,r._)([(0,u.Cb)({json:{read:{source:"appProxies"}}})],R.prototype,"applicationProxies",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"avgRating",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"categories",void 0),(0,r._)([(0,u.Cb)({type:Date})],R.prototype,"created",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"culture",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"description",void 0),(0,r._)([(0,u.Cb)({readOnly:!0})],R.prototype,"displayName",null),(0,r._)([(0,u.Cb)({type:y.Z})],R.prototype,"extent",void 0),(0,r._)([(0,m.r)("extent")],R.prototype,"readExtent",null),(0,r._)([(0,u.Cb)()],R.prototype,"groupCategories",void 0),(0,r._)([(0,u.Cb)({readOnly:!0})],R.prototype,"iconUrl",null),(0,r._)([(0,u.Cb)()],R.prototype,"id",void 0),(0,r._)([(0,u.Cb)({readOnly:!0})],R.prototype,"isLayer",null),(0,r._)([(0,u.Cb)({type:Boolean,readOnly:!0})],R.prototype,"isOrgItem",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"itemControl",void 0),(0,r._)([(0,u.Cb)({readOnly:!0})],R.prototype,"itemPageUrl",null),(0,r._)([(0,u.Cb)({readOnly:!0})],R.prototype,"itemUrl",null),(0,r._)([(0,u.Cb)()],R.prototype,"licenseInfo",void 0),(0,r._)([(0,u.Cb)({type:Date})],R.prototype,"modified",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"name",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"numComments",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"numRatings",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"numViews",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"owner",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"ownerFolder",void 0),(0,r._)([(0,u.Cb)({type:b.Z})],R.prototype,"portal",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"screenshots",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"size",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"snippet",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"sourceJSON",void 0),(0,r._)([(0,u.Cb)({type:String})],R.prototype,"sourceUrl",void 0),(0,r._)([(0,u.Cb)({type:String})],R.prototype,"spatialReference",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"tags",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"thumbnail",void 0),(0,r._)([(0,u.Cb)({readOnly:!0})],R.prototype,"thumbnailUrl",null),(0,r._)([(0,u.Cb)()],R.prototype,"title",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"type",void 0),(0,r._)([(0,u.Cb)()],R.prototype,"typeKeywords",void 0),(0,r._)([(0,u.Cb)({type:String,json:{read(e,t){if(U.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],R.prototype,"url",void 0),(0,r._)([(0,u.Cb)({readOnly:!0})],R.prototype,"userItemUrl",null),R=I=(0,r._)([(0,g.j)("esri.portal.PortalItem")],R);const O=R}}]);