@esri/solutions-components 0.11.17 → 0.11.18

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 (73) hide show
  1. package/dist/cjs/card-manager_3.cjs.entry.js +116 -137
  2. package/dist/cjs/create-feature_4.cjs.entry.js +55 -9
  3. package/dist/cjs/create-related-feature_3.cjs.entry.js +1 -1
  4. package/dist/cjs/crowdsource-manager.cjs.entry.js +32 -19
  5. package/dist/cjs/crowdsource-reporter.cjs.entry.js +1 -1
  6. package/dist/cjs/{downloadUtils-88ec0e88.js → downloadUtils-9abff913.js} +1 -1
  7. package/dist/cjs/feature-list.cjs.entry.js +3 -3
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/map-layer-picker.cjs.entry.js +1 -1
  10. package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
  11. package/dist/cjs/{mapViewUtils-319df9ec.js → mapViewUtils-4ea7216c.js} +0 -44
  12. package/dist/cjs/{popupUtils-ca1127aa.js → popupUtils-fc7557da.js} +1 -1
  13. package/dist/cjs/public-notification.cjs.entry.js +2 -2
  14. package/dist/cjs/solution-item-accordion.cjs.entry.js +6 -3
  15. package/dist/cjs/solutions-components.cjs.js +1 -1
  16. package/dist/collection/assets/t9n/crowdsource-manager/resources.json +4 -1
  17. package/dist/collection/assets/t9n/crowdsource-manager/resources_en.json +4 -1
  18. package/dist/collection/components/card-manager/card-manager.js +1 -1
  19. package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +23 -0
  20. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +32 -18
  21. package/dist/collection/components/info-card/info-card.js +88 -7
  22. package/dist/collection/components/layer-table/layer-table.js +147 -137
  23. package/dist/collection/components/solution-item-accordion/solution-item-accordion.js +11 -4
  24. package/dist/components/card-manager2.js +1 -1
  25. package/dist/components/crowdsource-manager.js +33 -19
  26. package/dist/components/info-card2.js +54 -6
  27. package/dist/components/layer-table2.js +116 -136
  28. package/dist/components/map-select-tools2.js +1 -1
  29. package/dist/components/queryUtils.js +1 -43
  30. package/dist/components/refine-selection2.js +1 -1
  31. package/dist/components/solution-item-accordion.js +6 -3
  32. package/dist/esm/card-manager_3.entry.js +116 -137
  33. package/dist/esm/create-feature_4.entry.js +55 -9
  34. package/dist/esm/create-related-feature_3.entry.js +1 -1
  35. package/dist/esm/crowdsource-manager.entry.js +32 -19
  36. package/dist/esm/crowdsource-reporter.entry.js +1 -1
  37. package/dist/esm/{downloadUtils-22a8f2d8.js → downloadUtils-36d854d2.js} +1 -1
  38. package/dist/esm/feature-list.entry.js +3 -3
  39. package/dist/esm/loader.js +1 -1
  40. package/dist/esm/map-layer-picker.entry.js +1 -1
  41. package/dist/esm/map-select-tools_3.entry.js +2 -2
  42. package/dist/esm/{mapViewUtils-a854e298.js → mapViewUtils-9da9be1c.js} +1 -43
  43. package/dist/esm/{popupUtils-1314cb13.js → popupUtils-64d25cb0.js} +1 -1
  44. package/dist/esm/public-notification.entry.js +2 -2
  45. package/dist/esm/solution-item-accordion.entry.js +6 -3
  46. package/dist/esm/solutions-components.js +1 -1
  47. package/dist/solutions-components/assets/t9n/crowdsource-manager/resources.json +4 -1
  48. package/dist/solutions-components/assets/t9n/crowdsource-manager/resources_en.json +4 -1
  49. package/dist/solutions-components/{p-43d9bb7d.entry.js → p-055706e3.entry.js} +1 -1
  50. package/dist/solutions-components/{p-8ea0a36a.entry.js → p-06970873.entry.js} +1 -1
  51. package/dist/solutions-components/{p-bf2598f8.entry.js → p-3c43839b.entry.js} +1 -1
  52. package/dist/solutions-components/{p-4f514c6d.js → p-6eab9d1f.js} +1 -1
  53. package/dist/solutions-components/{p-a003600b.entry.js → p-72ae3bf0.entry.js} +1 -1
  54. package/dist/solutions-components/p-777ed6b0.entry.js +6 -0
  55. package/dist/solutions-components/{p-5ea1e18b.entry.js → p-8b5c3c9f.entry.js} +1 -1
  56. package/dist/solutions-components/{p-1fe3577a.entry.js → p-a44815ea.entry.js} +1 -1
  57. package/dist/solutions-components/p-b1bd3028.entry.js +6 -0
  58. package/dist/solutions-components/{p-3c3aecdd.js → p-d0d21a1f.js} +1 -1
  59. package/dist/solutions-components/{p-952da957.js → p-dcd2f00b.js} +2 -2
  60. package/dist/solutions-components/{p-bc2548ba.entry.js → p-e2270562.entry.js} +1 -1
  61. package/dist/solutions-components/p-e90c0e26.entry.js +6 -0
  62. package/dist/solutions-components/solutions-components.esm.js +1 -1
  63. package/dist/solutions-components_commit.txt +6 -6
  64. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +11 -7
  65. package/dist/types/components/info-card/info-card.d.ts +16 -0
  66. package/dist/types/components/layer-table/layer-table.d.ts +32 -21
  67. package/dist/types/components/solution-item-accordion/solution-item-accordion.d.ts +1 -1
  68. package/dist/types/components.d.ts +19 -2
  69. package/dist/types/preact.d.ts +2 -1
  70. package/package.json +1 -1
  71. package/dist/solutions-components/p-87919d6d.entry.js +0 -6
  72. package/dist/solutions-components/p-b37be371.entry.js +0 -6
  73. package/dist/solutions-components/p-ce8377c6.entry.js +0 -6
@@ -3,4 +3,4 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{r as t,c as e,g as i,h as s,H as a,F as h}from"./p-1b0588d2.js";import{l,g as o}from"./p-ee2cbba0.js";import{g as n,a as r,b as c,c as d,h as u,d as p,q as m}from"./p-952da957.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";const f=class{constructor(i){t(this,i),this.togglePanel=e(this,"togglePanel",7)}get el(){return i(this)}center;commentButtonText;commentSubmittedMessage;defaultWebmap="";description;enableAnonymousAccess;enableAnonymousComments;enableComments;enableHome=!0;enableLogin;enableNewReports;enableSearch=!0;enableZoom=!0;isMobile;layerExpressions=[];layerId;level;locale;loginTitle;mapInfos=[];mapView;objectId;reportButtonText;reportingOptions;reportsHeader;reportSubmittedMessage;searchConfiguration;showComments;showUserImageInCommentsList=!1;showFeatureSymbol=!1;showMyReportsOnly=!1;theme="light";zoomToScale;floorLevel;showFullCommentTitle=!0;_featureCreationFailedErrorMsg;_filterActive=!1;_flowItems=[];_hasValidLayers=!1;_mapInfo;_reportSubmitted=!1;_selectedLayerName;_showSubmitCancelButton=!1;_showLoadingIndicator=!1;_sidePanelCollapsed=!1;_translations;_updatedProgressBarStatus=25;_updatedSorting;_updatedSortOption="sortNewest";_commentSubmitted=!1;_addingCommentFailed=!1;_createFeature;_currentFeatureId;_defaultCenter;_defaultLevel;_editableLayerIds;_featureDetails;_featureList;_currentFeature;_selectedRelatedFeature;_relatedTable;_filterList;_highlightHandle;_layerList;_createRelatedFeature;_layers;_mapChange;_mapClickHandle;reactiveUtils;FeatureFilter;_selectedFeature;_selectedFeatureIndex;_selectedLayerId;_shareNode;_urlParamsLoaded;_validLayers;_nonVisibleValidLayers;_selectedLayer;_layerItemsHash;_showFullPanel;_floorExpression;_formElements=[];_prevSelectedLayerId;_currentLayerExpressions;_initDefExpressions;_t9nLayerExpressions;async isMobileWatchHandler(){this.updatePanelState(!1,this._showFullPanel)}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(){await this.mapView.when((async()=>{this.setInitExpressions(),await this.setMapView()}))}async floorLevelWatchHandler(){if(this._editableLayerIds)for(const t of this._editableLayerIds){const e=await n(this.mapView,t);e.floorInfo?.floorField&&this._updateFloorDefinitionExpression(e)}"layer-list"===this._flowItems[this._flowItems.length-1]&&this._layerList&&await this._layerList.refresh(),this._featureList&&this._featureList.refresh(),this._createFeature&&this._createFeature.refresh(this.floorLevel)}async showMyReportsOnlyWatchHandler(){this._editableLayerIds&&(await this._updateFeatures(),setTimeout((()=>{"layer-list"===this._flowItems[this._flowItems.length-1]&&this._layerList&&this._layerList.refresh(),this._featureList&&this._featureList.refresh()}),50))}async layerExpressionsWatchHandler(){this.resetFilterList(),await this.handleSelectedLayersFilter(),await(this._featureList?.refresh())}async showFeatureSymbolWatchHandler(){await(this._featureList?.refresh())}async updateLayerExpressionsT9n(t){if(this._t9nLayerExpressions=t||this.layerExpressions,null!=this._filterList)await this._filterList.handleUpdatingT9nData(this._t9nLayerExpressions);else if(null!=this._currentLayerExpressions){const t=structuredClone(this._currentLayerExpressions);this.handleLayerExpressionsT9n(t,this._t9nLayerExpressions),this._currentLayerExpressions=t}return Promise.resolve()}togglePanel;async componentWillLoad(){this._urlParamsLoaded=!1,await this._initModules(),await this._getTranslations(),await(this.mapView?.when((async()=>{this._layers=this.reportingOptions?Object.keys(this.reportingOptions).filter((t=>this.reportingOptions[t].visible)):[],this.setInitExpressions(),await this.setMapView()})))}componentWillRender(){this._flowItems.includes("filter-panel")&&this._filterList?.updateInitDefExpressions({initDefExpressions:this._initDefExpressions})}render(){const t="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return s(a,{key:"03d613fe8f275852672fb546ceb4449fb82580c0"},this._reportSubmitted&&s("calcite-alert",{key:"969a66978549d6993b1e4fce87bbd2387858cdf8","auto-close":!0,class:t+" report-submitted-msg",icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._reportSubmitted=!1},open:!0,placement:"top"},s("div",{key:"60ae42443e09a97d97a46bba07b1ea010b382348",slot:"message"},this.reportSubmittedMessage?this.reportSubmittedMessage:this._translations.submitMsg)),this._featureCreationFailedErrorMsg&&s("calcite-alert",{key:"bf6c346cf976a4b84da3553230239665c712e2b6","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._featureCreationFailedErrorMsg=""},open:!0,placement:"top"},s("div",{key:"1f9560e18d802a15bcb3e8ea9f05837a4a6fb8aa",slot:"title"},this._translations.error),s("div",{key:"1f5ef09cbf94996eeb5783211ed1542a5cf53e93",slot:"message"},this._featureCreationFailedErrorMsg)),this._commentSubmitted&&s("calcite-alert",{key:"15538e8faabbec476d7586dcc4152b422404c23f","auto-close":!0,class:"report-submitted "+t,icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._commentSubmitted=!1},open:!0,placement:"top"},s("div",{key:"925a9a243a79dfb66554a9a51f24396ca2b71c98",slot:"message"},this.commentSubmittedMessage||this._translations.commentSubmittedMsg)),this._addingCommentFailed&&s("calcite-alert",{key:"62c63d3b1c51bdc7879e815e2b2f4d3c4d039c4c","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._addingCommentFailed=!1},open:!0,placement:"top"},s("div",{key:"971f07331a8689b859f2cedc96ba3589a3ad3e16",slot:"title"},this._translations.error),s("div",{key:"1627f1ab5c4a4aceb7bdb70471aed6b8ca6d67b8",slot:"message"},this._translations.addingCommentFailedMsg)),s("div",{key:"b3257ba523357b4444ce7da7d13a86f6b71185d9"},s("calcite-shell",{key:"35fc5a814528bb0acc22919839719bb4349e9ae4","content-behind":!0},this._getReporter())))}async _initModules(){const[t,e]=await l(["esri/core/reactiveUtils","esri/layers/support/FeatureFilter"]);this.reactiveUtils=t,this.FeatureFilter=e}async setSelectedLayer(t,e){this._selectedLayerId=t,this._selectedLayer=await n(this.mapView,t),this._selectedLayerName=e,this._validLayers.forEach((e=>{this._nonVisibleValidLayers.find((t=>t.id===e.id))||e.set("visible",!t||e.id===t)}))}_getLayersConfig(t){return this.reportingOptions&&this.reportingOptions[t]?this.reportingOptions[t]:null}_getReporter(){const t=[];return this._flowItems.forEach((e=>{switch(e){case"layer-list":t.push(this.getLayerListFlowItem());break;case"feature-list":t.push(this.getFeatureListFlowItem(this._selectedLayerId,this._selectedLayerName));break;case"filter-panel":t.push(this.getFilterPanel());break;case"feature-details":t.push(this.getFeatureDetailsFlowItem());break;case"reporting-layer-list":t.push(this.getChooseCategoryFlowItem());break;case"feature-create":t.push(this.getFeatureCreateFlowItem());break;case"comment-details":t.push(this.getCommentDetailsFlowItem());break;case"add-comment":t.push(this.getAddCommentFlowItem())}})),s("calcite-panel",{class:"width-full "+("dark"===this.theme?"calcite-mode-dark":"calcite-mode-light")},this.mapView?s("calcite-flow",null,t?.length>0&&t):s("calcite-loader",{label:"",scale:"m"}))}async sortOptionClick(t,e,i){this._updatedSorting={field:t,order:e},this._updatedSortOption=i}_toggleSort(){const t=this.reportingOptions&&this.reportingOptions[this._selectedLayerId]&&this.reportingOptions[this._selectedLayerId].like&&this.reportingOptions[this._selectedLayerId].likeField;return s("calcite-popover",{autoClose:!0,label:"",offsetDistance:0,placement:this.isMobile?"leading-start":"bottom-start",pointerDisabled:!0,referenceElement:"sort-popover"},s("calcite-list",{label:"","selection-mode":"single"},s("calcite-list-item",{label:this._translations.sortNewest,onCalciteListItemSelect:()=>{this.sortOptionClick(this._selectedLayer.objectIdField,"desc","sortNewest")},selected:"sortNewest"===this._updatedSortOption,value:"sortNewest"}),s("calcite-list-item",{label:this._translations.sortOldest,onCalciteListItemSelect:()=>{this.sortOptionClick(this._selectedLayer.objectIdField,"asc","sortOldest")},selected:"sortOldest"===this._updatedSortOption,value:"sortOldest"}),t&&s(h,null,s("calcite-list-item",{label:this._translations.sortHighestVoted,onCalciteListItemSelect:()=>{this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField,"desc","sortHighestVoted")},selected:"sortHighestVoted"===this._updatedSortOption,value:"sortHighestVoted"}),s("calcite-list-item",{label:this._translations.sortLowestVoted,onCalciteListItemSelect:()=>{this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField,"asc","sortLowestVoted")},selected:"sortLowestVoted"===this._updatedSortOption,value:"sortLowestVoted"}))))}async _handleFilterListReset(){this._filterActive=!1}async _handleFilterUpdate(t){this._showLoadingIndicator=!0,this._filterActive=t,await this._featureList.refresh(),this._showLoadingIndicator=!1}getLayerListFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportsHeader,selected:"layer-list"===this._flowItems[this._flowItems.length-1]},this.isMobile&&this.getActionToExpandCollapsePanel(),this._hasValidLayers&&this.enableNewReports&&s("calcite-button",{appearance:"solid",onClick:this.navigateToChooseCategory.bind(this),slot:"footer",width:"full"},this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText),s("calcite-panel",{"full-height":!0,"full-width":!0},s("layer-list",{applyLayerViewFilter:this.showMyReportsOnly,class:"height-full",layers:this._editableLayerIds?.length>0?this._editableLayerIds:this._layers,locale:this.locale,mapView:this.mapView,onLayerSelect:this.displayFeaturesList.bind(this),onLayersListLoaded:this.layerListLoaded.bind(this),ref:t=>this._layerList=t,showFeatureCount:!0,showNextIcon:!0})))}getChooseCategoryFlowItem(){const t=this.reportingOptions?Object.keys(this.reportingOptions).filter((t=>this.reportingOptions[t].visible&&this.reportingOptions[t].reporting&&this._layerItemsHash[t]&&this._layerItemsHash[t].supportsAdd)):[];return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this),selected:"reporting-layer-list"===this._flowItems[this._flowItems.length-1]},s("calcite-panel",{"full-height":!0,"full-width":!0},s("div",{class:"progress-bar"},s("calcite-progress",{type:"determinate",value:this._updatedProgressBarStatus})),s("calcite-notice",{class:"notice-msg",icon:"lightbulb",kind:"success",open:!0},s("div",{slot:"message"},this._translations.chooseCategoryMsg)),s("layer-list",{class:"height-full",layers:t,locale:this.locale,mapView:this.mapView,onLayerSelect:this.navigateToCreateFeature.bind(this),showFeatureCount:!1,showNextIcon:!1})))}getFeatureCreateFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,onCalciteFlowItemBack:this.backFromCreateFeaturePanel.bind(this),selected:"feature-create"===this._flowItems[this._flowItems.length-1]},this._showSubmitCancelButton&&s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",onClick:this.onCreateFeatureSubmitButtonClick.bind(this),width:"full"},this._translations.submit),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromCreateFeaturePanel.bind(this),width:"full"},this._translations.cancel)),s("calcite-panel",{"full-height":!0,"full-width":!0},s("div",{class:"progress-bar"},s("calcite-progress",{type:"determinate",value:this._updatedProgressBarStatus})),s("create-feature",{customizeSubmit:!0,enableSearch:!0,floorLevel:this.floorLevel,formElements:this._formElements.find((t=>t.id===this._selectedLayerId)),isMobile:this.isMobile,locale:this.locale,mapView:this.mapView,onDrawComplete:this.onFormReady.bind(this),onEditingAttachment:this.showSubmitCancelButton.bind(this),onFail:this.createFeatureFailed.bind(this),onModeChanged:this.backFromCreateFeaturePanel.bind(this),onProgressStatus:this.updatedProgressStatus.bind(this),onSuccess:this.onReportSubmitted.bind(this),ref:t=>this._createFeature=t,searchConfiguration:this.searchConfiguration,selectedLayerId:this._selectedLayerId})))}updatedProgressStatus(t){this._updatedProgressBarStatus=t.detail}onFormReady(){this._showSubmitCancelButton=!0}showSubmitCancelButton(t){this._showSubmitCancelButton=!t.detail}onCreateFeatureSubmitButtonClick(){this._createFeature&&this._createFeature.submit()}backFromCreateFeaturePanel(){this._createFeature&&this.updateNonVisibleLayersOnMap(!1),this.backFromSelectedPanel()}onCreateRelatedFeatureSubmitButtonClick(){this._createRelatedFeature&&this._createRelatedFeature.submit()}backFromCreateRelatedFeaturePanel(){this._createRelatedFeature&&(this._showSubmitCancelButton=!1),this.backFromSelectedPanel()}createFeatureFailed(t){console.error(t.detail),this._featureCreationFailedErrorMsg=t.detail.message}async onReportSubmitted(){this.updateNonVisibleLayersOnMap(!1),await this.navigateToHomePage(),this._reportSubmitted=!0,this._updatedProgressBarStatus=25,this._showFullPanel&&this.updatePanelState(this._sidePanelCollapsed,!1)}addCommentFailed(t){console.error(t.detail),this._addingCommentFailed=!0}async onCommentSubmitted(){this._commentSubmitted=!0,this.backFromSelectedPanel(),this._showLoadingIndicator=!0,await this._featureDetails.refresh(this._currentFeature),setTimeout((()=>{this._showLoadingIndicator=!1}),300)}async navigateToHomePage(){await this.setSelectedFeatures([]),this._layerList&&await this._layerList.refresh(),1===this._editableLayerIds.length?(await this._featureList.refresh(),this._flowItems=["feature-list"]):this._flowItems=["layer-list"]}async navigateToCreateFeature(t){t.detail.layerId&&t.detail.layerName&&await this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this.updateNonVisibleLayersOnMap(!0),this._getFormElements(),this._showSubmitCancelButton=!1,this.updatePanelState(!1,!0),this._flowItems=[...this._flowItems,"feature-create"]}navigateToChooseCategory(){this.updatePanelState(!1,!0),this._flowItems=[...this._flowItems,"reporting-layer-list"]}updateNonVisibleLayersOnMap(t){this._nonVisibleValidLayers.find((t=>t.id===this._selectedLayerId))&&this._selectedLayer.set("visible",t)}async layerListLoaded(t){const e=t.detail,i=await r(this.mapView),s=[];this._validLayers=[],this._nonVisibleValidLayers=[],i.forEach((t=>{e.includes(t.id)&&(this._validLayers.push(t),t.visible||this._nonVisibleValidLayers.push(t),this._getLayersConfig(t.id)?.reporting&&this._layerItemsHash[t.id]&&this._layerItemsHash[t.id].supportsAdd&&s.push(t.id))})),this.handleMapClick(),this._hasValidLayers=s.length>0,this._urlParamsLoaded||(this._urlParamsLoaded=!0,await this.loadFeatureFromURLParams())}async displayFeaturesList(t){this._updatedSorting={field:"",order:"desc"},this._updatedSortOption="sortNewest",await this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this.handleSelectedLayersFilter(),this._flowItems=[...this._flowItems,"feature-list"],this._prevSelectedLayerId=this._selectedLayerId}async backFromFilterPanel(){null!=this._filterList&&(this._currentLayerExpressions=await this._filterList.getCurrentLayerExpressions()),await this._featureList.refresh(),this.backFromSelectedPanel()}backFromSelectedPanel(){this._updatedProgressBarStatus=25;const t=[...this._flowItems];"comment-details"!==t[t.length-1]&&"add-comment"!==t[t.length-1]&&this.clearHighlights(),"reporting-layer-list"!==t[t.length-1]&&("feature-create"!==t[t.length-1]||"feature-list"!==t[0]&&"feature-list"!==t[t.length-2])||this.updatePanelState(this._sidePanelCollapsed,!1),t.pop(),1!==t.length||"layer-list"!==t[0]?this._flowItems=[...t]:this.navigateToHomePage()}toggleSidePanel(){this._sidePanelCollapsed=!this._sidePanelCollapsed,this.togglePanel.emit({panelState:this._sidePanelCollapsed,isFormOpen:this._showFullPanel})}updatePanelState(t,e){this._sidePanelCollapsed=t,this._showFullPanel=e,this.togglePanel.emit({panelState:this._sidePanelCollapsed,isFormOpen:this._showFullPanel})}async onFeatureSelectFromList(t){this._showLoadingIndicator=!0,await this.setSelectedFeatures([t.detail]),this._flowItems=[...this._flowItems,"feature-details"]}async getRelatedTable(){const t=this._currentFeature.layer,e=await c(this.mapView);t.relationships.some((i=>{const s=e.filter((e=>t.url===e.url&&e.layerId===i.relatedTableId));if(s&&s.length>0)return this._relatedTable=s[0],!0}))}async updatingFeatureDetails(t){this._showLoadingIndicator=t}async selectionChanged(t){this.updatingFeatureDetails(!0),await this.setCurrentFeature(t.detail.selectedFeature[0]),this.highlightOnMap(t.detail.selectedFeature[0]),this._selectedFeatureIndex=t.detail.selectedFeatureIndex,await this._featureDetails.refresh(t.detail.selectedFeature[0])}showAddCommentsPanel(){this._flowItems=[...this._flowItems,"add-comment"]}async onCommentSelectFromList(t){this._selectedRelatedFeature=[t.detail],this._flowItems=[...this._flowItems,"comment-details"]}getFeatureListFlowItem(t,e){const i=this._getLayersConfig(this._selectedLayerId)?.reporting&&this._layerItemsHash[this._selectedLayerId].supportsAdd,a=this._currentLayerExpressions?.length>0;return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:e,loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this),selected:"feature-list"===this._flowItems[this._flowItems.length-1]},this._toggleSort(),s("calcite-action",{icon:"sort-ascending-arrow",id:"sort-popover",slot:"header-actions-end",text:this._translations.sort,title:this._translations.sort}),a&&s("calcite-action",{icon:"filter",indicator:this._filterActive,onClick:()=>{this._flowItems=[...this._flowItems,"filter-panel"]},slot:"header-actions-end",text:this._translations.filter,title:this._translations.filter}),this.isMobile&&this.getActionToExpandCollapsePanel(),this.enableNewReports&&i&&s("calcite-button",{appearance:"solid",onClick:this.navigateToCreateFeature.bind(this),slot:"footer",width:"full"},this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText),s("calcite-panel",{"full-height":!0},s("feature-list",{applyLayerViewFilter:this.showMyReportsOnly,class:"height-full",highlightOnHover:!0,locale:this.locale,mapView:this.mapView,noFeaturesFoundMsg:this._translations.featureErrorMsg,onFeatureSelect:this.onFeatureSelectFromList.bind(this),pageSize:30,ref:t=>this._featureList=t,reportingOptions:this.reportingOptions,selectedLayerId:t,showFeatureSymbol:this.showFeatureSymbol,sortingInfo:this._updatedSorting})))}getFilterPanel(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._translations?.filterLayerTitle?.replace("{{title}}",this._selectedLayerName),loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromFilterPanel.bind(this),selected:"filter-panel"===this._flowItems[this._flowItems.length-1]},this.isMobile&&this.getActionToExpandCollapsePanel(),s("div",{class:"width-full",slot:"footer"},s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",disabled:!this._filterActive,onClick:this.resetFilterList.bind(this),width:"full"},this._translations.resetFilter),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromFilterPanel.bind(this),width:"full"},this._translations.close))),s("calcite-panel",{"full-height":!0},s("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtnOnClick:()=>{},comboboxOverlayPositioning:"fixed",layerExpressions:this._currentLayerExpressions,onFilterListReset:()=>{this._handleFilterListReset()},onFilterUpdate:()=>{this._handleFilterUpdate(this._filterList.filterCount>0)},ref:t=>this._filterList=t,resetBtn:!1,resetFiltersOnDisconnect:!1,view:this.mapView,zoomBtn:!1})))}getFeatureDetailsFlowItem(){const t=this._getLayersConfig(this._selectedLayerId)?.comment&&this._selectedLayer.relationships.length>0&&this._relatedTable;return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this),selected:"feature-details"===this._flowItems[this._flowItems.length-1]},this.isMobile&&this.getActionToExpandCollapsePanel(),s("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"share-node",embed:!1,popoverButtonIconScale:"s",ref:t=>this._shareNode=t,removePopoverOffset:!0,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",slot:"header-actions-end",socialMedia:!0,view:this.mapView}),this._selectedFeature.length>1&&this.getFeaturesPagination(),s("calcite-panel",null,s("feature-details",{class:"full-height",graphics:this._selectedFeature,layerItemsHash:this._layerItemsHash,locale:this.locale,mapView:this.mapView,onAddComment:this.showAddCommentsPanel.bind(this),onCommentSelect:this.onCommentSelectFromList.bind(this),onFeatureSelectionChange:this.selectionChanged.bind(this),onLikeOrDislikeClicked:()=>{this._featureList.refresh(!0)},onLoadingStatus:t=>{this.updatingFeatureDetails(t.detail)},ref:t=>this._featureDetails=t,reportingOptions:this.reportingOptions,showFullCommentTitle:this.showFullCommentTitle,showUserImageInCommentsList:this.showUserImageInCommentsList}),t&&s("calcite-button",{appearance:"solid",onClick:this.showAddCommentsPanel.bind(this),slot:"footer",width:"full"},this.commentButtonText||this._translations.comment)))}getFeaturesPagination(){return s("div",{class:"feature-pagination"},s("div",null,s("calcite-button",{appearance:"transparent",disabled:!1,iconStart:"chevron-left",id:"solutions-back",onClick:()=>{this._featureDetails.back()},scale:"s",width:"full"}),s("calcite-tooltip",{label:"",placement:"top","reference-element":"solutions-back"},s("span",null,this._translations.back))),s("calcite-button",{appearance:"transparent",onClick:()=>{this._featureDetails.toggleListView()},scale:"s"},s("span",{class:"pagination-count"},this._getCount())),s("div",null,s("calcite-button",{appearance:"transparent",disabled:!1,iconStart:"chevron-right",id:"solutions-next",onClick:()=>{this._featureDetails.next()},scale:"s",width:"full"}),s("calcite-tooltip",{placement:"top","reference-element":"solutions-next"},s("span",null,this._translations.next))))}getCommentDetailsFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._relatedTable.title,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this),selected:"comment-details"===this._flowItems[this._flowItems.length-1]},this.isMobile&&this.getActionToExpandCollapsePanel(),s("calcite-panel",{"full-height":!0},s("info-card",{allowEditing:!1,graphics:this._selectedRelatedFeature,highlightEnabled:!1,isLoading:!1,isMobile:!1,locale:this.locale,mapView:this.mapView,paginationEnabled:!1})))}getAddCommentFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._relatedTable.title,onCalciteFlowItemBack:this.backFromCreateRelatedFeaturePanel.bind(this),selected:"add-comment"===this._flowItems[this._flowItems.length-1]},this.isMobile&&this.getActionToExpandCollapsePanel(),s("div",{class:"width-full",slot:"footer"},this._showSubmitCancelButton&&s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",onClick:this.onCreateRelatedFeatureSubmitButtonClick.bind(this),width:"full"},this._translations.submit),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromCreateRelatedFeaturePanel.bind(this),width:"full"},this._translations.cancel))),s("calcite-panel",null,s("create-related-feature",{customizeSubmit:!0,locale:this.locale,mapView:this.mapView,onFail:this.addCommentFailed.bind(this),onFormReady:this.onFormReady.bind(this),onIsActionPending:this.showSubmitCancelButton.bind(this),onSuccess:this.onCommentSubmitted.bind(this),ref:t=>this._createRelatedFeature=t,selectedFeature:this._currentFeature,table:this._relatedTable})))}async setSelectedFeatures(t){this._selectedFeature=t,await this.setCurrentFeature(this._selectedFeature.length?this._selectedFeature[0]:null)}async setCurrentFeature(t){if(this._currentFeature=t,t&&t.layer){const e=t.layer;this.setSelectedLayer(e.id,e.title),this._currentFeatureId=t.attributes[e.objectIdField],this._getLayersConfig(e.id)?.comment&&e.relationships.length>0&&await this.getRelatedTable()}else this._editableLayerIds.length>1&&(this.setSelectedLayer("",""),this.handlePrevLayersFilter()),this._currentFeatureId="";this._updateShareURL()}async highlightOnMap(t){if(this.clearHighlights(),t&&t.geometry&&t.layer){const e=await d(this.mapView,t.layer.id);e.highlightOptions=null,this._highlightHandle=await u([t.getObjectId()],e,this.mapView,!0,this.zoomToScale)}this.updatingFeatureDetails(!1)}clearHighlights(){this._highlightHandle&&this._highlightHandle.remove()}getActionToExpandCollapsePanel(){return s("calcite-action",{icon:this._sidePanelCollapsed?"chevrons-up":"chevrons-down",onClick:this.toggleSidePanel.bind(this),slot:"header-actions-end",text:this._sidePanelCollapsed?this._translations.expand:this._translations.collapse})}async setMapView(){await this.getLayersToShowInList(),await this._updateFeatures(),1===this._editableLayerIds?.length?await this.renderFeaturesList():this._flowItems=["layer-list"],this.mapView.popupEnabled=!1,this._defaultCenter&&this._defaultLevel&&(await this.mapView.goTo({center:this._defaultCenter,zoom:this._defaultLevel}),this._defaultCenter=void 0,this._defaultLevel=void 0)}handleMapClick(){this._mapClickHandle&&this._mapClickHandle.remove(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",this.onMapClick.bind(this))}async onMapClick(t){this.mapView.popupEnabled=!1;const e=await this.mapView.hitTest(t);if(e.results.length>0){const t=[];e.results.forEach((function(e){"graphic"===e.type&&t.push(e.graphic)}));const i=t.filter((t=>this._validLayers.includes(t.layer))),s=t.filter((t=>!this._validLayers.includes(t.layer)&&t?.layer?.popupEnabled&&t?.layer?.id));if(i.length>0&&(await this.setSelectedFeatures(i),this._flowItems.length&&this._flowItems.includes("feature-details")?(this._flowItems=[...this._flowItems.slice(0,this._flowItems.indexOf("feature-details")+1)],await this.highlightOnMap(t[0])):this._flowItems=[...this._flowItems,"feature-details"]),s.length>0){this.mapView.popupEnabled=!0;const t={features:s,updateLocationEnabled:!0};await this.mapView.openPopup(t)}}}_getCount(){const t=(this._selectedFeatureIndex+1).toString(),e=this._selectedFeature.length.toString();return this._translations.indexOfTotal.replace("{{index}}",t).replace("{{total}}",e)}async _getTranslations(){const t=await o(this.el);this._translations=t[0]}_updateFloorDefinitionExpression(t){const e=`${t.floorInfo.floorField} = '${this.floorLevel}'`,i=t.definitionExpression;t.definitionExpression=i?.indexOf(this._floorExpression)>-1?i.replace(this._floorExpression,e):e,this._floorExpression=e}_getFormElements(){const t=this._selectedLayer,e=t?.floorInfo?.floorField;if(e&&this.floorLevel&&t?.formTemplate){const e=this._formElements.find((e=>e.id===t.id));0!==this._formElements.length&&e||this._formElements.push({id:t.id,orgElements:t.formTemplate.elements,orgExpressionInfos:t.formTemplate.expressionInfos})}}reduceToConfiguredLayers(t,e){return Object.keys(t).reduce(((i,s)=>{const a=this.reportingOptions?this._getLayersConfig(s)?.visible:t[s].supportsAdd;return!e.includes(s)&&a&&i.push(s),i}),[])}async _updateFeatures(){for(const t of this._editableLayerIds){const e=await d(this.mapView,t);await this._showMyFeaturesOnly(e);const i=e.layer?.floorInfo?.floorField;i&&this.floorLevel&&this._updateFloorDefinitionExpression(e.layer)}}async _showMyFeaturesOnly(t){const e=this.mapView.map.portalItem.portal?.credential?.userId;if(e){const i=t.layer.editFieldsInfo?.creatorField.toLowerCase();t.filter=this.showMyReportsOnly&&i?new this.FeatureFilter({where:i+"='"+e+"'"}):null}}async getLayersToShowInList(){const t=await p(this.mapView,!0),e=await r(this.mapView),i=[];e.forEach((e=>{"feature"===e?.type&&e?.editingEnabled&&e?.capabilities?.operations?.supportsAdd&&(t[e.id].supportsAdd=!0),e?.editingEnabled||i.push(e.id)})),this._editableLayerIds=this.reduceToConfiguredLayers(t,i),this._layerItemsHash=t}async renderFeaturesList(){this._flowItems=["feature-list"];const t={detail:this._editableLayerIds};await this.layerListLoaded(t),await this.setSelectedLayer(this._validLayers[0].id,this._validLayers[0].title),this.handleSelectedLayersFilter()}_updateShareURL(){const t=this._shareNode?.shareUrl;if(!t)return;const e=new URL(t);this._selectedLayerId?e.searchParams.set("layerid",this._selectedLayerId):e.searchParams.delete("layerid"),this._selectedFeature?.length?e.searchParams.set("oid",this._currentFeatureId):e.searchParams.delete("oid"),this._shareNode.shareUrl=e.href}async loadFeatureFromURLParams(){if(this.center&&this.level&&await this.mapView.goTo({center:this.center.split(";").map(Number),zoom:this.level}),this.layerId&&this.objectId){const t=await n(this.mapView,this.layerId);if(t){const e=await m([Number(this.objectId)],t,[],!0,this.mapView.spatialReference);e.length&&(await this.setSelectedFeatures(e),this._flowItems=this._flowItems.length&&"feature-details"!==this._flowItems[this._flowItems.length-1]?[...this._flowItems,"feature-details"]:[...this._flowItems])}}}async handleSelectedLayersFilter(){if(this._selectedLayer){const t=this.layerExpressions?structuredClone(this.layerExpressions.filter((t=>t.id===this._selectedLayerId))):[];null!=this._t9nLayerExpressions&&this.handleLayerExpressionsT9n(t,this._t9nLayerExpressions),this._currentLayerExpressions=t,this.setActiveDefinitionExpressions()}}async handlePrevLayersFilter(){if(this._prevSelectedLayerId){const t=await n(this.mapView,this._prevSelectedLayerId);t&&(t.definitionExpression=this._initDefExpressions[this._prevSelectedLayerId])}}resetFilterList(){this._filterList?.forceReset(),null!=this._selectedLayer&&(this._selectedLayer.definitionExpression=this._initDefExpressions[this._selectedLayerId],this._filterActive=!1)}setActiveDefinitionExpressions(){if(null==this._selectedLayer)return;const t=[];if(this._currentLayerExpressions?.length>0){const e=this._currentLayerExpressions[0];for(const i of e.expressions){const{active:e,definitionExpression:s}=i;e&&s&&t.push(`(${s})`)}this._filterActive=t.length>0,this.updateFilterLayerDefExpression(t,e.operator)}}updateFilterLayerDefExpression(t,e){const i=this._initDefExpressions[this._selectedLayerId],s=t?.length>0&&null!=i?`(${t.join(e)}) AND (${i})`:t.length>0?t.join(e):i;this._selectedLayer.definitionExpression=s}setInitExpressions(){if(this._initDefExpressions={},null==this.mapView)return;const t=this.mapView.map;t.allLayers.concat(t.allTables).forEach((t=>{"feature"===t.type&&(this._initDefExpressions[t.id]=t.definitionExpression)}))}handleLayerExpressionsT9n(t,e){t?.forEach((t=>{const i=e?.find((e=>e.id===t.id));null!=i&&(t.title=i.title,t.expressions?.forEach((t=>{const e=i.expressions?.find((e=>e.id===t.id));null!=e&&(t.name=e.name)})))}))}static get watchers(){return{isMobile:["isMobileWatchHandler"],locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"],floorLevel:["floorLevelWatchHandler"],showMyReportsOnly:["showMyReportsOnlyWatchHandler"],layerExpressions:["layerExpressionsWatchHandler"],showFeatureSymbol:["showFeatureSymbolWatchHandler"]}}};f.style=":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.notice-msg{padding:10px;width:calc(100% - 20px)}.progress-bar{padding:12px}.footer-top-button{padding-bottom:7px}.footer-button{height:35px}.feature-pagination{background-color:var(--calcite-color-foreground-1) !important;border-block-end:1px solid var(--calcite-color-border-3);display:flex;justify-content:center;padding:5px 0}.pagination-count{color:var(--calcite-color-brand);border-bottom:1px solid var(--calcite-color-brand);font-weight:bold}.report-submitted-msg{position:absolute;z-index:1000}.share-node{display:flex}";export{f as crowdsource_reporter}
6
+ import{r as t,c as e,g as i,h as s,H as a,F as h}from"./p-1b0588d2.js";import{l,g as o}from"./p-ee2cbba0.js";import{g as n,a as r,b as c,c as d,h as u,d as p,q as m}from"./p-dcd2f00b.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";const f=class{constructor(i){t(this,i),this.togglePanel=e(this,"togglePanel",7)}get el(){return i(this)}center;commentButtonText;commentSubmittedMessage;defaultWebmap="";description;enableAnonymousAccess;enableAnonymousComments;enableComments;enableHome=!0;enableLogin;enableNewReports;enableSearch=!0;enableZoom=!0;isMobile;layerExpressions=[];layerId;level;locale;loginTitle;mapInfos=[];mapView;objectId;reportButtonText;reportingOptions;reportsHeader;reportSubmittedMessage;searchConfiguration;showComments;showUserImageInCommentsList=!1;showFeatureSymbol=!1;showMyReportsOnly=!1;theme="light";zoomToScale;floorLevel;showFullCommentTitle=!0;_featureCreationFailedErrorMsg;_filterActive=!1;_flowItems=[];_hasValidLayers=!1;_mapInfo;_reportSubmitted=!1;_selectedLayerName;_showSubmitCancelButton=!1;_showLoadingIndicator=!1;_sidePanelCollapsed=!1;_translations;_updatedProgressBarStatus=25;_updatedSorting;_updatedSortOption="sortNewest";_commentSubmitted=!1;_addingCommentFailed=!1;_createFeature;_currentFeatureId;_defaultCenter;_defaultLevel;_editableLayerIds;_featureDetails;_featureList;_currentFeature;_selectedRelatedFeature;_relatedTable;_filterList;_highlightHandle;_layerList;_createRelatedFeature;_layers;_mapChange;_mapClickHandle;reactiveUtils;FeatureFilter;_selectedFeature;_selectedFeatureIndex;_selectedLayerId;_shareNode;_urlParamsLoaded;_validLayers;_nonVisibleValidLayers;_selectedLayer;_layerItemsHash;_showFullPanel;_floorExpression;_formElements=[];_prevSelectedLayerId;_currentLayerExpressions;_initDefExpressions;_t9nLayerExpressions;async isMobileWatchHandler(){this.updatePanelState(!1,this._showFullPanel)}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(){await this.mapView.when((async()=>{this.setInitExpressions(),await this.setMapView()}))}async floorLevelWatchHandler(){if(this._editableLayerIds)for(const t of this._editableLayerIds){const e=await n(this.mapView,t);e.floorInfo?.floorField&&this._updateFloorDefinitionExpression(e)}"layer-list"===this._flowItems[this._flowItems.length-1]&&this._layerList&&await this._layerList.refresh(),this._featureList&&this._featureList.refresh(),this._createFeature&&this._createFeature.refresh(this.floorLevel)}async showMyReportsOnlyWatchHandler(){this._editableLayerIds&&(await this._updateFeatures(),setTimeout((()=>{"layer-list"===this._flowItems[this._flowItems.length-1]&&this._layerList&&this._layerList.refresh(),this._featureList&&this._featureList.refresh()}),50))}async layerExpressionsWatchHandler(){this.resetFilterList(),await this.handleSelectedLayersFilter(),await(this._featureList?.refresh())}async showFeatureSymbolWatchHandler(){await(this._featureList?.refresh())}async updateLayerExpressionsT9n(t){if(this._t9nLayerExpressions=t||this.layerExpressions,null!=this._filterList)await this._filterList.handleUpdatingT9nData(this._t9nLayerExpressions);else if(null!=this._currentLayerExpressions){const t=structuredClone(this._currentLayerExpressions);this.handleLayerExpressionsT9n(t,this._t9nLayerExpressions),this._currentLayerExpressions=t}return Promise.resolve()}togglePanel;async componentWillLoad(){this._urlParamsLoaded=!1,await this._initModules(),await this._getTranslations(),await(this.mapView?.when((async()=>{this._layers=this.reportingOptions?Object.keys(this.reportingOptions).filter((t=>this.reportingOptions[t].visible)):[],this.setInitExpressions(),await this.setMapView()})))}componentWillRender(){this._flowItems.includes("filter-panel")&&this._filterList?.updateInitDefExpressions({initDefExpressions:this._initDefExpressions})}render(){const t="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return s(a,{key:"03d613fe8f275852672fb546ceb4449fb82580c0"},this._reportSubmitted&&s("calcite-alert",{key:"969a66978549d6993b1e4fce87bbd2387858cdf8","auto-close":!0,class:t+" report-submitted-msg",icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._reportSubmitted=!1},open:!0,placement:"top"},s("div",{key:"60ae42443e09a97d97a46bba07b1ea010b382348",slot:"message"},this.reportSubmittedMessage?this.reportSubmittedMessage:this._translations.submitMsg)),this._featureCreationFailedErrorMsg&&s("calcite-alert",{key:"bf6c346cf976a4b84da3553230239665c712e2b6","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._featureCreationFailedErrorMsg=""},open:!0,placement:"top"},s("div",{key:"1f9560e18d802a15bcb3e8ea9f05837a4a6fb8aa",slot:"title"},this._translations.error),s("div",{key:"1f5ef09cbf94996eeb5783211ed1542a5cf53e93",slot:"message"},this._featureCreationFailedErrorMsg)),this._commentSubmitted&&s("calcite-alert",{key:"15538e8faabbec476d7586dcc4152b422404c23f","auto-close":!0,class:"report-submitted "+t,icon:"check-circle",kind:"success",label:"",onCalciteAlertClose:()=>{this._commentSubmitted=!1},open:!0,placement:"top"},s("div",{key:"925a9a243a79dfb66554a9a51f24396ca2b71c98",slot:"message"},this.commentSubmittedMessage||this._translations.commentSubmittedMsg)),this._addingCommentFailed&&s("calcite-alert",{key:"62c63d3b1c51bdc7879e815e2b2f4d3c4d039c4c","auto-close":!0,class:t,icon:"x-octagon",kind:"danger",label:"",onCalciteAlertClose:()=>{this._addingCommentFailed=!1},open:!0,placement:"top"},s("div",{key:"971f07331a8689b859f2cedc96ba3589a3ad3e16",slot:"title"},this._translations.error),s("div",{key:"1627f1ab5c4a4aceb7bdb70471aed6b8ca6d67b8",slot:"message"},this._translations.addingCommentFailedMsg)),s("div",{key:"b3257ba523357b4444ce7da7d13a86f6b71185d9"},s("calcite-shell",{key:"35fc5a814528bb0acc22919839719bb4349e9ae4","content-behind":!0},this._getReporter())))}async _initModules(){const[t,e]=await l(["esri/core/reactiveUtils","esri/layers/support/FeatureFilter"]);this.reactiveUtils=t,this.FeatureFilter=e}async setSelectedLayer(t,e){this._selectedLayerId=t,this._selectedLayer=await n(this.mapView,t),this._selectedLayerName=e,this._validLayers.forEach((e=>{this._nonVisibleValidLayers.find((t=>t.id===e.id))||e.set("visible",!t||e.id===t)}))}_getLayersConfig(t){return this.reportingOptions&&this.reportingOptions[t]?this.reportingOptions[t]:null}_getReporter(){const t=[];return this._flowItems.forEach((e=>{switch(e){case"layer-list":t.push(this.getLayerListFlowItem());break;case"feature-list":t.push(this.getFeatureListFlowItem(this._selectedLayerId,this._selectedLayerName));break;case"filter-panel":t.push(this.getFilterPanel());break;case"feature-details":t.push(this.getFeatureDetailsFlowItem());break;case"reporting-layer-list":t.push(this.getChooseCategoryFlowItem());break;case"feature-create":t.push(this.getFeatureCreateFlowItem());break;case"comment-details":t.push(this.getCommentDetailsFlowItem());break;case"add-comment":t.push(this.getAddCommentFlowItem())}})),s("calcite-panel",{class:"width-full "+("dark"===this.theme?"calcite-mode-dark":"calcite-mode-light")},this.mapView?s("calcite-flow",null,t?.length>0&&t):s("calcite-loader",{label:"",scale:"m"}))}async sortOptionClick(t,e,i){this._updatedSorting={field:t,order:e},this._updatedSortOption=i}_toggleSort(){const t=this.reportingOptions&&this.reportingOptions[this._selectedLayerId]&&this.reportingOptions[this._selectedLayerId].like&&this.reportingOptions[this._selectedLayerId].likeField;return s("calcite-popover",{autoClose:!0,label:"",offsetDistance:0,placement:this.isMobile?"leading-start":"bottom-start",pointerDisabled:!0,referenceElement:"sort-popover"},s("calcite-list",{label:"","selection-mode":"single"},s("calcite-list-item",{label:this._translations.sortNewest,onCalciteListItemSelect:()=>{this.sortOptionClick(this._selectedLayer.objectIdField,"desc","sortNewest")},selected:"sortNewest"===this._updatedSortOption,value:"sortNewest"}),s("calcite-list-item",{label:this._translations.sortOldest,onCalciteListItemSelect:()=>{this.sortOptionClick(this._selectedLayer.objectIdField,"asc","sortOldest")},selected:"sortOldest"===this._updatedSortOption,value:"sortOldest"}),t&&s(h,null,s("calcite-list-item",{label:this._translations.sortHighestVoted,onCalciteListItemSelect:()=>{this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField,"desc","sortHighestVoted")},selected:"sortHighestVoted"===this._updatedSortOption,value:"sortHighestVoted"}),s("calcite-list-item",{label:this._translations.sortLowestVoted,onCalciteListItemSelect:()=>{this.sortOptionClick(this.reportingOptions[this._selectedLayerId].likeField,"asc","sortLowestVoted")},selected:"sortLowestVoted"===this._updatedSortOption,value:"sortLowestVoted"}))))}async _handleFilterListReset(){this._filterActive=!1}async _handleFilterUpdate(t){this._showLoadingIndicator=!0,this._filterActive=t,await this._featureList.refresh(),this._showLoadingIndicator=!1}getLayerListFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportsHeader,selected:"layer-list"===this._flowItems[this._flowItems.length-1]},this.isMobile&&this.getActionToExpandCollapsePanel(),this._hasValidLayers&&this.enableNewReports&&s("calcite-button",{appearance:"solid",onClick:this.navigateToChooseCategory.bind(this),slot:"footer",width:"full"},this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText),s("calcite-panel",{"full-height":!0,"full-width":!0},s("layer-list",{applyLayerViewFilter:this.showMyReportsOnly,class:"height-full",layers:this._editableLayerIds?.length>0?this._editableLayerIds:this._layers,locale:this.locale,mapView:this.mapView,onLayerSelect:this.displayFeaturesList.bind(this),onLayersListLoaded:this.layerListLoaded.bind(this),ref:t=>this._layerList=t,showFeatureCount:!0,showNextIcon:!0})))}getChooseCategoryFlowItem(){const t=this.reportingOptions?Object.keys(this.reportingOptions).filter((t=>this.reportingOptions[t].visible&&this.reportingOptions[t].reporting&&this._layerItemsHash[t]&&this._layerItemsHash[t].supportsAdd)):[];return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this),selected:"reporting-layer-list"===this._flowItems[this._flowItems.length-1]},s("calcite-panel",{"full-height":!0,"full-width":!0},s("div",{class:"progress-bar"},s("calcite-progress",{type:"determinate",value:this._updatedProgressBarStatus})),s("calcite-notice",{class:"notice-msg",icon:"lightbulb",kind:"success",open:!0},s("div",{slot:"message"},this._translations.chooseCategoryMsg)),s("layer-list",{class:"height-full",layers:t,locale:this.locale,mapView:this.mapView,onLayerSelect:this.navigateToCreateFeature.bind(this),showFeatureCount:!1,showNextIcon:!1})))}getFeatureCreateFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,onCalciteFlowItemBack:this.backFromCreateFeaturePanel.bind(this),selected:"feature-create"===this._flowItems[this._flowItems.length-1]},this._showSubmitCancelButton&&s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",onClick:this.onCreateFeatureSubmitButtonClick.bind(this),width:"full"},this._translations.submit),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromCreateFeaturePanel.bind(this),width:"full"},this._translations.cancel)),s("calcite-panel",{"full-height":!0,"full-width":!0},s("div",{class:"progress-bar"},s("calcite-progress",{type:"determinate",value:this._updatedProgressBarStatus})),s("create-feature",{customizeSubmit:!0,enableSearch:!0,floorLevel:this.floorLevel,formElements:this._formElements.find((t=>t.id===this._selectedLayerId)),isMobile:this.isMobile,locale:this.locale,mapView:this.mapView,onDrawComplete:this.onFormReady.bind(this),onEditingAttachment:this.showSubmitCancelButton.bind(this),onFail:this.createFeatureFailed.bind(this),onModeChanged:this.backFromCreateFeaturePanel.bind(this),onProgressStatus:this.updatedProgressStatus.bind(this),onSuccess:this.onReportSubmitted.bind(this),ref:t=>this._createFeature=t,searchConfiguration:this.searchConfiguration,selectedLayerId:this._selectedLayerId})))}updatedProgressStatus(t){this._updatedProgressBarStatus=t.detail}onFormReady(){this._showSubmitCancelButton=!0}showSubmitCancelButton(t){this._showSubmitCancelButton=!t.detail}onCreateFeatureSubmitButtonClick(){this._createFeature&&this._createFeature.submit()}backFromCreateFeaturePanel(){this._createFeature&&this.updateNonVisibleLayersOnMap(!1),this.backFromSelectedPanel()}onCreateRelatedFeatureSubmitButtonClick(){this._createRelatedFeature&&this._createRelatedFeature.submit()}backFromCreateRelatedFeaturePanel(){this._createRelatedFeature&&(this._showSubmitCancelButton=!1),this.backFromSelectedPanel()}createFeatureFailed(t){console.error(t.detail),this._featureCreationFailedErrorMsg=t.detail.message}async onReportSubmitted(){this.updateNonVisibleLayersOnMap(!1),await this.navigateToHomePage(),this._reportSubmitted=!0,this._updatedProgressBarStatus=25,this._showFullPanel&&this.updatePanelState(this._sidePanelCollapsed,!1)}addCommentFailed(t){console.error(t.detail),this._addingCommentFailed=!0}async onCommentSubmitted(){this._commentSubmitted=!0,this.backFromSelectedPanel(),this._showLoadingIndicator=!0,await this._featureDetails.refresh(this._currentFeature),setTimeout((()=>{this._showLoadingIndicator=!1}),300)}async navigateToHomePage(){await this.setSelectedFeatures([]),this._layerList&&await this._layerList.refresh(),1===this._editableLayerIds.length?(await this._featureList.refresh(),this._flowItems=["feature-list"]):this._flowItems=["layer-list"]}async navigateToCreateFeature(t){t.detail.layerId&&t.detail.layerName&&await this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this.updateNonVisibleLayersOnMap(!0),this._getFormElements(),this._showSubmitCancelButton=!1,this.updatePanelState(!1,!0),this._flowItems=[...this._flowItems,"feature-create"]}navigateToChooseCategory(){this.updatePanelState(!1,!0),this._flowItems=[...this._flowItems,"reporting-layer-list"]}updateNonVisibleLayersOnMap(t){this._nonVisibleValidLayers.find((t=>t.id===this._selectedLayerId))&&this._selectedLayer.set("visible",t)}async layerListLoaded(t){const e=t.detail,i=await r(this.mapView),s=[];this._validLayers=[],this._nonVisibleValidLayers=[],i.forEach((t=>{e.includes(t.id)&&(this._validLayers.push(t),t.visible||this._nonVisibleValidLayers.push(t),this._getLayersConfig(t.id)?.reporting&&this._layerItemsHash[t.id]&&this._layerItemsHash[t.id].supportsAdd&&s.push(t.id))})),this.handleMapClick(),this._hasValidLayers=s.length>0,this._urlParamsLoaded||(this._urlParamsLoaded=!0,await this.loadFeatureFromURLParams())}async displayFeaturesList(t){this._updatedSorting={field:"",order:"desc"},this._updatedSortOption="sortNewest",await this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this.handleSelectedLayersFilter(),this._flowItems=[...this._flowItems,"feature-list"],this._prevSelectedLayerId=this._selectedLayerId}async backFromFilterPanel(){null!=this._filterList&&(this._currentLayerExpressions=await this._filterList.getCurrentLayerExpressions()),await this._featureList.refresh(),this.backFromSelectedPanel()}backFromSelectedPanel(){this._updatedProgressBarStatus=25;const t=[...this._flowItems];"comment-details"!==t[t.length-1]&&"add-comment"!==t[t.length-1]&&this.clearHighlights(),"reporting-layer-list"!==t[t.length-1]&&("feature-create"!==t[t.length-1]||"feature-list"!==t[0]&&"feature-list"!==t[t.length-2])||this.updatePanelState(this._sidePanelCollapsed,!1),t.pop(),1!==t.length||"layer-list"!==t[0]?this._flowItems=[...t]:this.navigateToHomePage()}toggleSidePanel(){this._sidePanelCollapsed=!this._sidePanelCollapsed,this.togglePanel.emit({panelState:this._sidePanelCollapsed,isFormOpen:this._showFullPanel})}updatePanelState(t,e){this._sidePanelCollapsed=t,this._showFullPanel=e,this.togglePanel.emit({panelState:this._sidePanelCollapsed,isFormOpen:this._showFullPanel})}async onFeatureSelectFromList(t){this._showLoadingIndicator=!0,await this.setSelectedFeatures([t.detail]),this._flowItems=[...this._flowItems,"feature-details"]}async getRelatedTable(){const t=this._currentFeature.layer,e=await c(this.mapView);t.relationships.some((i=>{const s=e.filter((e=>t.url===e.url&&e.layerId===i.relatedTableId));if(s&&s.length>0)return this._relatedTable=s[0],!0}))}async updatingFeatureDetails(t){this._showLoadingIndicator=t}async selectionChanged(t){this.updatingFeatureDetails(!0),await this.setCurrentFeature(t.detail.selectedFeature[0]),this.highlightOnMap(t.detail.selectedFeature[0]),this._selectedFeatureIndex=t.detail.selectedFeatureIndex,await this._featureDetails.refresh(t.detail.selectedFeature[0])}showAddCommentsPanel(){this._flowItems=[...this._flowItems,"add-comment"]}async onCommentSelectFromList(t){this._selectedRelatedFeature=[t.detail],this._flowItems=[...this._flowItems,"comment-details"]}getFeatureListFlowItem(t,e){const i=this._getLayersConfig(this._selectedLayerId)?.reporting&&this._layerItemsHash[this._selectedLayerId].supportsAdd,a=this._currentLayerExpressions?.length>0;return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:e,loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this),selected:"feature-list"===this._flowItems[this._flowItems.length-1]},this._toggleSort(),s("calcite-action",{icon:"sort-ascending-arrow",id:"sort-popover",slot:"header-actions-end",text:this._translations.sort,title:this._translations.sort}),a&&s("calcite-action",{icon:"filter",indicator:this._filterActive,onClick:()=>{this._flowItems=[...this._flowItems,"filter-panel"]},slot:"header-actions-end",text:this._translations.filter,title:this._translations.filter}),this.isMobile&&this.getActionToExpandCollapsePanel(),this.enableNewReports&&i&&s("calcite-button",{appearance:"solid",onClick:this.navigateToCreateFeature.bind(this),slot:"footer",width:"full"},this.reportButtonText?this.reportButtonText:this._translations.createReportButtonText),s("calcite-panel",{"full-height":!0},s("feature-list",{applyLayerViewFilter:this.showMyReportsOnly,class:"height-full",highlightOnHover:!0,locale:this.locale,mapView:this.mapView,noFeaturesFoundMsg:this._translations.featureErrorMsg,onFeatureSelect:this.onFeatureSelectFromList.bind(this),pageSize:30,ref:t=>this._featureList=t,reportingOptions:this.reportingOptions,selectedLayerId:t,showFeatureSymbol:this.showFeatureSymbol,sortingInfo:this._updatedSorting})))}getFilterPanel(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._translations?.filterLayerTitle?.replace("{{title}}",this._selectedLayerName),loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromFilterPanel.bind(this),selected:"filter-panel"===this._flowItems[this._flowItems.length-1]},this.isMobile&&this.getActionToExpandCollapsePanel(),s("div",{class:"width-full",slot:"footer"},s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",disabled:!this._filterActive,onClick:this.resetFilterList.bind(this),width:"full"},this._translations.resetFilter),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromFilterPanel.bind(this),width:"full"},this._translations.close))),s("calcite-panel",{"full-height":!0},s("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtnOnClick:()=>{},comboboxOverlayPositioning:"fixed",layerExpressions:this._currentLayerExpressions,onFilterListReset:()=>{this._handleFilterListReset()},onFilterUpdate:()=>{this._handleFilterUpdate(this._filterList.filterCount>0)},ref:t=>this._filterList=t,resetBtn:!1,resetFiltersOnDisconnect:!1,view:this.mapView,zoomBtn:!1})))}getFeatureDetailsFlowItem(){const t=this._getLayersConfig(this._selectedLayerId)?.comment&&this._selectedLayer.relationships.length>0&&this._relatedTable;return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,loading:this._showLoadingIndicator,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this),selected:"feature-details"===this._flowItems[this._flowItems.length-1]},this.isMobile&&this.getActionToExpandCollapsePanel(),s("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"share-node",embed:!1,popoverButtonIconScale:"s",ref:t=>this._shareNode=t,removePopoverOffset:!0,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",slot:"header-actions-end",socialMedia:!0,view:this.mapView}),this._selectedFeature.length>1&&this.getFeaturesPagination(),s("calcite-panel",null,s("feature-details",{class:"full-height",graphics:this._selectedFeature,layerItemsHash:this._layerItemsHash,locale:this.locale,mapView:this.mapView,onAddComment:this.showAddCommentsPanel.bind(this),onCommentSelect:this.onCommentSelectFromList.bind(this),onFeatureSelectionChange:this.selectionChanged.bind(this),onLikeOrDislikeClicked:()=>{this._featureList.refresh(!0)},onLoadingStatus:t=>{this.updatingFeatureDetails(t.detail)},ref:t=>this._featureDetails=t,reportingOptions:this.reportingOptions,showFullCommentTitle:this.showFullCommentTitle,showUserImageInCommentsList:this.showUserImageInCommentsList}),t&&s("calcite-button",{appearance:"solid",onClick:this.showAddCommentsPanel.bind(this),slot:"footer",width:"full"},this.commentButtonText||this._translations.comment)))}getFeaturesPagination(){return s("div",{class:"feature-pagination"},s("div",null,s("calcite-button",{appearance:"transparent",disabled:!1,iconStart:"chevron-left",id:"solutions-back",onClick:()=>{this._featureDetails.back()},scale:"s",width:"full"}),s("calcite-tooltip",{label:"",placement:"top","reference-element":"solutions-back"},s("span",null,this._translations.back))),s("calcite-button",{appearance:"transparent",onClick:()=>{this._featureDetails.toggleListView()},scale:"s"},s("span",{class:"pagination-count"},this._getCount())),s("div",null,s("calcite-button",{appearance:"transparent",disabled:!1,iconStart:"chevron-right",id:"solutions-next",onClick:()=>{this._featureDetails.next()},scale:"s",width:"full"}),s("calcite-tooltip",{placement:"top","reference-element":"solutions-next"},s("span",null,this._translations.next))))}getCommentDetailsFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._relatedTable.title,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this),selected:"comment-details"===this._flowItems[this._flowItems.length-1]},this.isMobile&&this.getActionToExpandCollapsePanel(),s("calcite-panel",{"full-height":!0},s("info-card",{allowEditing:!1,graphics:this._selectedRelatedFeature,highlightEnabled:!1,isLoading:!1,isMobile:!1,locale:this.locale,mapView:this.mapView,paginationEnabled:!1})))}getAddCommentFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._relatedTable.title,onCalciteFlowItemBack:this.backFromCreateRelatedFeaturePanel.bind(this),selected:"add-comment"===this._flowItems[this._flowItems.length-1]},this.isMobile&&this.getActionToExpandCollapsePanel(),s("div",{class:"width-full",slot:"footer"},this._showSubmitCancelButton&&s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"solid",class:"footer-top-button footer-button",onClick:this.onCreateRelatedFeatureSubmitButtonClick.bind(this),width:"full"},this._translations.submit),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromCreateRelatedFeaturePanel.bind(this),width:"full"},this._translations.cancel))),s("calcite-panel",null,s("create-related-feature",{customizeSubmit:!0,locale:this.locale,mapView:this.mapView,onFail:this.addCommentFailed.bind(this),onFormReady:this.onFormReady.bind(this),onIsActionPending:this.showSubmitCancelButton.bind(this),onSuccess:this.onCommentSubmitted.bind(this),ref:t=>this._createRelatedFeature=t,selectedFeature:this._currentFeature,table:this._relatedTable})))}async setSelectedFeatures(t){this._selectedFeature=t,await this.setCurrentFeature(this._selectedFeature.length?this._selectedFeature[0]:null)}async setCurrentFeature(t){if(this._currentFeature=t,t&&t.layer){const e=t.layer;this.setSelectedLayer(e.id,e.title),this._currentFeatureId=t.attributes[e.objectIdField],this._getLayersConfig(e.id)?.comment&&e.relationships.length>0&&await this.getRelatedTable()}else this._editableLayerIds.length>1&&(this.setSelectedLayer("",""),this.handlePrevLayersFilter()),this._currentFeatureId="";this._updateShareURL()}async highlightOnMap(t){if(this.clearHighlights(),t&&t.geometry&&t.layer){const e=await d(this.mapView,t.layer.id);e.highlightOptions=null,this._highlightHandle=await u([t.getObjectId()],e,this.mapView,!0,this.zoomToScale)}this.updatingFeatureDetails(!1)}clearHighlights(){this._highlightHandle&&this._highlightHandle.remove()}getActionToExpandCollapsePanel(){return s("calcite-action",{icon:this._sidePanelCollapsed?"chevrons-up":"chevrons-down",onClick:this.toggleSidePanel.bind(this),slot:"header-actions-end",text:this._sidePanelCollapsed?this._translations.expand:this._translations.collapse})}async setMapView(){await this.getLayersToShowInList(),await this._updateFeatures(),1===this._editableLayerIds?.length?await this.renderFeaturesList():this._flowItems=["layer-list"],this.mapView.popupEnabled=!1,this._defaultCenter&&this._defaultLevel&&(await this.mapView.goTo({center:this._defaultCenter,zoom:this._defaultLevel}),this._defaultCenter=void 0,this._defaultLevel=void 0)}handleMapClick(){this._mapClickHandle&&this._mapClickHandle.remove(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",this.onMapClick.bind(this))}async onMapClick(t){this.mapView.popupEnabled=!1;const e=await this.mapView.hitTest(t);if(e.results.length>0){const t=[];e.results.forEach((function(e){"graphic"===e.type&&t.push(e.graphic)}));const i=t.filter((t=>this._validLayers.includes(t.layer))),s=t.filter((t=>!this._validLayers.includes(t.layer)&&t?.layer?.popupEnabled&&t?.layer?.id));if(i.length>0&&(await this.setSelectedFeatures(i),this._flowItems.length&&this._flowItems.includes("feature-details")?(this._flowItems=[...this._flowItems.slice(0,this._flowItems.indexOf("feature-details")+1)],await this.highlightOnMap(t[0])):this._flowItems=[...this._flowItems,"feature-details"]),s.length>0){this.mapView.popupEnabled=!0;const t={features:s,updateLocationEnabled:!0};await this.mapView.openPopup(t)}}}_getCount(){const t=(this._selectedFeatureIndex+1).toString(),e=this._selectedFeature.length.toString();return this._translations.indexOfTotal.replace("{{index}}",t).replace("{{total}}",e)}async _getTranslations(){const t=await o(this.el);this._translations=t[0]}_updateFloorDefinitionExpression(t){const e=`${t.floorInfo.floorField} = '${this.floorLevel}'`,i=t.definitionExpression;t.definitionExpression=i?.indexOf(this._floorExpression)>-1?i.replace(this._floorExpression,e):e,this._floorExpression=e}_getFormElements(){const t=this._selectedLayer,e=t?.floorInfo?.floorField;if(e&&this.floorLevel&&t?.formTemplate){const e=this._formElements.find((e=>e.id===t.id));0!==this._formElements.length&&e||this._formElements.push({id:t.id,orgElements:t.formTemplate.elements,orgExpressionInfos:t.formTemplate.expressionInfos})}}reduceToConfiguredLayers(t,e){return Object.keys(t).reduce(((i,s)=>{const a=this.reportingOptions?this._getLayersConfig(s)?.visible:t[s].supportsAdd;return!e.includes(s)&&a&&i.push(s),i}),[])}async _updateFeatures(){for(const t of this._editableLayerIds){const e=await d(this.mapView,t);await this._showMyFeaturesOnly(e);const i=e.layer?.floorInfo?.floorField;i&&this.floorLevel&&this._updateFloorDefinitionExpression(e.layer)}}async _showMyFeaturesOnly(t){const e=this.mapView.map.portalItem.portal?.credential?.userId;if(e){const i=t.layer.editFieldsInfo?.creatorField.toLowerCase();t.filter=this.showMyReportsOnly&&i?new this.FeatureFilter({where:i+"='"+e+"'"}):null}}async getLayersToShowInList(){const t=await p(this.mapView,!0),e=await r(this.mapView),i=[];e.forEach((e=>{"feature"===e?.type&&e?.editingEnabled&&e?.capabilities?.operations?.supportsAdd&&(t[e.id].supportsAdd=!0),e?.editingEnabled||i.push(e.id)})),this._editableLayerIds=this.reduceToConfiguredLayers(t,i),this._layerItemsHash=t}async renderFeaturesList(){this._flowItems=["feature-list"];const t={detail:this._editableLayerIds};await this.layerListLoaded(t),await this.setSelectedLayer(this._validLayers[0].id,this._validLayers[0].title),this.handleSelectedLayersFilter()}_updateShareURL(){const t=this._shareNode?.shareUrl;if(!t)return;const e=new URL(t);this._selectedLayerId?e.searchParams.set("layerid",this._selectedLayerId):e.searchParams.delete("layerid"),this._selectedFeature?.length?e.searchParams.set("oid",this._currentFeatureId):e.searchParams.delete("oid"),this._shareNode.shareUrl=e.href}async loadFeatureFromURLParams(){if(this.center&&this.level&&await this.mapView.goTo({center:this.center.split(";").map(Number),zoom:this.level}),this.layerId&&this.objectId){const t=await n(this.mapView,this.layerId);if(t){const e=await m([Number(this.objectId)],t,[],!0,this.mapView.spatialReference);e.length&&(await this.setSelectedFeatures(e),this._flowItems=this._flowItems.length&&"feature-details"!==this._flowItems[this._flowItems.length-1]?[...this._flowItems,"feature-details"]:[...this._flowItems])}}}async handleSelectedLayersFilter(){if(this._selectedLayer){const t=this.layerExpressions?structuredClone(this.layerExpressions.filter((t=>t.id===this._selectedLayerId))):[];null!=this._t9nLayerExpressions&&this.handleLayerExpressionsT9n(t,this._t9nLayerExpressions),this._currentLayerExpressions=t,this.setActiveDefinitionExpressions()}}async handlePrevLayersFilter(){if(this._prevSelectedLayerId){const t=await n(this.mapView,this._prevSelectedLayerId);t&&(t.definitionExpression=this._initDefExpressions[this._prevSelectedLayerId])}}resetFilterList(){this._filterList?.forceReset(),null!=this._selectedLayer&&(this._selectedLayer.definitionExpression=this._initDefExpressions[this._selectedLayerId],this._filterActive=!1)}setActiveDefinitionExpressions(){if(null==this._selectedLayer)return;const t=[];if(this._currentLayerExpressions?.length>0){const e=this._currentLayerExpressions[0];for(const i of e.expressions){const{active:e,definitionExpression:s}=i;e&&s&&t.push(`(${s})`)}this._filterActive=t.length>0,this.updateFilterLayerDefExpression(t,e.operator)}}updateFilterLayerDefExpression(t,e){const i=this._initDefExpressions[this._selectedLayerId],s=t?.length>0&&null!=i?`(${t.join(e)}) AND (${i})`:t.length>0?t.join(e):i;this._selectedLayer.definitionExpression=s}setInitExpressions(){if(this._initDefExpressions={},null==this.mapView)return;const t=this.mapView.map;t.allLayers.concat(t.allTables).forEach((t=>{"feature"===t.type&&(this._initDefExpressions[t.id]=t.definitionExpression)}))}handleLayerExpressionsT9n(t,e){t?.forEach((t=>{const i=e?.find((e=>e.id===t.id));null!=i&&(t.title=i.title,t.expressions?.forEach((t=>{const e=i.expressions?.find((e=>e.id===t.id));null!=e&&(t.name=e.name)})))}))}static get watchers(){return{isMobile:["isMobileWatchHandler"],locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"],floorLevel:["floorLevelWatchHandler"],showMyReportsOnly:["showMyReportsOnlyWatchHandler"],layerExpressions:["layerExpressionsWatchHandler"],showFeatureSymbol:["showFeatureSymbolWatchHandler"]}}};f.style=":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.notice-msg{padding:10px;width:calc(100% - 20px)}.progress-bar{padding:12px}.footer-top-button{padding-bottom:7px}.footer-button{height:35px}.feature-pagination{background-color:var(--calcite-color-foreground-1) !important;border-block-end:1px solid var(--calcite-color-border-3);display:flex;justify-content:center;padding:5px 0}.pagination-count{color:var(--calcite-color-brand);border-bottom:1px solid var(--calcite-color-brand);font-weight:bold}.report-submitted-msg{position:absolute;z-index:1000}.share-node{display:flex}";export{f as crowdsource_reporter}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{t}from"./p-4fe489cf.js";import{a as n}from"./p-1b0588d2.js";import{l as i}from"./p-ee2cbba0.js";import{q as r}from"./p-952da957.js";import{S as e}from"./p-2bc98cb0.js";import"./p-4f236b5d.js";import{g as s}from"./p-570b13d9.js";import{a as o,r as a,c as u}from"./p-0668e30d.js";
6
+ import{t}from"./p-4fe489cf.js";import{a as n}from"./p-1b0588d2.js";import{l as i}from"./p-ee2cbba0.js";import{q as r}from"./p-dcd2f00b.js";import{S as e}from"./p-2bc98cb0.js";import"./p-4f236b5d.js";import{g as s}from"./p-570b13d9.js";import{a as o,r as a,c as u}from"./p-0668e30d.js";
7
7
  /* @preserve
8
8
  * arcgis-pdf-creator v0.0.1
9
9
  * Thu Apr 27 2023 17:20:32 GMT-0700 (Pacific Daylight Time)
@@ -3,4 +3,4 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{r as t,c as e,g as i,h as s,H as a}from"./p-1b0588d2.js";import{g as h}from"./p-ee2cbba0.js";import{g as l,d as n,p as o}from"./p-952da957.js";import{s as r}from"./p-48942eb8.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";import"./p-e23b4193.js";const c=class{constructor(i){t(this,i),this.beforeLayerSelectionChange=e(this,"beforeLayerSelectionChange",7),this.idsFound=e(this,"idsFound",7),this.noLayersFound=e(this,"noLayersFound",7),this.layerSelectionChange=e(this,"layerSelectionChange",7)}get el(){return i(this)}appearance="transparent";defaultLayerId="";display="inline-block";enabledLayerIds=[];enabledTableIds=[];height;isMobile;locale;mapView;onlyShowUpdatableLayers;placeholderIcon="";selectedIds=[];scale="m";showTables;showTablesDisabled;showSingleLayerAsLabel=!1;type="select";_hasMultipleLayers=!0;_hasValidLayers=!0;_isDropdownOpen;ids=[];selectedName="";_translations;defaultLayerHonored=!1;_layerElement;_layerNameHash;_skipEditCheck=!1;_tableNameHash;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(){await this._setLayers(),this.ids.length>0?(this._hasValidLayers=!0,this._hasMultipleLayers=this.ids.length>1,this._setSelectedLayer(this.ids[0])):(this._hasValidLayers=!1,this.noLayersFound.emit())}async setLayerById(t,e=!1){this._skipEditCheck=e,this._setSelectedLayer(t),this._skipEditCheck=!1}async setLayerByIds(t,e=!1){this._skipEditCheck=e,this._layerSelectionChange(t),this._skipEditCheck=!1}async updateLayer(){this._setSelectedLayer(this.ids[0])}beforeLayerSelectionChange;idsFound;noLayersFound;layerSelectionChange;async componentWillLoad(){await this._getTranslations(),await this._setLayers()}async componentWillRender(){if(this.ids.length>0||1===this.selectedIds.length){const t=1===this.selectedIds.length?this.selectedIds[0]:this.ids[0];if(t!==this.selectedIds[0])this._setSelectedLayer(t);else{const t=await l(this.mapView,this.selectedIds[0]);this.selectedName=t?.title}}}render(){const t="map-layer-picker";let e=this.height>0?{height:`${this.height.toString()}px`}:{};return e={...e,display:this.display},s(a,{key:"a4d7a923fcf0b6ec488fafa3af8b3c3a9599d61a"},s("div",{key:"54d5cde231707391537fbd649647a5b9e86a1ab3",class:"map-layer-picker-container",style:e},s("div",{key:"1d1329f393778e561bfed22a1c1542cd75d4b55b",class:"map-layer-picker",style:e},this._hasValidLayers?!this._hasMultipleLayers&&this.showSingleLayerAsLabel?this._getSingleLayerPlaceholder():"combobox"===this.type?this._getCombobox(t):"select"===this.type?this._getSelect(t):this._getDropdown(t):this._getInvalidPlaceholder())))}async componentDidLoad(){if(this.ids.length>0||1===this.selectedIds.length){const t=1===this.selectedIds.length?this.selectedIds[0]:this.ids[0];"select"===this.type?this._layerElement.value=t:"dropdown"===this.type&&(this.selectedName=Object.keys(this._layerNameHash).indexOf(t)>-1?this._layerNameHash[t].name:Object.keys(this._tableNameHash).indexOf(t)>-1?this._tableNameHash[t].name:"")}}_getInvalidPlaceholder(){return s("div",null,s("calcite-notice",{class:"height-100",icon:"exclamation-mark-triangle",id:"no-valid-layers",kind:"danger",open:!0},s("div",{slot:"message"},this._translations.noLayersFound)),s("calcite-tooltip",{label:this._translations.enableEditUpdate,placement:"bottom","reference-element":"no-valid-layers"},s("span",null,this._translations.enableEditUpdate)))}_getSingleLayerPlaceholder(){const t=this._getItemTypeIcon();return s("div",{class:"layer-picker-label-container cursor-default"},s("calcite-icon",{icon:t,scale:"s"}),s("calcite-label",{class:"no-bottom-margin padding-start-1"},this.selectedName))}_getSelect(t){return s("calcite-select",{id:t,label:"",onCalciteSelectChange:()=>this._layerSelectionChange(),ref:t=>{this._layerElement=t},scale:this.scale},this._getMapLayerOptions())}_getCombobox(t){return s("calcite-combobox",{clearDisabled:!0,id:t,label:"",onCalciteComboboxChange:()=>this._layerSelectionChange(),"placeholder-icon":this.placeholderIcon,ref:t=>{this._layerElement=t},scale:this.scale,"selection-mode":"single"},this._getMapLayerOptions())}_getDropdown(t){return s("calcite-dropdown",{class:"layer-picker-dropdown",onCalciteDropdownBeforeClose:()=>this._isDropdownOpen=!1,onCalciteDropdownBeforeOpen:()=>this._isDropdownOpen=!0},this.isMobile?this._getDropdownButton():this._getActionDropdownButton(t),s("calcite-dropdown-group",{"selection-mode":"single"},this._getMapLayerOptions()))}_getActionDropdownButton(t){return s("calcite-action",{id:t,slot:"trigger",text:""},this._getDropdownButton())}_getDropdownButton(){const t=this._getItemTypeIcon();return s("calcite-button",{alignment:"icon-end-space-between",appearance:this.appearance,class:this.isMobile?"":"max-width-350",iconEnd:this._isDropdownOpen?"chevron-up":"chevron-down",iconStart:t,kind:"neutral",slot:this.isMobile?"trigger":"",width:"full"},s("div",null,this.selectedName))}_getItemTypeIcon(){let t="layers";if(this.selectedIds.length>0){const e=this.selectedIds[0];t=Object.keys(this._layerNameHash).indexOf(e)>-1?"layers":"table"}return t}_getMapLayerOptions(){return this.ids.reduce(((t,e)=>(this._validLayer(e)?t.push(this._getItem(e,"layer")):this._validTable(e)&&t.push(this._getItem(e,"table")),t)),[])}_getItem(t,e){const i="layer"===e?this._layerNameHash[t]:this._tableNameHash[t],a=!!this.onlyShowUpdatableLayers&&!i.supportsUpdate,h=i.name,l=this.selectedIds.indexOf(t)>-1;return"combobox"===this.type?s("calcite-combobox-item",{disabled:a,selected:l,textLabel:h,value:t}):"select"===this.type?s("calcite-option",{disabled:a,label:h,selected:l,value:t}):s("calcite-dropdown-group",{class:a?"disabled":"",selectionMode:a?"none":"single"},s("calcite-dropdown-item",{disabled:"table"===e&&this.showTablesDisabled,"icon-start":e,onClick:a?void 0:()=>{this._setSelectedLayer(t)},selected:l},h))}_setSelectedLayer(t){let e;this.defaultLayerId&&!this.defaultLayerHonored&&(e=this._getLayerFromHash(this.defaultLayerId),this.defaultLayerHonored=void 0!==e,t=this.defaultLayerHonored?this.defaultLayerId:t),e=e||this._getLayerFromHash(t),(this._skipEditCheck||!this.beforeLayerSelectionChange.emit({currentId:this.selectedIds[0],newId:t,ref:this.el}).defaultPrevented)&&(this.selectedName=e?.name,this.selectedIds=[t],this.layerSelectionChange.emit(this.selectedIds))}_getLayerFromHash(t){return Object.keys(this._layerNameHash).indexOf(t)>-1?this._layerNameHash[t]:Object.keys(this._tableNameHash).indexOf(t)>-1?this._tableNameHash[t]:void 0}async _setLayers(){if(this.mapView){await this._initLayerTableHash();const t=this.onlyShowUpdatableLayers?this._getEditableIds(this._layerNameHash):Object.keys(this._layerNameHash),e=this.showTables?this.onlyShowUpdatableLayers?this._getEditableIds(this._tableNameHash):Object.keys(this._tableNameHash):[];this.ids=[...t.reverse().filter((t=>!(this.enabledLayerIds?.length>0)||this.enabledLayerIds.reverse().indexOf(t)>-1)),...e.reverse().filter((t=>!(this.enabledTableIds?.length>0)||this.enabledTableIds.reverse().indexOf(t)>-1))],this.idsFound.emit({layerIds:t,tableIds:e})}}_getEditableIds(t){return Object.keys(t).reduce(((e,i)=>(t[i].supportsUpdate&&e.push(i),e)),[])}async _initLayerTableHash(){this._layerNameHash=await n(this.mapView,this.onlyShowUpdatableLayers),this._tableNameHash=this.showTables?await o(this.mapView,this.onlyShowUpdatableLayers):{}}_validLayer(t){const e=this._layerNameHash[t]?.name;return e&&Object.keys(r.managedLayers).indexOf(e)<0&&(!(this.enabledLayerIds.length>0)||this.enabledLayerIds.indexOf(t)>-1)}_validTable(t){const e=this._tableNameHash[t]?.name,i=e&&this.showTables;return i?r.managedTables.indexOf(e)<0&&(!(this.enabledTableIds.length>0)||this.enabledTableIds.indexOf(t)>-1):i}_layerSelectionChange(t){const e=t||(Array.isArray(this._layerElement.value)?this._layerElement.value:[this._layerElement.value]);if(JSON.stringify(e)!==JSON.stringify([""])){if(!this._skipEditCheck&&this.beforeLayerSelectionChange.emit({currentIds:this.selectedIds,newIds:e,ref:this.el}).defaultPrevented)return;this.selectedIds=e,this.layerSelectionChange.emit(this.selectedIds)}}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}static get watchers(){return{locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"]}}};c.style=":host{display:block}.map-layer-picker-container{width:100%;align-items:center}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}.layer-picker-dropdown{height:100%;width:100%}.max-width-350{max-width:350px}.height-100{height:100%}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.no-bottom-margin{--calcite-label-margin-bottom:0px}.layer-picker-label-container{align-items:center;display:inline-flex;height:100%;padding-inline-start:1rem;padding-inline-end:1rem}.padding-start-1{padding-inline-start:1rem}.cursor-default{cursor:default}";export{c as map_layer_picker}
6
+ import{r as t,c as e,g as i,h as s,H as a}from"./p-1b0588d2.js";import{g as h}from"./p-ee2cbba0.js";import{g as l,d as n,n as o}from"./p-dcd2f00b.js";import{s as r}from"./p-48942eb8.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-80cb7c73.js";import"./p-e23b4193.js";const c=class{constructor(i){t(this,i),this.beforeLayerSelectionChange=e(this,"beforeLayerSelectionChange",7),this.idsFound=e(this,"idsFound",7),this.noLayersFound=e(this,"noLayersFound",7),this.layerSelectionChange=e(this,"layerSelectionChange",7)}get el(){return i(this)}appearance="transparent";defaultLayerId="";display="inline-block";enabledLayerIds=[];enabledTableIds=[];height;isMobile;locale;mapView;onlyShowUpdatableLayers;placeholderIcon="";selectedIds=[];scale="m";showTables;showTablesDisabled;showSingleLayerAsLabel=!1;type="select";_hasMultipleLayers=!0;_hasValidLayers=!0;_isDropdownOpen;ids=[];selectedName="";_translations;defaultLayerHonored=!1;_layerElement;_layerNameHash;_skipEditCheck=!1;_tableNameHash;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(){await this._setLayers(),this.ids.length>0?(this._hasValidLayers=!0,this._hasMultipleLayers=this.ids.length>1,this._setSelectedLayer(this.ids[0])):(this._hasValidLayers=!1,this.noLayersFound.emit())}async setLayerById(t,e=!1){this._skipEditCheck=e,this._setSelectedLayer(t),this._skipEditCheck=!1}async setLayerByIds(t,e=!1){this._skipEditCheck=e,this._layerSelectionChange(t),this._skipEditCheck=!1}async updateLayer(){this._setSelectedLayer(this.ids[0])}beforeLayerSelectionChange;idsFound;noLayersFound;layerSelectionChange;async componentWillLoad(){await this._getTranslations(),await this._setLayers()}async componentWillRender(){if(this.ids.length>0||1===this.selectedIds.length){const t=1===this.selectedIds.length?this.selectedIds[0]:this.ids[0];if(t!==this.selectedIds[0])this._setSelectedLayer(t);else{const t=await l(this.mapView,this.selectedIds[0]);this.selectedName=t?.title}}}render(){const t="map-layer-picker";let e=this.height>0?{height:`${this.height.toString()}px`}:{};return e={...e,display:this.display},s(a,{key:"a4d7a923fcf0b6ec488fafa3af8b3c3a9599d61a"},s("div",{key:"54d5cde231707391537fbd649647a5b9e86a1ab3",class:"map-layer-picker-container",style:e},s("div",{key:"1d1329f393778e561bfed22a1c1542cd75d4b55b",class:"map-layer-picker",style:e},this._hasValidLayers?!this._hasMultipleLayers&&this.showSingleLayerAsLabel?this._getSingleLayerPlaceholder():"combobox"===this.type?this._getCombobox(t):"select"===this.type?this._getSelect(t):this._getDropdown(t):this._getInvalidPlaceholder())))}async componentDidLoad(){if(this.ids.length>0||1===this.selectedIds.length){const t=1===this.selectedIds.length?this.selectedIds[0]:this.ids[0];"select"===this.type?this._layerElement.value=t:"dropdown"===this.type&&(this.selectedName=Object.keys(this._layerNameHash).indexOf(t)>-1?this._layerNameHash[t].name:Object.keys(this._tableNameHash).indexOf(t)>-1?this._tableNameHash[t].name:"")}}_getInvalidPlaceholder(){return s("div",null,s("calcite-notice",{class:"height-100",icon:"exclamation-mark-triangle",id:"no-valid-layers",kind:"danger",open:!0},s("div",{slot:"message"},this._translations.noLayersFound)),s("calcite-tooltip",{label:this._translations.enableEditUpdate,placement:"bottom","reference-element":"no-valid-layers"},s("span",null,this._translations.enableEditUpdate)))}_getSingleLayerPlaceholder(){const t=this._getItemTypeIcon();return s("div",{class:"layer-picker-label-container cursor-default"},s("calcite-icon",{icon:t,scale:"s"}),s("calcite-label",{class:"no-bottom-margin padding-start-1"},this.selectedName))}_getSelect(t){return s("calcite-select",{id:t,label:"",onCalciteSelectChange:()=>this._layerSelectionChange(),ref:t=>{this._layerElement=t},scale:this.scale},this._getMapLayerOptions())}_getCombobox(t){return s("calcite-combobox",{clearDisabled:!0,id:t,label:"",onCalciteComboboxChange:()=>this._layerSelectionChange(),"placeholder-icon":this.placeholderIcon,ref:t=>{this._layerElement=t},scale:this.scale,"selection-mode":"single"},this._getMapLayerOptions())}_getDropdown(t){return s("calcite-dropdown",{class:"layer-picker-dropdown",onCalciteDropdownBeforeClose:()=>this._isDropdownOpen=!1,onCalciteDropdownBeforeOpen:()=>this._isDropdownOpen=!0},this.isMobile?this._getDropdownButton():this._getActionDropdownButton(t),s("calcite-dropdown-group",{"selection-mode":"single"},this._getMapLayerOptions()))}_getActionDropdownButton(t){return s("calcite-action",{id:t,slot:"trigger",text:""},this._getDropdownButton())}_getDropdownButton(){const t=this._getItemTypeIcon();return s("calcite-button",{alignment:"icon-end-space-between",appearance:this.appearance,class:this.isMobile?"":"max-width-350",iconEnd:this._isDropdownOpen?"chevron-up":"chevron-down",iconStart:t,kind:"neutral",slot:this.isMobile?"trigger":"",width:"full"},s("div",null,this.selectedName))}_getItemTypeIcon(){let t="layers";if(this.selectedIds.length>0){const e=this.selectedIds[0];t=Object.keys(this._layerNameHash).indexOf(e)>-1?"layers":"table"}return t}_getMapLayerOptions(){return this.ids.reduce(((t,e)=>(this._validLayer(e)?t.push(this._getItem(e,"layer")):this._validTable(e)&&t.push(this._getItem(e,"table")),t)),[])}_getItem(t,e){const i="layer"===e?this._layerNameHash[t]:this._tableNameHash[t],a=!!this.onlyShowUpdatableLayers&&!i.supportsUpdate,h=i.name,l=this.selectedIds.indexOf(t)>-1;return"combobox"===this.type?s("calcite-combobox-item",{disabled:a,selected:l,textLabel:h,value:t}):"select"===this.type?s("calcite-option",{disabled:a,label:h,selected:l,value:t}):s("calcite-dropdown-group",{class:a?"disabled":"",selectionMode:a?"none":"single"},s("calcite-dropdown-item",{disabled:"table"===e&&this.showTablesDisabled,"icon-start":e,onClick:a?void 0:()=>{this._setSelectedLayer(t)},selected:l},h))}_setSelectedLayer(t){let e;this.defaultLayerId&&!this.defaultLayerHonored&&(e=this._getLayerFromHash(this.defaultLayerId),this.defaultLayerHonored=void 0!==e,t=this.defaultLayerHonored?this.defaultLayerId:t),e=e||this._getLayerFromHash(t),(this._skipEditCheck||!this.beforeLayerSelectionChange.emit({currentId:this.selectedIds[0],newId:t,ref:this.el}).defaultPrevented)&&(this.selectedName=e?.name,this.selectedIds=[t],this.layerSelectionChange.emit(this.selectedIds))}_getLayerFromHash(t){return Object.keys(this._layerNameHash).indexOf(t)>-1?this._layerNameHash[t]:Object.keys(this._tableNameHash).indexOf(t)>-1?this._tableNameHash[t]:void 0}async _setLayers(){if(this.mapView){await this._initLayerTableHash();const t=this.onlyShowUpdatableLayers?this._getEditableIds(this._layerNameHash):Object.keys(this._layerNameHash),e=this.showTables?this.onlyShowUpdatableLayers?this._getEditableIds(this._tableNameHash):Object.keys(this._tableNameHash):[];this.ids=[...t.reverse().filter((t=>!(this.enabledLayerIds?.length>0)||this.enabledLayerIds.reverse().indexOf(t)>-1)),...e.reverse().filter((t=>!(this.enabledTableIds?.length>0)||this.enabledTableIds.reverse().indexOf(t)>-1))],this.idsFound.emit({layerIds:t,tableIds:e})}}_getEditableIds(t){return Object.keys(t).reduce(((e,i)=>(t[i].supportsUpdate&&e.push(i),e)),[])}async _initLayerTableHash(){this._layerNameHash=await n(this.mapView,this.onlyShowUpdatableLayers),this._tableNameHash=this.showTables?await o(this.mapView,this.onlyShowUpdatableLayers):{}}_validLayer(t){const e=this._layerNameHash[t]?.name;return e&&Object.keys(r.managedLayers).indexOf(e)<0&&(!(this.enabledLayerIds.length>0)||this.enabledLayerIds.indexOf(t)>-1)}_validTable(t){const e=this._tableNameHash[t]?.name,i=e&&this.showTables;return i?r.managedTables.indexOf(e)<0&&(!(this.enabledTableIds.length>0)||this.enabledTableIds.indexOf(t)>-1):i}_layerSelectionChange(t){const e=t||(Array.isArray(this._layerElement.value)?this._layerElement.value:[this._layerElement.value]);if(JSON.stringify(e)!==JSON.stringify([""])){if(!this._skipEditCheck&&this.beforeLayerSelectionChange.emit({currentIds:this.selectedIds,newIds:e,ref:this.el}).defaultPrevented)return;this.selectedIds=e,this.layerSelectionChange.emit(this.selectedIds)}}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}static get watchers(){return{locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"]}}};c.style=":host{display:block}.map-layer-picker-container{width:100%;align-items:center}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}.layer-picker-dropdown{height:100%;width:100%}.max-width-350{max-width:350px}.height-100{height:100%}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.no-bottom-margin{--calcite-label-margin-bottom:0px}.layer-picker-label-container{align-items:center;display:inline-flex;height:100%;padding-inline-start:1rem;padding-inline-end:1rem}.padding-start-1{padding-inline-start:1rem}.cursor-default{cursor:default}";export{c as map_layer_picker}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright 2022 Esri
3
+ * Licensed under the Apache License, Version 2.0
4
+ * http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import{r as e,c as t,g as i,h as s,H as o}from"./p-1b0588d2.js";import{g as a}from"./p-ee2cbba0.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";const n=class{constructor(i){e(this,i),this.solutionItemHover=t(this,"solutionItemHover",7),this.solutionItemSelect=t(this,"solutionItemSelect",7),this.solutionTypeHover=t(this,"solutionTypeHover",7)}get el(){return i(this)}locale;listSelectionMode="none";templateInfos=[];_sortedTemplateInfos=[];_translations;_sortOrder=["Hub Site Application","Hub Page","Web Experience","Instant App","Web Mapping Application","Dashboard","StoryMap","Form","QuickCapture Project","Workflow","Big Data Analytic (hosted)","Real Time Analytic (hosted)","Feed (hosted)","Tool","Notebook","Data Pipeline","Project Package","Desktop Application Template","TypeNotFound","Web Map","Web Scene","Feature Layer (hosted, view)","Feature Layer (hosted)","Table (hosted, view)","Table (hosted)","Tile Layer","CSV","Microsoft Excel","Microsoft Word","Report Template","Rule Package","Group"];async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async templateInfosWatchHandler(){this._sortedTemplateInfos=this._sortTemplates()}async deselectAll(){"single"!==this.listSelectionMode&&"single-persist"!==this.listSelectionMode||this.el.shadowRoot.querySelectorAll("calcite-list-item").forEach((e=>{e.selected&&(e.selected=!1,e.parentElement.parentElement.expanded=!1)}))}async selectItem(e){"single"!==this.listSelectionMode&&"single-persist"!==this.listSelectionMode||this.el.shadowRoot.querySelectorAll("calcite-list-item").forEach((t=>{t.id===e&&(t.selected=!0,t.parentElement.parentElement.expanded=!0)}))}solutionItemHover;solutionItemSelect;solutionTypeHover;async componentWillLoad(){this._sortedTemplateInfos=this._sortTemplates(),await this._getTranslations()}render(){return s(o,{key:"23845e68bd1920f17f27b1679df20915230f99c3"},this._getAccordion())}_deselectOthers(e){"single"!==this.listSelectionMode&&"single-persist"!==this.listSelectionMode||this.el.shadowRoot.querySelectorAll("calcite-list-item").forEach((t=>{t.id!==e&&(t.selected=!1)}))}_getAccordion(){const e=[],t=this._sortedTemplateInfos.reduce(((t,i)=>{const s=this._getTypeForDisplay(i.type,i.typeKeywords);return e.indexOf(s)<0&&(e.push(s),t.push(this._getAccordionItem(i))),t}),[]);return s("calcite-accordion",{class:"border-override",selectionMode:"single"},t)}_getAccordionItem(e){const t=this._getTypeForDisplay(e.type,e.typeKeywords),i=this._sortedTemplateInfos.filter((e=>this._getTypeForDisplay(e.type,e.typeKeywords)===t));return s("calcite-accordion-item",{description:`${t} (${i.length})`,onMouseEnter:()=>this.solutionTypeHover.emit({itemType:t,entering:!0}),onMouseLeave:()=>this.solutionTypeHover.emit({itemType:t,entering:!1})},s("solution-item-icon",{class:"padding-start-1 display-flex align-center",slot:"actions-start",type:e.type,typeKeywords:e.typeKeywords}),this._getList(i))}_getList(e){const t=this._sortTemplatesByTitle(e);return s("calcite-list",{label:"",selectionAppearance:"border",selectionMode:this.listSelectionMode},t.map((e=>this._getListItem(e))))}_getListItem(e){return s("calcite-list-item",{description:e.snippet,id:e.id,label:e.title,onCalciteListItemSelect:()=>{this._deselectOthers(e.id),this.solutionItemSelect.emit({itemId:e.id,selected:!0})},onMouseEnter:()=>this.solutionItemHover.emit({itemId:e.id,entering:!0}),onMouseLeave:()=>this.solutionItemHover.emit({itemId:e.id,entering:!1}),value:e.id},e.url?s("calcite-action",{icon:"launch",onClick:()=>window.open(e.url,"_blank"),slot:"actions-end",text:this._translations?.openDetails?.replace("{{solutionTitle}}",e.title)}):null)}_sortTemplatesByTitle(e){return e.sort(((e,t)=>e.title<t.title?-1:e.title>t.title?1:0))}_sortTemplates(){return this.templateInfos.sort(((e,t)=>{const i=this._getTypeForSort(e),s=this._getTypeForSort(t);return this._sortOrder.indexOf(i)-this._sortOrder.indexOf(s)}))}_getTypeForSort(e){let t=this._getTypeForDisplay(e.type,e.typeKeywords);return this._sortOrder.indexOf(t)<0&&(t="TypeNotFound"),t}_getTypeForDisplay(e,t){let i=e;if("Feature Service"===e){const e=t.indexOf("View Service")>-1,s=t.indexOf("Table")>-1;i=e&&s?"Table (hosted, view)":s?"Table (hosted)":e?"Feature Layer (hosted, view)":"Feature Layer (hosted)"}return"Web Mapping Application"===e&&(i=t.indexOf("configurableApp")>-1?"Instant App":i),i="Geoprocessing Service"===e?"Tool":i,i="Feed"===e?"Feed (hosted)":i,i="Real Time Analytic"===e?"Real Time Analytic (hosted)":i,i="Big Data Analytic"===e?"Big Data Analytic (hosted)":i,i="Vector Tile Service"===e?"Tile Layer":i,i}async _getTranslations(){const e=await a(this.el);this._translations=e[0]}static get watchers(){return{locale:["localeWatchHandler"],templateInfos:["templateInfosWatchHandler"]}}};n.style=":host{display:block}.padding-start-1{padding-inline-start:1rem}.border-override{--calcite-accordion-border-color:var(--calcite-color-border-1) !important}.display-flex{display:flex}.align-center{align-items:center}";export{n as solution_item_accordion}
@@ -3,4 +3,4 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{r as t,c as i,g as e,h as s}from"./p-1b0588d2.js";import{l as a,g as h}from"./p-ee2cbba0.js";import{P as l}from"./p-3c3aecdd.js";import{g as n,c as o,h as r}from"./p-952da957.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-4f514c6d.js";import"./p-4fe489cf.js";import"./p-2bc98cb0.js";import"./p-4f236b5d.js";import"./p-570b13d9.js";import"./p-0668e30d.js";import"./p-80cb7c73.js";const c=class{constructor(e){t(this,e),this.featureSelect=i(this,"featureSelect",7)}get el(){return e(this)}selectedLayerId;mapView;noFeaturesFoundMsg;pageSize=100;highlightOnMap=!1;highlightOnHover=!1;locale;sortingInfo;whereClause;textSize="large";showInitialLoading=!0;showErrorWhenNoFeatures=!0;showUserImageInList=!1;showFeatureSymbol=!1;applyLayerViewFilter=!1;reportingOptions;showFullTitle=!0;_featureItems=[];_featuresCount=0;_isLoading=!1;_searchPlaceHolder="";_fullTextSearchInfo;_translations;Color;esriConfig;symbolUtils;_popupUtils;_selectedLayer;_highlightHandle;_highlights;_pagination;_calciteList;_validFieldTypes=["small-integer","integer","big-integer","single","long"];_abbreviatedLikeCount;_likeFieldAvailable=!1;_searchExpression;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async selectedLayerWatchHandler(){this._selectedLayer=await n(this.mapView,this.selectedLayerId),await this.initializeFeatureItems()}async sortingInfoWatchHandler(){await this.initializeFeatureItems()}async whereClauseHandler(){await this.initializeFeatureItems()}async refresh(t){if(t&&this._pagination){const t={target:{startItem:this._pagination.startItem}};await this.pageChanged(t)}else this._searchExpression?await this._searchFullText():await this.initializeFeatureItems()}featureSelect;async componentWillLoad(){await this.initModules(),await this._getTranslations(),this._isLoading=this.showInitialLoading,this._popupUtils=new l,this.mapView&&this.selectedLayerId&&(this._selectedLayer=await n(this.mapView,this.selectedLayerId),this._getFullTextSearchInfo())}async componentDidLoad(){await this.initializeFeatureItems()}render(){const t=this._canShowFullTextSearch();return s("calcite-panel",{key:"56599be334eec65be00681d415db28917133b0c1","full-height":!0,"full-width":!0},t&&s("calcite-input",{key:"6de9873f6b7ab961dffe1334d2fc20b4322d8ea8",class:"search",clearable:!0,icon:"search",onCalciteInputChange:this._searchTextChanged.bind(this),placeholder:this._searchPlaceHolder,title:"",type:"search"}),this._isLoading&&s("calcite-loader",{key:"4189b0d6c2a85116d529f5b7844c1f2d41657350",label:"",scale:"m"}),this.showErrorWhenNoFeatures&&0===this._featureItems.length&&!this._isLoading&&s("calcite-notice",{key:"7f2e8276ad5345e21667b2dedc7e23f5c34672f5",class:"error-msg",icon:"feature-details",kind:"info",open:!0},s("div",{key:"63d44ac906c8d5584aac2cfbeec4cf0962d61abe",slot:"message"},this.noFeaturesFoundMsg?this.noFeaturesFoundMsg:this._translations.featureErrorMsg)),s("calcite-list",{key:"5843f8d7ca994cb799a9be0ab2f43a8f1e407e9a",class:"small"!==this.textSize||this.showFullTitle?"":"overflow-hidden",label:"",ref:t=>this._calciteList=t,"selection-appearance":"border","selection-mode":"none"},!this._isLoading&&this._featureItems.length>0&&this._featureItems),this._featuresCount>this.pageSize&&s("div",{key:"288364bc505fe6bce8b1260dce5173163a795330",class:"width-full",slot:"footer"},s("calcite-pagination",{key:"e30e2d46a0005dd3e0d289deb4721b9155d4df29",class:"pagination","full-width":!0,onCalcitePaginationChange:this.pageChanged.bind(this),"page-size":this.pageSize,ref:t=>this._pagination=t,"start-item":"1","total-items":this._featuresCount})))}async initModules(){const[t,i,e]=await a(["esri/Color","esri/config","esri/symbols/support/symbolUtils"]);this.Color=t,this.esriConfig=i,this.symbolUtils=e}async getWhereCondition(){let t="1=1";if(this.whereClause&&(t=this.whereClause),this._selectedLayer?.definitionExpression&&(t=t+" AND "+this._selectedLayer.definitionExpression),this.applyLayerViewFilter){const i=await o(this.mapView,this.selectedLayerId);i?.filter?.where&&(t=t+" AND "+i.filter.where)}return t}async initializeFeatureItems(){if(this._selectedLayer){this._pagination?.goTo("start"),this._isLoading=this.showInitialLoading,this._featureItems=await this.queryPage(0);const t={where:await this.getWhereCondition()};this._featuresCount=await this._selectedLayer.queryFeatureCount(t),this._isLoading=!1}}async pageChanged(t){this._isLoading=!0,this._highlightHandle&&(this._highlightHandle.remove(),this._highlightHandle=null);const i=t.target.startItem-1;this._featureItems=await this.queryPage(i),this._isLoading=!1}_canShowFullTextSearch(){return((this._selectedLayer?.capabilities)?.query)?.supportsFullTextSearch&&this._selectedLayer.indexes.items.filter((t=>"FullText"==t.indexType)).length>0}_getFullTextSearchInfo(){if(this._fullTextSearchInfo=[],((this._selectedLayer?.capabilities)?.query)?.supportsFullTextSearch){const t=this._selectedLayer.indexes?.filter((t=>"FullText"==t.indexType));if(t?.length){const i=[];t.forEach((t=>{i.push(...t.fields.split(","))}));const e=[];i.forEach((t=>{const i=this._selectedLayer.getField(t.trim());e.push(i.alias)})),this._searchPlaceHolder=this._translations.searchPlaceholder.replace("{{fields}}",e.join(", ")),this._fullTextSearchInfo.push({onFields:["*"],searchTerm:"",searchType:"prefix"})}}}async _searchTextChanged(t){this._fullTextSearchInfo.forEach((i=>{i.searchTerm=t.target.value})),await this._searchFullText()}async _searchFullText(){this._searchExpression&&this._clearSearchDefinitionExpression();let t=[];if(this._fullTextSearchInfo&&this._fullTextSearchInfo[0].searchTerm){const i=this._selectedLayer.createQuery();i.fullText=this._fullTextSearchInfo,t=await this._selectedLayer.queryObjectIds(i),await this._updateSearchDefinitionExpression(t?.length?t:[-1])}await this.initializeFeatureItems()}async _updateSearchDefinitionExpression(t){const i=this._selectedLayer.definitionExpression;if(t?.length){const e=`objectId in(${t})`;this._selectedLayer.definitionExpression=i?.indexOf(this._searchExpression)>-1?i.replace(this._searchExpression,e):i?`${i} AND (${e})`:e,this._searchExpression=e}else this._clearSearchDefinitionExpression()}_clearSearchDefinitionExpression(){const t=this._selectedLayer.definitionExpression;this._searchExpression&&t?.indexOf(this._searchExpression)>-1&&(this._selectedLayer.definitionExpression=t?.indexOf(" AND ("+this._searchExpression)>-1?t.replace(` AND (${this._searchExpression})`,""):t.replace(this._searchExpression,"")),this._searchExpression=void 0}async featureClicked(t,i){if(this.clearHighlights(),this.highlightOnMap){const i=Number(t.target.value),e=await o(this.mapView,this.selectedLayerId);this._highlightHandle=await r([i],e,this.mapView,!0)}await this.emitSelectedFeature(i)}async emitSelectedFeature(t){const i=t.layer,e=i.createQuery();e.returnGeometry=!0,e.objectIds=[t.getObjectId()];const s=await i.queryFeatures(e);this.featureSelect.emit(s.features[0])}async onFeatureHover(t){if(this.clearHighlights(),this.highlightOnHover){const i=t.getObjectId(),e=await o(this.mapView,this.selectedLayerId);this._highlights&&(e.highlights=JSON.parse(this._highlights)),e.highlightOptions={color:new this.Color("#FFFF00")},this._highlights=JSON.stringify(e.highlights),this._highlightHandle=e.highlight([i])}}clearHighlights(){this._highlightHandle&&this._highlightHandle.remove()}async queryPage(t){const i=this._selectedLayer,e=this.sortingInfo?.field?this.sortingInfo.field:i.objectIdField,s=this.sortingInfo?.order?this.sortingInfo.order:"desc",a=await this.getWhereCondition(),h={start:t,num:this.pageSize,outFields:["*"],returnGeometry:!0,where:a,outSpatialReference:this.mapView.spatialReference.toJSON()};e&&s&&(h.orderByFields=[e.toString()+" "+s]);const l=await i.queryFeatures(h);return await this.createFeatureItem(l)}async createFeatureItem(t){const i=t?.features,e=this.reportingOptions&&this.reportingOptions[this.selectedLayerId].like,s=i.map((async t=>{const i=await this._popupUtils.getPopupTitle(t,this.mapView.map);let s,a;if(this.showUserImageInList){const i=this._selectedLayer.editFieldsInfo?.creatorField;i&&(s=await this.getUserInformation(t))}return this.showFeatureSymbol&&(a=await this.getFeatureSymbol(t)),e&&this.getAbbreviatedLikeCount(t),this.getFeatureItem(t,i,a,s)}));return Promise.all(s)}getAbbreviatedLikeCount(t){const i=this._selectedLayer,e=this.reportingOptions[i.id].likeField;i.fields.forEach((s=>{if(this._validFieldTypes.indexOf(s.type)>-1&&s.name===e&&this.reportingOptions[i.id].like){this._likeFieldAvailable=!0;let i=t.attributes[e]||0;i>999&&(i=i>999999?this._translations.millionsAbbreviation.replace("{{abbreviated_value}}",Math.floor(i/1e6).toString()):this._translations.thousandsAbbreviation.replace("{{abbreviated_value}}",Math.floor(i/1e3).toString())),this._abbreviatedLikeCount=i}}))}getFeatureItem(t,i,e,a){const h=t.attributes[this._selectedLayer.objectIdField].toString();i=i??h;const l=Number(t.attributes[this.reportingOptions?.[this._selectedLayer.id].likeField]).toLocaleString(),n="small"!==this.textSize||this.showFullTitle?"small"===this.textSize?"feature-list-popup-title-small":"feature-list-popup-title":"feature-list-popup-title-small-ellipsis",o=this._calciteList.offsetWidth-(this.showUserImageInList?115:65);return s("calcite-list-item",{onCalciteListItemSelect:i=>{this.featureClicked(i,t)},onMouseLeave:()=>{this.clearHighlights()},onMouseOver:()=>{this.onFeatureHover(t)},value:h},this.showUserImageInList&&s("calcite-avatar",{class:"profile-img","full-name":a?.fullName,scale:"m",slot:"content-start",thumbnail:a?.userProfileUrl,userId:a?.id,username:a?.fullName?a.username:void 0}),this.showFeatureSymbol&&s("div",{class:"feature-symbol",ref:t=>t&&t.replaceChildren(e),slot:"content-start"}),s("div",{class:`popup-title ${n}`,slot:"content-start",style:{maxWidth:"large"===this.textSize?"none":`${o}px`}},i),this._likeFieldAvailable&&s("div",{class:"like-container",id:h.concat("like"),slot:"content-end"},s("span",null,this._abbreviatedLikeCount),s("calcite-icon",{icon:"thumbs-up",scale:"s"}),s("calcite-tooltip",{overlayPositioning:"fixed",placement:"top","reference-element":h.concat("like")},l)),s("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}async getUserInformation(t){let i=this._selectedLayer.editFieldsInfo?.creatorField;t.attributes.hasOwnProperty(i.toLowerCase())?i=i.toLowerCase():t.attributes.hasOwnProperty(i.toUpperCase())&&(i=i.toUpperCase());let e=`${this.esriConfig.portalUrl}/sharing/rest/community/users/${t.attributes[i]}?f=json&returnUserLicensedItems=true`;const s=this.mapView.map.portalItem.portal?.credential?.token;s&&(e+=`&token=${s}`);const a=await fetch(e),h=await a.json();let l=`${this.esriConfig.portalUrl}/sharing/rest/community/users/${h?.username??t.attributes[i]}/info/blob.png`;return h?.access&&s&&(l+=`?token=${s}`),h.userProfileUrl=l,h}async getFeatureSymbol(t){const i=document.createElement("div");return await this.symbolUtils.getDisplayedSymbol(t).then((async t=>{if(t&&await(this.symbolUtils?.renderPreviewHTML(t,{node:i})),i.children?.length){const t=i.children[0];if(t){const i=Number(t.getAttribute("height")),e=Number(t.getAttribute("width"));e>30?t.setAttribute("width","30"):e<19&&t.setAttribute("width","20"),t.setAttribute("viewBox",`0 0 ${e} ${i}`)}}})),i}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}static get watchers(){return{locale:["localeWatchHandler"],selectedLayerId:["selectedLayerWatchHandler"],sortingInfo:["sortingInfoWatchHandler"],whereClause:["whereClauseHandler"]}}};c.style=":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.feature-list-popup-title{font-weight:500;white-space:pre-line}.feature-list-popup-title-small{font-size:small;white-space:pre-line}.feature-list-popup-title-small-ellipsis{font-size:small;white-space:nowrap !important;text-overflow:ellipsis;overflow:hidden}.popup-title{padding:0 5px;word-break:break-word}.profile-img{padding:0 5px;min-width:32px}.like-container{display:flex;align-items:center;gap:5px;color:gray !important;font-style:italic}.feature-symbol{padding:0 3px;min-width:30px;display:flex;justify-content:center}.search{padding:10px;background-color:var(--calcite-color-foreground-1) !important;border-block-end:1px solid var(--calcite-color-border-3)}";export{c as feature_list}
6
+ import{r as t,c as i,g as e,h as s}from"./p-1b0588d2.js";import{l as a,g as h}from"./p-ee2cbba0.js";import{P as l}from"./p-d0d21a1f.js";import{g as n,c as o,h as r}from"./p-dcd2f00b.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-6eab9d1f.js";import"./p-4fe489cf.js";import"./p-2bc98cb0.js";import"./p-4f236b5d.js";import"./p-570b13d9.js";import"./p-0668e30d.js";import"./p-80cb7c73.js";const c=class{constructor(e){t(this,e),this.featureSelect=i(this,"featureSelect",7)}get el(){return e(this)}selectedLayerId;mapView;noFeaturesFoundMsg;pageSize=100;highlightOnMap=!1;highlightOnHover=!1;locale;sortingInfo;whereClause;textSize="large";showInitialLoading=!0;showErrorWhenNoFeatures=!0;showUserImageInList=!1;showFeatureSymbol=!1;applyLayerViewFilter=!1;reportingOptions;showFullTitle=!0;_featureItems=[];_featuresCount=0;_isLoading=!1;_searchPlaceHolder="";_fullTextSearchInfo;_translations;Color;esriConfig;symbolUtils;_popupUtils;_selectedLayer;_highlightHandle;_highlights;_pagination;_calciteList;_validFieldTypes=["small-integer","integer","big-integer","single","long"];_abbreviatedLikeCount;_likeFieldAvailable=!1;_searchExpression;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async selectedLayerWatchHandler(){this._selectedLayer=await n(this.mapView,this.selectedLayerId),await this.initializeFeatureItems()}async sortingInfoWatchHandler(){await this.initializeFeatureItems()}async whereClauseHandler(){await this.initializeFeatureItems()}async refresh(t){if(t&&this._pagination){const t={target:{startItem:this._pagination.startItem}};await this.pageChanged(t)}else this._searchExpression?await this._searchFullText():await this.initializeFeatureItems()}featureSelect;async componentWillLoad(){await this.initModules(),await this._getTranslations(),this._isLoading=this.showInitialLoading,this._popupUtils=new l,this.mapView&&this.selectedLayerId&&(this._selectedLayer=await n(this.mapView,this.selectedLayerId),this._getFullTextSearchInfo())}async componentDidLoad(){await this.initializeFeatureItems()}render(){const t=this._canShowFullTextSearch();return s("calcite-panel",{key:"56599be334eec65be00681d415db28917133b0c1","full-height":!0,"full-width":!0},t&&s("calcite-input",{key:"6de9873f6b7ab961dffe1334d2fc20b4322d8ea8",class:"search",clearable:!0,icon:"search",onCalciteInputChange:this._searchTextChanged.bind(this),placeholder:this._searchPlaceHolder,title:"",type:"search"}),this._isLoading&&s("calcite-loader",{key:"4189b0d6c2a85116d529f5b7844c1f2d41657350",label:"",scale:"m"}),this.showErrorWhenNoFeatures&&0===this._featureItems.length&&!this._isLoading&&s("calcite-notice",{key:"7f2e8276ad5345e21667b2dedc7e23f5c34672f5",class:"error-msg",icon:"feature-details",kind:"info",open:!0},s("div",{key:"63d44ac906c8d5584aac2cfbeec4cf0962d61abe",slot:"message"},this.noFeaturesFoundMsg?this.noFeaturesFoundMsg:this._translations.featureErrorMsg)),s("calcite-list",{key:"5843f8d7ca994cb799a9be0ab2f43a8f1e407e9a",class:"small"!==this.textSize||this.showFullTitle?"":"overflow-hidden",label:"",ref:t=>this._calciteList=t,"selection-appearance":"border","selection-mode":"none"},!this._isLoading&&this._featureItems.length>0&&this._featureItems),this._featuresCount>this.pageSize&&s("div",{key:"288364bc505fe6bce8b1260dce5173163a795330",class:"width-full",slot:"footer"},s("calcite-pagination",{key:"e30e2d46a0005dd3e0d289deb4721b9155d4df29",class:"pagination","full-width":!0,onCalcitePaginationChange:this.pageChanged.bind(this),"page-size":this.pageSize,ref:t=>this._pagination=t,"start-item":"1","total-items":this._featuresCount})))}async initModules(){const[t,i,e]=await a(["esri/Color","esri/config","esri/symbols/support/symbolUtils"]);this.Color=t,this.esriConfig=i,this.symbolUtils=e}async getWhereCondition(){let t="1=1";if(this.whereClause&&(t=this.whereClause),this._selectedLayer?.definitionExpression&&(t=t+" AND "+this._selectedLayer.definitionExpression),this.applyLayerViewFilter){const i=await o(this.mapView,this.selectedLayerId);i?.filter?.where&&(t=t+" AND "+i.filter.where)}return t}async initializeFeatureItems(){if(this._selectedLayer){this._pagination?.goTo("start"),this._isLoading=this.showInitialLoading,this._featureItems=await this.queryPage(0);const t={where:await this.getWhereCondition()};this._featuresCount=await this._selectedLayer.queryFeatureCount(t),this._isLoading=!1}}async pageChanged(t){this._isLoading=!0,this._highlightHandle&&(this._highlightHandle.remove(),this._highlightHandle=null);const i=t.target.startItem-1;this._featureItems=await this.queryPage(i),this._isLoading=!1}_canShowFullTextSearch(){return((this._selectedLayer?.capabilities)?.query)?.supportsFullTextSearch&&this._selectedLayer.indexes.items.filter((t=>"FullText"==t.indexType)).length>0}_getFullTextSearchInfo(){if(this._fullTextSearchInfo=[],((this._selectedLayer?.capabilities)?.query)?.supportsFullTextSearch){const t=this._selectedLayer.indexes?.filter((t=>"FullText"==t.indexType));if(t?.length){const i=[];t.forEach((t=>{i.push(...t.fields.split(","))}));const e=[];i.forEach((t=>{const i=this._selectedLayer.getField(t.trim());e.push(i.alias)})),this._searchPlaceHolder=this._translations.searchPlaceholder.replace("{{fields}}",e.join(", ")),this._fullTextSearchInfo.push({onFields:["*"],searchTerm:"",searchType:"prefix"})}}}async _searchTextChanged(t){this._fullTextSearchInfo.forEach((i=>{i.searchTerm=t.target.value})),await this._searchFullText()}async _searchFullText(){this._searchExpression&&this._clearSearchDefinitionExpression();let t=[];if(this._fullTextSearchInfo&&this._fullTextSearchInfo[0].searchTerm){const i=this._selectedLayer.createQuery();i.fullText=this._fullTextSearchInfo,t=await this._selectedLayer.queryObjectIds(i),await this._updateSearchDefinitionExpression(t?.length?t:[-1])}await this.initializeFeatureItems()}async _updateSearchDefinitionExpression(t){const i=this._selectedLayer.definitionExpression;if(t?.length){const e=`objectId in(${t})`;this._selectedLayer.definitionExpression=i?.indexOf(this._searchExpression)>-1?i.replace(this._searchExpression,e):i?`${i} AND (${e})`:e,this._searchExpression=e}else this._clearSearchDefinitionExpression()}_clearSearchDefinitionExpression(){const t=this._selectedLayer.definitionExpression;this._searchExpression&&t?.indexOf(this._searchExpression)>-1&&(this._selectedLayer.definitionExpression=t?.indexOf(" AND ("+this._searchExpression)>-1?t.replace(` AND (${this._searchExpression})`,""):t.replace(this._searchExpression,"")),this._searchExpression=void 0}async featureClicked(t,i){if(this.clearHighlights(),this.highlightOnMap){const i=Number(t.target.value),e=await o(this.mapView,this.selectedLayerId);this._highlightHandle=await r([i],e,this.mapView,!0)}await this.emitSelectedFeature(i)}async emitSelectedFeature(t){const i=t.layer,e=i.createQuery();e.returnGeometry=!0,e.objectIds=[t.getObjectId()];const s=await i.queryFeatures(e);this.featureSelect.emit(s.features[0])}async onFeatureHover(t){if(this.clearHighlights(),this.highlightOnHover){const i=t.getObjectId(),e=await o(this.mapView,this.selectedLayerId);this._highlights&&(e.highlights=JSON.parse(this._highlights)),e.highlightOptions={color:new this.Color("#FFFF00")},this._highlights=JSON.stringify(e.highlights),this._highlightHandle=e.highlight([i])}}clearHighlights(){this._highlightHandle&&this._highlightHandle.remove()}async queryPage(t){const i=this._selectedLayer,e=this.sortingInfo?.field?this.sortingInfo.field:i.objectIdField,s=this.sortingInfo?.order?this.sortingInfo.order:"desc",a=await this.getWhereCondition(),h={start:t,num:this.pageSize,outFields:["*"],returnGeometry:!0,where:a,outSpatialReference:this.mapView.spatialReference.toJSON()};e&&s&&(h.orderByFields=[e.toString()+" "+s]);const l=await i.queryFeatures(h);return await this.createFeatureItem(l)}async createFeatureItem(t){const i=t?.features,e=this.reportingOptions&&this.reportingOptions[this.selectedLayerId].like,s=i.map((async t=>{const i=await this._popupUtils.getPopupTitle(t,this.mapView.map);let s,a;if(this.showUserImageInList){const i=this._selectedLayer.editFieldsInfo?.creatorField;i&&(s=await this.getUserInformation(t))}return this.showFeatureSymbol&&(a=await this.getFeatureSymbol(t)),e&&this.getAbbreviatedLikeCount(t),this.getFeatureItem(t,i,a,s)}));return Promise.all(s)}getAbbreviatedLikeCount(t){const i=this._selectedLayer,e=this.reportingOptions[i.id].likeField;i.fields.forEach((s=>{if(this._validFieldTypes.indexOf(s.type)>-1&&s.name===e&&this.reportingOptions[i.id].like){this._likeFieldAvailable=!0;let i=t.attributes[e]||0;i>999&&(i=i>999999?this._translations.millionsAbbreviation.replace("{{abbreviated_value}}",Math.floor(i/1e6).toString()):this._translations.thousandsAbbreviation.replace("{{abbreviated_value}}",Math.floor(i/1e3).toString())),this._abbreviatedLikeCount=i}}))}getFeatureItem(t,i,e,a){const h=t.attributes[this._selectedLayer.objectIdField].toString();i=i??h;const l=Number(t.attributes[this.reportingOptions?.[this._selectedLayer.id].likeField]).toLocaleString(),n="small"!==this.textSize||this.showFullTitle?"small"===this.textSize?"feature-list-popup-title-small":"feature-list-popup-title":"feature-list-popup-title-small-ellipsis",o=this._calciteList.offsetWidth-(this.showUserImageInList?115:65);return s("calcite-list-item",{onCalciteListItemSelect:i=>{this.featureClicked(i,t)},onMouseLeave:()=>{this.clearHighlights()},onMouseOver:()=>{this.onFeatureHover(t)},value:h},this.showUserImageInList&&s("calcite-avatar",{class:"profile-img","full-name":a?.fullName,scale:"m",slot:"content-start",thumbnail:a?.userProfileUrl,userId:a?.id,username:a?.fullName?a.username:void 0}),this.showFeatureSymbol&&s("div",{class:"feature-symbol",ref:t=>t&&t.replaceChildren(e),slot:"content-start"}),s("div",{class:`popup-title ${n}`,slot:"content-start",style:{maxWidth:"large"===this.textSize?"none":`${o}px`}},i),this._likeFieldAvailable&&s("div",{class:"like-container",id:h.concat("like"),slot:"content-end"},s("span",null,this._abbreviatedLikeCount),s("calcite-icon",{icon:"thumbs-up",scale:"s"}),s("calcite-tooltip",{overlayPositioning:"fixed",placement:"top","reference-element":h.concat("like")},l)),s("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}async getUserInformation(t){let i=this._selectedLayer.editFieldsInfo?.creatorField;t.attributes.hasOwnProperty(i.toLowerCase())?i=i.toLowerCase():t.attributes.hasOwnProperty(i.toUpperCase())&&(i=i.toUpperCase());let e=`${this.esriConfig.portalUrl}/sharing/rest/community/users/${t.attributes[i]}?f=json&returnUserLicensedItems=true`;const s=this.mapView.map.portalItem.portal?.credential?.token;s&&(e+=`&token=${s}`);const a=await fetch(e),h=await a.json();let l=`${this.esriConfig.portalUrl}/sharing/rest/community/users/${h?.username??t.attributes[i]}/info/blob.png`;return h?.access&&s&&(l+=`?token=${s}`),h.userProfileUrl=l,h}async getFeatureSymbol(t){const i=document.createElement("div");return await this.symbolUtils.getDisplayedSymbol(t).then((async t=>{if(t&&await(this.symbolUtils?.renderPreviewHTML(t,{node:i})),i.children?.length){const t=i.children[0];if(t){const i=Number(t.getAttribute("height")),e=Number(t.getAttribute("width"));e>30?t.setAttribute("width","30"):e<19&&t.setAttribute("width","20"),t.setAttribute("viewBox",`0 0 ${e} ${i}`)}}})),i}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}static get watchers(){return{locale:["localeWatchHandler"],selectedLayerId:["selectedLayerWatchHandler"],sortingInfo:["sortingInfoWatchHandler"],whereClause:["whereClauseHandler"]}}};c.style=":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.feature-list-popup-title{font-weight:500;white-space:pre-line}.feature-list-popup-title-small{font-size:small;white-space:pre-line}.feature-list-popup-title-small-ellipsis{font-size:small;white-space:nowrap !important;text-overflow:ellipsis;overflow:hidden}.popup-title{padding:0 5px;word-break:break-word}.profile-img{padding:0 5px;min-width:32px}.like-container{display:flex;align-items:center;gap:5px;color:gray !important;font-style:italic}.feature-symbol{padding:0 3px;min-width:30px;display:flex;justify-content:center}.search{padding:10px;background-color:var(--calcite-color-foreground-1) !important;border-block-end:1px solid var(--calcite-color-border-3)}";export{c as feature_list}
@@ -3,4 +3,4 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{r as e,c as t,g as i,h as s,H as a}from"./p-1b0588d2.js";import{a as l,l as h,g as n}from"./p-ee2cbba0.js";import{e as r,h as c,k as o,l as d,c as p,m as b,n as f,o as g}from"./p-952da957.js";import{a as y,e as m,f as u}from"./p-80cb7c73.js";import{s as w}from"./p-48942eb8.js";import{d as _,a as v}from"./p-4f514c6d.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-e23b4193.js";import"./p-4fe489cf.js";import"./p-2bc98cb0.js";import"./p-4f236b5d.js";import"./p-570b13d9.js";import"./p-0668e30d.js";const S=class{constructor(i){e(this,i),this.selectionSetChange=t(this,"selectionSetChange",7)}get el(){return i(this)}bufferColor=[227,139,79,.8];bufferOutlineColor=[255,255,255];customLabelEnabled;enabledLayerIds=[];enableLayerFeatures=!0;enableLayerFeaturesOnLoad=!1;enableSearchDistance=!0;enableSearchDistanceOnLoad=!1;enableSketchTools=!0;defaultBufferDistance;defaultBufferUnit;geometries=[];isUpdate=!1;layerViews=[];locale;mapView;noResultText;searchConfiguration;selectionSet;selectionLayerIds=[];selectLayerView;sketchLineSymbol;sketchPointSymbol;sketchPolygonSymbol;searchDistanceEnabled=!1;useLayerFeaturesEnabled=!1;_numSelected=0;_searchTerm;_selectionLoading=!1;_translations;_esriRequest;FeatureLayer;Graphic;GraphicsLayer;Search;_geometryEngine;_bufferGeometry;_bufferGraphicsLayer;_bufferTools;_distance;_drawTools;_labelName;_selectLayers;_searchElement;_searchResult;_searchWidget;_selectedIds=[];_selectionLabel="";_skipGeomOIDs;_sketchGraphic;_graphics=[];_unit;_workflowType;_featuresCollection={};async watchGeometriesHandler(e,t){if(e!==t){const t=0===e.length;if(await this._clearResults(t,t),e.length>0)return this._highlightWithOIDsOrGeoms()}}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(e,t){e&&e!==t&&await this._init()}async watchSearchConfigurationHandler(e,t){JSON.stringify(e)!==JSON.stringify(t)&&await this._initSearchWidget()}async clearSelection(){return this._clearResults(!0,!0)}async getSelection(){return/\S+/gm.test(this._selectionLabel)||await this._updateLabel(),{id:this.isUpdate?this.selectionSet.id:Date.now(),searchResult:this._searchResult,buffer:this._bufferGeometry,distance:this._bufferTools?.distance,download:!0,unit:this._bufferTools?.unit,label:this._selectionLabel,selectedIds:this._selectedIds,layerView:this.selectLayerView,geometries:this.geometries,graphics:this._graphics,selectLayers:this.layerViews,skipGeomOIDs:this._skipGeomOIDs,searchDistanceEnabled:this.searchDistanceEnabled,workflowType:this._workflowType,useLayerFeaturesEnabled:this.useLayerFeaturesEnabled,sketchGraphic:this._sketchGraphic}}selectionSetChange;searchConfigurationChangeChanged(e){this.searchConfiguration=e.detail}async distanceChanged(e){await this._distanceChanged(e.detail)}async unitChanged(e){e.detail.newValue!==e.detail.oldValue&&(this._unit=e.detail.newValue,await this._updateLabel())}async componentWillLoad(){await this._getTranslations(),await this._initModules()}async componentDidLoad(){await this._init()}render(){const e=this.enableSketchTools?"":"display-none",t=this.enableSketchTools?"padding-top-1":"";return s(a,{key:"a5001c196db1464bffa746310638b2853ff5fdf9"},this._getMapLayerPicker(),s("div",{key:"3e023a81f76bdd371c84d9ecb42e97a9160c6f89",class:"border-bottom"}),s("div",{key:"c6be571bee2d2c1fe82407aee9a1cf9f1f27280d",class:"padding-top-sides-1"},s("div",{key:"aaf5992f616728f6be5be034700ac09b9b5b733f",class:"search-widget",ref:e=>{this._searchElement=e}}),s("div",{key:"a86b4e147b7baf4b93272bed7f189a47faf65ab8",class:t},s("map-draw-tools",{key:"9b3c2faaa8f612d055189206e2baeb868d55dceb",active:!0,class:e,editGraphicsEnabled:!this.useLayerFeaturesEnabled,graphics:this._graphics,locale:this.locale,mapView:this.mapView,onSketchGraphicsChange:e=>{this._sketchGraphicsChanged(e)},pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,ref:e=>{this._drawTools=e}})),this.enableSearchDistance?this._getBufferOptions():void 0,this.enableLayerFeatures?this._getUseLayerFeaturesOptions():void 0,this._getNumSelected()),s("div",{key:"73b3039f0861046a3f955872180b64c15bd5c5d9",class:"border-bottom"}),this._getNameInput())}_getBufferOptions(){this.enableSearchDistanceOnLoad&&(this.searchDistanceEnabled=!0,this.enableSearchDistanceOnLoad=!1);const e=this.searchDistanceEnabled?"search-distance":"div-not-visible",t="number"==typeof this.selectionSet?.distance?this.selectionSet.distance:this.defaultBufferDistance;return s("div",null,s("div",{class:"padding-top-1 display-flex"},s("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},s("div",{class:"tooltip-container"},this._translations.searchDistance,s("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"search-distance-icon",scale:"s"}))),s("calcite-popover",{closable:!0,label:"",referenceElement:"search-distance-icon"},s("span",{class:"tooltip-message"},this._translations.useSearchDistanceTootip)),s("calcite-switch",{checked:this.searchDistanceEnabled,onCalciteSwitchChange:()=>this.searchDistanceEnabled=!this.searchDistanceEnabled})),s("div",{class:e},s("buffer-tools",{disabled:!this.searchDistanceEnabled,distance:t,geometries:this.geometries,locale:this.locale,onBufferComplete:e=>{this._bufferComplete(e)},ref:e=>this._bufferTools=e,unit:this.selectionSet?.unit||this.defaultBufferUnit})))}_getUseLayerFeaturesOptions(){this.enableLayerFeaturesOnLoad&&(this.useLayerFeaturesEnabled=!0,this.enableLayerFeaturesOnLoad=!1);const e=this.useLayerFeaturesEnabled?"div-visible":"div-not-visible";return s("div",null,s("div",{class:"padding-top-1 display-flex"},s("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},s("div",{class:"tooltip-container"},this._translations.useLayerFeatures,s("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"use-layer-features-icon",scale:"s"}))),s("calcite-popover",{closable:!0,label:"",referenceElement:"use-layer-features-icon"},s("span",{class:"tooltip-message"},this._translations.useLayerFeaturesTooltip)),s("calcite-switch",{checked:this.useLayerFeaturesEnabled,onCalciteSwitchChange:()=>{this._useLayerFeaturesEnabledChanged()}})),s("div",{class:e+" padding-top-1"},s("map-layer-picker",{enabledLayerIds:this.selectionLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._layerSelectionChange(e)},selectedIds:this.layerViews.map((e=>e.layer.id)),showTables:!1})))}_getNumSelected(){const e=l(this.el),t=e&&"en"===e?`${this._translations.selectionLoading}...`:this._translations.selectionLoading;return s("div",{class:"padding-top-1 padding-bottom-1",style:{"align-items":"end",display:"flex"}},this._selectionLoading?s("div",null,s("calcite-loader",{class:"info-blue",inline:!0,label:t,scale:"m",type:"indeterminate"})):s("calcite-icon",{class:"info-blue padding-end-1-2",icon:"feature-layer",scale:"s"}),s("calcite-input-message",{class:"info-blue",scale:"m"},this._selectionLoading?t:this.noResultText&&0===this._numSelected?this.noResultText:this._translations.selectedFeatures.replace("{{n}}",this._numSelected.toString())))}_getNameInput(){return s("div",{class:"padding-sides-1 padding-top-1 "+(this.customLabelEnabled?"":"display-none")},s("calcite-label",{class:"font-bold"},this._translations.listName,s("calcite-input",{onInput:()=>{this._selectionLabel=this._labelName.value},placeholder:this._translations.listNamePlaceholder,ref:e=>{this._labelName=e},value:this._selectionLabel||""})))}_getMapLayerPicker(){return s("div",{class:"display-flex padding-sides-1 padding-bottom-1"},s("calcite-label",{class:"font-bold width-full label-margin-0"},this._translations.inputLayer,s("map-layer-picker",{enabledLayerIds:this.enabledLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._inputLayerSelectionChange(e)},selectedIds:this.selectLayerView?[this.selectLayerView.layer.id]:this.selectionSet?[this.selectionSet.layerView.layer.id]:[],showTables:!1})))}async _initModules(){const[e,t,i,s,a,l]=await h(["esri/request","esri/layers/GraphicsLayer","esri/Graphic","esri/widgets/Search","esri/geometry/geometryEngine","esri/layers/FeatureLayer"]);this._esriRequest=e,this.GraphicsLayer=t,this.Graphic=i,this.Search=s,this._geometryEngine=a,this.FeatureLayer=l}async _init(){this._initGraphicsLayer(),await this._initSelectionSet(),await this._initSearchWidget()}async _initSelectionSet(){this.selectionSet&&(this._searchTerm=this.selectionSet.searchResult?.name,this._searchResult=this.selectionSet.searchResult,this._selectLayers=this.selectionSet.selectLayers,this._selectedIds=this.selectionSet.selectedIds,this._skipGeomOIDs=this.selectionSet.skipGeomOIDs,this.searchDistanceEnabled=this.selectionSet.searchDistanceEnabled,this.useLayerFeaturesEnabled=this.selectionSet.useLayerFeaturesEnabled,this._distance=this.selectionSet.searchDistanceEnabled?this.selectionSet.distance:0,this._unit=this.selectionSet.unit,this._workflowType=this.selectionSet.workflowType,this.selectLayerView=this.selectionSet.layerView,this._sketchGraphic=this.selectionSet.sketchGraphic,this.geometries=[...this.selectionSet?.geometries||[]],this._graphics=this.geometries.map((e=>new this.Graphic({geometry:e,symbol:"point"===e.type?this.sketchPointSymbol:"polyline"===e.type?this.sketchLineSymbol:this.sketchPolygonSymbol}))),this._selectionLabel=this.selectionSet?.label,this.useLayerFeaturesEnabled||await(this._drawTools?.updateGraphics()),await r(this.selectionSet.selectedIds,this.selectionSet.layerView,this.mapView,!1))}async _initSearchWidget(){if(this.mapView&&this._searchElement){const e=this._getSearchConfig(this.searchConfiguration,this.mapView),t={view:this.mapView,container:this._searchElement,searchTerm:this._searchTerm,...e};this._searchWidget=new this.Search(t),this._searchWidget.popupEnabled=!1,this._searchWidget.resultGraphicEnabled=!1,this._searchWidget.on("search-clear",(()=>{const e=this._searchClearLabel();this._clearResults(!1,e)})),this._searchWidget.on("select-result",(e=>{this._selectResult(e.result)})),await this._searchWidget.when((()=>{this._searchWidget.allPlaceholder=this.searchConfiguration?.allPlaceholder&&"find address or place"!==this.searchConfiguration.allPlaceholder.toLowerCase()?this.searchConfiguration.allPlaceholder:this._translations.placeholder}))}}async _selectResult(e){if(e){this._searchResult=e;const t=e.feature,i=t?.layer,s=this.selectLayerView.layer,a=t?.getObjectId();let l,h;i?.sourceJSON?.isView&&(l=await this._getViewSourceUrl(i.url)),s?.sourceJSON?.isView&&(h=await this._getViewSourceUrl(s.url));const n=i?.url?.toLowerCase(),r=l?.toLowerCase(),c=s?.url?.toLowerCase(),o=h?.toLowerCase(),d=n&&c&&(n===c||n===o||r===c||r===o)&&!isNaN(a),p=d?[a]:void 0;this._workflowType=y.SEARCH,this._updateLabel();const b=[e.feature];this._updateSelection(b,d,p),this._drawTools.graphics=b,this._searchWidget.resultGraphic.visible=!1}else{const e=this._searchClearLabel();this._clearResults(!1,e)}}async _getViewSourceUrl(e){let t="";const i=`${e}/sources?f=json`;try{const e=await this._esriRequest(i,{query:{f:"json"}});1===e?.data?.services?.length&&(t=e.data.services[0].url)}catch(e){console.log(e)}return t}_searchClearLabel(){return this._searchResult?.name&&this._labelName.value.indexOf(this._searchResult.name)>-1}_getSearchConfig(e,t){const i=e?.sources;return i?.length>0?(e={...e,includeDefaultSources:!1},i.forEach((e=>{if(e.hasOwnProperty("layer")){const i=e,s=i.layer?.id,a=s?t.map.findLayerById(s):null,l=i?.layer?.url;a?i.layer=a:l&&(i.layer=new this.FeatureLayer(l))}})),i?.forEach((e=>{if(e.hasOwnProperty("locator")){const t=e;"ArcGIS World Geocoding Service"===t?.name&&(t.outFields=t.outFields||["Addr_type","Match_addr","StAddr","City"],t.singleLineFieldName="SingleLine"),t.url=t.url,delete t.url}}))):e={...e,includeDefaultSources:!0},e}_initGraphicsLayer(){const e=this._translations.bufferLayer;if(this.mapView){const t=this.mapView.map.layers.findIndex((t=>t.title===e));if(t>-1)this._bufferGraphicsLayer=this.mapView.map.layers.getItemAt(t);else{this._bufferGraphicsLayer=new this.GraphicsLayer({title:e,listMode:"hide"}),w.managedLayers[e]="buffer";const t=this.mapView.map.layers.findIndex((e=>e.title===this._translations.sketchLayer));t>-1?this.mapView.map.layers.add(this._bufferGraphicsLayer,t):this.mapView.map.layers.add(this._bufferGraphicsLayer)}}}async _sketchGraphicsChanged(e,t=!1){const i=e.detail.graphics;if(i.length>0&&i[0])if(t||(this._sketchGraphic=i[0]),this._workflowType=this.useLayerFeaturesEnabled?y.SELECT:y.SKETCH,this._workflowType===y.SKETCH&&await this._drawTools.updateGraphics(),await this._updateLabel(),this._clearSearchWidget(),this.useLayerFeaturesEnabled&&!t){const e=Array.isArray(i)?i.map((e=>e.geometry)):this.geometries;await this._selectLayerFeatures(e[0])}else{const t=i.reduce(((e,t)=>(t?.layer?.objectIdField?e.push(t.attributes[t.layer.objectIdField]):t.getObjectId&&e.push(t.getObjectId()),e)),[]),s=e.detail.useOIDs&&t.length>0;this._updateSelection(i,s,t),s&&await this._highlightFeatures(t)}else await this._clearResults(!0,!0)}async _highlightWithOIDsOrGeoms(){return this._skipGeomOIDs?.length>0?(this._selectedIds=this._skipGeomOIDs,this._highlightFeatures(this._selectedIds)):this._geomQuery(this.geometries)}async _highlightFeatures(e){w.removeHandles(),e.length>0&&w.highlightHandles.push(await c(e,this.selectLayerView,this.mapView)),this._numSelected=e.length,this.selectionSetChange.emit(e.length)}async _selectFeatures(e){this._selectionLoading=!0,this._selectedIds=await o(e,this.selectLayerView.layer),this._selectionLoading=!1,this._drawTools.graphics=this._graphics,await this._highlightFeatures(this._selectedIds)}async _bufferComplete(e){this._bufferGeometry=Array.isArray(e.detail)?e.detail[0]:e.detail;let t=this._bufferTools.distance,i=0;if(this._bufferGeometry){const e=new this.Graphic({geometry:this._bufferGeometry,symbol:{type:"simple-fill",color:this.bufferColor,outline:{color:this.bufferOutlineColor,width:1}}});this._bufferGraphicsLayer.removeAll(),this._bufferGraphicsLayer.add(e),await this._selectFeatures([this._bufferGeometry]),await this.mapView.goTo(e.geometry.extent),i=t,t=0}else this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),await this._highlightWithOIDsOrGeoms();await this._distanceChanged({oldValue:t,newValue:i})}_geomQuery(e){const t=d(e,this._geometryEngine);return this._selectFeatures(t)}async _clearResults(e=!0,t=!1){this._selectedIds=[],this._distance=void 0,this._unit=void 0,t&&(this._selectionLabel="",this._labelName&&(this._labelName.value="")),this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),e&&this._searchWidget&&this._clearSearchWidget(),w.removeHandles(),this._drawTools?.clear&&(this._graphics=[],await this._drawTools.clear()),this._numSelected=this._selectedIds.length,this.selectionSetChange.emit(this._numSelected)}_clearSearchWidget(){this._searchWidget.clear(),this._searchResult=void 0}_updateSelection(e,t,i){this._selectedIds=t&&i?i:this._selectedIds,this._skipGeomOIDs=t?i:void 0,this.geometries=Array.isArray(e)?e.map((e=>e.geometry)):this.geometries,this._graphics=e}async _updateLabel(){if(this.enableSearchDistance){const e=this._selectionLabel.indexOf(this._translations.sketch)>-1,t=this._selectionLabel.indexOf(this._translations.select)>-1,i=this._selectionLabel.indexOf(this._searchResult?.name)>-1,s=this._workflowType===y.SEARCH?this._searchResult?.name:this._workflowType===y.SELECT?this._translations.select:this._translations.sketch,a=this._unit?this._unit:this._bufferTools.unit,l=await this._bufferTools.getTranslatedUnit(a),h=isNaN(this._distance)?this._bufferTools.distance:this._distance;this._selectionLabel=e||t||i||!this._selectionLabel?`${s} ${h} ${l}`:this._selectionLabel,this._labelName.value=this._selectionLabel}}async _layerSelectionChange(e){if(Array.isArray(e.detail)&&e.detail.length>0){const t=e.detail.map((e=>p(this.mapView,e)));return Promise.all(t).then((e=>{this.layerViews=e,this._featuresCollection={},this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}))}}async _inputLayerSelectionChange(e){const t=e?.detail?.length>0?e.detail[0]:"";this.selectLayerView&&t===this.selectLayerView.layer.id||(this.selectLayerView=await p(this.mapView,t),await this._updateLabel(),this._bufferGeometry?await this._selectFeatures([this._bufferGeometry]):await this._highlightWithOIDsOrGeoms())}async _distanceChanged(e){e.newValue!==e.oldValue&&(this._distance=e.newValue,await this._updateLabel())}async _selectLayerFeatures(e){this._selectionLoading=!0;const t=this.layerViews.map((t=>(this._featuresCollection[t.layer.id]=[],b(0,t.layer,e,this._featuresCollection))));return Promise.all(t).then((async e=>{this._selectionLoading=!1;let t=[];e.forEach((e=>{Object.keys(e).forEach((i=>{t=t.concat(e[i])}))}));let i=!1;t.forEach((e=>{const t=e.geometry;e.symbol="point"===t.type?this.sketchPointSymbol:"polyline"===t.type?this.sketchLineSymbol:"polygon"===t.type?this.sketchPolygonSymbol:void 0,i=e?.layer?.hasOwnProperty("objectIdField")||e.hasOwnProperty("getObjectId")}));const s=this.layerViews[0].layer,a=this.selectLayerView.layer,l=i&&s.url===a.url&&a.layerId===s.layerId;await this._sketchGraphicsChanged({detail:{graphics:t,useOIDs:l}},!0)}))}_useLayerFeaturesEnabledChanged(){this.useLayerFeaturesEnabled=!this.useLayerFeaturesEnabled,this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}static get watchers(){return{geometries:["watchGeometriesHandler"],locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"],searchConfiguration:["watchSearchConfigurationHandler"]}}};S.style=':host{display:block}.div-visible{display:inherit}.div-visible-search{display:flex;height:44px;align-items:center;padding-bottom:0}.div-not-visible{display:none}.padding-bottom-1{padding-bottom:1rem}.padding-top-1{padding-top:1rem}.search-widget{width:100% !important;border:1px solid var(--calcite-color-border-input)}.w-100{width:100%}.w-50{width:50%}.search-distance-container{padding-top:"1rem" !important}.end-border{border-inline-end:1px solid var(--calcite-color-border-2)}.search-distance{display:flex;padding-top:1rem}.font-bold{font:bold}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.tooltip-container{display:flex}.padding-start-1-2{padding-inline-start:0.5rem}.icon{--calcite-color-icon-color:var(--calcite-color-brand)}.tooltip-message{padding:5px 8px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-color-text-2)}';const L=Object.freeze({__proto__:null,default:[{descriptionPDF:{labelWidthDisplay:"2-5/8",labelHeightDisplay:"1",labelsPerPageDisplay:"30",averyPartNumber:"*60"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.1875,rightMargin:.1875,topMargin:.5,bottomMargin:.5},numLabelsAcross:3,numLabelsDown:10,labelWidth:2.625,labelHeight:1,horizGapIn:.125,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:4}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"1",labelsPerPageDisplay:"20",averyPartNumber:"*61"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.47637821,bottomMargin:.5},numLabelsAcross:2,numLabelsDown:10,labelWidth:4,labelHeight:1.0025,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:4}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"1-1/3",labelsPerPageDisplay:"14",averyPartNumber:"*62"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.81889808,bottomMargin:.83464612},numLabelsAcross:2,numLabelsDown:7,labelWidth:4,labelHeight:1.3352,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:6}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"2",labelsPerPageDisplay:"10",averyPartNumber:"*63"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.5,bottomMargin:.5},numLabelsAcross:2,numLabelsDown:5,labelWidth:4,labelHeight:2,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:12,maxNumLabelLines:10}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"3-1/3",labelsPerPageDisplay:"6",averyPartNumber:"*64"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.4724412,bottomMargin:.50000027},numLabelsAcross:2,numLabelsDown:3,labelWidth:4,labelHeight:3.342,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:14,maxNumLabelLines:12}},{descriptionPDF:{labelWidthDisplay:"1-3/4",labelHeightDisplay:"1/2",labelsPerPageDisplay:"80",averyPartNumber:"*67"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.307086375,rightMargin:.307086375,topMargin:.4724412,bottomMargin:.49606326},numLabelsAcross:4,numLabelsDown:20,labelWidth:1.75,labelHeight:.50155,horizGapIn:.29527575,vertGapIn:0,labelPadding:.1,fontSizePx:8,maxNumLabelLines:3}},{descriptionPDF:{labelWidthDisplay:"1-3/4",labelHeightDisplay:"2/3",labelsPerPageDisplay:"60",averyPartNumber:"*95"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.28936983,rightMargin:.28936983,topMargin:.53937037,bottomMargin:.5511814},numLabelsAcross:4,numLabelsDown:15,labelWidth:1.75,labelHeight:.6605,horizGapIn:.30708678,vertGapIn:0,labelPadding:.1,fontSizePx:8,maxNumLabelLines:4}}]}),k=class{constructor(t){e(this,t)}get el(){return i(this)}defaultNumLabelsPerPage;disabled=!1;locale;_translations;_labelInfoElement;_intl;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async downloadCSV(e,t,i,s=!0){return _(e,t,!0,i,s)}async downloadPDF(e,t,i=!1,s="",a=""){return v(e,t,this._labelInfoElement.selectedOption?.value,i,s,a)}async componentWillLoad(){await this._getTranslations(),await this._initModules()}render(){return s(a,{key:"2fd2ec44e8962468e3698b81e98746ddf6b7a3ca"},s("calcite-select",{key:"d24fca5c39aa358116ee8557249f7a4b09727b3f",disabled:this.disabled,label:"",ref:e=>{this._labelInfoElement=e}}))}componentDidLoad(){this._renderOptions()}async _initModules(){const[e]=await h(["esri/intl"]);this._intl=e}_getLabelSizeText(e){const t="&lrm;"+e.descriptionPDF.labelWidthDisplay+" x "+e.descriptionPDF.labelHeightDisplay+"&rlm;";return this._translations.pdfLabel.replace("{{n}}",e.descriptionPDF.labelsPerPageDisplay).replace("{{labelSize}}",t)}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}_renderOptions(){(L.default||L).sort(((e,t)=>{const i=parseInt(e.descriptionPDF.labelsPerPageDisplay,10),s=parseInt(t.descriptionPDF.labelsPerPageDisplay,10);return i<s?-1:i>s?1:0})).forEach(((e,t)=>{const i=document.createElement("calcite-option");i.value=e,i.innerHTML=this._getLabelSizeText(e),this._labelInfoElement.appendChild(i),(this.defaultNumLabelsPerPage?parseInt(e.descriptionPDF.labelsPerPageDisplay,10)===this.defaultNumLabelsPerPage:0===t)&&(i.selected=!0)}))}static get watchers(){return{locale:["localeWatchHandler"]}}};k.style=":host{display:block}";const P=class{constructor(i){e(this,i),this.selectionLoadingChange=t(this,"selectionLoadingChange",7),this.selectionSetsChanged=t(this,"selectionSetsChanged",7)}get el(){return i(this)}addresseeLayer;enabledLayerIds=[];locale;mapView;selectionSets=[];sketchLineSymbol;sketchPointSymbol;sketchPolygonSymbol;_translations;_selectionMode=m.ADD;_refineLayer;_addEnabled=!0;_drawTools;_refineSets=[];_enabledLayerIds=[];_layerPicker;_featuresCollection={};_refineSelectionSet;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}selectionLoadingChange;selectionSetsChanged;async componentWillLoad(){await this._getTranslations(),this._enabledLayerIds=this._getEnabledLayerIds(),await this._setRefineSet(this._enabledLayerIds[0])}render(){return s(a,{key:"8220100e14abd8339947a74df2d8072d06fb2a25"},s("div",{key:"1d7426778d638f347b563bfd29478fae7598e2dd",class:(this._enabledLayerIds.length>1?"display-block":"display-none")+" padding-top-sides-1"},s("div",{key:"cfb649989c24c403bde7d358794933f8f7959bb8",class:"display-flex"},s("calcite-label",{key:"dce85bbfa526941a0fb46c1aeba57f4b028948ef",class:"font-bold width-full label-margin-0"},s("div",{key:"86c19198643381fd99681c53bf0b2b5e66ecf7dc",class:"display-flex"},this._translations.inputLayer,s("calcite-icon",{key:"392022947cd9f53b4b83895992c5b0b32e56fb06",class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"refine-input-layer",scale:"s"})),s("map-layer-picker",{key:"d0946a46e7a79fc613b9eb9aa3e6f896c12bef92",enabledLayerIds:this._enabledLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._layerSelectionChange(e)},ref:e=>{this._layerPicker=e},selectedIds:[this._refineLayer.layer.id],showTables:!1})),s("calcite-popover",{key:"3b733fd5e7ceb011446112e65aa1ee1b0c5899c7",closable:!0,label:"",referenceElement:"refine-input-layer"},s("span",{key:"2076104710f4fbdd1de1f31b552b17749ebf9239",class:"tooltip-message"},this._translations.inputLayerTip)))),s("div",{key:"040efdfd6a269244790101cc0712a1cb0bac40d8",class:"padding-1"},s("div",{key:"be963f2cb157fda55980166359e53139a5713405",class:"padding-bottom-1"},s("calcite-segmented-control",{key:"459fa98e8852ea96afd0c9ab5864787f80ff6559",class:"w-100",width:"full"},s("calcite-segmented-control-item",{key:"965fa774838ecd3292c19a430cdbdfc7b44c82b2",checked:this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(m.ADD),value:m.ADD},s("span",{key:"e0b6fddbded9c78fa98674709ff03f050fd47300",class:"font-weight-500"},this._translations.add)),s("calcite-segmented-control-item",{key:"56e453183fc559ddbce5b041095fad5a8d6262ab",checked:!this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(m.REMOVE),value:m.REMOVE},s("span",{key:"13593da569557fa57822c98e12a5654cade219a1",class:"font-weight-500"},this._translations.remove)))),s("div",{key:"029fec164d9475274294a1d740a434cab2535cdc"},s("map-draw-tools",{key:"a212c5d21b2b1cdf7ba284a95dacaf83cf0180c9",active:!0,drawMode:u.REFINE,locale:this.locale,mapView:this.mapView,onDrawRedo:()=>this._redo(),onDrawUndo:()=>this._undo(),onSketchGraphicsChange:e=>this._sketchGraphicsChanged(e),pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,redoEnabled:this._refineSelectionSet?.redoStack.length>0,ref:e=>{this._drawTools=e},undoEnabled:this._refineSelectionSet?.undoStack.length>0})),s("br",{key:"352a0523461cfeeae3bae09ae1cc6f8fa759616b"}),s("calcite-list",{key:"948c7f0aa24d827d29cbc1c2c702deb52134e771",class:"list-border",label:""},this._getRefineSelectionSetList())))}_layerSelectionChange(e){this._setRefineSet(e.detail[0])}_setSelectionMode(e){this._selectionMode=e}_sketchGraphicsChanged(e){const t=e.detail?.graphics[0].geometry;this._selectFeatures(t)}_getEnabledLayerIds(){return this.selectionSets.reduce(((e,t)=>{const i=t?.layerView?.layer.id;return i&&e.indexOf(i)<0?e.push(i):t.workflowType===y.REFINE&&Object.keys(t.refineInfos).forEach((t=>{e.indexOf(t)<0&&e.push(t)})),e}),[])}async _setRefineSet(e){this.selectionSets.some((t=>{if(t.workflowType===y.REFINE)return this._refineSelectionSet=t,Object.keys(t.refineInfos).indexOf(e)>-1}))||await this._initRefineSet(e,this._refineSelectionSet),this._refineLayer=this._refineSelectionSet.refineInfos[e].layerView}async _initRefineSet(e,t){const i={};i[e]={addIds:[],removeIds:[],layerView:await p(this.mapView,e)},t?t.refineInfos={...t.refineInfos,...i}:(this._refineSelectionSet={id:Date.now(),searchResult:void 0,buffer:void 0,distance:0,download:!0,unit:"feet",label:"Refine",selectedIds:[],layerView:void 0,geometries:[],graphics:[],selectLayers:[],workflowType:y.REFINE,searchDistanceEnabled:!1,useLayerFeaturesEnabled:!1,refineInfos:i,redoStack:[],undoStack:[],sketchGraphic:void 0},this.selectionSets.push(this._refineSelectionSet))}_undo(){const e=this._refineSelectionSet.undoStack.pop();this._updateIds(e.ids,e.mode===m.ADD?m.REMOVE:m.ADD,this._refineSelectionSet.redoStack,e.layerView)}_redo(){const e=this._refineSelectionSet.redoStack.pop();this._updateIds(e.ids,e.mode===m.ADD?m.REMOVE:m.ADD,this._refineSelectionSet.undoStack,e.layerView)}_getRefineSelectionSetList(){const e=this._getTotal(this.selectionSets);let t;this.selectionSets.some((e=>{if(e.workflowType===y.REFINE)return t=e,!0}));let i=0,a=0;return Object.keys(t.refineInfos).forEach((e=>{i+=t.refineInfos[e].addIds.length,a+=t.refineInfos[e].removeIds.length})),[s("calcite-list-item",{label:this._translations.featuresAdded.replace("{{n}}",i.toString()),"non-interactive":!0}),s("calcite-list-item",{label:this._translations.featuresRemoved.replace("{{n}}",a.toString()),"non-interactive":!0}),s("calcite-list-item",{label:this._translations.totalSelected.replace("{{n}}",e.toString()),"non-interactive":!0})]}_getTotal(e){const t=f(e);return Object.keys(t).reduce(((e,i)=>e+t[i].ids.length),0)}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}async _selectFeatures(e){this.selectionLoadingChange.emit(!0),this._featuresCollection[this._refineLayer?.layer.id]=[];const t=await b(0,this._refineLayer?.layer,e,this._featuresCollection);this.selectionLoadingChange.emit(!1);let i=[];Object.keys(t).forEach((e=>{e===this._refineLayer?.layer.id&&(i=i.concat(t[e]))}));const s=Array.isArray(i)?i.map((e=>e.attributes[e?.layer?.objectIdField])):[];await this._updateIds(s,this._selectionMode,this._refineSelectionSet.undoStack,this._refineLayer),this._drawTools.clear()}async _highlightFeatures(){this._clearHighlight(),w.highlightHandles=await g(this.selectionSets)}_clearHighlight(){w.removeHandles()}async _updateIds(e,t,i,s){let a=!1;const l=this._refineSelectionSet.refineInfos,h=s.layer.id,n={};n[h]={addIds:[],removeIds:[],layerView:s};const r=Object.keys(l).indexOf(h)>-1?l[h]:n[h];if(t===m.ADD)r.addIds=[...new Set([...e,...r.addIds])],r.addIds.length>0&&i.push({ids:e,mode:t,layerView:s}),r.removeIds.length>0&&(r.removeIds=r.removeIds.filter((t=>e.indexOf(t)<0)));else{const l=this.selectionSets.reduce(((t,i)=>(e.forEach((e=>{i.workflowType!==y.REFINE?i.selectedIds.indexOf(e)>-1&&t.push(e):Object.keys(i.refineInfos).some((a=>{const l=i.refineInfos[a];if(l.layerView.layer.id===s.layer.id&&l.addIds.indexOf(e)>-1)return t.push(e),!0}))})),t)),[]);r.removeIds=[...new Set([...l,...r.removeIds])],r.addIds=r.addIds.filter((e=>l.indexOf(e)<0)),r.removeIds.length>0&&i.push({ids:l,mode:t,layerView:s}),this.selectionSets=this.selectionSets.reduce(((e,t)=>(t.workflowType!==y.REFINE&&t.layerView.layer.id===s.layer.id?(t.selectedIds=t.selectedIds.filter((e=>r.removeIds.indexOf(e)<0)),t.selectedIds.length>0?e.push(t):a=!0):e.push(t),e)),[])}this._refineSelectionSet.refineInfos[h]=r,this.selectionSets=[...this.selectionSets],a&&this.selectionSetsChanged.emit(this.selectionSets),await this._highlightFeatures()}static get watchers(){return{locale:["localeWatchHandler"]}}};P.style=':host{display:block}.div-visible{display:inherit}.div-not-visible{display:none !important}.padding-top-1-2{padding-top:.5rem}.main-label{display:flex;float:left}html[dir="rtl"] .main-label{display:flex;float:right}.border{outline:1px solid var(--calcite-color-border-input)}.margin-top-1{margin-top:1rem}.esri-sketch{display:flex;flex-flow:column wrap}.esri-widget{box-sizing:border-box;color:#323232;font-size:14px;font-family:"Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;line-height:1.3em;background-color:var(--calcite-color-foreground-1)}.esri-sketch__panel{align-items:center;display:flex;flex-flow:row nowrap;padding:0}*/ .esri-sketch__tool-section{border-right:1px solid rgba(110, 110, 110, .3)}.esri-sketch__section{align-items:center;display:flex;flex-flow:row nowrap;padding:0 7px;margin:6px 0;border-right:1px solid rgba(110, 110, 110, .3)}.display-flex{display:flex}.font-bold{font-weight:bold}.width-full{width:100%}.label-margin-0{--calcite-label-margin-bottom:0}.padding-start-1-2{padding-inline-start:0.5rem}.font-weight-500{font-weight:500}.word-wrap-anywhere{word-wrap:anywhere}';export{S as map_select_tools,k as pdf_download,P as refine_selection}
6
+ import{r as e,c as t,g as i,h as s,H as a}from"./p-1b0588d2.js";import{a as l,l as h,g as n}from"./p-ee2cbba0.js";import{e as r,h as c,i as o,j as d,c as b,k as p,l as f,m as g}from"./p-dcd2f00b.js";import{a as y,e as m,f as u}from"./p-80cb7c73.js";import{s as w}from"./p-48942eb8.js";import{d as _,a as v}from"./p-6eab9d1f.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-e23b4193.js";import"./p-4fe489cf.js";import"./p-2bc98cb0.js";import"./p-4f236b5d.js";import"./p-570b13d9.js";import"./p-0668e30d.js";const S=class{constructor(i){e(this,i),this.selectionSetChange=t(this,"selectionSetChange",7)}get el(){return i(this)}bufferColor=[227,139,79,.8];bufferOutlineColor=[255,255,255];customLabelEnabled;enabledLayerIds=[];enableLayerFeatures=!0;enableLayerFeaturesOnLoad=!1;enableSearchDistance=!0;enableSearchDistanceOnLoad=!1;enableSketchTools=!0;defaultBufferDistance;defaultBufferUnit;geometries=[];isUpdate=!1;layerViews=[];locale;mapView;noResultText;searchConfiguration;selectionSet;selectionLayerIds=[];selectLayerView;sketchLineSymbol;sketchPointSymbol;sketchPolygonSymbol;searchDistanceEnabled=!1;useLayerFeaturesEnabled=!1;_numSelected=0;_searchTerm;_selectionLoading=!1;_translations;_esriRequest;FeatureLayer;Graphic;GraphicsLayer;Search;_geometryEngine;_bufferGeometry;_bufferGraphicsLayer;_bufferTools;_distance;_drawTools;_labelName;_selectLayers;_searchElement;_searchResult;_searchWidget;_selectedIds=[];_selectionLabel="";_skipGeomOIDs;_sketchGraphic;_graphics=[];_unit;_workflowType;_featuresCollection={};async watchGeometriesHandler(e,t){if(e!==t){const t=0===e.length;if(await this._clearResults(t,t),e.length>0)return this._highlightWithOIDsOrGeoms()}}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async mapViewWatchHandler(e,t){e&&e!==t&&await this._init()}async watchSearchConfigurationHandler(e,t){JSON.stringify(e)!==JSON.stringify(t)&&await this._initSearchWidget()}async clearSelection(){return this._clearResults(!0,!0)}async getSelection(){return/\S+/gm.test(this._selectionLabel)||await this._updateLabel(),{id:this.isUpdate?this.selectionSet.id:Date.now(),searchResult:this._searchResult,buffer:this._bufferGeometry,distance:this._bufferTools?.distance,download:!0,unit:this._bufferTools?.unit,label:this._selectionLabel,selectedIds:this._selectedIds,layerView:this.selectLayerView,geometries:this.geometries,graphics:this._graphics,selectLayers:this.layerViews,skipGeomOIDs:this._skipGeomOIDs,searchDistanceEnabled:this.searchDistanceEnabled,workflowType:this._workflowType,useLayerFeaturesEnabled:this.useLayerFeaturesEnabled,sketchGraphic:this._sketchGraphic}}selectionSetChange;searchConfigurationChangeChanged(e){this.searchConfiguration=e.detail}async distanceChanged(e){await this._distanceChanged(e.detail)}async unitChanged(e){e.detail.newValue!==e.detail.oldValue&&(this._unit=e.detail.newValue,await this._updateLabel())}async componentWillLoad(){await this._getTranslations(),await this._initModules()}async componentDidLoad(){await this._init()}render(){const e=this.enableSketchTools?"":"display-none",t=this.enableSketchTools?"padding-top-1":"";return s(a,{key:"a5001c196db1464bffa746310638b2853ff5fdf9"},this._getMapLayerPicker(),s("div",{key:"3e023a81f76bdd371c84d9ecb42e97a9160c6f89",class:"border-bottom"}),s("div",{key:"c6be571bee2d2c1fe82407aee9a1cf9f1f27280d",class:"padding-top-sides-1"},s("div",{key:"aaf5992f616728f6be5be034700ac09b9b5b733f",class:"search-widget",ref:e=>{this._searchElement=e}}),s("div",{key:"a86b4e147b7baf4b93272bed7f189a47faf65ab8",class:t},s("map-draw-tools",{key:"9b3c2faaa8f612d055189206e2baeb868d55dceb",active:!0,class:e,editGraphicsEnabled:!this.useLayerFeaturesEnabled,graphics:this._graphics,locale:this.locale,mapView:this.mapView,onSketchGraphicsChange:e=>{this._sketchGraphicsChanged(e)},pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,ref:e=>{this._drawTools=e}})),this.enableSearchDistance?this._getBufferOptions():void 0,this.enableLayerFeatures?this._getUseLayerFeaturesOptions():void 0,this._getNumSelected()),s("div",{key:"73b3039f0861046a3f955872180b64c15bd5c5d9",class:"border-bottom"}),this._getNameInput())}_getBufferOptions(){this.enableSearchDistanceOnLoad&&(this.searchDistanceEnabled=!0,this.enableSearchDistanceOnLoad=!1);const e=this.searchDistanceEnabled?"search-distance":"div-not-visible",t="number"==typeof this.selectionSet?.distance?this.selectionSet.distance:this.defaultBufferDistance;return s("div",null,s("div",{class:"padding-top-1 display-flex"},s("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},s("div",{class:"tooltip-container"},this._translations.searchDistance,s("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"search-distance-icon",scale:"s"}))),s("calcite-popover",{closable:!0,label:"",referenceElement:"search-distance-icon"},s("span",{class:"tooltip-message"},this._translations.useSearchDistanceTootip)),s("calcite-switch",{checked:this.searchDistanceEnabled,onCalciteSwitchChange:()=>this.searchDistanceEnabled=!this.searchDistanceEnabled})),s("div",{class:e},s("buffer-tools",{disabled:!this.searchDistanceEnabled,distance:t,geometries:this.geometries,locale:this.locale,onBufferComplete:e=>{this._bufferComplete(e)},ref:e=>this._bufferTools=e,unit:this.selectionSet?.unit||this.defaultBufferUnit})))}_getUseLayerFeaturesOptions(){this.enableLayerFeaturesOnLoad&&(this.useLayerFeaturesEnabled=!0,this.enableLayerFeaturesOnLoad=!1);const e=this.useLayerFeaturesEnabled?"div-visible":"div-not-visible";return s("div",null,s("div",{class:"padding-top-1 display-flex"},s("calcite-label",{class:"label-margin-0 w-100",layout:"inline-space-between"},s("div",{class:"tooltip-container"},this._translations.useLayerFeatures,s("calcite-icon",{class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"use-layer-features-icon",scale:"s"}))),s("calcite-popover",{closable:!0,label:"",referenceElement:"use-layer-features-icon"},s("span",{class:"tooltip-message"},this._translations.useLayerFeaturesTooltip)),s("calcite-switch",{checked:this.useLayerFeaturesEnabled,onCalciteSwitchChange:()=>{this._useLayerFeaturesEnabledChanged()}})),s("div",{class:e+" padding-top-1"},s("map-layer-picker",{enabledLayerIds:this.selectionLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._layerSelectionChange(e)},selectedIds:this.layerViews.map((e=>e.layer.id)),showTables:!1})))}_getNumSelected(){const e=l(this.el),t=e&&"en"===e?`${this._translations.selectionLoading}...`:this._translations.selectionLoading;return s("div",{class:"padding-top-1 padding-bottom-1",style:{"align-items":"end",display:"flex"}},this._selectionLoading?s("div",null,s("calcite-loader",{class:"info-blue",inline:!0,label:t,scale:"m",type:"indeterminate"})):s("calcite-icon",{class:"info-blue padding-end-1-2",icon:"feature-layer",scale:"s"}),s("calcite-input-message",{class:"info-blue",scale:"m"},this._selectionLoading?t:this.noResultText&&0===this._numSelected?this.noResultText:this._translations.selectedFeatures.replace("{{n}}",this._numSelected.toString())))}_getNameInput(){return s("div",{class:"padding-sides-1 padding-top-1 "+(this.customLabelEnabled?"":"display-none")},s("calcite-label",{class:"font-bold"},this._translations.listName,s("calcite-input",{onInput:()=>{this._selectionLabel=this._labelName.value},placeholder:this._translations.listNamePlaceholder,ref:e=>{this._labelName=e},value:this._selectionLabel||""})))}_getMapLayerPicker(){return s("div",{class:"display-flex padding-sides-1 padding-bottom-1"},s("calcite-label",{class:"font-bold width-full label-margin-0"},this._translations.inputLayer,s("map-layer-picker",{enabledLayerIds:this.enabledLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._inputLayerSelectionChange(e)},selectedIds:this.selectLayerView?[this.selectLayerView.layer.id]:this.selectionSet?[this.selectionSet.layerView.layer.id]:[],showTables:!1})))}async _initModules(){const[e,t,i,s,a,l]=await h(["esri/request","esri/layers/GraphicsLayer","esri/Graphic","esri/widgets/Search","esri/geometry/geometryEngine","esri/layers/FeatureLayer"]);this._esriRequest=e,this.GraphicsLayer=t,this.Graphic=i,this.Search=s,this._geometryEngine=a,this.FeatureLayer=l}async _init(){this._initGraphicsLayer(),await this._initSelectionSet(),await this._initSearchWidget()}async _initSelectionSet(){this.selectionSet&&(this._searchTerm=this.selectionSet.searchResult?.name,this._searchResult=this.selectionSet.searchResult,this._selectLayers=this.selectionSet.selectLayers,this._selectedIds=this.selectionSet.selectedIds,this._skipGeomOIDs=this.selectionSet.skipGeomOIDs,this.searchDistanceEnabled=this.selectionSet.searchDistanceEnabled,this.useLayerFeaturesEnabled=this.selectionSet.useLayerFeaturesEnabled,this._distance=this.selectionSet.searchDistanceEnabled?this.selectionSet.distance:0,this._unit=this.selectionSet.unit,this._workflowType=this.selectionSet.workflowType,this.selectLayerView=this.selectionSet.layerView,this._sketchGraphic=this.selectionSet.sketchGraphic,this.geometries=[...this.selectionSet?.geometries||[]],this._graphics=this.geometries.map((e=>new this.Graphic({geometry:e,symbol:"point"===e.type?this.sketchPointSymbol:"polyline"===e.type?this.sketchLineSymbol:this.sketchPolygonSymbol}))),this._selectionLabel=this.selectionSet?.label,this.useLayerFeaturesEnabled||await(this._drawTools?.updateGraphics()),await r(this.selectionSet.selectedIds,this.selectionSet.layerView,this.mapView,!1))}async _initSearchWidget(){if(this.mapView&&this._searchElement){const e=this._getSearchConfig(this.searchConfiguration,this.mapView),t={view:this.mapView,container:this._searchElement,searchTerm:this._searchTerm,...e};this._searchWidget=new this.Search(t),this._searchWidget.popupEnabled=!1,this._searchWidget.resultGraphicEnabled=!1,this._searchWidget.on("search-clear",(()=>{const e=this._searchClearLabel();this._clearResults(!1,e)})),this._searchWidget.on("select-result",(e=>{this._selectResult(e.result)})),await this._searchWidget.when((()=>{this._searchWidget.allPlaceholder=this.searchConfiguration?.allPlaceholder&&"find address or place"!==this.searchConfiguration.allPlaceholder.toLowerCase()?this.searchConfiguration.allPlaceholder:this._translations.placeholder}))}}async _selectResult(e){if(e){this._searchResult=e;const t=e.feature,i=t?.layer,s=this.selectLayerView.layer,a=t?.getObjectId();let l,h;i?.sourceJSON?.isView&&(l=await this._getViewSourceUrl(i.url)),s?.sourceJSON?.isView&&(h=await this._getViewSourceUrl(s.url));const n=i?.url?.toLowerCase(),r=l?.toLowerCase(),c=s?.url?.toLowerCase(),o=h?.toLowerCase(),d=n&&c&&(n===c||n===o||r===c||r===o)&&!isNaN(a),b=d?[a]:void 0;this._workflowType=y.SEARCH,this._updateLabel();const p=[e.feature];this._updateSelection(p,d,b),this._drawTools.graphics=p,this._searchWidget.resultGraphic.visible=!1}else{const e=this._searchClearLabel();this._clearResults(!1,e)}}async _getViewSourceUrl(e){let t="";const i=`${e}/sources?f=json`;try{const e=await this._esriRequest(i,{query:{f:"json"}});1===e?.data?.services?.length&&(t=e.data.services[0].url)}catch(e){console.log(e)}return t}_searchClearLabel(){return this._searchResult?.name&&this._labelName.value.indexOf(this._searchResult.name)>-1}_getSearchConfig(e,t){const i=e?.sources;return i?.length>0?(e={...e,includeDefaultSources:!1},i.forEach((e=>{if(e.hasOwnProperty("layer")){const i=e,s=i.layer?.id,a=s?t.map.findLayerById(s):null,l=i?.layer?.url;a?i.layer=a:l&&(i.layer=new this.FeatureLayer(l))}})),i?.forEach((e=>{if(e.hasOwnProperty("locator")){const t=e;"ArcGIS World Geocoding Service"===t?.name&&(t.outFields=t.outFields||["Addr_type","Match_addr","StAddr","City"],t.singleLineFieldName="SingleLine"),t.url=t.url,delete t.url}}))):e={...e,includeDefaultSources:!0},e}_initGraphicsLayer(){const e=this._translations.bufferLayer;if(this.mapView){const t=this.mapView.map.layers.findIndex((t=>t.title===e));if(t>-1)this._bufferGraphicsLayer=this.mapView.map.layers.getItemAt(t);else{this._bufferGraphicsLayer=new this.GraphicsLayer({title:e,listMode:"hide"}),w.managedLayers[e]="buffer";const t=this.mapView.map.layers.findIndex((e=>e.title===this._translations.sketchLayer));t>-1?this.mapView.map.layers.add(this._bufferGraphicsLayer,t):this.mapView.map.layers.add(this._bufferGraphicsLayer)}}}async _sketchGraphicsChanged(e,t=!1){const i=e.detail.graphics;if(i.length>0&&i[0])if(t||(this._sketchGraphic=i[0]),this._workflowType=this.useLayerFeaturesEnabled?y.SELECT:y.SKETCH,this._workflowType===y.SKETCH&&await this._drawTools.updateGraphics(),await this._updateLabel(),this._clearSearchWidget(),this.useLayerFeaturesEnabled&&!t){const e=Array.isArray(i)?i.map((e=>e.geometry)):this.geometries;await this._selectLayerFeatures(e[0])}else{const t=i.reduce(((e,t)=>(t?.layer?.objectIdField?e.push(t.attributes[t.layer.objectIdField]):t.getObjectId&&e.push(t.getObjectId()),e)),[]),s=e.detail.useOIDs&&t.length>0;this._updateSelection(i,s,t),s&&await this._highlightFeatures(t)}else await this._clearResults(!0,!0)}async _highlightWithOIDsOrGeoms(){return this._skipGeomOIDs?.length>0?(this._selectedIds=this._skipGeomOIDs,this._highlightFeatures(this._selectedIds)):this._geomQuery(this.geometries)}async _highlightFeatures(e){w.removeHandles(),e.length>0&&w.highlightHandles.push(await c(e,this.selectLayerView,this.mapView)),this._numSelected=e.length,this.selectionSetChange.emit(e.length)}async _selectFeatures(e){this._selectionLoading=!0,this._selectedIds=await o(e,this.selectLayerView.layer),this._selectionLoading=!1,this._drawTools.graphics=this._graphics,await this._highlightFeatures(this._selectedIds)}async _bufferComplete(e){this._bufferGeometry=Array.isArray(e.detail)?e.detail[0]:e.detail;let t=this._bufferTools.distance,i=0;if(this._bufferGeometry){const e=new this.Graphic({geometry:this._bufferGeometry,symbol:{type:"simple-fill",color:this.bufferColor,outline:{color:this.bufferOutlineColor,width:1}}});this._bufferGraphicsLayer.removeAll(),this._bufferGraphicsLayer.add(e),await this._selectFeatures([this._bufferGeometry]),await this.mapView.goTo(e.geometry.extent),i=t,t=0}else this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),await this._highlightWithOIDsOrGeoms();await this._distanceChanged({oldValue:t,newValue:i})}_geomQuery(e){const t=d(e,this._geometryEngine);return this._selectFeatures(t)}async _clearResults(e=!0,t=!1){this._selectedIds=[],this._distance=void 0,this._unit=void 0,t&&(this._selectionLabel="",this._labelName&&(this._labelName.value="")),this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),e&&this._searchWidget&&this._clearSearchWidget(),w.removeHandles(),this._drawTools?.clear&&(this._graphics=[],await this._drawTools.clear()),this._numSelected=this._selectedIds.length,this.selectionSetChange.emit(this._numSelected)}_clearSearchWidget(){this._searchWidget.clear(),this._searchResult=void 0}_updateSelection(e,t,i){this._selectedIds=t&&i?i:this._selectedIds,this._skipGeomOIDs=t?i:void 0,this.geometries=Array.isArray(e)?e.map((e=>e.geometry)):this.geometries,this._graphics=e}async _updateLabel(){if(this.enableSearchDistance){const e=this._selectionLabel.indexOf(this._translations.sketch)>-1,t=this._selectionLabel.indexOf(this._translations.select)>-1,i=this._selectionLabel.indexOf(this._searchResult?.name)>-1,s=this._workflowType===y.SEARCH?this._searchResult?.name:this._workflowType===y.SELECT?this._translations.select:this._translations.sketch,a=this._unit?this._unit:this._bufferTools.unit,l=await this._bufferTools.getTranslatedUnit(a),h=isNaN(this._distance)?this._bufferTools.distance:this._distance;this._selectionLabel=e||t||i||!this._selectionLabel?`${s} ${h} ${l}`:this._selectionLabel,this._labelName.value=this._selectionLabel}}async _layerSelectionChange(e){if(Array.isArray(e.detail)&&e.detail.length>0){const t=e.detail.map((e=>b(this.mapView,e)));return Promise.all(t).then((e=>{this.layerViews=e,this._featuresCollection={},this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}))}}async _inputLayerSelectionChange(e){const t=e?.detail?.length>0?e.detail[0]:"";this.selectLayerView&&t===this.selectLayerView.layer.id||(this.selectLayerView=await b(this.mapView,t),await this._updateLabel(),this._bufferGeometry?await this._selectFeatures([this._bufferGeometry]):await this._highlightWithOIDsOrGeoms())}async _distanceChanged(e){e.newValue!==e.oldValue&&(this._distance=e.newValue,await this._updateLabel())}async _selectLayerFeatures(e){this._selectionLoading=!0;const t=this.layerViews.map((t=>(this._featuresCollection[t.layer.id]=[],p(0,t.layer,e,this._featuresCollection))));return Promise.all(t).then((async e=>{this._selectionLoading=!1;let t=[];e.forEach((e=>{Object.keys(e).forEach((i=>{t=t.concat(e[i])}))}));let i=!1;t.forEach((e=>{const t=e.geometry;e.symbol="point"===t.type?this.sketchPointSymbol:"polyline"===t.type?this.sketchLineSymbol:"polygon"===t.type?this.sketchPolygonSymbol:void 0,i=e?.layer?.hasOwnProperty("objectIdField")||e.hasOwnProperty("getObjectId")}));const s=this.layerViews[0].layer,a=this.selectLayerView.layer,l=i&&s.url===a.url&&a.layerId===s.layerId;await this._sketchGraphicsChanged({detail:{graphics:t,useOIDs:l}},!0)}))}_useLayerFeaturesEnabledChanged(){this.useLayerFeaturesEnabled=!this.useLayerFeaturesEnabled,this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}static get watchers(){return{geometries:["watchGeometriesHandler"],locale:["localeWatchHandler"],mapView:["mapViewWatchHandler"],searchConfiguration:["watchSearchConfigurationHandler"]}}};S.style=':host{display:block}.div-visible{display:inherit}.div-visible-search{display:flex;height:44px;align-items:center;padding-bottom:0}.div-not-visible{display:none}.padding-bottom-1{padding-bottom:1rem}.padding-top-1{padding-top:1rem}.search-widget{width:100% !important;border:1px solid var(--calcite-color-border-input)}.w-100{width:100%}.w-50{width:50%}.search-distance-container{padding-top:"1rem" !important}.end-border{border-inline-end:1px solid var(--calcite-color-border-2)}.search-distance{display:flex;padding-top:1rem}.font-bold{font:bold}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.tooltip-container{display:flex}.padding-start-1-2{padding-inline-start:0.5rem}.icon{--calcite-color-icon-color:var(--calcite-color-brand)}.tooltip-message{padding:5px 8px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-color-text-2)}';const L=Object.freeze({__proto__:null,default:[{descriptionPDF:{labelWidthDisplay:"2-5/8",labelHeightDisplay:"1",labelsPerPageDisplay:"30",averyPartNumber:"*60"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.1875,rightMargin:.1875,topMargin:.5,bottomMargin:.5},numLabelsAcross:3,numLabelsDown:10,labelWidth:2.625,labelHeight:1,horizGapIn:.125,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:4}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"1",labelsPerPageDisplay:"20",averyPartNumber:"*61"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.47637821,bottomMargin:.5},numLabelsAcross:2,numLabelsDown:10,labelWidth:4,labelHeight:1.0025,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:4}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"1-1/3",labelsPerPageDisplay:"14",averyPartNumber:"*62"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.81889808,bottomMargin:.83464612},numLabelsAcross:2,numLabelsDown:7,labelWidth:4,labelHeight:1.3352,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:11,maxNumLabelLines:6}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"2",labelsPerPageDisplay:"10",averyPartNumber:"*63"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.5,bottomMargin:.5},numLabelsAcross:2,numLabelsDown:5,labelWidth:4,labelHeight:2,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:12,maxNumLabelLines:10}},{descriptionPDF:{labelWidthDisplay:"4",labelHeightDisplay:"3-1/3",labelsPerPageDisplay:"6",averyPartNumber:"*64"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.15625,rightMargin:.15625,topMargin:.4724412,bottomMargin:.50000027},numLabelsAcross:2,numLabelsDown:3,labelWidth:4,labelHeight:3.342,horizGapIn:.1875,vertGapIn:0,labelPadding:.1,fontSizePx:14,maxNumLabelLines:12}},{descriptionPDF:{labelWidthDisplay:"1-3/4",labelHeightDisplay:"1/2",labelsPerPageDisplay:"80",averyPartNumber:"*67"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.307086375,rightMargin:.307086375,topMargin:.4724412,bottomMargin:.49606326},numLabelsAcross:4,numLabelsDown:20,labelWidth:1.75,labelHeight:.50155,horizGapIn:.29527575,vertGapIn:0,labelPadding:.1,fontSizePx:8,maxNumLabelLines:3}},{descriptionPDF:{labelWidthDisplay:"1-3/4",labelHeightDisplay:"2/3",labelsPerPageDisplay:"60",averyPartNumber:"*95"},labelSpec:{type:"AVERY",pageProperties:{pageType:"ANSI A",leftMargin:.28936983,rightMargin:.28936983,topMargin:.53937037,bottomMargin:.5511814},numLabelsAcross:4,numLabelsDown:15,labelWidth:1.75,labelHeight:.6605,horizGapIn:.30708678,vertGapIn:0,labelPadding:.1,fontSizePx:8,maxNumLabelLines:4}}]}),k=class{constructor(t){e(this,t)}get el(){return i(this)}defaultNumLabelsPerPage;disabled=!1;locale;_translations;_labelInfoElement;_intl;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}async downloadCSV(e,t,i,s=!0){return _(e,t,!0,i,s)}async downloadPDF(e,t,i=!1,s="",a=""){return v(e,t,this._labelInfoElement.selectedOption?.value,i,s,a)}async componentWillLoad(){await this._getTranslations(),await this._initModules()}render(){return s(a,{key:"2fd2ec44e8962468e3698b81e98746ddf6b7a3ca"},s("calcite-select",{key:"d24fca5c39aa358116ee8557249f7a4b09727b3f",disabled:this.disabled,label:"",ref:e=>{this._labelInfoElement=e}}))}componentDidLoad(){this._renderOptions()}async _initModules(){const[e]=await h(["esri/intl"]);this._intl=e}_getLabelSizeText(e){const t="&lrm;"+e.descriptionPDF.labelWidthDisplay+" x "+e.descriptionPDF.labelHeightDisplay+"&rlm;";return this._translations.pdfLabel.replace("{{n}}",e.descriptionPDF.labelsPerPageDisplay).replace("{{labelSize}}",t)}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}_renderOptions(){(L.default||L).sort(((e,t)=>{const i=parseInt(e.descriptionPDF.labelsPerPageDisplay,10),s=parseInt(t.descriptionPDF.labelsPerPageDisplay,10);return i<s?-1:i>s?1:0})).forEach(((e,t)=>{const i=document.createElement("calcite-option");i.value=e,i.innerHTML=this._getLabelSizeText(e),this._labelInfoElement.appendChild(i),(this.defaultNumLabelsPerPage?parseInt(e.descriptionPDF.labelsPerPageDisplay,10)===this.defaultNumLabelsPerPage:0===t)&&(i.selected=!0)}))}static get watchers(){return{locale:["localeWatchHandler"]}}};k.style=":host{display:block}";const P=class{constructor(i){e(this,i),this.selectionLoadingChange=t(this,"selectionLoadingChange",7),this.selectionSetsChanged=t(this,"selectionSetsChanged",7)}get el(){return i(this)}addresseeLayer;enabledLayerIds=[];locale;mapView;selectionSets=[];sketchLineSymbol;sketchPointSymbol;sketchPolygonSymbol;_translations;_selectionMode=m.ADD;_refineLayer;_addEnabled=!0;_drawTools;_refineSets=[];_enabledLayerIds=[];_layerPicker;_featuresCollection={};_refineSelectionSet;async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}selectionLoadingChange;selectionSetsChanged;async componentWillLoad(){await this._getTranslations(),this._enabledLayerIds=this._getEnabledLayerIds(),await this._setRefineSet(this._enabledLayerIds[0])}render(){return s(a,{key:"8220100e14abd8339947a74df2d8072d06fb2a25"},s("div",{key:"1d7426778d638f347b563bfd29478fae7598e2dd",class:(this._enabledLayerIds.length>1?"display-block":"display-none")+" padding-top-sides-1"},s("div",{key:"cfb649989c24c403bde7d358794933f8f7959bb8",class:"display-flex"},s("calcite-label",{key:"dce85bbfa526941a0fb46c1aeba57f4b028948ef",class:"font-bold width-full label-margin-0"},s("div",{key:"86c19198643381fd99681c53bf0b2b5e66ecf7dc",class:"display-flex"},this._translations.inputLayer,s("calcite-icon",{key:"392022947cd9f53b4b83895992c5b0b32e56fb06",class:"padding-start-1-2 icon",flipRtl:!("he"===this.locale?.toLowerCase()),icon:"question",id:"refine-input-layer",scale:"s"})),s("map-layer-picker",{key:"d0946a46e7a79fc613b9eb9aa3e6f896c12bef92",enabledLayerIds:this._enabledLayerIds,locale:this.locale,mapView:this.mapView,onLayerSelectionChange:e=>{this._layerSelectionChange(e)},ref:e=>{this._layerPicker=e},selectedIds:[this._refineLayer.layer.id],showTables:!1})),s("calcite-popover",{key:"3b733fd5e7ceb011446112e65aa1ee1b0c5899c7",closable:!0,label:"",referenceElement:"refine-input-layer"},s("span",{key:"2076104710f4fbdd1de1f31b552b17749ebf9239",class:"tooltip-message"},this._translations.inputLayerTip)))),s("div",{key:"040efdfd6a269244790101cc0712a1cb0bac40d8",class:"padding-1"},s("div",{key:"be963f2cb157fda55980166359e53139a5713405",class:"padding-bottom-1"},s("calcite-segmented-control",{key:"459fa98e8852ea96afd0c9ab5864787f80ff6559",class:"w-100",width:"full"},s("calcite-segmented-control-item",{key:"965fa774838ecd3292c19a430cdbdfc7b44c82b2",checked:this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(m.ADD),value:m.ADD},s("span",{key:"e0b6fddbded9c78fa98674709ff03f050fd47300",class:"font-weight-500"},this._translations.add)),s("calcite-segmented-control-item",{key:"56e453183fc559ddbce5b041095fad5a8d6262ab",checked:!this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(m.REMOVE),value:m.REMOVE},s("span",{key:"13593da569557fa57822c98e12a5654cade219a1",class:"font-weight-500"},this._translations.remove)))),s("div",{key:"029fec164d9475274294a1d740a434cab2535cdc"},s("map-draw-tools",{key:"a212c5d21b2b1cdf7ba284a95dacaf83cf0180c9",active:!0,drawMode:u.REFINE,locale:this.locale,mapView:this.mapView,onDrawRedo:()=>this._redo(),onDrawUndo:()=>this._undo(),onSketchGraphicsChange:e=>this._sketchGraphicsChanged(e),pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,redoEnabled:this._refineSelectionSet?.redoStack.length>0,ref:e=>{this._drawTools=e},undoEnabled:this._refineSelectionSet?.undoStack.length>0})),s("br",{key:"352a0523461cfeeae3bae09ae1cc6f8fa759616b"}),s("calcite-list",{key:"948c7f0aa24d827d29cbc1c2c702deb52134e771",class:"list-border",label:""},this._getRefineSelectionSetList())))}_layerSelectionChange(e){this._setRefineSet(e.detail[0])}_setSelectionMode(e){this._selectionMode=e}_sketchGraphicsChanged(e){const t=e.detail?.graphics[0].geometry;this._selectFeatures(t)}_getEnabledLayerIds(){return this.selectionSets.reduce(((e,t)=>{const i=t?.layerView?.layer.id;return i&&e.indexOf(i)<0?e.push(i):t.workflowType===y.REFINE&&Object.keys(t.refineInfos).forEach((t=>{e.indexOf(t)<0&&e.push(t)})),e}),[])}async _setRefineSet(e){this.selectionSets.some((t=>{if(t.workflowType===y.REFINE)return this._refineSelectionSet=t,Object.keys(t.refineInfos).indexOf(e)>-1}))||await this._initRefineSet(e,this._refineSelectionSet),this._refineLayer=this._refineSelectionSet.refineInfos[e].layerView}async _initRefineSet(e,t){const i={};i[e]={addIds:[],removeIds:[],layerView:await b(this.mapView,e)},t?t.refineInfos={...t.refineInfos,...i}:(this._refineSelectionSet={id:Date.now(),searchResult:void 0,buffer:void 0,distance:0,download:!0,unit:"feet",label:"Refine",selectedIds:[],layerView:void 0,geometries:[],graphics:[],selectLayers:[],workflowType:y.REFINE,searchDistanceEnabled:!1,useLayerFeaturesEnabled:!1,refineInfos:i,redoStack:[],undoStack:[],sketchGraphic:void 0},this.selectionSets.push(this._refineSelectionSet))}_undo(){const e=this._refineSelectionSet.undoStack.pop();this._updateIds(e.ids,e.mode===m.ADD?m.REMOVE:m.ADD,this._refineSelectionSet.redoStack,e.layerView)}_redo(){const e=this._refineSelectionSet.redoStack.pop();this._updateIds(e.ids,e.mode===m.ADD?m.REMOVE:m.ADD,this._refineSelectionSet.undoStack,e.layerView)}_getRefineSelectionSetList(){const e=this._getTotal(this.selectionSets);let t;this.selectionSets.some((e=>{if(e.workflowType===y.REFINE)return t=e,!0}));let i=0,a=0;return Object.keys(t.refineInfos).forEach((e=>{i+=t.refineInfos[e].addIds.length,a+=t.refineInfos[e].removeIds.length})),[s("calcite-list-item",{label:this._translations.featuresAdded.replace("{{n}}",i.toString()),"non-interactive":!0}),s("calcite-list-item",{label:this._translations.featuresRemoved.replace("{{n}}",a.toString()),"non-interactive":!0}),s("calcite-list-item",{label:this._translations.totalSelected.replace("{{n}}",e.toString()),"non-interactive":!0})]}_getTotal(e){const t=f(e);return Object.keys(t).reduce(((e,i)=>e+t[i].ids.length),0)}async _getTranslations(){const e=await n(this.el);this._translations=e[0]}async _selectFeatures(e){this.selectionLoadingChange.emit(!0),this._featuresCollection[this._refineLayer?.layer.id]=[];const t=await p(0,this._refineLayer?.layer,e,this._featuresCollection);this.selectionLoadingChange.emit(!1);let i=[];Object.keys(t).forEach((e=>{e===this._refineLayer?.layer.id&&(i=i.concat(t[e]))}));const s=Array.isArray(i)?i.map((e=>e.attributes[e?.layer?.objectIdField])):[];await this._updateIds(s,this._selectionMode,this._refineSelectionSet.undoStack,this._refineLayer),this._drawTools.clear()}async _highlightFeatures(){this._clearHighlight(),w.highlightHandles=await g(this.selectionSets)}_clearHighlight(){w.removeHandles()}async _updateIds(e,t,i,s){let a=!1;const l=this._refineSelectionSet.refineInfos,h=s.layer.id,n={};n[h]={addIds:[],removeIds:[],layerView:s};const r=Object.keys(l).indexOf(h)>-1?l[h]:n[h];if(t===m.ADD)r.addIds=[...new Set([...e,...r.addIds])],r.addIds.length>0&&i.push({ids:e,mode:t,layerView:s}),r.removeIds.length>0&&(r.removeIds=r.removeIds.filter((t=>e.indexOf(t)<0)));else{const l=this.selectionSets.reduce(((t,i)=>(e.forEach((e=>{i.workflowType!==y.REFINE?i.selectedIds.indexOf(e)>-1&&t.push(e):Object.keys(i.refineInfos).some((a=>{const l=i.refineInfos[a];if(l.layerView.layer.id===s.layer.id&&l.addIds.indexOf(e)>-1)return t.push(e),!0}))})),t)),[]);r.removeIds=[...new Set([...l,...r.removeIds])],r.addIds=r.addIds.filter((e=>l.indexOf(e)<0)),r.removeIds.length>0&&i.push({ids:l,mode:t,layerView:s}),this.selectionSets=this.selectionSets.reduce(((e,t)=>(t.workflowType!==y.REFINE&&t.layerView.layer.id===s.layer.id?(t.selectedIds=t.selectedIds.filter((e=>r.removeIds.indexOf(e)<0)),t.selectedIds.length>0?e.push(t):a=!0):e.push(t),e)),[])}this._refineSelectionSet.refineInfos[h]=r,this.selectionSets=[...this.selectionSets],a&&this.selectionSetsChanged.emit(this.selectionSets),await this._highlightFeatures()}static get watchers(){return{locale:["localeWatchHandler"]}}};P.style=':host{display:block}.div-visible{display:inherit}.div-not-visible{display:none !important}.padding-top-1-2{padding-top:.5rem}.main-label{display:flex;float:left}html[dir="rtl"] .main-label{display:flex;float:right}.border{outline:1px solid var(--calcite-color-border-input)}.margin-top-1{margin-top:1rem}.esri-sketch{display:flex;flex-flow:column wrap}.esri-widget{box-sizing:border-box;color:#323232;font-size:14px;font-family:"Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;line-height:1.3em;background-color:var(--calcite-color-foreground-1)}.esri-sketch__panel{align-items:center;display:flex;flex-flow:row nowrap;padding:0}*/ .esri-sketch__tool-section{border-right:1px solid rgba(110, 110, 110, .3)}.esri-sketch__section{align-items:center;display:flex;flex-flow:row nowrap;padding:0 7px;margin:6px 0;border-right:1px solid rgba(110, 110, 110, .3)}.display-flex{display:flex}.font-bold{font-weight:bold}.width-full{width:100%}.label-margin-0{--calcite-label-margin-bottom:0}.padding-start-1-2{padding-inline-start:0.5rem}.font-weight-500{font-weight:500}.word-wrap-anywhere{word-wrap:anywhere}';export{S as map_select_tools,k as pdf_download,P as refine_selection}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright 2022 Esri
3
+ * Licensed under the Apache License, Version 2.0
4
+ * http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import{r as t,c as i,g as e,h as s,H as o,F as a}from"./p-1b0588d2.js";import{g as l}from"./p-ee2cbba0.js";import{E as h}from"./p-80cb7c73.js";import{g as n}from"./p-dcd2f00b.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";const r=class{constructor(e){t(this,e),this.showIntroductionWindow=i(this,"showIntroductionWindow",7),this.showCoverPage=i(this,"showCoverPage",7)}get el(){return e(this)}appLayout;appProxies;basemapConfig;coverPageEnabled;customInfoText;defaultAppLayout;defaultCenter="";defaultGlobalId="";defaultLayer="";defaultLevel="";defaultOid="";defaultWebmap="";honorMapFieldSettings=!1;introductionWindowEnabled=!1;enableAutoRefresh=!1;enableBasemap=!0;enableColumnReorder=!0;enableCSV=!0;enableFloorFilter=!0;enableFullscreen=!0;enableHome=!0;enableLegend=!0;enableSearch=!0;enableShare=!1;enableZoom=!0;locale;mapInfos=[];onlyShowUpdatableLayers=!0;popupHeaderColor;popupHeaderHoverColor;popupHeaderHoverTextColor;popupHeaderTextColor;searchConfiguration;shareIncludeEmbed;shareIncludeSocial;showNewestFirst=!0;theme="light";zoomAndScrollToSelected=!1;zoomToScale;_deleteDialogOpen=!1;_enableCreateFeatures=!0;_hideFooter=!1;_hideTable=!1;_isMobile=!1;_isPortraitMobile=!1;_translations;_layer;_layoutMode=h.GRID;_mapInfo;_mapView;_panelOpen=!0;_numSelected=0;_filterOpen=!1;_showInformationHeader=!0;_layerIds;_isLoading=!0;_mapExtentFilterChecked;_defaultAppLayoutHonored=!1;_defaultCenterHonored=!1;_defaultLevelHonored=!1;_deleteIds;_layerTable;_mapChange;_resizeObserver;_shouldSetMapView=!1;_layerExpressions;_filterList;_mapCard;_isMapViewOnLoad=!1;appLayoutWatchHandler(t,i){t!==i&&(this._layerTable.validateTableUpdate("splitView"===t),this._setActiveLayout(t),"mapView"===this.appLayout&&this._layer?.isTable&&this._mapCard.updateLayer(),this._isMapViewOnLoad&&(this._layerTable.refresh(),this._isMapViewOnLoad=!1))}enableZoomWatchHandler(){this._initMapZoom()}async localeWatchHandler(){this.el.lang=this.locale,await this._getTranslations()}showIntroductionWindow;showCoverPage;async featureSelectionChange(t){this._numSelected=t.detail?.length}async popupClosed(){this._isPortraitMobile&&this.showHideMapPopupAndTable(!1)}async layoutChanged(t){this._layoutMode=t.detail}async mapChanged(t){this._mapChange=t.detail,await this._mapChange.mapView.when((async()=>{await this._setMapView()}))}async layerSelectionChange(t){const i=t.detail[0],e=await n(this._mapView,i);e&&await e.when((()=>{0===this._layerIds.length&&"mapView"===this.appLayout&&e.isTable&&(this.appLayout="splitView"),this._layer=e,this._initLayerExpressions(),this._handleFilterListReset(),this._isLoading=!1}))}async showDelete(t){this._deleteIds=t.detail.ids,this._deleteDialogOpen=!0}async idsFound(t){this._layerIds=t.detail.layerIds}async componentWillLoad(){await this._getTranslations(),this._resizeObserver=new ResizeObserver((()=>this._onResize()))}render(){return s(o,{key:"ad9bee93d8478b4bdbfe93716471d3270c274b35"},s("calcite-shell",{key:"2a8a2d5c316238db649fff0b769e0c578d395391",class:"position-relative"},s("calcite-panel",{key:"15c1e4159de917fdd60412bf588857157af4431c",class:"width-full height-full "+(this.popupHeaderColor&&"#FFFFFF"!==this.popupHeaderColor?"border-width-0":""),loading:this._isLoading},this._getBody(this._layoutMode,this._panelOpen,this._hideTable)),this._getFooter()),this._filterModal(),this._deleteModal())}async componentDidRender(){this._shouldSetMapView&&(this._shouldSetMapView=!1,this._mapChange&&await this._setMapView())}async componentDidLoad(){this._resizeObserver.observe(this.el),!this._defaultAppLayoutHonored&&this.defaultAppLayout?(this._defaultAppLayoutHonored=!0,this.appLayout=this.defaultAppLayout):this.appLayout||(this.appLayout="splitView"),this._isMapViewOnLoad="mapView"===this.appLayout,this._setActiveLayout(this.appLayout)}_getFooter(){const t=this._numSelected>0,i=this._layer?.editingEnabled&&this._layer?.capabilities?.operations?.supportsDelete;return this._isPortraitMobile&&t&&!this._hideFooter?s("div",{class:"width-100",slot:"footer"},s("div",{class:"display-flex padding-1-2"},s("calcite-button",{appearance:"solid",id:"solutions-show",onClick:()=>this.showHideMapPopupAndTable(!0),width:"full"},this._translations.view.replace("{{n}}",this._numSelected.toString())),i?s("delete-button",{class:"padding-inline-start-1 width-full",id:"solutions-delete",ids:this._layerTable.selectedIds,layer:this._layer,locale:this.locale}):void 0)):void 0}_setActiveLayout(t){"splitView"!==t||this._panelOpen||this._toggleLayout(),"mapView"===t?this._showMapInFullView():this._showMapInCardView()}_getDividerIcon(t,i){let e="";switch(t){case h.HORIZONTAL:e=i?"chevrons-up":"chevrons-down";break;case h.VERTICAL:case h.GRID:e=i?"chevrons-left":"chevrons-right"}return e}_getMapSizeClass(t,i,e){let s="";switch(t){case h.HORIZONTAL:s=(i&&!e?"height-1-2 display-grid":i&&e?"height-full":"height-0")+" width-full position-relative";break;case h.GRID:s="height-full position-relative "+(i?"width-1-3":"width-0");break;case h.VERTICAL:s="height-full position-relative "+(i?"width-1-2":"width-0")}return s}_getTableSizeClass(t,i){let e="";switch(t){case h.HORIZONTAL:e=(i?"height-1-2":"height-full")+" width-full display-flex flex-column";break;case h.GRID:e=(i?"width-2-3":"width-full")+" height-full display-flex";break;case h.VERTICAL:e=(i?"width-1-2":"width-full")+" height-full display-flex"}return e}_getBody(t,i,e){const o="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return s("calcite-panel",{class:"width-full height-full position-absolute"},s("div",{class:"width-full height-full overflow-hidden "+(t===h.HORIZONTAL?"":"display-flex")},this._getMapAndCard(t,i,e),this._getTable(t,i,e)),this.coverPageEnabled&&s("div",{class:"floating-container",onClick:this.coverPageButtonClick.bind(this)},s("calcite-button",{appearance:"solid",class:`floating-button ${o}`,"icon-start":"content-minimal",kind:"neutral",label:"",round:!0,scale:"l","split-child":"primary",width:"auto"})),this.introductionWindowEnabled&&s("div",{class:"floating-container",onClick:this.infoButtonClick.bind(this)},s("calcite-button",{appearance:"solid",class:`floating-button ${o}`,"icon-start":"information-letter",kind:"neutral",label:"",round:!0,scale:"l","split-child":"primary",width:"auto"})))}infoButtonClick(){this.showIntroductionWindow.emit()}coverPageButtonClick(){this.showCoverPage.emit()}_getMapAndCard(t,i,e){const o=this._getMapSizeClass(t,i,e);return s("div",{class:`${o} overflow-hidden z-index-1 ${!this._isPortraitMobile&&this._isMobile?"border-right":""}`},this._getMapNode(i),this._getPopupExpandNode())}_getMapNode(t){const i="mapView"===this.appLayout,e="tableView"===this.appLayout;return s("div",{class:(i||e?"position-absolute-0":this._layoutMode!==h.HORIZONTAL||this._isPortraitMobile&&!t?"adjusted-height-50":"")+" overflow-hidden",id:"card-mapView"},s("map-card",{appLayout:this.appLayout,appProxies:this.appProxies,basemapConfig:this.basemapConfig,class:"width-full",defaultLayerId:this.defaultWebmap&&this.defaultLayer?this.defaultLayer:"",defaultWebmapId:this.defaultWebmap,enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableHome:this.enableHome,enableLegend:this.enableLegend,enableSearch:this.enableSearch,enableShare:this.enableShare,enableSingleExpand:!0,hidden:!this._isPortraitMobile&&e,homeZoomIndex:3,homeZoomPosition:"top-left",homeZoomToolsSize:"s",isMapLayout:i,isMobile:this._isMobile,locale:this.locale,mapInfo:this._mapInfo,mapInfos:this.mapInfos?.filter((t=>!1!==t.visible)),mapWidgetsIndex:0,mapWidgetsPosition:"top-right",mapWidgetsSize:"m",onToggleFilter:this._toggleFilter.bind(this),onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,ref:t=>this._mapCard=t,selectedFeaturesIds:this._layerTable?.selectedIds,selectedLayer:this._layer,shareIncludeEmbed:this.shareIncludeEmbed,shareIncludeSocial:this.shareIncludeSocial,stackTools:!0,theme:this.theme,toolOrder:["legend","search","fullscreen","basemap","floorfilter"],zoomToScale:this.zoomToScale}))}_getPopupExpandNode(){const t=this._isPortraitMobile&&this._showInformationHeader?"display-none height-0":"";return s("div",{class:`${this.popupHeaderColor?"":this._isPortraitMobile?"calcite-mode-light":"calcite-mode-dark"} ${this._isMobile?"height-full":"height-full position-relative"} ${this._isPortraitMobile&&this._hideTable?"position-absolute-0 width-full height-full":this._isPortraitMobile?"display-none height-0":""} ${this.mapInfos?.length>1&&"tableView"===this.appLayout?"position-relative top-51":""} position-sticky`,style:{"--calcite-color-foreground-1":this.popupHeaderColor,"--calcite-color-foreground-2":this.popupHeaderHoverColor,"--calcite-color-text-3":this.popupHeaderTextColor,"--calcite-color-text-2":this.popupHeaderTextColor}},s("calcite-panel",null,!this._isPortraitMobile&&this._showInformationHeader||this._numSelected>0&&!this._isPortraitMobile?s("div",{class:`display-flex align-items-center ${t}`,slot:"header-content"},s("calcite-icon",{icon:"information",scale:"s"}),s("div",{class:"padding-inline-start-75"},this._translations.information)):s("div",null),this._getCardNode()))}_getCardNode(){const t="mapView"===this.appLayout,i="tableView"===this.appLayout;return s("div",{class:"width-50 height-full "+("dark"===this.theme?"calcite-mode-dark":"calcite-mode-light")},s("card-manager",{class:(i&&this.mapInfos?.length>1?"adjusted-height-100-51":t||i?"height-full":this._numSelected>0&&!this._isMobile?"height-50":this._showInformationHeader?this._isPortraitMobile?"height-full":"height-50":"adjusted-height-50_25")+" width-full",customInfoText:this.customInfoText,enableCreateFeatures:this._enableCreateFeatures&&!this._isMobile,enableEditGeometry:this?._mapInfo?.enableEditGeometry,isMobile:this._isPortraitMobile,layer:this._layer,locale:this.locale,mapView:this?._mapView,onBackFromCreateWorkFlow:()=>{this._showInformationHeader=!0},onCreateWorkFlowStarted:()=>{this.appLayout=this._layer.isTable?"tableView":"mapView",this._showInformationHeader=!1},onFeatureOrRecordSubmitted:()=>{this._layerTable.refresh()},selectedFeaturesIds:this._layerTable?.selectedIds,selectingFeatureFromMap:"mapView"===this.appLayout,zoomAndScrollToSelected:this.zoomAndScrollToSelected}))}_getTable(t,i,e){const o="mapView"===this.appLayout,a="tableView"===this.appLayout,l=e&&this._isPortraitMobile?"visibility-hidden":o?"display-none":"",n=o?"height-full width-full z-index-0":"display-none",r=this._getTableSizeClass(t,i),d=t===h.HORIZONTAL?"horizontal":"vertical",c=t===h.HORIZONTAL?"header":"panel-start",p=this.defaultWebmap&&this.defaultLayer,u=this.defaultGlobalId?this.defaultGlobalId?.indexOf(",")>-1?this.defaultGlobalId.split(","):[this.defaultGlobalId]:void 0,g=this.defaultOid?this.defaultOid?.indexOf(",")>-1?this.defaultOid.split(",").map((t=>parseInt(t,10))):[parseInt(this.defaultOid,10)]:void 0;return s("calcite-shell",{class:`${r} border-bottom`},this._isMobile?void 0:s("calcite-action-bar",{class:"border-sides",expandDisabled:!0,layout:d,slot:c},this.getActions(t,i)),s("div",{class:`width-full height-full position-relative z-index-0 ${l}`},s("layer-table",{appLayout:this.appLayout,createFilterModal:!1,defaultGlobalId:p?u:void 0,defaultLayerId:p?this.defaultLayer:"",defaultOid:p&&!u?g:void 0,enableAutoRefresh:this.enableAutoRefresh,enableCSV:this.enableCSV,enableColumnReorder:this.enableColumnReorder,enableInlineEdit:this?._mapInfo?.enableInlineEdit,enableShare:this.enableShare,honorMapFieldSettings:this.honorMapFieldSettings,isMobile:this._isPortraitMobile,locale:this.locale,mapHidden:a,mapInfo:this._mapInfo,mapView:this?._mapView,onToggleFilter:this._toggleFilter.bind(this),onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,ref:t=>this._layerTable=t,shareIncludeEmbed:this.shareIncludeEmbed,shareIncludeSocial:this.shareIncludeSocial,showNewestFirst:this.showNewestFirst,zoomAndScrollToSelected:this.zoomAndScrollToSelected,zoomToScale:this.zoomToScale})),s("div",{class:n,id:"full-map-view"}))}getActions(t,i){const e=this._getDividerIcon(t,i),o=i?this._translations.close:this._translations.open,l="toggle-layout";return s(a,null,s("calcite-action",{active:"splitView"===this.appLayout,class:"toggle-node",icon:"browser",id:"browser-action",onClick:()=>{this.appLayout="splitView"},text:""}),s("calcite-tooltip",{placement:"right","reference-element":"browser-action"},s("span",null,this._translations.splitView)),s("calcite-action",{active:"tableView"===this.appLayout,class:"toggle-node",icon:"dock-left",id:"dock-left-action",onClick:()=>{this.appLayout="tableView"},text:""}),s("calcite-tooltip",{placement:"right","reference-element":"dock-left-action"},s("span",null,this._translations.tableView)),s("calcite-action",{active:"mapView"===this.appLayout,class:"toggle-node",disabled:0===this._layerIds?.length,icon:"browser-map",id:"browser-map-action",onClick:()=>{this.appLayout="mapView"},text:""}),s("calcite-tooltip",{placement:"right","reference-element":"browser-map-action"},s("span",null,this._translations.mapView)),s("calcite-action",{class:"toggle-node",icon:e,id:l,onClick:()=>this._toggleLayout(),slot:"actions-end",text:""}),s("calcite-tooltip",{placement:"bottom","reference-element":l},s("span",null,o)))}_deleteModal(){return s("delete-dialog",{id:"deleteDialogId",ids:this._deleteIds,layer:this._layer,locale:this.locale,onDeleteDialogClose:()=>this._deleteDialogOpen=!1,open:this._deleteDialogOpen})}_mapExtentFilter(){const t=0===this._layerExpressions?.length;return s("calcite-panel",null,s("div",null,s("calcite-block",{class:"dark"===this.theme?"background-dark":"",heading:"","menu-placement":"bottom-end",open:!0},s("div",{class:"filter-extent-container"},s("div",{class:"filter-extent-message"},s("span",null,this._translations.filterByExtentMsg," "),s("calcite-icon",{icon:"information",id:"filter-message-info",scale:"s"}),s("calcite-tooltip",{overlayPositioning:"fixed",placement:"top","reference-element":"filter-message-info"},this._translations.filterByExtentTooltipMsg)),s("calcite-switch",{checked:this._mapExtentFilterChecked,onCalciteSwitchChange:t=>{this._layerTable.filterUpdate(t.target.checked||this._filterList?.filterCount>0,t.target.checked),this._mapExtentFilterChecked=t.target.checked},scale:"m"}))),t&&s("div",{class:"filter-modal-buttons",slot:"footer"},s("calcite-button",{appearance:"outline",onClick:this._handleFilterListReset.bind(this),width:"full"},this._translations.Resetfilter),s("calcite-button",{onClick:this._closeFilter.bind(this),width:"full"},this._translations.close))))}_filterModal(){const t=this._layerExpressions?.length>0;return s("calcite-dialog",{class:"filter-content-space",heading:this._translations?.filter?.replace("{{title}}",this._layer?.title),id:"solutions-filter-dialog",kind:"brand",modal:!0,onCalciteDialogClose:()=>{this._closeFilter()},open:this._filterOpen,widthScale:"s"},this._mapExtentFilter(),t&&s("instant-apps-filter-list",{autoUpdateUrl:!1,closeBtn:!0,closeBtnOnClick:async()=>this._closeFilter(),comboboxOverlayPositioning:"fixed",layerExpressions:this._layerExpressions,onFilterListReset:this._handleFilterListReset.bind(this),onFilterUpdate:async()=>{const t=this._filterList.filterCount>0||this._mapExtentFilterChecked;await(this._layerTable?.filterUpdate(t)),await this._mapCard.updateFilterState(t)},ref:t=>this._filterList=t,view:this._mapView,zoomBtn:!1}))}_initLayerExpressions(){const t=this._mapInfo?.filterConfig?.layerExpressions;this._layerExpressions=t?t.filter((t=>t.id===this._layer?.id)):[],this._layerExpressions.filter((t=>t.expressions.filter((t=>t.active)).length>0))}_toggleFilter(){this._filterOpen=!this._filterOpen}_handleFilterListReset(){this._mapExtentFilterChecked=!1,this._mapCard.resetFilter(),this._layerTable.filterReset()}async _closeFilter(){this._filterOpen&&(this._filterOpen=!1,this._layerTable.closeFilter())}_onResize(){const t=this.el.offsetWidth<1024,i=!this._isMobile&&t;this._isMobile=t,i&&(this._panelOpen=!0),this._isMobile?(this.showHideMapPopupAndTable(!this._isMobile),this._isPortraitMobile=!!window.matchMedia("(orientation: portrait)").matches,this.appLayout="splitView"):this._isPortraitMobile=!1,this._layoutMode=this._isPortraitMobile?h.HORIZONTAL:h.GRID}_toggleLayout(){this._panelOpen=!this._panelOpen}_showMapInCardView(){if("mapView"!==this.appLayout){const t=document.getElementById("full-map-view")?.childNodes[0],i=document.getElementById("card-mapView");t&&i.appendChild(t)}}_showMapInFullView(){const t=document.getElementById("card-mapView")?.childNodes[0],i=document.getElementById("full-map-view");t&&i.appendChild(t)}showHideMapPopupAndTable(t){this._hideTable=t,this._hideFooter=t}_getMapInfo(t){let i;return this.mapInfos.some((e=>{if(e.id===t)return i=e,!0})),{...i}}async _setMapView(){this._mapInfo=this._getMapInfo(this._mapChange.id),this._enableCreateFeatures=this._mapInfo.enableCreateFeatures,this._mapView=this._mapChange.mapView,this._initMapZoom(),this._mapView.popupEnabled=!1;const t=!this.defaultCenter||this._defaultCenterHonored?void 0:this.defaultCenter?.split(";").map((t=>parseFloat(t))),i=!this.defaultLevel||this._defaultLevelHonored?void 0:parseInt(this.defaultLevel,10);t&&i&&(await this._mapView.goTo({center:t,zoom:i}),this._defaultCenterHonored=!0,this._defaultLevelHonored=!0)}_initMapZoom(){this.enableZoom?this.enableZoom&&this._mapView.ui.add({component:"zoom",position:"top-left",index:0}):this._mapView.ui.remove("zoom")}async _getTranslations(){const t=await l(this.el);this._translations=t[0]}static get watchers(){return{appLayout:["appLayoutWatchHandler"],enableZoom:["enableZoomWatchHandler"],locale:["localeWatchHandler"]}}};r.style=":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.padding-1-2{padding:0.5rem}.display-flex{display:flex}.width-full{width:100%}.width-1-2{position:relative;width:50%}.width-1-3{position:relative;width:33.33%}.width-2-3{position:relative;width:66.66%}.width-0{width:0}.height-full{height:100%}.height-1-2{position:relative;height:50%}.height-0{height:0}.toggle-node{width:51px;height:51px}.overflow-hidden{overflow:hidden}.flex-column{flex-direction:column}.border{border:1px solid var(--calcite-color-border-3)}.border-bottom{border-bottom:1px solid var(--calcite-color-border-3)}.border-right{border-right:2px solid var(--calcite-color-border-3)}.border-sides{border-left:1px solid var(--calcite-color-border-3);border-right:1px solid var(--calcite-color-border-3)}.position-relative{position:relative}.position-absolute{position:absolute}.position-sticky{position:sticky}.height-50{height:50%}.top-51{top:51px}.adjusted-height-50{height:calc(50% - 25px)}.adjusted-height-100{height:calc(100% - 50px)}.adjusted-height-100-51{height:calc(100% - 51px)}.display-none{display:none !important}.adjusted-height-50_25{height:calc(50% + 25px)}.position-absolute-53{position:absolute;top:53px}.display-grid{display:grid}.height-50-px{height:50px}.padding-inline-start-75{padding-inline-start:0.75rem}.align-items-center{align-items:center}.esri-floor-filter__close-levels-button{width:40px !important;height:40px !important}.esri-floor-filter__level-button{width:40px !important;height:40px !important}.esri-floor-filter__browse-button{width:40px !important;height:40px !important}.position-absolute-50{position:absolute;top:50px;bottom:0px;left:0px;right:0px}.position-absolute-0{position:absolute;top:0px;bottom:0px;left:0px;right:0px}.visibility-hidden{visibility:hidden;height:0px}.position-fixed{position:fixed}.border-width-0{border-width:0px}.border-bottom-width-0{border-bottom-width:0px}.floating-container{position:fixed;width:100px;height:10px;bottom:0;right:0;margin:100px 0px}.floating-container .floating-button{box-shadow:0 10px 25px rgb(92 93 94 / 60%);transform:translatey(5px);transition:all 0.3s}.z-index-0{z-index:0 !important}.z-index-1{z-index:1 !important}.filter-content-space{--calcite-dialog-content-space:0px}.background-dark{background:var(--calcite-color-background)}.filter-extent-container{display:flex;justify-content:space-between;align-items:center;padding:10px 0}.filter-modal-buttons{display:flex;padding:12px;gap:10px}.filter-extent-message{align-items:center;display:flex;gap:5px}";export{r as crowdsource_manager}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{_ as t}from"./p-4f514c6d.js";import{l as s}from"./p-ee2cbba0.js";
6
+ import{_ as t}from"./p-6eab9d1f.js";import{l as s}from"./p-ee2cbba0.js";
7
7
  /** @license
8
8
  * Copyright 2022 Esri
9
9
  *