@arcgis/core 4.32.0-next.20250107 → 4.32.0-next.20250108

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 (99) hide show
  1. package/WebLinkChart.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{07304287ed5244fa4e12.js → 12b2c8251ec2d0e2ca46.js} +1 -1
  4. package/assets/esri/core/workers/chunks/24a597ae32a2083a50a5.js +1 -0
  5. package/assets/esri/core/workers/chunks/510cb8647841fec436c8.js +1 -0
  6. package/assets/esri/core/workers/chunks/{f6d6bc43ac1c13892d44.js → 58485909e1cfeb52c01e.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{c49707b577f3805f0142.js → 5b61a1e7ac60a02a906d.js} +1 -1
  8. package/assets/esri/core/workers/chunks/76a7114a69264f5c07b0.js +2 -0
  9. package/assets/esri/core/workers/chunks/{ca1e186f136abb23ae4b.js → 7d0fc25ce1f74adcfeb6.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{dca0eb66116e4b5403fc.js → 7df076d15b7b7a66dcee.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{955421ee2247965244f0.js → 7fe92f072d3641ec4662.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{4423aac6e44c3dbf184e.js → 89286d8f59844724cd16.js} +1 -1
  13. package/assets/esri/core/workers/chunks/a8ec4189ec3b37d5ff74.js +1 -0
  14. package/assets/esri/core/workers/chunks/cd92b80de7e9f982f9a9.js +1 -0
  15. package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
  16. package/chunks/LineSeries.js +1 -1
  17. package/chunks/OperatorProject.js +1 -1
  18. package/chunks/Pattern.glsl.js +1 -1
  19. package/chunks/QuadraticBezier.js +1 -1
  20. package/chunks/Transformation2D.js +1 -1
  21. package/chunks/chartUtilsAm5.js +1 -1
  22. package/chunks/lyr3DWorker.js +1 -1
  23. package/chunks/vxlLayer.js +1 -1
  24. package/geometry/support/meshUtils/primitives.js +1 -1
  25. package/geometry/support/triangle.js +1 -1
  26. package/interfaces.d.ts +175 -91
  27. package/layers/LinkChartLayer.js +1 -1
  28. package/layers/MapNotesLayer.js +1 -1
  29. package/layers/MediaLayer.js +1 -1
  30. package/layers/support/ImageElement.js +1 -1
  31. package/layers/support/VideoElement.js +1 -1
  32. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  33. package/layers/video/VideoController.js +1 -1
  34. package/linkChart/OrganicLayoutSettings.js +1 -1
  35. package/package.json +3 -3
  36. package/smartMapping/renderers/color.js +1 -1
  37. package/smartMapping/renderers/size.js +1 -1
  38. package/smartMapping/renderers/univariateColorSize.js +1 -1
  39. package/support/mediaLayerUtils.js +5 -0
  40. package/support/revision.js +1 -1
  41. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  42. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  43. package/views/2d/AnimationManager.js +1 -1
  44. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  45. package/views/2d/engine/webgl/Overlay.js +1 -1
  46. package/views/2d/engine/webgl/SDFConverter.js +1 -1
  47. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  48. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  49. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  50. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  51. package/views/2d/navigation/MapViewNavigation.js +1 -1
  52. package/views/2d/support/HighlightGroup.js +1 -1
  53. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  54. package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
  55. package/views/3d/analysis/support/measurementUtils.js +1 -1
  56. package/views/3d/environment/CloudsParameters.js +1 -1
  57. package/views/3d/environment/MarsAtmosphere.js +1 -1
  58. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  59. package/views/3d/layers/MediaLayerView3D.js +1 -1
  60. package/views/3d/layers/graphics/placementUtils.js +1 -1
  61. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  62. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  63. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  64. package/views/3d/support/HighlightGroup.js +1 -1
  65. package/views/3d/terrain/SphericalPatch.js +1 -1
  66. package/views/3d/terrain/TilePerLayerInfo.js +1 -1
  67. package/views/3d/terrain/TileRenderer.js +1 -1
  68. package/views/3d/terrain/TileTexture.js +1 -1
  69. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  70. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  71. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  72. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  73. package/views/SceneView.js +1 -1
  74. package/views/View.js +1 -1
  75. package/views/input/BrowserEventSource.js +1 -1
  76. package/views/layers/MediaLayerView.js +1 -1
  77. package/views/support/HighlightGroup.d.ts +4 -0
  78. package/views/support/HighlightGroup.js +5 -0
  79. package/views/webgl/Texture.js +1 -1
  80. package/views/webgl/textureUtils.js +1 -1
  81. package/webscene/Slide.js +1 -1
  82. package/widgets/BasemapLayerList.js +1 -1
  83. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  84. package/widgets/CatalogLayerList.js +1 -1
  85. package/widgets/FeatureTable/support/exportUtils.js +1 -1
  86. package/widgets/LayerList/support/layerListUtils.js +1 -1
  87. package/widgets/LayerList.js +1 -1
  88. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  89. package/widgets/PanoramicViewer/utils.js +1 -1
  90. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  91. package/widgets/Sketch/SketchViewModel.js +1 -1
  92. package/widgets/TableList.js +1 -1
  93. package/assets/esri/core/workers/chunks/127c82cdb229434883b6.js +0 -1
  94. package/assets/esri/core/workers/chunks/66b411119b8ffb99b9dc.js +0 -1
  95. package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +0 -1
  96. package/assets/esri/core/workers/chunks/b07710e01494a6cda097.js +0 -1
  97. package/assets/esri/core/workers/chunks/c05e0bd145a1c27d6857.js +0 -2
  98. package/views/2d/support/HighlightGroup.d.ts +0 -4
  99. /package/assets/esri/core/workers/chunks/{c05e0bd145a1c27d6857.js.LICENSE.txt → 76a7114a69264f5c07b0.js.LICENSE.txt} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import i from"../core/Identifiable.js";import s from"../core/ReactiveMap.js";import{on as o,watch as l,initial as r,syncAndInitial as n}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import c from"./Widget.js";import p from"./BasemapLayerList/BasemapLayerListViewModel.js";import m from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as h}from"./BasemapLayerList/css.js";import u from"./LayerList/LayerListItem.js";import g from"./LayerList/ListItem.js";import{minFilterItems as y,getItem as f,getLayerType as _,sortLayersToIds as b,sortChildLayersToIds as L,removeDestroyedListItems as I}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as v}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import{incrementHeadingLevel as F}from"./support/Heading.js";import{calciteListFilterProps as E}from"./support/listUtils.js";import{setFocus as C}from"./support/widgetUtils.js";import{messageBundle as T}from"./support/decorators/messageBundle.js";import{vmEvent as M}from"./support/decorators/vmEvent.js";import{tsx as O}from"./support/jsxFactory.js";const A=t.ofType(g),R="nested",B=".*\\S+.*",P="data-basemap-layer-type";let k=class extends(i.IdentifiableMixin(c)){constructor(e,i){super(e,i),this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._focusEditingFlowItem=!1,this._layerListMap=new s,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterText="",this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=y,this.openedLayers=new t,this.openedLayerLists=new t,this.tableList=null,this.selectedItems=new A,this.selectionMode="none",this.tileOptions=null,this.viewModel=new p,this.visibilityAppearance="default",this.visibleElements=new m,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=f(e);if(!l?.sortable)return!1;const r=f(t),n=_(t),a=f(i),d=_(i),c=!!n&&!!d&&n===d,p={selected:l,from:r,to:a},m=t.group,h=i.group,u=r?.layer?.type??"",g=a?.layer?.type??"",y=new Set(["map-image","catalog","knowledge-graph"]),b="sublayer";return m&&h&&"function"==typeof o?o.call(null,p):c&&!y.has(u)&&!y.has(g)&&l?.layer?.type!==b},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(h.item)));this._activeItem=f(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=o.value;const r=s,n=i;if(r!==n)this._moveLayerFromChildList({toEl:n,fromEl:r,dragEl:o,newIndex:l});else{const e=Array.from(s.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(r,e)}}}initialize(){this.addHandles([o((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),r),l((()=>[this.viewModel.referenceItems.toArray(),this.viewModel.baseItems.toArray()]),(()=>I(this.selectedItems)),n)])}loadDependencies(){return v({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._tooltipReferenceMap.clear(),this._destroyOpenedLayerLists()}get _visibleBaseItems(){return this.baseItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _visibleReferenceItems(){return this.referenceItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleReferenceItems.concat(this._visibleBaseItems).flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get _totalBaseItems(){return this.viewModel.baseItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer?.type)))).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer?.type)))).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map(((t,i)=>this._renderLayerFlowItem(t,i===e.length-1)))}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[w.hidden]:"loading"===e,[w.disabled]:"disabled"===e};return O("div",{class:this.classes(h.base,w.widget,w.panel,t)},this._renderItems())}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:s,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:n,visibilityAppearance:a,_onCatalogOpen:d,_onTablesOpen:c,layerTablesEnabled:p}=this;return new t({headingLevel:i,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:n,visibilityAppearance:a,...s,catalogLayer:e,layerTablesEnabled:p,onCatalogOpen:d,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:s,dragEnabled:o}=this;return new t({headingLevel:i,selectionMode:s,dragEnabled:o,...this._getTableListParams(e)})}async _createFlowList(e,t){const{_layerListMap:i}=this,s=i.get(e);if(s)return s;const o="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,o),o}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const s=new AbortController,{signal:o}=s;this._openedLayersController=s,e.forEach(((i,s)=>{t.includes(s)||(i.destroy(),e.delete(s))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,o))));if(o.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){return e?O("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,referenceElement:this._tooltipReferenceMap.get(e.layer?.uid)},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(){return this._visibleReferenceItems.concat(this._visibleBaseItems)?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,C(e))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map((({title:i,panel:s},o)=>{const l=()=>this._handlePanelFlowItemBack(s);return O("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:s.title,headingLevel:this.headingLevel,key:`flow-panel-${s.uid}`,selected:!t.length&&o===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},s.render(),O("calcite-button",{appearance:"transparent",onclick:l,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,C(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,C(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,C(e))}_renderItem(e,t,i,s){return O(u,{activeItem:this._activeItem,canMove:this._canMove,css:h,displayMode:R,dragEnabled:!t&&this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=f(i),l=f(e),r=f(t),n=j(t),a=j(e);n&&a&&this.viewModel.moveListItem({targetItem:o,fromParentItem:r,toParentItem:l,newIndex:s,from:n,to:a})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid){const i=j(e),s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;b(s,t)}else{const i=f(e);if(!i)return;L(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>f(e))).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return O("div",{class:h.editing},O("calcite-label",null,e.basemapTitle,O("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:B,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return O("calcite-button",{appearance:"outline",bind:this,label:e,onclick:this._toggleEditingTitle,slot:"footer",title:e,width:"full"},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return O("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"full"},e.form.ok)}_renderEditingForm(){return this.editingTitle?O("form",{bind:this,class:h.editingForm,onsubmit:this._formSubmit},O("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,selected:0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?O("calcite-action",{bind:this,icon:"pencil",onclick:this._toggleEditingTitle,slot:"header-actions-end",text:s,title:s}):null}_renderNoLayersInfoMessage(e){return O("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return O("div",{class:h.itemMessage},O("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},messages:r,viewModel:n}=this,a=[O("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?n.basemapTitle??r.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!this.editingTitle&&0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(),this._renderBaseSection()),this._renderEditingForm(),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return t?[l?O("calcite-flow",{key:"root-flow"},a):a,this._renderItemTooltips()]:null}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:s}=this,o=e.title||this.messages.untitledLayer;return O("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:o,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),s.pop();const t=s.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:l,filterPlaceholder:r,baseFilterText:n,referenceFilterText:a,_baseFilterEnabled:d,_referenceFilterEnabled:c,_rootGroupUid:p}=this,m="reference"===t?s.noReferenceLayers:s.noBaseLayers,u="reference"===t?c:d;return O("calcite-block",{class:h.section,collapsible:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:F(this.headingLevel),key:`block-${t}`,open:!0},0===e?.length?this._renderNoLayersInfo(m,t):null,O("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),displayMode:R,filterProps:E,[P]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:u,filterPlaceholder:r,filterText:u?"reference"===t?a:n:"",group:p,key:`list-${t}`,label:s.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:l,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e,i))),e?.length&&u?O("div",{class:h.filterNoResults,slot:"filter-no-results"},O("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(m))):null))}_renderBaseSection(){const{_visibleBaseItems:e}=this;return this.visibleElements.baseLayers?this._renderList(e,"base",1===e?.length):null}_renderReferenceSection(){return this.visibleElements.referenceLayers?this._renderList(this._visibleReferenceItems,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function j(e){return e?.closest(`[${P}]`)?.getAttribute(P)}e([a()],k.prototype,"_activeItem",void 0),e([a()],k.prototype,"_tooltipReferenceMap",void 0),e([a()],k.prototype,"_focusRootFlowItem",void 0),e([a()],k.prototype,"_focusPanelFlowItem",void 0),e([a()],k.prototype,"_focusLayerFlowItem",void 0),e([a()],k.prototype,"_focusEditingFlowItem",void 0),e([a()],k.prototype,"_layerListMap",void 0),e([a()],k.prototype,"_visibleBaseItems",null),e([a()],k.prototype,"_visibleReferenceItems",null),e([a()],k.prototype,"_openedPanelItems",null),e([a()],k.prototype,"_totalBaseItems",null),e([a()],k.prototype,"_totalReferenceItems",null),e([a()],k.prototype,"_baseFilterEnabled",null),e([a()],k.prototype,"_referenceFilterEnabled",null),e([a()],k.prototype,"_renderedOpenLayerFlowItems",null),e([a()],k.prototype,"basemapTitle",null),e([a({readOnly:!0})],k.prototype,"catalogLayerList",void 0),e([a()],k.prototype,"catalogOptions",void 0),e([a()],k.prototype,"collapsed",void 0),e([a()],k.prototype,"dragEnabled",void 0),e([a()],k.prototype,"editingTitle",void 0),e([a()],k.prototype,"filterPlaceholder",void 0),e([a()],k.prototype,"baseFilterText",void 0),e([a()],k.prototype,"referenceFilterText",void 0),e([a()],k.prototype,"listItemCanGiveFunction",void 0),e([a()],k.prototype,"listItemCanReceiveFunction",void 0),e([a()],k.prototype,"baseListItemCreatedFunction",null),e([a()],k.prototype,"headingLevel",void 0),e([a()],k.prototype,"icon",null),e([a()],k.prototype,"knowledgeGraphOptions",void 0),e([a()],k.prototype,"label",null),e([a()],k.prototype,"layerTablesEnabled",void 0),e([a()],k.prototype,"mapImageOptions",void 0),e([a(),T("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],k.prototype,"messages",void 0),e([a(),T("esri/t9n/common")],k.prototype,"messagesCommon",void 0),e([a()],k.prototype,"minFilterItems",void 0),e([a({readOnly:!0})],k.prototype,"openedLayers",void 0),e([a({readOnly:!0})],k.prototype,"openedLayerLists",void 0),e([a()],k.prototype,"referenceListItemCreatedFunction",null),e([a({readOnly:!0})],k.prototype,"tableList",void 0),e([a({readOnly:!0})],k.prototype,"baseItems",null),e([a({readOnly:!0})],k.prototype,"referenceItems",null),e([a()],k.prototype,"selectedItems",void 0),e([a()],k.prototype,"selectionMode",void 0),e([a()],k.prototype,"tileOptions",void 0),e([a()],k.prototype,"view",null),e([M("trigger-action"),a({type:p})],k.prototype,"viewModel",void 0),e([a()],k.prototype,"visibilityAppearance",void 0),e([a({type:m,nonNullable:!0})],k.prototype,"visibleElements",void 0),k=e([d("esri.widgets.BasemapLayerList")],k);const D=k;export{D as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import i from"../core/Identifiable.js";import s from"../core/ReactiveMap.js";import{on as o,watch as r,initial as l,syncAndInitial as n}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import p from"./BasemapLayerList/BasemapLayerListViewModel.js";import m from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as h}from"./BasemapLayerList/css.js";import u from"./LayerList/LayerListItem.js";import f from"./LayerList/ListItem.js";import{minFilterItems as g,getItem as y,getLayerType as _,sortLayersToIds as b,sortChildLayersToIds as L,removeDestroyedListItems as v,setFilterPredicate as I}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as w}from"./support/componentsUtils.js";import{globalCss as F}from"./support/globalCss.js";import{incrementHeadingLevel as E}from"./support/Heading.js";import{calciteListFilterProps as C}from"./support/listUtils.js";import{setFocus as T}from"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as P}from"./support/decorators/vmEvent.js";import{tsx as O}from"./support/jsxFactory.js";const A=t.ofType(f),R="nested",B=".*\\S+.*",k="data-basemap-layer-type";let j=class extends(i.IdentifiableMixin(d)){constructor(e,i){super(e,i),this._baseListEl=null,this._referenceListEl=null,this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._focusEditingFlowItem=!1,this._layerListMap=new s,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterPredicate=null,this.baseFilterText="",this.referenceFilterPredicate=null,this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=g,this.openedLayers=new t,this.openedLayerLists=new t,this.tableList=null,this.selectedItems=new A,this.selectionMode="none",this.tileOptions=null,this.viewModel=new p,this.visibilityAppearance="default",this.visibleElements=new m,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,r=y(e);if(!r?.sortable)return!1;const l=y(t),n=_(t),a=y(i),c=_(i),d=!!n&&!!c&&n===c,p={selected:r,from:l,to:a},m=t.group,h=i.group,u=l?.layer?.type??"",f=a?.layer?.type??"",g=new Set(["map-image","catalog","knowledge-graph"]),b="sublayer";return m&&h&&"function"==typeof o?o.call(null,p):d&&!g.has(u)&&!g.has(f)&&r?.layer?.type!==b},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(h.item)));this._activeItem=y(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:r}=e;if(!s||!i||t?.newIndex===r&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=o.value;const l=s,n=i;if(l!==n)this._moveLayerFromChildList({toEl:n,fromEl:l,dragEl:o,newIndex:r});else{const e=Array.from(s.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(l,e)}}}initialize(){this.addHandles([o((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),l),r((()=>[this.viewModel.referenceItems.toArray(),this.viewModel.baseItems.toArray()]),(()=>v(this.selectedItems)),n),r((()=>[this.baseFilterPredicate,this._baseListEl]),(()=>I(this._baseListEl,this.baseFilterPredicate))),r((()=>[this.referenceFilterPredicate,this._referenceListEl]),(()=>I(this._referenceListEl,this.referenceFilterPredicate)))])}loadDependencies(){return w({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._tooltipReferenceMap.clear(),this._destroyOpenedLayerLists()}get _visibleBaseItems(){return this.baseItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _visibleReferenceItems(){return this.referenceItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleReferenceItems.concat(this._visibleBaseItems).flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get _totalBaseItems(){return this.viewModel.baseItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer?.type)))).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer?.type)))).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map(((t,i)=>this._renderLayerFlowItem(t,i===e.length-1)))}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[F.hidden]:"loading"===e,[F.disabled]:"disabled"===e};return O("div",{class:this.classes(h.base,F.widget,F.panel,t)},this._renderItems())}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:s,view:o,filterPlaceholder:r,minFilterItems:l,selectionMode:n,visibilityAppearance:a,_onCatalogOpen:c,_onTablesOpen:d,layerTablesEnabled:p}=this;return new t({headingLevel:i,view:o,filterPlaceholder:r,minFilterItems:l,selectionMode:n,visibilityAppearance:a,...s,catalogLayer:e,layerTablesEnabled:p,onCatalogOpen:c,onTablesOpen:d})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:s,dragEnabled:o}=this;return new t({headingLevel:i,selectionMode:s,dragEnabled:o,...this._getTableListParams(e)})}async _createFlowList(e,t){const{_layerListMap:i}=this,s=i.get(e);if(s)return s;const o="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,o),o}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const s=new AbortController,{signal:o}=s;this._openedLayersController=s,e.forEach(((i,s)=>{t.includes(s)||(i.destroy(),e.delete(s))}));const r=await Promise.all(t.map((e=>this._createFlowList(e,o))));if(o.aborted)return;i.removeAll(),i.addMany(r);const l=i.at(-1);l?"catalogLayer"in l?(this._set("catalogLayerList",l),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",l)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){return e?O("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,referenceElement:this._tooltipReferenceMap.get(e.layer?.uid)},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(){return this._visibleReferenceItems.concat(this._visibleBaseItems)?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,T(e))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map((({title:i,panel:s},o)=>{const r=()=>this._handlePanelFlowItemBack(s);return O("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:s.title,headingLevel:this.headingLevel,key:`flow-panel-${s.uid}`,selected:!t.length&&o===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),r()}},s.render(),O("calcite-button",{appearance:"transparent",onclick:r,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,T(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,T(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,T(e))}_renderItem(e,t,i,s){return O(u,{activeItem:this._activeItem,canMove:this._canMove,css:h,displayMode:R,dragEnabled:!t&&this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=y(i),r=y(e),l=y(t),n=D(t),a=D(e);n&&a&&this.viewModel.moveListItem({targetItem:o,fromParentItem:l,toParentItem:r,newIndex:s,from:n,to:a})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid){const i=D(e),s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;b(s,t)}else{const i=y(e);if(!i)return;L(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>y(e))).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return O("div",{class:h.editing},O("calcite-label",null,e.basemapTitle,O("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:B,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return O("calcite-button",{appearance:"outline",bind:this,label:e,onclick:this._toggleEditingTitle,slot:"footer",title:e,width:"full"},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return O("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"full"},e.form.ok)}_renderEditingForm(){return this.editingTitle?O("form",{bind:this,class:h.editingForm,onsubmit:this._formSubmit},O("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,selected:0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?O("calcite-action",{bind:this,icon:"pencil",onclick:this._toggleEditingTitle,slot:"header-actions-end",text:s,title:s}):null}_renderNoLayersInfoMessage(e){return O("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return O("div",{class:h.itemMessage},O("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:r},messages:l,viewModel:n}=this,a=[O("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?n.basemapTitle??l.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!this.editingTitle&&0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(),this._renderBaseSection()),this._renderEditingForm(),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return t?[r?O("calcite-flow",{key:"root-flow"},a):a,this._renderItemTooltips()]:null}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:s}=this,o=e.title||this.messages.untitledLayer;return O("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:o,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),s.pop();const t=s.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:r,filterPlaceholder:l,baseFilterText:n,referenceFilterText:a,_baseFilterEnabled:c,_referenceFilterEnabled:d,_rootGroupUid:p}=this,m="reference"===t?s.noReferenceLayers:s.noBaseLayers,u="reference"===t?d:c;return O("calcite-block",{class:h.section,collapsible:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:E(this.headingLevel),key:`block-${t}`,open:!0},0===e?.length?this._renderNoLayersInfo(m,t):null,O("calcite-list",{afterCreate:e=>{"reference"===t?this._referenceListEl=e:this._baseListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{"reference"===t?this._referenceListEl=null:this._baseListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),displayMode:R,filterProps:C,[k]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:u,filterPlaceholder:l,filterText:u?"reference"===t?a:n:"",group:p,key:`list-${t}`,label:s.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:r,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e,i))),e?.length&&u?O("div",{class:h.filterNoResults,slot:"filter-no-results"},O("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(m))):null))}_renderBaseSection(){const{_visibleBaseItems:e}=this;return this.visibleElements.baseLayers?this._renderList(e,"base",1===e?.length):null}_renderReferenceSection(){return this.visibleElements.referenceLayers?this._renderList(this._visibleReferenceItems,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function D(e){return e?.closest(`[${k}]`)?.getAttribute(k)}e([a()],j.prototype,"_baseListEl",void 0),e([a()],j.prototype,"_referenceListEl",void 0),e([a()],j.prototype,"_activeItem",void 0),e([a()],j.prototype,"_tooltipReferenceMap",void 0),e([a()],j.prototype,"_focusRootFlowItem",void 0),e([a()],j.prototype,"_focusPanelFlowItem",void 0),e([a()],j.prototype,"_focusLayerFlowItem",void 0),e([a()],j.prototype,"_focusEditingFlowItem",void 0),e([a()],j.prototype,"_layerListMap",void 0),e([a()],j.prototype,"_visibleBaseItems",null),e([a()],j.prototype,"_visibleReferenceItems",null),e([a()],j.prototype,"_openedPanelItems",null),e([a()],j.prototype,"_totalBaseItems",null),e([a()],j.prototype,"_totalReferenceItems",null),e([a()],j.prototype,"_baseFilterEnabled",null),e([a()],j.prototype,"_referenceFilterEnabled",null),e([a()],j.prototype,"_renderedOpenLayerFlowItems",null),e([a()],j.prototype,"basemapTitle",null),e([a({readOnly:!0})],j.prototype,"catalogLayerList",void 0),e([a()],j.prototype,"catalogOptions",void 0),e([a()],j.prototype,"collapsed",void 0),e([a()],j.prototype,"dragEnabled",void 0),e([a()],j.prototype,"editingTitle",void 0),e([a()],j.prototype,"filterPlaceholder",void 0),e([a()],j.prototype,"baseFilterPredicate",void 0),e([a()],j.prototype,"baseFilterText",void 0),e([a()],j.prototype,"referenceFilterPredicate",void 0),e([a()],j.prototype,"referenceFilterText",void 0),e([a()],j.prototype,"listItemCanGiveFunction",void 0),e([a()],j.prototype,"listItemCanReceiveFunction",void 0),e([a()],j.prototype,"baseListItemCreatedFunction",null),e([a()],j.prototype,"headingLevel",void 0),e([a()],j.prototype,"icon",null),e([a()],j.prototype,"knowledgeGraphOptions",void 0),e([a()],j.prototype,"label",null),e([a()],j.prototype,"layerTablesEnabled",void 0),e([a()],j.prototype,"mapImageOptions",void 0),e([a(),M("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],j.prototype,"messages",void 0),e([a(),M("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([a()],j.prototype,"minFilterItems",void 0),e([a({readOnly:!0})],j.prototype,"openedLayers",void 0),e([a({readOnly:!0})],j.prototype,"openedLayerLists",void 0),e([a()],j.prototype,"referenceListItemCreatedFunction",null),e([a({readOnly:!0})],j.prototype,"tableList",void 0),e([a({readOnly:!0})],j.prototype,"baseItems",null),e([a({readOnly:!0})],j.prototype,"referenceItems",null),e([a()],j.prototype,"selectedItems",void 0),e([a()],j.prototype,"selectionMode",void 0),e([a()],j.prototype,"tileOptions",void 0),e([a()],j.prototype,"view",null),e([P("trigger-action"),a({type:p})],j.prototype,"viewModel",void 0),e([a()],j.prototype,"visibilityAppearance",void 0),e([a({type:m,nonNullable:!0})],j.prototype,"visibleElements",void 0),j=e([c("esri.widgets.BasemapLayerList")],j);const U=j;export{U 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{on as t}from"../../../core/events.js";import{clamp as s}from"../../../core/mathUtils.js";import{watch as i,initial as l}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../Widget.js";import{l as a,a as h,b as v,c as d,d as _,e as c,f as p,g,h as u,i as m,j as L}from"../../../chunks/constants.js";import{css as y}from"./css.js";import{Label as P}from"./Label.js";import{LevelItem as C}from"./LevelItem.js";import{loadCalciteComponents as f}from"../../support/componentsUtils.js";import{globalCss as w}from"../../support/globalCss.js";import"../../support/widgetUtils.js";import{tsx as x}from"../../support/jsxFactory.js";const b={selectLevel:"selectLevel",clearLevel:"clearLevel",nextLevel:"nextLevel",previousLevel:"previousLevel",currentLevel:"{{value}}"};let W=class extends r{constructor(e,t){super(e,t),this._levelHandlesKey="levelHandles",this._levelEventHandlesKey="levelEventHandles",this._levelWidgets=[],this._labelWidget=new P({onClear:()=>this.vm.clear()}),this._hoveredLevel=null,this._expandedLevelsHeight=void 0,this._normalizedPointerPosition=0,this._hovering=!1,this._containerPosTop=null,this._levelsContainer=null,this._onKeyDown=e=>{switch(e.key){case"ArrowDown":case"ArrowLeft":e.preventDefault(),e.stopPropagation(),this.vm.previous(),this._focusCurrentLevel();break;case"ArrowUp":case"ArrowRight":e.preventDefault(),e.stopPropagation(),this.vm.next(),this._focusCurrentLevel()}},this._onFocus=()=>{this._hoveredLevel=this._levels.length>0?this._levels[0]:null},this._onArrowUpClick=()=>{this.vm.next()},this._onArrowDownClick=()=>{this.vm.previous()},this._onPointerUp=()=>{if(window.getSelection()?.removeAllRanges(),null==this._hoveredLevel)return;const{vm:e}=this;e.enabled&&this._hoveredLevel===e.value?e.clear():e.select(this._hoveredLevel)},this._onPointerEnter=()=>{this._hovering||null==this._levelsContainer||(this._hovering=!0,this._containerPosTop=this._levelsContainer.getBoundingClientRect().top??0)},this._onPointerLeave=()=>{this._hovering&&(this._normalizedPointerPosition=0,this._hoveredLevel=null,this._hovering=!1)},this._onPointerMove=e=>{if(!this._hovering)return!1;if(window.getSelection()?.removeAllRanges(),null!=this._containerPosTop){const t=this._containerPosTop,s=_*L,i=this._expandedLevelsMargin;let l=this._levelsHeight,o=t+s+i;const n=this._levelHeight/2;o+=n,l-=n;let r=(e.clientY-o)/l;r+=g,this._normalizedPointerPosition=r}return!1}}loadDependencies(){return f({action:()=>import("@esri/calcite-components/dist/components/calcite-action")})}postInitialize(){this.addHandles([i((()=>this._levelsContainer),(()=>this._onContainerChange()),l),i((()=>this._levels),(()=>this._createLevelWidgets()),l),i((()=>this.messages),(()=>{this._labelWidget.messages=this.messages??b}),l)])}destroy(){this._levelWidgets.forEach((e=>e.destroy())),this._labelWidget.destroy()}get _levels(){return this.vm.allowedValues}get _numLevels(){return this._levels.length}get _levelsHeight(){return Math.round(this._levelHeight*this._numLevels)}get _expandedLevelsMargin(){return Math.round(((this._expandedLevelsHeight??0)-this._levelsHeight)/2)}get _levelWidth(){const{levelWidthNominator:e,levelWidthConstant:t}=u,i=e/Math.sqrt(this._numLevels)+t;return Math.round(s(i,h,a))}get _levelHeight(){const e=m,t=2*e/Math.sqrt(this._numLevels);return Math.round(s(t,2,e))}get _gaussianFactor(){const e=this._numLevels;return e/Math.log(v*e)*d}get _levelClosestToPointer(){if(!this._hovering)return null;const e=this._numLevels-1,t=this._normalizedPointerPosition;return e>=0&&null!=t?this._levels[Math.round((1-t)*e)]:null}render(){const e=this._levelWidgets.length,t=e>1?this._levelWidgets.map((e=>e.render())):null,s=_*L,i=-s/L,l=this._levelsHeight,o=l+2*s;return x("div",{class:this.classes(w.widget,y.container,{[y.animateLevel]:!this._hovering,[y.noLevel]:e<2}),key:this,onkeydown:this._onKeyDown},this._renderLabelContainer(),x("div",{afterCreate:e=>this._levelsContainer=e,class:y.levelsContainer,"data-node-ref":"",onfocus:this._onFocus,styles:{height:`${o}px`,marginBlockStart:`${i}px`,marginBlockEnd:`${i}px`}},x("div",{class:y.innerLevelsContainer,styles:{height:`${l}px`,margin:"0",marginBlockStart:_-this._expandedLevelsMargin+"px"}},t)))}_renderLabelContainer(){const{hasPrevious:e,hasNext:t}=this.vm,s=this.messages??b,i=s.previousLevel,l=s.nextLevel;return x("div",{class:y.labelContainer,tabIndex:0},H({className:y.arrowUp,disabled:!t,icon:"chevron-up",onClick:this._onArrowUpClick,text:l}),this._labelWidget.render(),H({className:y.arrowDown,disabled:!e,icon:"chevron-down",onClick:this._onArrowDownClick,text:i}))}_updateComponents(){const e=this.messages??b,t=this.vm.enabled?this.vm.value:null,s=null!=this._hoveredLevel?this._hoveredLevel:t;this._levelWidgets.forEach((s=>{const i=this.vm.getValueLabel(s.level);s.label=null!=i?i:e.currentLevel?.replace("{{level}}",String(s.level)),s.active=s.level===t,s.hovering=s.level===this._hoveredLevel})),this._labelWidget.level=s,this._labelWidget.active=s===t,this._labelWidget.hovering=null!=this._hoveredLevel}_createLevelWidgets(){this._levelWidgets.forEach((e=>e.destroy())),this._levelWidgets=this._levels.map((e=>new C({level:e,onSelect:()=>this._onLevelToggle(e)}))),this.removeHandles(this._levelHandlesKey),this.addHandles([i((()=>{const{vm:e}=this;return[this.messages,e?.value,e?.enabled,this._hoveredLevel,this._hovering]}),(()=>this._updateComponents()),l),i((()=>[this._normalizedPointerPosition,this._hovering]),(()=>this._onPointerPositionChange()),l),i((()=>this._levelWidth),(e=>this._levelWidgets.forEach((t=>t.width=e))),l)],this._levelHandlesKey)}_onContainerChange(){const e=this._levelsContainer;null!=e&&(this.removeHandles(this._levelEventHandlesKey),this.addHandles([t(e,"pointerenter",this._onPointerEnter),t(e,"pointerover",this._onPointerEnter),t(e,"pointerleave",this._onPointerLeave),t(e,"pointerup",this._onPointerUp),t(e,"pointermove",this._onPointerMove)],this._levelEventHandlesKey))}_focusCurrentLevel(){const e=this._levelWidgets.find((e=>e.level===this.vm.value));e?.focus()}_onLevelToggle(e){const{vm:t}=this;t.enabled&&t.value===e?t.clear():t.select(e)}_onPointerPositionChange(){let e=0;this._levelWidgets.forEach(((t,s)=>{const{width:i,height:l}=this._getLevelWidgetSize(s);t.height=l,t.width=i,e+=l})),this._hoveredLevel=this._levelClosestToPointer;const t=this._expandedLevelsHeight;(null==t||Math.abs(t-e)>30)&&(this._expandedLevelsHeight=e)}_getLevelWidgetSize(e){const t={width:this._levelWidth,height:this._levelHeight};if(this._hovering){const s=this._getGaussianFactor(e,this._normalizedPointerPosition);t.width+=c*s,t.height+=p*s}return t}_getGaussianFactor(e,t){const s=this._numLevels-1,i=(s-e)/s,l=this._gaussianFactor*(i-t);return Math.exp(-(l**2))}};function H(e){return x("calcite-action",{appearance:"transparent",class:e.className,disabled:e.disabled,icon:e.icon,key:e.className,onclick:e.onClick,scale:"s",text:e.text,textEnabled:!1,title:e.text})}e([o()],W.prototype,"vm",void 0),e([o()],W.prototype,"messages",void 0),e([o()],W.prototype,"_levelWidgets",void 0),e([o()],W.prototype,"_labelWidget",void 0),e([o()],W.prototype,"_hoveredLevel",void 0),e([o()],W.prototype,"_levels",null),e([o()],W.prototype,"_numLevels",null),e([o({readOnly:!0})],W.prototype,"_levelsHeight",null),e([o()],W.prototype,"_expandedLevelsHeight",void 0),e([o({readOnly:!0})],W.prototype,"_expandedLevelsMargin",null),e([o({readOnly:!0})],W.prototype,"_levelWidth",null),e([o({readOnly:!0})],W.prototype,"_levelHeight",null),e([o({readOnly:!0})],W.prototype,"_gaussianFactor",null),e([o({readOnly:!0})],W.prototype,"_levelClosestToPointer",null),e([o({type:Number,range:{min:0,max:1}})],W.prototype,"_normalizedPointerPosition",void 0),e([o()],W.prototype,"_hovering",void 0),e([o()],W.prototype,"_containerPosTop",void 0),e([o()],W.prototype,"_levelsContainer",void 0),W=e([n("esri.widgets.BuildingExplorer.BuildingLevelPicker.BuildingLevelPicker")],W);const j=W;export{j as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{on as t}from"../../../core/events.js";import{clamp as s}from"../../../core/mathUtils.js";import{watch as i,initial as l}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../Widget.js";import{l as a,a as h,b as v,c as d,d as _,e as c,f as p,g,h as u,i as m,j as L}from"../../../chunks/constants.js";import{css as y}from"./css.js";import{Label as P}from"./Label.js";import{LevelItem as C}from"./LevelItem.js";import{loadCalciteComponents as f}from"../../support/componentsUtils.js";import{globalCss as w}from"../../support/globalCss.js";import"../../support/widgetUtils.js";import{tsx as x}from"../../support/jsxFactory.js";const b={selectLevel:"selectLevel",clearLevel:"clearLevel",nextLevel:"nextLevel",previousLevel:"previousLevel",currentLevel:"{{value}}"};let W=class extends r{constructor(e,t){super(e,t),this._levelHandlesKey="levelHandles",this._levelEventHandlesKey="levelEventHandles",this._levelWidgets=[],this._labelWidget=new P({onClear:()=>this.vm.clear()}),this._hoveredLevel=null,this._expandedLevelsHeight=void 0,this._normalizedPointerPosition=0,this._hovering=!1,this._containerPosTop=null,this._levelsContainer=null,this._onKeyDown=e=>{switch(e.key){case"ArrowDown":case"ArrowLeft":e.preventDefault(),e.stopPropagation(),this.vm.previous(),this._focusCurrentLevel();break;case"ArrowUp":case"ArrowRight":e.preventDefault(),e.stopPropagation(),this.vm.next(),this._focusCurrentLevel()}},this._onFocus=()=>{this._hoveredLevel=this._levels.length>0?this._levels[0]:null},this._onArrowUpClick=()=>{this.vm.next()},this._onArrowDownClick=()=>{this.vm.previous()},this._onPointerUp=()=>{if(window.getSelection()?.removeAllRanges(),null==this._hoveredLevel)return;const{vm:e}=this;e.enabled&&this._hoveredLevel===e.value?e.clear():e.select(this._hoveredLevel)},this._onPointerEnter=()=>{this._hovering||null==this._levelsContainer||(this._hovering=!0,this._containerPosTop=this._levelsContainer.getBoundingClientRect().top??0)},this._onPointerLeave=()=>{this._hovering&&(this._normalizedPointerPosition=0,this._hoveredLevel=null,this._hovering=!1)},this._onPointerMove=e=>{if(!this._hovering)return!1;if(window.getSelection()?.removeAllRanges(),null!=this._containerPosTop){const t=this._containerPosTop,s=_*L,i=this._expandedLevelsMargin;let l=this._levelsHeight,o=t+s+i;const n=this._levelHeight/2;o+=n,l-=n;let r=(e.clientY-o)/l;r+=g,this._normalizedPointerPosition=r}return!1}}loadDependencies(){return f({action:()=>import("@esri/calcite-components/dist/components/calcite-action")})}postInitialize(){this.addHandles([i((()=>this._levelsContainer),(()=>this._onContainerChange()),l),i((()=>this._levels),(()=>this._createLevelWidgets()),l),i((()=>this.messages),(()=>{this._labelWidget.messages=this.messages??b}),l)])}destroy(){this._levelWidgets.forEach((e=>e.destroy())),this._labelWidget.destroy()}get _levels(){return this.vm.allowedValues}get _numLevels(){return this._levels.length}get _levelsHeight(){return Math.round(this._levelHeight*this._numLevels)}get _expandedLevelsMargin(){return Math.round(((this._expandedLevelsHeight??0)-this._levelsHeight)/2)}get _levelWidth(){const{levelWidthNominator:e,levelWidthConstant:t}=u,i=e/Math.sqrt(this._numLevels)+t;return Math.round(s(i,h,a))}get _levelHeight(){const e=m,t=2*e/Math.sqrt(this._numLevels);return Math.round(s(t,2,e))}get _gaussianFactor(){const e=this._numLevels;return e/Math.log(v*e)*d}get _levelClosestToPointer(){if(!this._hovering)return null;const e=this._numLevels-1,t=this._normalizedPointerPosition;return e>=0&&null!=t?this._levels[Math.round((1-t)*e)]:null}render(){const e=this._levelWidgets.length,t=e>1?this._levelWidgets.map((e=>e.render())):null,s=_*L,i=-40/L,l=this._levelsHeight,o=l+2*s;return x("div",{class:this.classes(w.widget,y.container,{[y.animateLevel]:!this._hovering,[y.noLevel]:e<2}),key:this,onkeydown:this._onKeyDown},this._renderLabelContainer(),x("div",{afterCreate:e=>this._levelsContainer=e,class:y.levelsContainer,"data-node-ref":"",onfocus:this._onFocus,styles:{height:`${o}px`,marginBlockStart:`${i}px`,marginBlockEnd:`${i}px`}},x("div",{class:y.innerLevelsContainer,styles:{height:`${l}px`,margin:"0",marginBlockStart:_-this._expandedLevelsMargin+"px"}},t)))}_renderLabelContainer(){const{hasPrevious:e,hasNext:t}=this.vm,s=this.messages??b,i=s.previousLevel,l=s.nextLevel;return x("div",{class:y.labelContainer,tabIndex:0},H({className:y.arrowUp,disabled:!t,icon:"chevron-up",onClick:this._onArrowUpClick,text:l}),this._labelWidget.render(),H({className:y.arrowDown,disabled:!e,icon:"chevron-down",onClick:this._onArrowDownClick,text:i}))}_updateComponents(){const e=this.messages??b,t=this.vm.enabled?this.vm.value:null,s=null!=this._hoveredLevel?this._hoveredLevel:t;this._levelWidgets.forEach((s=>{const i=this.vm.getValueLabel(s.level);s.label=null!=i?i:e.currentLevel?.replace("{{level}}",String(s.level)),s.active=s.level===t,s.hovering=s.level===this._hoveredLevel})),this._labelWidget.level=s,this._labelWidget.active=s===t,this._labelWidget.hovering=null!=this._hoveredLevel}_createLevelWidgets(){this._levelWidgets.forEach((e=>e.destroy())),this._levelWidgets=this._levels.map((e=>new C({level:e,onSelect:()=>this._onLevelToggle(e)}))),this.removeHandles(this._levelHandlesKey),this.addHandles([i((()=>{const{vm:e}=this;return[this.messages,e?.value,e?.enabled,this._hoveredLevel,this._hovering]}),(()=>this._updateComponents()),l),i((()=>[this._normalizedPointerPosition,this._hovering]),(()=>this._onPointerPositionChange()),l),i((()=>this._levelWidth),(e=>this._levelWidgets.forEach((t=>t.width=e))),l)],this._levelHandlesKey)}_onContainerChange(){const e=this._levelsContainer;null!=e&&(this.removeHandles(this._levelEventHandlesKey),this.addHandles([t(e,"pointerenter",this._onPointerEnter),t(e,"pointerover",this._onPointerEnter),t(e,"pointerleave",this._onPointerLeave),t(e,"pointerup",this._onPointerUp),t(e,"pointermove",this._onPointerMove)],this._levelEventHandlesKey))}_focusCurrentLevel(){const e=this._levelWidgets.find((e=>e.level===this.vm.value));e?.focus()}_onLevelToggle(e){const{vm:t}=this;t.enabled&&t.value===e?t.clear():t.select(e)}_onPointerPositionChange(){let e=0;this._levelWidgets.forEach(((t,s)=>{const{width:i,height:l}=this._getLevelWidgetSize(s);t.height=l,t.width=i,e+=l})),this._hoveredLevel=this._levelClosestToPointer;const t=this._expandedLevelsHeight;(null==t||Math.abs(t-e)>30)&&(this._expandedLevelsHeight=e)}_getLevelWidgetSize(e){const t={width:this._levelWidth,height:this._levelHeight};if(this._hovering){const s=this._getGaussianFactor(e,this._normalizedPointerPosition);t.width+=c*s,t.height+=p*s}return t}_getGaussianFactor(e,t){const s=this._numLevels-1,i=(s-e)/s,l=this._gaussianFactor*(i-t);return Math.exp(-(l**2))}};function H(e){return x("calcite-action",{appearance:"transparent",class:e.className,disabled:e.disabled,icon:e.icon,key:e.className,onclick:e.onClick,scale:"s",text:e.text,textEnabled:!1,title:e.text})}e([o()],W.prototype,"vm",void 0),e([o()],W.prototype,"messages",void 0),e([o()],W.prototype,"_levelWidgets",void 0),e([o()],W.prototype,"_labelWidget",void 0),e([o()],W.prototype,"_hoveredLevel",void 0),e([o()],W.prototype,"_levels",null),e([o()],W.prototype,"_numLevels",null),e([o({readOnly:!0})],W.prototype,"_levelsHeight",null),e([o()],W.prototype,"_expandedLevelsHeight",void 0),e([o({readOnly:!0})],W.prototype,"_expandedLevelsMargin",null),e([o({readOnly:!0})],W.prototype,"_levelWidth",null),e([o({readOnly:!0})],W.prototype,"_levelHeight",null),e([o({readOnly:!0})],W.prototype,"_gaussianFactor",null),e([o({readOnly:!0})],W.prototype,"_levelClosestToPointer",null),e([o({type:Number,range:{min:0,max:1}})],W.prototype,"_normalizedPointerPosition",void 0),e([o()],W.prototype,"_hovering",void 0),e([o()],W.prototype,"_containerPosTop",void 0),e([o()],W.prototype,"_levelsContainer",void 0),W=e([n("esri.widgets.BuildingExplorer.BuildingLevelPicker.BuildingLevelPicker")],W);const j=W;export{j 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import o from"../core/Identifiable.js";import s from"../core/ReactiveMap.js";import{on as i,initial as l}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import p from"./CatalogLayerList/CatalogLayerListViewModel.js";import d from"./CatalogLayerList/CatalogLayerListVisibleElements.js";import{css as c}from"./CatalogLayerList/css.js";import m from"./LayerList/LayerListItem.js";import h from"./LayerList/ListItem.js";import{minFilterItems as y,getItem as u,removeDestroyedListItems as g}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as L}from"./support/componentsUtils.js";import{globalCss as f}from"./support/globalCss.js";import{calciteListFilterProps as _}from"./support/listUtils.js";import{setFocus as v}from"./support/widgetUtils.js";import{messageBundle as I}from"./support/decorators/messageBundle.js";import{vmEvent as w}from"./support/decorators/vmEvent.js";import{tsx as b}from"./support/jsxFactory.js";var C;const F=t.ofType(h),M="nested";let O=C=class extends(o.IdentifiableMixin(n)){constructor(e,o){super(e,o),this._activeItem=null,this._tooltipReferenceMap=new s,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new s,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=y,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new F,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new p,this.visibilityAppearance="default",this.visibleElements=new d,this._onTablesOpen=e=>{this.onTablesOpen?this.onTablesOpen(e):(this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid)},this._onCatalogOpen=e=>{this.onCatalogOpen?this.onCatalogOpen(e):(this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid)},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(c.item)));this._activeItem=u(t)}}initialize(){this.addHandles([i((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),l),i((()=>this.viewModel.catalogItems),"change",(()=>g(this.selectedItems)),l)])}loadDependencies(){return L({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get _visibleItems(){return this.catalogItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleItems.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map(((t,o)=>this._renderLayerFlowItem(t,o===e.length-1)))}get catalogItems(){return this.viewModel.catalogItems}set catalogItems(e){this.viewModel.catalogItems=e}get catalogLayer(){return this.viewModel.catalogLayer}set catalogLayer(e){this.viewModel.catalogLayer=e}get icon(){return"catalog-dataset"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,{_visibleItems:t}=this,o={[f.hidden]:"loading"===e,[f.disabled]:"disabled"===e};return b("div",{class:this.classes(c.base,f.widget,f.panel,o)},t?.length?[this._renderItemTooltips(),this._renderItems()]:this._renderNoItems())}async _createFlowList(e,t){const{_layerListMap:o}=this,s=o.get(e);if(s)return s;const i="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||o.set(e,i),i}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:o}=this;this._openedLayersController?.abort();const s=new AbortController,{signal:i}=s;this._openedLayersController=s,e.forEach(((o,s)=>{t.includes(s)||(o.destroy(),e.delete(s))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,i))));if(i.aborted)return;o.removeAll(),o.addMany(l);const a=o.at(-1);a?"catalogLayer"in a?(this._set("catalogLayerList",a),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",a)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:o}=this;return e?.layer?b("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},o.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(){return this._visibleItems?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return b("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return b("div",{class:c.itemMessage,key:"esri-layer-list__no-items"},b("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map((({title:o,panel:s},i)=>{const l=()=>this._handlePanelFlowItemBack(s);return b("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:o,heading:s.title,headingLevel:this.headingLevel,key:`flow-panel-${s.uid}`,selected:!t.length&&i===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},s.render(),b("calcite-button",{appearance:"transparent",onclick:l,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,v(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,v(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:o,_filterEnabled:s,_rootGroupUid:i,visibleElements:{closeButton:l,collapseButton:a,heading:r,flow:n},selectionMode:p,filterText:d,filterPlaceholder:m,messages:h,openedLayers:y,_openedPanelItems:u}=this,g=[b("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!e,collapsed:t,collapsible:a,heading:r?h.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!y.length&&!u.length,onCalciteFlowItemClose:()=>this.visible=!1},b("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},"data-layer-type":i,displayMode:M,filterEnabled:s,filterPlaceholder:m,filterProps:_,filterText:s?d:"",group:i,key:"root-list",label:h.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:p,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??""},o?.toArray().map((e=>this._renderItem(e))),o?.length&&s?b("div",{class:c.filterNoResults,slot:"filter-no-results"},b("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?n?b("calcite-flow",{key:"root-flow"},g):g:null}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,v(e))}_renderLayerFlowItem(e,t){const{messages:o,openedLayers:s}=this,i=e.title||this.messages.untitledLayer;return b("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:i,heading:o["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),s.pop();const t=s.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}async _createCatalogLayerList(e){const{headingLevel:t,catalogOptions:o,view:s,filterPlaceholder:i,listItemCreatedFunction:l,minFilterItems:a,selectionMode:r,visibilityAppearance:n,onCatalogOpen:p,onTablesOpen:d}=this;return new C({headingLevel:t,view:s,filterPlaceholder:i,listItemCreatedFunction:l,minFilterItems:a,selectionMode:r,visibilityAppearance:n,...o,catalogLayer:e,onCatalogOpen:p,onTablesOpen:d})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:o,selectionMode:s}=this;return new t({headingLevel:o,selectionMode:s,...this._getTableListParams(e)})}_renderItem(e,t,o){return b(m,{activeItem:this._activeItem,css:c,displayMode:M,dragEnabled:!1,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:o,rootGroupUid:this._rootGroupUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:o}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>u(e))).filter(Boolean);o.removeAll(),o.addMany(s)}};e([a()],O.prototype,"_activeItem",void 0),e([a()],O.prototype,"_tooltipReferenceMap",void 0),e([a()],O.prototype,"_focusRootFlowItem",void 0),e([a()],O.prototype,"_focusPanelFlowItem",void 0),e([a()],O.prototype,"_focusLayerFlowItem",void 0),e([a()],O.prototype,"_layerListMap",void 0),e([a()],O.prototype,"_filterEnabled",null),e([a()],O.prototype,"_visibleItems",null),e([a()],O.prototype,"_openedPanelItems",null),e([a()],O.prototype,"_renderedOpenLayerFlowItems",null),e([a()],O.prototype,"catalogItems",null),e([a()],O.prototype,"catalogLayer",null),e([a({readOnly:!0})],O.prototype,"catalogLayerList",void 0),e([a()],O.prototype,"catalogOptions",void 0),e([a()],O.prototype,"collapsed",void 0),e([a()],O.prototype,"filterPlaceholder",void 0),e([a()],O.prototype,"filterText",void 0),e([a()],O.prototype,"headingLevel",void 0),e([a()],O.prototype,"icon",null),e([a()],O.prototype,"knowledgeGraphOptions",void 0),e([a()],O.prototype,"label",null),e([a()],O.prototype,"layerTablesEnabled",void 0),e([a()],O.prototype,"listItemCreatedFunction",null),e([a()],O.prototype,"mapImageOptions",void 0),e([a(),I("esri/widgets/CatalogLayerList/t9n/CatalogLayerList")],O.prototype,"messages",void 0),e([a(),I("esri/t9n/common")],O.prototype,"messagesCommon",void 0),e([a()],O.prototype,"minFilterItems",void 0),e([a({readOnly:!0})],O.prototype,"openedLayers",void 0),e([a({readOnly:!0})],O.prototype,"openedLayerLists",void 0),e([a()],O.prototype,"onCatalogOpen",void 0),e([a()],O.prototype,"onTablesOpen",void 0),e([a()],O.prototype,"selectedItems",void 0),e([a()],O.prototype,"selectionMode",void 0),e([a({readOnly:!0})],O.prototype,"tableList",void 0),e([a()],O.prototype,"tileOptions",void 0),e([a()],O.prototype,"view",null),e([w("trigger-action"),a({type:p})],O.prototype,"viewModel",void 0),e([a()],O.prototype,"visibilityAppearance",void 0),e([a({type:d,nonNullable:!0})],O.prototype,"visibleElements",void 0),O=C=e([r("esri.widgets.CatalogLayerList")],O);const T=O;export{T as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import o from"../core/Identifiable.js";import i from"../core/ReactiveMap.js";import{on as s,watch as l,initial as r}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import p from"./Widget.js";import d from"./CatalogLayerList/CatalogLayerListViewModel.js";import c from"./CatalogLayerList/CatalogLayerListVisibleElements.js";import{css as m}from"./CatalogLayerList/css.js";import h from"./LayerList/LayerListItem.js";import y from"./LayerList/ListItem.js";import{minFilterItems as u,getItem as g,removeDestroyedListItems as L,setFilterPredicate as f}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{globalCss as v}from"./support/globalCss.js";import{calciteListFilterProps as I}from"./support/listUtils.js";import{setFocus as w}from"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{vmEvent as C}from"./support/decorators/vmEvent.js";import{tsx as F}from"./support/jsxFactory.js";var M;const O=t.ofType(y),T="nested";let P=M=class extends(o.IdentifiableMixin(p)){constructor(e,o){super(e,o),this._rootListEl=null,this._activeItem=null,this._tooltipReferenceMap=new i,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new i,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=u,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new O,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new d,this.visibilityAppearance="default",this.visibleElements=new c,this._onTablesOpen=e=>{this.onTablesOpen?this.onTablesOpen(e):(this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid)},this._onCatalogOpen=e=>{this.onCatalogOpen?this.onCatalogOpen(e):(this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid)},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(m.item)));this._activeItem=g(t)}}initialize(){this.addHandles([s((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),r),s((()=>this.viewModel.catalogItems),"change",(()=>L(this.selectedItems)),r),l((()=>[this.filterPredicate,this._rootListEl]),(()=>f(this._rootListEl,this.filterPredicate)))])}loadDependencies(){return _({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get _visibleItems(){return this.catalogItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleItems.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map(((t,o)=>this._renderLayerFlowItem(t,o===e.length-1)))}get catalogItems(){return this.viewModel.catalogItems}set catalogItems(e){this.viewModel.catalogItems=e}get catalogLayer(){return this.viewModel.catalogLayer}set catalogLayer(e){this.viewModel.catalogLayer=e}get icon(){return"catalog-dataset"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,{_visibleItems:t}=this,o={[v.hidden]:"loading"===e,[v.disabled]:"disabled"===e};return F("div",{class:this.classes(m.base,v.widget,v.panel,o)},t?.length?[this._renderItemTooltips(),this._renderItems()]:this._renderNoItems())}async _createFlowList(e,t){const{_layerListMap:o}=this,i=o.get(e);if(i)return i;const s="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||o.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:o}=this;this._openedLayersController?.abort();const i=new AbortController,{signal:s}=i;this._openedLayersController=i,e.forEach(((o,i)=>{t.includes(i)||(o.destroy(),e.delete(i))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,s))));if(s.aborted)return;o.removeAll(),o.addMany(l);const r=o.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:o}=this;return e?.layer?F("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},o.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(){return this._visibleItems?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return F("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return F("div",{class:m.itemMessage,key:"esri-layer-list__no-items"},F("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map((({title:o,panel:i},s)=>{const l=()=>this._handlePanelFlowItemBack(i);return F("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:o,heading:i.title,headingLevel:this.headingLevel,key:`flow-panel-${i.uid}`,selected:!t.length&&s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},i.render(),F("calcite-button",{appearance:"transparent",onclick:l,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,w(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,w(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:o,_filterEnabled:i,_rootGroupUid:s,visibleElements:{closeButton:l,collapseButton:r,heading:a,flow:n},selectionMode:p,filterText:d,filterPlaceholder:c,messages:h,openedLayers:y,_openedPanelItems:u}=this,g=[F("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!e,collapsed:t,collapsible:r,heading:a?h.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!y.length&&!u.length,onCalciteFlowItemClose:()=>this.visible=!1},F("calcite-list",{afterCreate:e=>{this._rootListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{this._rootListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},"data-layer-type":s,displayMode:T,filterEnabled:i,filterPlaceholder:c,filterProps:I,filterText:i?d:"",group:s,key:"root-list",label:h.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:p,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??""},o?.toArray().map((e=>this._renderItem(e))),o?.length&&i?F("div",{class:m.filterNoResults,slot:"filter-no-results"},F("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?n?F("calcite-flow",{key:"root-flow"},g):g:null}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,w(e))}_renderLayerFlowItem(e,t){const{messages:o,openedLayers:i}=this,s=e.title||this.messages.untitledLayer;return F("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:o["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),i.pop();const t=i.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}async _createCatalogLayerList(e){const{headingLevel:t,catalogOptions:o,view:i,filterPlaceholder:s,listItemCreatedFunction:l,minFilterItems:r,selectionMode:a,visibilityAppearance:n,onCatalogOpen:p,onTablesOpen:d}=this;return new M({headingLevel:t,view:i,filterPlaceholder:s,listItemCreatedFunction:l,minFilterItems:r,selectionMode:a,visibilityAppearance:n,...o,catalogLayer:e,onCatalogOpen:p,onTablesOpen:d})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:o,selectionMode:i}=this;return new t({headingLevel:o,selectionMode:i,...this._getTableListParams(e)})}_renderItem(e,t,o){return F(h,{activeItem:this._activeItem,css:m,displayMode:T,dragEnabled:!1,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:o,rootGroupUid:this._rootGroupUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:o}=this;if("none"===t)return;const i=e.target.selectedItems.map((e=>g(e))).filter(Boolean);o.removeAll(),o.addMany(i)}};e([a()],P.prototype,"_rootListEl",void 0),e([a()],P.prototype,"_activeItem",void 0),e([a()],P.prototype,"_tooltipReferenceMap",void 0),e([a()],P.prototype,"_focusRootFlowItem",void 0),e([a()],P.prototype,"_focusPanelFlowItem",void 0),e([a()],P.prototype,"_focusLayerFlowItem",void 0),e([a()],P.prototype,"_layerListMap",void 0),e([a()],P.prototype,"_filterEnabled",null),e([a()],P.prototype,"_visibleItems",null),e([a()],P.prototype,"_openedPanelItems",null),e([a()],P.prototype,"_renderedOpenLayerFlowItems",null),e([a()],P.prototype,"catalogItems",null),e([a()],P.prototype,"catalogLayer",null),e([a({readOnly:!0})],P.prototype,"catalogLayerList",void 0),e([a()],P.prototype,"catalogOptions",void 0),e([a()],P.prototype,"collapsed",void 0),e([a()],P.prototype,"filterPlaceholder",void 0),e([a()],P.prototype,"filterPredicate",void 0),e([a()],P.prototype,"filterText",void 0),e([a()],P.prototype,"headingLevel",void 0),e([a()],P.prototype,"icon",null),e([a()],P.prototype,"knowledgeGraphOptions",void 0),e([a()],P.prototype,"label",null),e([a()],P.prototype,"layerTablesEnabled",void 0),e([a()],P.prototype,"listItemCreatedFunction",null),e([a()],P.prototype,"mapImageOptions",void 0),e([a(),b("esri/widgets/CatalogLayerList/t9n/CatalogLayerList")],P.prototype,"messages",void 0),e([a(),b("esri/t9n/common")],P.prototype,"messagesCommon",void 0),e([a()],P.prototype,"minFilterItems",void 0),e([a({readOnly:!0})],P.prototype,"openedLayers",void 0),e([a({readOnly:!0})],P.prototype,"openedLayerLists",void 0),e([a()],P.prototype,"onCatalogOpen",void 0),e([a()],P.prototype,"onTablesOpen",void 0),e([a()],P.prototype,"selectedItems",void 0),e([a()],P.prototype,"selectionMode",void 0),e([a({readOnly:!0})],P.prototype,"tableList",void 0),e([a()],P.prototype,"tileOptions",void 0),e([a()],P.prototype,"view",null),e([C("trigger-action"),a({type:d})],P.prototype,"viewModel",void 0),e([a()],P.prototype,"visibilityAppearance",void 0),e([a({type:c,nonNullable:!0})],P.prototype,"visibleElements",void 0),P=M=e([n("esri.widgets.CatalogLayerList")],P);const A=P;export{A as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Error.js";import{downloadBlobAsFile as e,blobUrlToBlob as r}from"../../../core/urlUtils.js";import{convertFeaturesToCSV as o}from"../../../exports/csv.js";import{renderingSanitizer as i}from"../../support/widgetUtils.js";function s(){return"showSaveFilePicker"in window&&(()=>{try{return window.self===window.top}catch{return!1}})()}async function a(r){const{layer:a,includeGeometry:n,objectIds:c,outFields:l}=r,u=l??a.outFields??["*"],w=a.createQuery();w.objectIds=c,w.outFields=u;const p=await a.queryFeatures(w),m=await o(p,{includeGeometry:!a.isTable&&(n||"point"===p.geometryType),outFields:u});if(!m)throw new t("export-csv:no-output","Unable to generate a valid export string");const d=new Blob([m],{type:"text/csv"}),f=i.sanitize(a.title);if(s())try{const t=await showSaveFilePicker({suggestedName:f,types:[{accept:{"text/csv":[".csv"]}}]}),e=await t.createWritable();await e.write(d),await e.close()}catch(y){if(y instanceof t&&"AbortError"!==y.name)throw y}else e(d,`${f}.csv`)}async function n(t){if(!t?.url)return;const o=await r(`${t.url}/${t.name}`);e(o,t.name)}export{n as downloadAttachmentInfo,a as exportToCSV,s as supportsFileSystemAccess};
5
+ import t from"../../../core/Error.js";import{downloadBlobAsFile as e,blobUrlToBlob as r}from"../../../core/urlUtils.js";import{convertFeaturesToCSV as o}from"../../../exports/csv.js";import{renderingSanitizer as i}from"../../support/widgetUtils.js";function s(){return"showSaveFilePicker"in window&&(()=>{try{return window.self===window.top}catch{return!1}})()}async function a(r){const{layer:a,includeGeometry:n,objectIds:c,outFields:l}=r,u=l??a.outFields??["*"],w=a.createQuery();w.objectIds=c,w.outFields=u;const p=await a.queryFeatures(w),d=await o(p,{includeGeometry:!a.isTable&&(n||"point"===p.geometryType),outFields:u});if(!d)throw new t("export-csv:no-output","Unable to generate a valid export string");const m=new Blob([d],{type:"text/csv"}),f=i.sanitize(a.title);if(s())try{const t=await showSaveFilePicker({suggestedName:f,types:[{accept:{"text/csv":[".csv"]}}]}),e=await t.createWritable();await e.write(m),await e.close()}catch(y){if(y instanceof t&&"AbortError"!==y.name)throw y}else e(m,`${f}.csv`)}async function n(t){if(!t?.url)return;const o=await r(`${t.url}`);e(o,t.name)}export{n as downloadAttachmentInfo,a as exportToCSV,s as supportsFileSystemAccess};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- const n={hide:"hide",hideChildren:"hide-children"},i=10,e=2;function t({exclusive:n,visible:i,visibilityAppearance:e}){const t="checkbox"===e;return i?n?"circle-f":t?"check-square-f":"view-visible":n?"circle":t?"square":"view-hide"}function r({connectionStatus:n,publishing:i}){return n?"connected"===n?"beacon":"offline":i?"square":"bullet-point"}function l(i){return i?.listMode===n.hideChildren}function u(n){return n?.listMode??void 0}function o(n){return null!=n&&"minScale"in n&&null!=n.minScale?n.minScale:void 0}function c(n){return null!=n&&"maxScale"in n&&null!=n.maxScale?n.maxScale:void 0}function a(n){if(!n)return"inherited";const i=x(m(n)?n.layer:n);return null!=i?i?"independent":"inherited":"visibilityMode"in n&&null!=n.visibilityMode?n.visibilityMode:"independent"}function s(n){n?.removeMany(n.filter((n=>n?.destroyed)))}function d(n){if(n&&(!("type"in n)||"wmts"!==n.type))return"sublayers"in n?"sublayers":"layers"in n?"layers":void 0}function y(n){const i=(n?.layer&&m(n.layer)?n.layer.layer:void 0)??n?.layer;return!!i&&("catalog"!==i.type&&(S(i)??!0))}function f(i){return u(i)!==n.hide}function p(n,i){if(!n||null==i||isNaN(i))return!1;const e=o(n),t=c(n),r=null!=e&&!isNaN(e)&&e>0&&i>e,l=null!=t&&!isNaN(t)&&t>0&&i<t;return r||l}function b(n,i){n?.sort(((n,e)=>{const t="uid"in n?i.indexOf(n.uid):-1,r="uid"in e?i.indexOf(e.uid):-1;return t>r?-1:t<r?1:0}))}function h(n,i){const e=n?.layer;if(!e)return;const t=d(e);if(!t)return;let r;"layers"===t&&"layers"in e?r=e.layers:"sublayers"===t&&"sublayers"in e&&(r=e.sublayers),b(r,i)}function v(n){const i=n?.layer;return i&&"layers"in i?i.layers:null}function m(n){return null!=n&&"layer"in n&&null!=n.layer}function x(n){const i=M(n);return null!=i&&"supportsSublayerVisibility"in i?i.supportsSublayerVisibility:void 0}function S(n){const i=M(n);return null!=i&&"supportsDynamicLayers"in i?i.supportsDynamicLayers:void 0}function M(n){return n&&"capabilities"in n&&null!=n.capabilities&&"exportMap"in n.capabilities?n.capabilities.exportMap:void 0}function g(n){return n?.["data-item"]}function N(n){return n?.getAttribute("data-layer-type")}function q({children:n,error:i,incompatible:e}){return!!n?.filter((n=>!n.hidden)).length&&!i&&!e}function w(n){for(const i of n)for(const n of i)if("button"===n.type||"toggle"===n.type)return n}export{l as areChildrenHidden,f as canDisplayLayer,y as canSortSublayers,u as findLayerListMode,c as findLayerMaxScale,o as findLayerMinScale,a as findLayerVisibilityMode,g as getItem,v as getItemLayers,N as getLayerType,d as getNormalizedChildLayerProperty,w as getSingleAction,r as getStatusIcon,t as getVisibilityIcon,p as isLayerOutsideScaleRange,m as isSublayer,q as listItemHasChildren,e as minDragEnabledItems,i as minFilterItems,s as removeDestroyedListItems,h as sortChildLayersToIds,b as sortLayersToIds};
5
+ const n={hide:"hide",hideChildren:"hide-children"},i=10,e=2;function t({exclusive:n,visible:i,visibilityAppearance:e}){const t="checkbox"===e;return i?n?"circle-f":t?"check-square-f":"view-visible":n?"circle":t?"square":"view-hide"}function r({connectionStatus:n,publishing:i}){return n?"connected"===n?"beacon":"offline":i?"square":"bullet-point"}function l(i){return i?.listMode===n.hideChildren}function u(n){return n?.listMode??void 0}function o(n){return null!=n&&"minScale"in n&&null!=n.minScale?n.minScale:void 0}function c(n){return null!=n&&"maxScale"in n&&null!=n.maxScale?n.maxScale:void 0}function a(n){if(!n)return"inherited";const i=S(x(n)?n.layer:n);return null!=i?i?"independent":"inherited":"visibilityMode"in n&&null!=n.visibilityMode?n.visibilityMode:"independent"}function s(n){n?.removeMany(n.filter((n=>n?.destroyed)))}function d(n){if(n&&(!("type"in n)||"wmts"!==n.type))return"sublayers"in n?"sublayers":"layers"in n?"layers":void 0}function f(n,i){n&&(n.filterPredicate=i?n=>i(N(n)):void 0)}function y(n){const i=(n?.layer&&x(n.layer)?n.layer.layer:void 0)??n?.layer;return!!i&&("catalog"!==i.type&&(M(i)??!0))}function p(i){return u(i)!==n.hide}function b(n,i){if(!n||null==i||isNaN(i))return!1;const e=o(n),t=c(n),r=null!=e&&!isNaN(e)&&e>0&&i>e,l=null!=t&&!isNaN(t)&&t>0&&i<t;return r||l}function v(n,i){n?.sort(((n,e)=>{const t="uid"in n?i.indexOf(n.uid):-1,r="uid"in e?i.indexOf(e.uid):-1;return t>r?-1:t<r?1:0}))}function h(n,i){const e=n?.layer;if(!e)return;const t=d(e);if(!t)return;let r;"layers"===t&&"layers"in e?r=e.layers:"sublayers"===t&&"sublayers"in e&&(r=e.sublayers),v(r,i)}function m(n){const i=n?.layer;return i&&"layers"in i?i.layers:null}function x(n){return null!=n&&"layer"in n&&null!=n.layer}function S(n){const i=g(n);return null!=i&&"supportsSublayerVisibility"in i?i.supportsSublayerVisibility:void 0}function M(n){const i=g(n);return null!=i&&"supportsDynamicLayers"in i?i.supportsDynamicLayers:void 0}function g(n){return n&&"capabilities"in n&&null!=n.capabilities&&"exportMap"in n.capabilities?n.capabilities.exportMap:void 0}function N(n){return n?.["data-item"]}function q(n){return n?.getAttribute("data-layer-type")}function w({children:n,error:i,incompatible:e}){return!!n?.filter((n=>!n.hidden)).length&&!i&&!e}function k(n){for(const i of n)for(const n of i)if("button"===n.type||"toggle"===n.type)return n}export{l as areChildrenHidden,p as canDisplayLayer,y as canSortSublayers,u as findLayerListMode,c as findLayerMaxScale,o as findLayerMinScale,a as findLayerVisibilityMode,N as getItem,m as getItemLayers,q as getLayerType,d as getNormalizedChildLayerProperty,k as getSingleAction,r as getStatusIcon,t as getVisibilityIcon,b as isLayerOutsideScaleRange,x as isSublayer,w as listItemHasChildren,e as minDragEnabledItems,i as minFilterItems,s as removeDestroyedListItems,f as setFilterPredicate,h as sortChildLayersToIds,v as sortLayersToIds};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import i from"../core/Identifiable.js";import o from"../core/ReactiveMap.js";import{on as s,initial as l}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import{css as d}from"./LayerList/css.js";import p from"./LayerList/LayerListItem.js";import c from"./LayerList/LayerListViewModel.js";import m from"./LayerList/LayerListVisibleElements.js";import h from"./LayerList/ListItem.js";import{minDragEnabledItems as y,minFilterItems as u,getItem as g,getLayerType as _,sortLayersToIds as f,sortChildLayersToIds as L,removeDestroyedListItems as I}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as v}from"./support/componentsUtils.js";import{globalCss as b}from"./support/globalCss.js";import{calciteListFilterProps as w}from"./support/listUtils.js";import{setFocus as C}from"./support/widgetUtils.js";import{messageBundle as F}from"./support/decorators/messageBundle.js";import{vmEvent as E}from"./support/decorators/vmEvent.js";import{tsx as M}from"./support/jsxFactory.js";const O=t.ofType(h),T="nested";let A=class extends(i.IdentifiableMixin(n)){constructor(e,i){super(e,i),this._activeItem=null,this._tooltipReferenceMap=new o,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new o,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=y,this.minFilterItems=u,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new O,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new c,this.visibilityAppearance="default",this.visibleElements=new m,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=g(e);if(!l?.sortable)return!1;const r=g(t),a=_(t),n=g(i),d=_(i),p=!!a&&!!d&&a===d,c={selected:l,from:r,to:n},m=t.group,h=i.group,y=r?.layer?.type??"",u=n?.layer?.type??"",f=new Set(["map-image","catalog","knowledge-graph"]),L="sublayer";return m&&h&&"function"==typeof s?s.call(null,c):p&&!f.has(y)&&!f.has(u)&&l?.layer?.type!==L},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(d.item)));this._activeItem=g(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o))if(this._lastDragDetail=e,this._selectedDragItemLayerUid=s.value,o!==i)this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l});else{const e=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(o,e)}}}initialize(){this.addHandles([s((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),l),s((()=>this.viewModel.operationalItems),"change",(()=>I(this.selectedItems)),l)])}loadDependencies(){return v({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _totalItems(){return this.viewModel.operationalItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer?.type)))).length}get _visibleItems(){return this.operationalItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleItems.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get _dragEnabled(){return this._totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this._totalItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map(((t,i)=>this._renderLayerFlowItem(t,i===e.length-1)))}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,{_visibleItems:t}=this,i={[b.hidden]:"loading"===e,[b.disabled]:"disabled"===e};return M("div",{class:this.classes(d.base,b.widget,b.panel,i)},t?.length?[this._renderItemTooltips(),this._renderItems()]:this._renderNoItems())}async _createFlowList(e,t){const{_layerListMap:i}=this,o=i.get(e);if(o)return o;const s="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const o=new AbortController,{signal:s}=o;this._openedLayersController=o,e.forEach(((i,o)=>{t.includes(o)||(i.destroy(),e.delete(o))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,s))));if(s.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?M("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,referenceElement:t.get(e.layer?.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(){return this._visibleItems?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return M("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return M("div",{class:d.itemMessage,key:"esri-layer-list__no-items"},M("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:o,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,_onCatalogOpen:p,_onTablesOpen:c,layerTablesEnabled:m}=this;return new t({headingLevel:i,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,...o,catalogLayer:e,layerTablesEnabled:m,onCatalogOpen:p,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:o,dragEnabled:s}=this;return new t({headingLevel:i,selectionMode:o,dragEnabled:s,...this._getTableListParams(e)})}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:o}=this,s=e.title||this.messages.untitledLayer;return M("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),o.pop();const t=o.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map((({title:i,panel:o},s)=>{const l=()=>this._handlePanelFlowItemBack(o);return M("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:o.title,headingLevel:this.headingLevel,key:`flow-panel-${o.uid}`,selected:!t.length&&s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},o.render(),M("calcite-button",{appearance:"transparent",onclick:l,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,C(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,C(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,C(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:i,_openedPanelItems:o,_filterEnabled:s,_rootGroupUid:l,visibleElements:{closeButton:r,collapseButton:a,heading:n,flow:p},_dragEnabled:c,selectionMode:m,filterText:h,openedLayers:y,filterPlaceholder:u,messages:g}=this,_=[M("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:r,closed:!e,collapsed:t,collapsible:a,heading:n?g.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!y.length&&!o.length,onCalciteFlowItemClose:()=>this.visible=!1},M("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":l,displayMode:T,dragEnabled:c,filterEnabled:s,filterPlaceholder:u,filterProps:w,filterText:s?h:"",group:l,key:"root-list",label:g.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:m,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},i?.toArray().map((e=>this._renderItem(e))),i?.length&&s?M("div",{class:d.filterNoResults,slot:"filter-no-results"},M("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?p?M("calcite-flow",{key:"root-flow"},_):_:null}_renderItem(e,t,i){return M(p,{activeItem:this._activeItem,canMove:this._canMove,css:d,displayMode:T,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=g(i),l=g(e),r=g(t);this.viewModel.moveListItem(s,r,l,o)}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid)f(this.view?.map?.layers,t);else{const i=g(e);if(!i)return;L(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>g(e))).filter(Boolean);i.removeAll(),i.addMany(o)}};e([r()],A.prototype,"_activeItem",void 0),e([r()],A.prototype,"_tooltipReferenceMap",void 0),e([r()],A.prototype,"_focusRootFlowItem",void 0),e([r()],A.prototype,"_focusPanelFlowItem",void 0),e([r()],A.prototype,"_focusLayerFlowItem",void 0),e([r()],A.prototype,"_layerListMap",void 0),e([r()],A.prototype,"_totalItems",null),e([r()],A.prototype,"_visibleItems",null),e([r()],A.prototype,"_openedPanelItems",null),e([r()],A.prototype,"_dragEnabled",null),e([r()],A.prototype,"_filterEnabled",null),e([r()],A.prototype,"_renderedOpenLayerFlowItems",null),e([r({readOnly:!0})],A.prototype,"catalogLayerList",void 0),e([r()],A.prototype,"catalogOptions",void 0),e([r()],A.prototype,"collapsed",void 0),e([r()],A.prototype,"dragEnabled",void 0),e([r()],A.prototype,"filterPlaceholder",void 0),e([r()],A.prototype,"filterText",void 0),e([r()],A.prototype,"headingLevel",void 0),e([r()],A.prototype,"icon",null),e([r()],A.prototype,"knowledgeGraphOptions",void 0),e([r()],A.prototype,"label",null),e([r()],A.prototype,"layerTablesEnabled",void 0),e([r()],A.prototype,"listItemCanGiveFunction",void 0),e([r()],A.prototype,"listItemCanReceiveFunction",void 0),e([r()],A.prototype,"listItemCreatedFunction",null),e([r()],A.prototype,"mapImageOptions",void 0),e([r(),F("esri/widgets/LayerList/t9n/LayerList")],A.prototype,"messages",void 0),e([r(),F("esri/t9n/common")],A.prototype,"messagesCommon",void 0),e([r()],A.prototype,"minDragEnabledItems",void 0),e([r()],A.prototype,"minFilterItems",void 0),e([r({readOnly:!0})],A.prototype,"openedLayers",void 0),e([r({readOnly:!0})],A.prototype,"openedLayerLists",void 0),e([r()],A.prototype,"operationalItems",null),e([r()],A.prototype,"selectedItems",void 0),e([r()],A.prototype,"selectionMode",void 0),e([r({readOnly:!0})],A.prototype,"tableList",void 0),e([r()],A.prototype,"tileOptions",void 0),e([r()],A.prototype,"view",null),e([E("trigger-action"),r({type:c})],A.prototype,"viewModel",void 0),e([r()],A.prototype,"visibilityAppearance",void 0),e([r({type:m,nonNullable:!0})],A.prototype,"visibleElements",void 0),A=e([a("esri.widgets.LayerList")],A);const P=A;export{P as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import i from"../core/Identifiable.js";import o from"../core/ReactiveMap.js";import{on as s,watch as l,initial as r}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import{css as p}from"./LayerList/css.js";import c from"./LayerList/LayerListItem.js";import m from"./LayerList/LayerListViewModel.js";import h from"./LayerList/LayerListVisibleElements.js";import y from"./LayerList/ListItem.js";import{minDragEnabledItems as u,minFilterItems as g,getItem as _,getLayerType as L,sortLayersToIds as f,sortChildLayersToIds as I,removeDestroyedListItems as v,setFilterPredicate as b}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as w}from"./support/componentsUtils.js";import{globalCss as C}from"./support/globalCss.js";import{calciteListFilterProps as E}from"./support/listUtils.js";import{setFocus as F}from"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as O}from"./support/decorators/vmEvent.js";import{tsx as T}from"./support/jsxFactory.js";const P=t.ofType(y),A="nested";let j=class extends(i.IdentifiableMixin(d)){constructor(e,i){super(e,i),this._rootListEl=null,this._activeItem=null,this._tooltipReferenceMap=new o,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new o,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=u,this.minFilterItems=g,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new P,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new m,this.visibilityAppearance="default",this.visibleElements=new h,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=_(e);if(!l?.sortable)return!1;const r=_(t),a=L(t),n=_(i),d=L(i),p=!!a&&!!d&&a===d,c={selected:l,from:r,to:n},m=t.group,h=i.group,y=r?.layer?.type??"",u=n?.layer?.type??"",g=new Set(["map-image","catalog","knowledge-graph"]),f="sublayer";return m&&h&&"function"==typeof s?s.call(null,c):p&&!g.has(y)&&!g.has(u)&&l?.layer?.type!==f},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(p.item)));this._activeItem=_(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o))if(this._lastDragDetail=e,this._selectedDragItemLayerUid=s.value,o!==i)this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l});else{const e=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(o,e)}}}initialize(){this.addHandles([s((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),r),s((()=>this.viewModel.operationalItems),"change",(()=>v(this.selectedItems)),r),l((()=>[this.filterPredicate,this._rootListEl]),(()=>b(this._rootListEl,this.filterPredicate)))])}loadDependencies(){return w({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _totalItems(){return this.viewModel.operationalItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer?.type)))).length}get _visibleItems(){return this.operationalItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleItems.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get _dragEnabled(){return this._totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this._totalItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map(((t,i)=>this._renderLayerFlowItem(t,i===e.length-1)))}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,{_visibleItems:t}=this,i={[C.hidden]:"loading"===e,[C.disabled]:"disabled"===e};return T("div",{class:this.classes(p.base,C.widget,C.panel,i)},t?.length?[this._renderItemTooltips(),this._renderItems()]:this._renderNoItems())}async _createFlowList(e,t){const{_layerListMap:i}=this,o=i.get(e);if(o)return o;const s="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const o=new AbortController,{signal:s}=o;this._openedLayersController=o,e.forEach(((i,o)=>{t.includes(o)||(i.destroy(),e.delete(o))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,s))));if(s.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?T("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,referenceElement:t.get(e.layer?.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(){return this._visibleItems?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return T("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return T("div",{class:p.itemMessage,key:"esri-layer-list__no-items"},T("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:o,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,_onCatalogOpen:p,_onTablesOpen:c,layerTablesEnabled:m}=this;return new t({headingLevel:i,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,...o,catalogLayer:e,layerTablesEnabled:m,onCatalogOpen:p,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:o,dragEnabled:s}=this;return new t({headingLevel:i,selectionMode:o,dragEnabled:s,...this._getTableListParams(e)})}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:o}=this,s=e.title||this.messages.untitledLayer;return T("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),o.pop();const t=o.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map((({title:i,panel:o},s)=>{const l=()=>this._handlePanelFlowItemBack(o);return T("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:o.title,headingLevel:this.headingLevel,key:`flow-panel-${o.uid}`,selected:!t.length&&s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},o.render(),T("calcite-button",{appearance:"transparent",onclick:l,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,F(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,F(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,F(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:i,_openedPanelItems:o,_filterEnabled:s,_rootGroupUid:l,visibleElements:{closeButton:r,collapseButton:a,heading:n,flow:d},_dragEnabled:c,selectionMode:m,filterText:h,openedLayers:y,filterPlaceholder:u,messages:g}=this,_=[T("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:r,closed:!e,collapsed:t,collapsible:a,heading:n?g.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!y.length&&!o.length,onCalciteFlowItemClose:()=>this.visible=!1},T("calcite-list",{afterCreate:e=>{this._rootListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{this._rootListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":l,displayMode:A,dragEnabled:c,filterEnabled:s,filterPlaceholder:u,filterProps:E,filterText:s?h:"",group:l,key:"root-list",label:g.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:m,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},i?.toArray().map((e=>this._renderItem(e))),i?.length&&s?T("div",{class:p.filterNoResults,slot:"filter-no-results"},T("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?d?T("calcite-flow",{key:"root-flow"},_):_:null}_renderItem(e,t,i){return T(c,{activeItem:this._activeItem,canMove:this._canMove,css:p,displayMode:A,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=_(i),l=_(e),r=_(t);this.viewModel.moveListItem(s,r,l,o)}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid)f(this.view?.map?.layers,t);else{const i=_(e);if(!i)return;I(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>_(e))).filter(Boolean);i.removeAll(),i.addMany(o)}};e([a()],j.prototype,"_rootListEl",void 0),e([a()],j.prototype,"_activeItem",void 0),e([a()],j.prototype,"_tooltipReferenceMap",void 0),e([a()],j.prototype,"_focusRootFlowItem",void 0),e([a()],j.prototype,"_focusPanelFlowItem",void 0),e([a()],j.prototype,"_focusLayerFlowItem",void 0),e([a()],j.prototype,"_layerListMap",void 0),e([a()],j.prototype,"_totalItems",null),e([a()],j.prototype,"_visibleItems",null),e([a()],j.prototype,"_openedPanelItems",null),e([a()],j.prototype,"_dragEnabled",null),e([a()],j.prototype,"_filterEnabled",null),e([a()],j.prototype,"_renderedOpenLayerFlowItems",null),e([a({readOnly:!0})],j.prototype,"catalogLayerList",void 0),e([a()],j.prototype,"catalogOptions",void 0),e([a()],j.prototype,"collapsed",void 0),e([a()],j.prototype,"dragEnabled",void 0),e([a()],j.prototype,"filterPlaceholder",void 0),e([a()],j.prototype,"filterPredicate",void 0),e([a()],j.prototype,"filterText",void 0),e([a()],j.prototype,"headingLevel",void 0),e([a()],j.prototype,"icon",null),e([a()],j.prototype,"knowledgeGraphOptions",void 0),e([a()],j.prototype,"label",null),e([a()],j.prototype,"layerTablesEnabled",void 0),e([a()],j.prototype,"listItemCanGiveFunction",void 0),e([a()],j.prototype,"listItemCanReceiveFunction",void 0),e([a()],j.prototype,"listItemCreatedFunction",null),e([a()],j.prototype,"mapImageOptions",void 0),e([a(),M("esri/widgets/LayerList/t9n/LayerList")],j.prototype,"messages",void 0),e([a(),M("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([a()],j.prototype,"minDragEnabledItems",void 0),e([a()],j.prototype,"minFilterItems",void 0),e([a({readOnly:!0})],j.prototype,"openedLayers",void 0),e([a({readOnly:!0})],j.prototype,"openedLayerLists",void 0),e([a()],j.prototype,"operationalItems",null),e([a()],j.prototype,"selectedItems",void 0),e([a()],j.prototype,"selectionMode",void 0),e([a({readOnly:!0})],j.prototype,"tableList",void 0),e([a()],j.prototype,"tileOptions",void 0),e([a()],j.prototype,"view",null),e([O("trigger-action"),a({type:m})],j.prototype,"viewModel",void 0),e([a()],j.prototype,"visibilityAppearance",void 0),e([a({type:h,nonNullable:!0})],j.prototype,"visibleElements",void 0),j=e([n("esri.widgets.LayerList")],j);const D=j;export{D 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{generateFillAttributes as e,generateStrokeAttributes as a,renderDef as l,renderShape as r,getBoundingBox as t,computeBBox as s,getTransformMatrix as o}from"../../../../symbols/support/svgUtils.js";import{getCSSFilterFromEffectList as i}from"../../../../symbols/support/utils.js";import{isRTL as n,classes as d}from"../../../support/widgetUtils.js";import{tsx as m}from"../../../support/jsxFactory.js";const b="esri-relationship-ramp",u=`${b}--diamond`,c=`${b}--square`,f="http://www.w3.org/2000/svg",p={diamondContainer:`${u}__container`,diamondLeftCol:`${u}__left-column`,diamondRightCol:`${u}__right-column`,diamondMidCol:`${u}__middle-column`,diamondMidColLabel:`${u}__middle-column--label`,diamondMidColRamp:`${u}__middle-column--ramp`,squareTable:`${c}__table`,squareTableRow:`${c}__table-row`,squareTableCell:`${c}__table-cell`,squareTableLabel:`${c}__table-label`,squareTableLabelLeftBottom:`${c}__table-label--left-bottom`,squareTableLabelRightBottom:`${c}__table-label--right-bottom`,squareTableLabelLeftTop:`${c}__table-label--left-top`,squareTableLabelRightTop:`${c}__table-label--right-top`};function k(e,a,l={}){const{focus:r,labels:t}=e,s=!!r,o=T(e,a,l),i={justifyContent:"center"},b=n(),u=l.key??a;return s?m("div",{class:p.diamondContainer,key:`${u}-container`,styles:i},m("div",{class:p.diamondLeftCol},b?t.right:t.left),m("div",{class:p.diamondMidCol},m("div",{class:p.diamondMidColLabel},t.top),o,m("div",{class:p.diamondMidColLabel},t.bottom)),m("div",{class:p.diamondRightCol},b?t.left:t.right)):m("div",{class:p.squareTable,key:`${u}-container`},m("div",{class:p.squareTableRow},m("div",{class:d(p.squareTableCell,p.squareTableLabel,p.squareTableLabelRightBottom)},b?t.top:t.left),m("div",{class:p.squareTableCell}),m("div",{class:d(p.squareTableCell,p.squareTableLabel,p.squareTableLabelLeftBottom)},b?t.left:t.top)),m("div",{class:p.squareTableRow},m("div",{class:p.squareTableCell}),o,m("div",{class:p.squareTableCell})),m("div",{class:p.squareTableRow},m("div",{class:d(p.squareTableCell,p.squareTableLabel,p.squareTableLabelRightTop)},b?t.right:t.bottom),m("div",{class:p.squareTableCell}),m("div",{class:d(p.squareTableCell,p.squareTableLabel,p.squareTableLabelLeftTop)},b?t.bottom:t.right)))}function h(e,a,l){const r=`${l}_arrowStart`,t=`${l}_arrowEnd`,s="left"===e,o={markerStart:null,markerEnd:null};switch(a){case"HL":s?o.markerStart=`url(#${t})`:o.markerEnd=`url(#${r})`;break;case"LL":o.markerStart=`url(#${t})`;break;case"LH":s?o.markerEnd=`url(#${r})`:o.markerStart=`url(#${t})`;break;default:o.markerEnd=`url(#${r})`}return o}function T(n,d,b={}){const{focus:u,numClasses:c,colors:k,rotation:T}=n,{opacity:_,effectList:q,ariaLabel:$}=b,L=b.size??60,g=!!u,C=Math.sqrt(L**2+L**2)+(g?0:5),v=[],w=[],y=[],x=(L||75)/c;for(let s=0;s<c;s++){const o=s*x;for(let i=0;i<c;i++){const n=i*x,d=e(k[s][i]),m=a(null),b={type:"rect",x:n,y:o,width:x,height:x},u=l(d);u&&v.push(u);const c=r(b,d.fill,m,null);c&&w.push(c),y.push(t(b))}}const R=10,E=15,M=15,S=10;let j=null;g||(j="margin: -15px -15px -18px -15px");const B=h("left",u,d),H=h("right",u,d),U=s(y),W=o(U,C,C,0,!1,T,!1),X=o(U,C,C,0,!1,g?-45:null,!1),Y={filter:i(q)??void 0,opacity:null==_?"":`${_}`};return m("div",{class:g?p.diamondMidColRamp:p.squareTableCell,styles:Y},m("svg",{"aria-label":$,focusable:!1,height:C,role:"image",style:j,width:C,xmlns:f},m("defs",null,m("marker",{id:`${d}_arrowStart`,markerHeight:"10",markerUnits:"strokeWidth",markerWidth:"10",orient:"auto",refX:"5",refY:"5"},m("polyline",{fill:"none",points:"0,0 5,5 0,10",stroke:"#555555","stroke-width":"1"})),m("marker",{id:`${d}_arrowEnd`,markerHeight:"10",markerUnits:"strokeWidth",markerWidth:"10",orient:"auto",refX:"0",refY:"5"},m("polyline",{fill:"none",points:"5,0 0,5 5,10",stroke:"#555555","stroke-width":"1"})),v),m("g",{transform:W},w),m("g",{transform:X},m("line",{fill:"none","marker-end":B.markerEnd,"marker-start":B.markerStart,stroke:"#555555","stroke-width":"1",x1:-R,x2:-R,y1:L-E,y2:E}),m("line",{fill:"none","marker-end":H.markerEnd,"marker-start":H.markerStart,stroke:"#555555","stroke-width":"1",x1:M,x2:L-M,y1:L+S,y2:L+S}))))}export{k as renderRelationshipRamp};
5
+ import{generateFillAttributes as e,generateStrokeAttributes as a,renderDef as l,renderShape as r,getBoundingBox as t,computeBBox as s,getTransformMatrix as o}from"../../../../symbols/support/svgUtils.js";import{getCSSFilterFromEffectList as i}from"../../../../symbols/support/utils.js";import{isRTL as n,classes as d}from"../../../support/widgetUtils.js";import{tsx as m}from"../../../support/jsxFactory.js";const b="esri-relationship-ramp",u=`${b}--diamond`,c=`${b}--square`,f="http://www.w3.org/2000/svg",p={diamondContainer:`${u}__container`,diamondLeftCol:`${u}__left-column`,diamondRightCol:`${u}__right-column`,diamondMidCol:`${u}__middle-column`,diamondMidColLabel:`${u}__middle-column--label`,diamondMidColRamp:`${u}__middle-column--ramp`,squareTable:`${c}__table`,squareTableRow:`${c}__table-row`,squareTableCell:`${c}__table-cell`,squareTableLabel:`${c}__table-label`,squareTableLabelLeftBottom:`${c}__table-label--left-bottom`,squareTableLabelRightBottom:`${c}__table-label--right-bottom`,squareTableLabelLeftTop:`${c}__table-label--left-top`,squareTableLabelRightTop:`${c}__table-label--right-top`};function k(e,a,l={}){const{focus:r,labels:t}=e,s=!!r,o=T(e,a,l),i={justifyContent:"center"},b=n(),u=l.key??a;return s?m("div",{class:p.diamondContainer,key:`${u}-container`,styles:i},m("div",{class:p.diamondLeftCol},b?t.right:t.left),m("div",{class:p.diamondMidCol},m("div",{class:p.diamondMidColLabel},t.top),o,m("div",{class:p.diamondMidColLabel},t.bottom)),m("div",{class:p.diamondRightCol},b?t.left:t.right)):m("div",{class:p.squareTable,key:`${u}-container`},m("div",{class:p.squareTableRow},m("div",{class:d(p.squareTableCell,p.squareTableLabel,p.squareTableLabelRightBottom)},b?t.top:t.left),m("div",{class:p.squareTableCell}),m("div",{class:d(p.squareTableCell,p.squareTableLabel,p.squareTableLabelLeftBottom)},b?t.left:t.top)),m("div",{class:p.squareTableRow},m("div",{class:p.squareTableCell}),o,m("div",{class:p.squareTableCell})),m("div",{class:p.squareTableRow},m("div",{class:d(p.squareTableCell,p.squareTableLabel,p.squareTableLabelRightTop)},b?t.right:t.bottom),m("div",{class:p.squareTableCell}),m("div",{class:d(p.squareTableCell,p.squareTableLabel,p.squareTableLabelLeftTop)},b?t.bottom:t.right)))}function h(e,a,l){const r=`${l}_arrowStart`,t=`${l}_arrowEnd`,s="left"===e,o={markerStart:null,markerEnd:null};switch(a){case"HL":s?o.markerStart=`url(#${t})`:o.markerEnd=`url(#${r})`;break;case"LL":o.markerStart=`url(#${t})`;break;case"LH":s?o.markerEnd=`url(#${r})`:o.markerStart=`url(#${t})`;break;default:o.markerEnd=`url(#${r})`}return o}function T(n,d,b={}){const{focus:u,numClasses:c,colors:k,rotation:T}=n,{opacity:_,effectList:q,ariaLabel:$}=b,L=b.size??60,g=!!u,C=Math.sqrt(L**2+L**2)+(g?0:5),v=[],w=[],y=[],x=(L||75)/c;for(let s=0;s<c;s++){const o=s*x;for(let i=0;i<c;i++){const n=i*x,d=e(k[s][i]),m=a(null),b={type:"rect",x:n,y:o,width:x,height:x},u=l(d);u&&v.push(u);const c=r(b,d.fill,m,null);c&&w.push(c),y.push(t(b))}}const R=15,E=15,M=10;let S=null;g||(S="margin: -15px -15px -18px -15px");const j=h("left",u,d),B=h("right",u,d),H=s(y),U=o(H,C,C,0,!1,T,!1),W=o(H,C,C,0,!1,g?-45:null,!1),X={filter:i(q)??void 0,opacity:null==_?"":`${_}`};return m("div",{class:g?p.diamondMidColRamp:p.squareTableCell,styles:X},m("svg",{"aria-label":$,focusable:!1,height:C,role:"image",style:S,width:C,xmlns:f},m("defs",null,m("marker",{id:`${d}_arrowStart`,markerHeight:"10",markerUnits:"strokeWidth",markerWidth:"10",orient:"auto",refX:"5",refY:"5"},m("polyline",{fill:"none",points:"0,0 5,5 0,10",stroke:"#555555","stroke-width":"1"})),m("marker",{id:`${d}_arrowEnd`,markerHeight:"10",markerUnits:"strokeWidth",markerWidth:"10",orient:"auto",refX:"0",refY:"5"},m("polyline",{fill:"none",points:"5,0 0,5 5,10",stroke:"#555555","stroke-width":"1"})),v),m("g",{transform:U},w),m("g",{transform:W},m("line",{fill:"none","marker-end":j.markerEnd,"marker-start":j.markerStart,stroke:"#555555","stroke-width":"1",x1:-10,x2:-10,y1:L-R,y2:R}),m("line",{fill:"none","marker-end":B.markerEnd,"marker-start":B.markerStart,stroke:"#555555","stroke-width":"1",x1:E,x2:L-E,y1:L+M,y2:L+M}))))}export{k as renderRelationshipRamp};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../Graphic.js";import"../../symbols.js";import e from"../../core/Collection.js";import{rad2deg as r,deg2rad as o}from"../../core/mathUtils.js";import s from"../../geometry/Mesh.js";import m from"../../geometry/support/MeshMaterial.js";import n from"../../geometry/support/MeshTexture.js";import{defaultImageSphereSize as i,defaultImageSphereCenter as u}from"./constants.js";import a from"../../symbols/MeshSymbol3D.js";import c from"../../symbols/FillSymbol3DLayer.js";function l(t,e=u,r=i){const o=e.clone();o.z=-i/2;const a=s.createSphere(o,{size:r,densificationFactor:2,vertexSpace:"georeferenced",material:new m({colorTexture:new n({data:t})})});if(a.components[0].trustSourceNormals=!0,a.vertexAttributes.uv){const t=a.vertexAttributes.uv.length??0;for(let e=0;e<t;e++)a.vertexAttributes.uv[2*e+0]=1-a.vertexAttributes.uv[2*e+0],a.vertexAttributes.uv[2*e+1]=a.vertexAttributes.uv[2*e+1]}return a.centerAt(o),a}function p(r){return new t({geometry:r,symbol:new a({symbolLayers:new e([new c])})})}function f(t,e){return 2*r(Math.atan(Math.tan(o(t/2))*Math.sqrt(e**2+1)))}export{l as createImageSphere,f as findDiagonalFOV,p as meshToGraphic};
5
+ import t from"../../Graphic.js";import"../../symbols.js";import e from"../../core/Collection.js";import{rad2deg as r,deg2rad as o}from"../../core/mathUtils.js";import s from"../../geometry/Mesh.js";import m from"../../geometry/support/MeshMaterial.js";import n from"../../geometry/support/MeshTexture.js";import{defaultImageSphereCenter as i,defaultImageSphereSize as u}from"./constants.js";import a from"../../symbols/MeshSymbol3D.js";import c from"../../symbols/FillSymbol3DLayer.js";function l(t,e=i,r=u){const o=e.clone();o.z=-500;const a=s.createSphere(o,{size:r,densificationFactor:2,vertexSpace:"georeferenced",material:new m({colorTexture:new n({data:t})})});if(a.components[0].trustSourceNormals=!0,a.vertexAttributes.uv){const t=a.vertexAttributes.uv.length??0;for(let e=0;e<t;e++)a.vertexAttributes.uv[2*e+0]=1-a.vertexAttributes.uv[2*e+0],a.vertexAttributes.uv[2*e+1]=a.vertexAttributes.uv[2*e+1]}return a.centerAt(o),a}function p(r){return new t({geometry:r,symbol:new a({symbolLayers:new e([new c])})})}function f(t,e){return 2*r(Math.atan(Math.tan(o(t/2))*Math.sqrt(e**2+1)))}export{l as createImageSphere,f as findDiagonalFOV,p as meshToGraphic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import i from"../../core/Accessor.js";import{watch as a,initial as l}from"../../core/reactiveUtils.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./ScaleRanges.js";import n from"../Slider/SliderViewModel.js";let c=class extends i{constructor(e){super(e),this.layer=null,this.mode="range",this.scaleRanges=r.fromScaleRange({minScale:0,maxScale:0}),this.sliderViewModel=(()=>{const{max:e}=this._getSliderIndexRange(this.scaleRanges.length-1);return new n({precision:10,min:0,max:e,values:[0,e]})})()}initialize(){this.addHandles([a((()=>this.layer),(e=>e?.load().catch((()=>{})))),a((()=>this.mode),(e=>{"range"===e&&1===this.sliderViewModel.values?.length?this.sliderViewModel.values=[this.sliderViewModel.min,this.sliderViewModel.values[0]]:2===this.sliderViewModel.values?.length&&("min-scale-only"===e?this.sliderViewModel.values=[this.sliderViewModel.values[0]]:"max-scale-only"===e&&(this.sliderViewModel.values=[this.sliderViewModel.values[1]]))})),a((()=>({loaded:this.layer?.loaded,ready:this.view?.ready})),(({loaded:e,ready:i})=>{if(!e||!i)return;if(this._hasTiledLayer()){const e=this._getLayerResampling()?void 0:this.mapScaleToSlider(this._getTiledLayerMaxScale()),i=this.mapScaleToSlider(this._getTiledLayerMinScale());this.sliderViewModel.effectiveMax=e,this.sliderViewModel.effectiveMin=i}else{const e=this.layer&&"maxScaleRange"in this.layer?this.layer.maxScaleRange:null,{minScale:i=0,maxScale:a=0}=e??{};this.sliderViewModel.effectiveMax=0===a?void 0:this.mapScaleToSlider(a),this.sliderViewModel.effectiveMin=0===i?void 0:this.mapScaleToSlider(i)}const a=this.layer;a&&"minScale"in a&&"maxScale"in a?(this.minScale=a.minScale,this.maxScale=a.maxScale):(this.minScale=void 0,this.maxScale=void 0)}),l)])}get effectiveMaxScale(){return 0===this.maxScale?this.maxScaleLimit:this.maxScale}get effectiveMinScale(){return 0===this.minScale?this.minScaleLimit:this.minScale}get effectiveMaxScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.effectiveMax??this.sliderViewModel.max)}get effectiveMinScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.effectiveMin??this.sliderViewModel.min)}get maxScale(){return this._getScale("max")}set maxScale(e){this._setMaxScaleOnSlider(e)}get maxScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.max)}set maxScaleLimit(e){this._setSliderRange({maxScale:e,minScale:this.minScaleLimit})}get minScale(){return this._getScale("min")}set minScale(e){this._setMinScaleOnSlider(e)}get minScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.min)}set minScaleLimit(e){this._setSliderRange({maxScale:this.maxScaleLimit,minScale:e})}get state(){const{view:e,layer:i}=this;return!e&&!i||!e&&i?.loaded||!i&&e?.ready||e&&e.ready&&i?.loaded?"ready":"disabled"}set view(e){this._set("view",e)}mapScaleToSlider(e){const i=this.scaleRanges.scaleToRangeIndex(e),a=this.scaleRanges.findScaleRangeByIndex(i),{maxScale:l,minScale:t}=a,{max:s,min:r}=this._getSliderIndexRange(i);return this._mapToRange(e,t,l,r,s)}mapSliderToScale(e){const i=this.scaleRanges.findScaleRangeByIndex(e),{maxScale:a,minScale:l}=i,{max:t,min:s}=this._getSliderIndexRange(e);return this._mapToRange(e,s,t,l,a)}_setSliderRange(e){this.scaleRanges=r.fromScaleRange(e);const{max:i}=this._getSliderIndexRange(this.scaleRanges.length-1);this.sliderViewModel.max=i,this.sliderViewModel.min=0,this.notifyChange("maxScaleLimit"),this.notifyChange("minScaleLimit")}_getSliderIndexRange(e){const i=Math.floor(e);return{min:i,max:i+.99999}}_mapToRange(e,i,a,l,t){return l+(e-i)*(t-l)/(a-i)}_getSliderValue(e){const{min:i,max:a,values:l}=this.sliderViewModel,[t,s]=l;switch(this.mode){case"max-scale-only":return"min"===e?i:t;case"min-scale-only":return"min"===e?t:a;default:return"min"===e?t??i:s??a}}_getScale(e){const i=this.mapSliderToScale(this._getSliderValue(e));return this._normalizeScale(e,i)}_setMaxScaleOnSlider(e){const{scaleRanges:i,sliderViewModel:a}=this;if(void 0!==e){const l=this.mapScaleToSlider(this._constrainMaxScaleToLayer(i.clampMaxScale(e)));switch(this.mode){case"range":a.values=[a.values[0],l];break;case"max-scale-only":a.values=[l]}}}_setMinScaleOnSlider(e){const{scaleRanges:i,sliderViewModel:a}=this;if(void 0!==e){const l=this.mapScaleToSlider(this._constrainMinScaleToLayer(i.clampMinScale(e)));switch(this.mode){case"range":a.values=[l,a.values[1]];break;case"min-scale-only":a.values=[l]}}}_constrainMinScaleToLayer(e){const{scaleRanges:i}=this;if(this._hasTiledLayer()){const{firstRange:a}=i,l=this._getTiledLayerMinScale(),t=.85;e=this._mapToRange(e,a.maxScale,a.minScale,0,1)>t||e>l?l:e}return e}_constrainMaxScaleToLayer(e){if(this._hasTiledLayer()&&!this._getLayerResampling()){const i=this._getTiledLayerMaxScale();e=e<i?i:e}return e}_normalizeScale(e,i){const a="max"===e?"maxScale":"minScale",l=this._hasTiledLayer()?"min"===e?this._getTiledLayerMinScale():this._getTiledLayerMaxScale():this.scaleRanges[a],t=this._hasTiledLayer()?"min"===e?this._getTiledLayerRealMinScale():this._getTiledLayerRealMaxScale():l,s=1e-6,r=0===i||t===i||Math.abs(t-i)<=s;return Number((r?0:i).toFixed(6))}_getLayerLODS(){if(!this.layer?.loaded||!("tileInfo"in this.layer))return null;return"imagery-tile"===this.layer?.type&&"Raster"===this.layer.raster?.tileType?null:this.layer.tileInfo?.lods}_getLayerResampling(){return!!this.layer?.loaded&&(!("resampling"in this.layer)||this.layer.resampling)}_getTiledLayerMinScale(){const e=this._getLayerLODS();return this.scaleRanges.clampMinScale(e[0].scale)}_getTiledLayerMaxScale(){const e=this._getLayerLODS();return e[e.length-1].scale}_getTiledLayerRealMinScale(){const e=this._getLayerLODS(),i=this.layer,a=i&&"sourceJSON"in i?i.sourceJSON?.tileInfo?.lods??e:e;return this.scaleRanges.clampMinScale(a[0].scale)}_getTiledLayerRealMaxScale(){const e=this._getLayerLODS(),i=this.layer,a=i&&"sourceJSON"in i?i.sourceJSON?.tileInfo?.lods??e:e;return a[a.length-1].scale}_hasTiledLayer(){return!!this._getLayerLODS()}};e([t({readOnly:!0})],c.prototype,"effectiveMaxScale",null),e([t({readOnly:!0})],c.prototype,"effectiveMinScale",null),e([t()],c.prototype,"effectiveMaxScaleLimit",null),e([t()],c.prototype,"effectiveMinScaleLimit",null),e([t()],c.prototype,"layer",void 0),e([t()],c.prototype,"maxScale",null),e([t()],c.prototype,"maxScaleLimit",null),e([t()],c.prototype,"mode",void 0),e([t()],c.prototype,"minScale",null),e([t()],c.prototype,"minScaleLimit",null),e([t()],c.prototype,"scaleRanges",void 0),e([t()],c.prototype,"sliderViewModel",void 0),e([t({readOnly:!0})],c.prototype,"state",null),e([t()],c.prototype,"view",null),c=e([s("esri.widgets.ScaleRangeSlider.ScaleRangeSliderViewModel")],c);const o=c;export{o as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import i from"../../core/Accessor.js";import{watch as a,initial as l}from"../../core/reactiveUtils.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./ScaleRanges.js";import n from"../Slider/SliderViewModel.js";let c=class extends i{constructor(e){super(e),this.layer=null,this.mode="range",this.scaleRanges=r.fromScaleRange({minScale:0,maxScale:0}),this.sliderViewModel=(()=>{const{max:e}=this._getSliderIndexRange(this.scaleRanges.length-1);return new n({precision:10,min:0,max:e,values:[0,e]})})()}initialize(){this.addHandles([a((()=>this.layer),(e=>e?.load().catch((()=>{})))),a((()=>this.mode),(e=>{"range"===e&&1===this.sliderViewModel.values?.length?this.sliderViewModel.values=[this.sliderViewModel.min,this.sliderViewModel.values[0]]:2===this.sliderViewModel.values?.length&&("min-scale-only"===e?this.sliderViewModel.values=[this.sliderViewModel.values[0]]:"max-scale-only"===e&&(this.sliderViewModel.values=[this.sliderViewModel.values[1]]))})),a((()=>({loaded:this.layer?.loaded,ready:this.view?.ready})),(({loaded:e,ready:i})=>{if(!e||!i)return;if(this._hasTiledLayer()){const e=this._getLayerResampling()?void 0:this.mapScaleToSlider(this._getTiledLayerMaxScale()),i=this.mapScaleToSlider(this._getTiledLayerMinScale());this.sliderViewModel.effectiveMax=e,this.sliderViewModel.effectiveMin=i}else{const e=this.layer&&"maxScaleRange"in this.layer?this.layer.maxScaleRange:null,{minScale:i=0,maxScale:a=0}=e??{};this.sliderViewModel.effectiveMax=0===a?void 0:this.mapScaleToSlider(a),this.sliderViewModel.effectiveMin=0===i?void 0:this.mapScaleToSlider(i)}const a=this.layer;a&&"minScale"in a&&"maxScale"in a?(this.minScale=a.minScale,this.maxScale=a.maxScale):(this.minScale=void 0,this.maxScale=void 0)}),l)])}get effectiveMaxScale(){return 0===this.maxScale?this.maxScaleLimit:this.maxScale}get effectiveMinScale(){return 0===this.minScale?this.minScaleLimit:this.minScale}get effectiveMaxScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.effectiveMax??this.sliderViewModel.max)}get effectiveMinScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.effectiveMin??this.sliderViewModel.min)}get maxScale(){return this._getScale("max")}set maxScale(e){this._setMaxScaleOnSlider(e)}get maxScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.max)}set maxScaleLimit(e){this._setSliderRange({maxScale:e,minScale:this.minScaleLimit})}get minScale(){return this._getScale("min")}set minScale(e){this._setMinScaleOnSlider(e)}get minScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.min)}set minScaleLimit(e){this._setSliderRange({maxScale:this.maxScaleLimit,minScale:e})}get state(){const{view:e,layer:i}=this;return!e&&!i||!e&&i?.loaded||!i&&e?.ready||e&&e.ready&&i?.loaded?"ready":"disabled"}set view(e){this._set("view",e)}mapScaleToSlider(e){const i=this.scaleRanges.scaleToRangeIndex(e),a=this.scaleRanges.findScaleRangeByIndex(i),{maxScale:l,minScale:t}=a,{max:s,min:r}=this._getSliderIndexRange(i);return this._mapToRange(e,t,l,r,s)}mapSliderToScale(e){const i=this.scaleRanges.findScaleRangeByIndex(e),{maxScale:a,minScale:l}=i,{max:t,min:s}=this._getSliderIndexRange(e);return this._mapToRange(e,s,t,l,a)}_setSliderRange(e){this.scaleRanges=r.fromScaleRange(e);const{max:i}=this._getSliderIndexRange(this.scaleRanges.length-1);this.sliderViewModel.max=i,this.sliderViewModel.min=0,this.notifyChange("maxScaleLimit"),this.notifyChange("minScaleLimit")}_getSliderIndexRange(e){const i=Math.floor(e);return{min:i,max:i+.99999}}_mapToRange(e,i,a,l,t){return l+(e-i)*(t-l)/(a-i)}_getSliderValue(e){const{min:i,max:a,values:l}=this.sliderViewModel,[t,s]=l;switch(this.mode){case"max-scale-only":return"min"===e?i:t;case"min-scale-only":return"min"===e?t:a;default:return"min"===e?t??i:s??a}}_getScale(e){const i=this.mapSliderToScale(this._getSliderValue(e));return this._normalizeScale(e,i)}_setMaxScaleOnSlider(e){const{scaleRanges:i,sliderViewModel:a}=this;if(void 0!==e){const l=this.mapScaleToSlider(this._constrainMaxScaleToLayer(i.clampMaxScale(e)));switch(this.mode){case"range":a.values=[a.values[0],l];break;case"max-scale-only":a.values=[l]}}}_setMinScaleOnSlider(e){const{scaleRanges:i,sliderViewModel:a}=this;if(void 0!==e){const l=this.mapScaleToSlider(this._constrainMinScaleToLayer(i.clampMinScale(e)));switch(this.mode){case"range":a.values=[l,a.values[1]];break;case"min-scale-only":a.values=[l]}}}_constrainMinScaleToLayer(e){const{scaleRanges:i}=this;if(this._hasTiledLayer()){const{firstRange:a}=i,l=this._getTiledLayerMinScale(),t=.85;e=this._mapToRange(e,a.maxScale,a.minScale,0,1)>t||e>l?l:e}return e}_constrainMaxScaleToLayer(e){if(this._hasTiledLayer()&&!this._getLayerResampling()){const i=this._getTiledLayerMaxScale();e=e<i?i:e}return e}_normalizeScale(e,i){const a="max"===e?"maxScale":"minScale",l=this._hasTiledLayer()?"min"===e?this._getTiledLayerMinScale():this._getTiledLayerMaxScale():this.scaleRanges[a],t=this._hasTiledLayer()?"min"===e?this._getTiledLayerRealMinScale():this._getTiledLayerRealMaxScale():l,s=1e-6,r=0===i||t===i||Math.abs(t-i)<=s;return Number((r?0:i).toFixed(6))}_getLayerLODS(){const{layer:e}=this;if(!e?.loaded||!("tileInfo"in e))return null;return"wcs"===e.type||"imagery-tile"===e.type&&"Raster"===e.raster?.tileType?null:e.tileInfo?.lods}_getLayerResampling(){return!!this.layer?.loaded&&(!("resampling"in this.layer)||this.layer.resampling)}_getTiledLayerMinScale(){const e=this._getLayerLODS();return this.scaleRanges.clampMinScale(e[0].scale)}_getTiledLayerMaxScale(){const e=this._getLayerLODS();return e[e.length-1].scale}_getTiledLayerRealMinScale(){const e=this._getLayerLODS(),i=this.layer,a=i&&"sourceJSON"in i?i.sourceJSON?.tileInfo?.lods??e:e;return this.scaleRanges.clampMinScale(a[0].scale)}_getTiledLayerRealMaxScale(){const e=this._getLayerLODS(),i=this.layer,a=i&&"sourceJSON"in i?i.sourceJSON?.tileInfo?.lods??e:e;return a[a.length-1].scale}_hasTiledLayer(){return!!this._getLayerLODS()}};e([t({readOnly:!0})],c.prototype,"effectiveMaxScale",null),e([t({readOnly:!0})],c.prototype,"effectiveMinScale",null),e([t()],c.prototype,"effectiveMaxScaleLimit",null),e([t()],c.prototype,"effectiveMinScaleLimit",null),e([t()],c.prototype,"layer",void 0),e([t()],c.prototype,"maxScale",null),e([t()],c.prototype,"maxScaleLimit",null),e([t()],c.prototype,"mode",void 0),e([t()],c.prototype,"minScale",null),e([t()],c.prototype,"minScaleLimit",null),e([t()],c.prototype,"scaleRanges",void 0),e([t()],c.prototype,"sliderViewModel",void 0),e([t({readOnly:!0})],c.prototype,"state",null),e([t()],c.prototype,"view",null),c=e([s("esri.widgets.ScaleRangeSlider.ScaleRangeSliderViewModel")],c);const o=c;export{o as default};