@esri/solutions-components 0.6.37 → 0.6.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/dist/cjs/calcite-alert_3.cjs.entry.js +1 -1
  2. package/dist/cjs/calcite-combobox_6.cjs.entry.js +1 -1
  3. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
  4. package/dist/cjs/card-manager_3.cjs.entry.js +4 -3
  5. package/dist/cjs/{downloadUtils-37d9aaf3.js → downloadUtils-d8e48fbd.js} +55 -12
  6. package/dist/cjs/{index.es-d1d9b140.js → index.es-6159eedc.js} +4 -3
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/map-select-tools_3.cjs.entry.js +4 -3
  9. package/dist/cjs/{mapViewUtils-96172223.js → mapViewUtils-f7bbc35b.js} +5 -2
  10. package/dist/cjs/public-notification.cjs.entry.js +5 -4
  11. package/dist/cjs/{clean-url-d5326abb.js → restHelpersGet-c94617cf.js} +398 -0
  12. package/dist/cjs/solution-configuration.cjs.entry.js +565 -565
  13. package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
  14. package/dist/cjs/{solution-store-714601a2.js → solution-store-b40c2f46.js} +19 -383
  15. package/dist/cjs/solutions-components.cjs.js +1 -1
  16. package/dist/collection/components/public-notification/public-notification.js +6 -5
  17. package/dist/collection/utils/downloadUtils.js +50 -8
  18. package/dist/collection/utils/downloadUtils.ts +62 -9
  19. package/dist/collection/utils/queryUtils.js +5 -2
  20. package/dist/collection/utils/queryUtils.ts +4 -2
  21. package/dist/components/downloadUtils.js +51 -8
  22. package/dist/components/public-notification.js +2 -2
  23. package/dist/components/queryUtils.js +5 -2
  24. package/dist/components/{clean-url.js → restHelpersGet.js} +392 -1
  25. package/dist/components/solution-configuration.js +552 -552
  26. package/dist/components/solution-store.js +2 -365
  27. package/dist/esm/calcite-alert_3.entry.js +1 -1
  28. package/dist/esm/calcite-combobox_6.entry.js +1 -1
  29. package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
  30. package/dist/esm/card-manager_3.entry.js +4 -3
  31. package/dist/esm/{downloadUtils-76379e4a.js → downloadUtils-d41ecba9.js} +53 -10
  32. package/dist/esm/{index.es-0d134a52.js → index.es-b226bf47.js} +4 -3
  33. package/dist/esm/loader.js +1 -1
  34. package/dist/esm/map-select-tools_3.entry.js +4 -3
  35. package/dist/esm/{mapViewUtils-08f6cfce.js → mapViewUtils-1e2befd7.js} +5 -2
  36. package/dist/esm/public-notification.entry.js +5 -4
  37. package/dist/esm/{clean-url-bce022e6.js → restHelpersGet-a5ec2192.js} +392 -1
  38. package/dist/esm/solution-configuration.entry.js +552 -552
  39. package/dist/esm/solution-contents_3.entry.js +2 -2
  40. package/dist/esm/{solution-store-3ee6c7a3.js → solution-store-17bb0a75.js} +2 -365
  41. package/dist/esm/solutions-components.js +1 -1
  42. package/dist/solutions-components/{p-9800e602.entry.js → p-091120c5.entry.js} +1 -1
  43. package/dist/solutions-components/p-1b14b687.entry.js +6 -0
  44. package/dist/solutions-components/p-20e627ed.entry.js +6 -0
  45. package/dist/solutions-components/{p-646e983f.entry.js → p-2d143359.entry.js} +1 -1
  46. package/dist/solutions-components/{p-ac7332b3.entry.js → p-40e95e2b.entry.js} +1 -1
  47. package/dist/solutions-components/p-420e1585.entry.js +36 -0
  48. package/dist/solutions-components/p-4807b2a1.js +36 -0
  49. package/dist/solutions-components/p-56a3b81e.entry.js +6 -0
  50. package/dist/solutions-components/p-5856dc4f.js +66 -0
  51. package/dist/solutions-components/p-89b4b401.js +145 -0
  52. package/dist/solutions-components/{p-4ecad91c.entry.js → p-973625f8.entry.js} +1 -1
  53. package/dist/solutions-components/{p-03130804.js → p-9ecb5d66.js} +1 -1
  54. package/dist/solutions-components/{p-b02eb8f4.js → p-a8661f1f.js} +30 -30
  55. package/dist/solutions-components/solutions-components.esm.js +1 -1
  56. package/dist/solutions-components/utils/downloadUtils.ts +62 -9
  57. package/dist/solutions-components/utils/queryUtils.ts +4 -2
  58. package/dist/types/components/public-notification/public-notification.d.ts +1 -1
  59. package/dist/types/components.d.ts +2 -2
  60. package/package.json +1 -1
  61. package/dist/esm/polyfills/core-js.js +0 -11
  62. package/dist/esm/polyfills/dom.js +0 -79
  63. package/dist/esm/polyfills/es5-html-element.js +0 -1
  64. package/dist/esm/polyfills/index.js +0 -34
  65. package/dist/esm/polyfills/system.js +0 -6
  66. package/dist/solutions-components/p-13b21d19.entry.js +0 -36
  67. package/dist/solutions-components/p-15070568.js +0 -36
  68. package/dist/solutions-components/p-81a0c88f.entry.js +0 -6
  69. package/dist/solutions-components/p-b7804687.entry.js +0 -6
  70. package/dist/solutions-components/p-d0544f24.js +0 -192
  71. package/dist/solutions-components/p-eba875d9.entry.js +0 -6
  72. package/dist/solutions-components/p-ecc95259.js +0 -20
@@ -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,h as i,H as s,g as e,c as a}from"./p-91c78d98.js";import{g as h}from"./p-99d8a839.js";import{q as o,a as l,g as n,b as d}from"./p-4807b2a1.js";import{l as r}from"./p-05948b48.js";import{d as c}from"./p-a8661f1f.js";import"./p-e1a4994d.js";import"./p-2a58e378.js";import"./p-ff0d7712.js";import"./p-5856dc4f.js";const p=class{constructor(i){t(this,i),this.layer=void 0,this.mapView=void 0,this.zoomAndScrollToSelected=void 0,this._cardLoading=!1,this._graphics=void 0,this._translations=void 0}async featureSelectionChange(t){const i=t.detail;this._cardLoading=!0;const s=i.length>0?await o(i,this.layer,[],!1,this.mapView.spatialReference):[];this._graphics=s.sort(((t,s)=>i.indexOf(t.getObjectId())-i.indexOf(s.getObjectId()))),this._cardLoading=!1}async layerSelectionChange(t){const i=t.detail[0];this.layer=await l(this.mapView,i)}async componentWillLoad(){await this._getTranslations()}render(){var t,e;const a=(null===(t=this._graphics)||void 0===t?void 0:t.length)>0?"":"display-none",h=(null===(e=this._graphics)||void 0===e?void 0:e.length)>0?"display-none":"";return i(s,null,i("div",{class:"overflow-auto height-full"},i("calcite-shell",{class:"position-relative "+a},i("div",null,i("info-card",{graphics:this._graphics,isLoading:this._cardLoading,mapView:this.mapView,zoomAndScrollToSelected:this.zoomAndScrollToSelected}))),i("calcite-shell",{class:"position-relative "+h},i("div",{class:"padding-1"},i("calcite-notice",{icon:"table",open:!0},i("div",{slot:"message"},this._translations.selectFeaturesToStart))))))}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}get el(){return e(this)}};p.style=":host{display:block !important}.display-flex{display:flex}.display-none{display:none}.w-100{width:100%}.padding-bottom-1{padding-bottom:1rem}.padding-1{padding:1rem}.position-relative{position:relative}.focus-margin{margin:1px 1px 0px 1px}.overflow-auto{overflow:auto}.height-full{height:100%}card-manager{display:block}";const u=class{constructor(i){t(this,i),this.featureSelectionChange=a(this,"featureSelectionChange",7),this.openFilterOptions=a(this,"openFilterOptions",7),this._allIds=[],this._tableSorting=!1,this.onTableNodeCreate=t=>{this._tableNode=t},this.enableAutoRefresh=void 0,this.enableCSV=void 0,this.enableInlineEdit=void 0,this.enableZoom=void 0,this.mapInfo=void 0,this.mapView=void 0,this.onlyShowUpdatableLayers=void 0,this.showNewestFirst=void 0,this.zoomAndScrollToSelected=void 0,this._confirmDelete=!1,this._controlsThatFit=void 0,this._fetchingData=!1,this._isDeleting=!1,this._layer=void 0,this._selectedIndexes=[],this._showOnlySelected=!1,this._sortActive=!1,this._translations=void 0}enableZoomWatchHandler(){var t;(null===(t=this._toolInfos)||void 0===t?void 0:t.length)>0&&this._initToolInfos()}enableCSVWatchHandler(){var t;(null===(t=this._toolInfos)||void 0===t?void 0:t.length)>0&&this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}_controlsThatFitWatchHandler(){const t=this._controlsThatFit?this._controlsThatFit.reduce(((t,i)=>(t.push(i.id),t)),[]):[];this._toolInfos=this._toolInfos.map((i=>{if(i&&this._controlsThatFit){const s=this._getId(i.icon);return i.isOverflow=t.indexOf(s)<0,i}}))}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",(t=>{this._mapClicked(t)})))}async _layerWatchHandler(){this._fetchingData=!0,await this._resetTable(),this._fetchingData=!1}async _selectedIndexesWatchHandler(){this._validateEnabledActions()}async _sortActiveWatchHandler(){this._sortActive||await this._sortTable()}async selectionChanged(t){if(this.zoomAndScrollToSelected){const i=t.detail,s=i.getObjectId(),e=this._table.viewModel.getObjectIdIndex(s);this._table.scrollToIndex(e);const a=i.layer;let h;this.mapView.allLayerViews.toArray().some((t=>{if(t.layer.title===a.title&&"feature"===t.layer.type)return h=t,!0})),h&&await n([s],h,this.mapView,!0)}}async editsComplete(){await this._refresh()}noLayersFound(){this._layer=void 0,this._allIds=[],this._clearSelection()}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initToolInfos(),this._resizeObserver=new ResizeObserver((()=>this._onResize()))}render(){const t=this._fetchingData?"display-none":"",e=this._fetchingData?"":"display-none",a=this._allIds.length.toString(),h=this._selectedIndexes.length.toString();return i(s,null,i("calcite-shell",null,this._getTableControlRow("header"),i("div",{class:"height-full-adjusted width-full"},i("calcite-panel",{class:"height-full width-full"},i("calcite-loader",{class:e,label:this._translations.fetchingData,scale:"l"}),i("div",{class:t,ref:this.onTableNodeCreate})),i("div",{class:"bottom-left text-color height-19"},this._translations.recordsSelected.replace("{{total}}",a).replace("{{selected}}",h)))),this._deleteMessage())}async componentDidLoad(){this._resizeObserver.observe(this._toolbar)}componentDidRender(){this._updateToolbar()}async _initModules(){const[t,i]=await r(["esri/widgets/FeatureTable","esri/core/reactiveUtils"]);this.FeatureTable=t,this.reactiveUtils=i}_onResize(){this._updateToolbar()}_getTableControlRow(t){const s="more-table-options";return i("div",{class:"display-flex border-bottom height-51",ref:t=>this._toolbar=t,slot:t},this._getActionBar(),this._getDropdown(s),this._getToolTip("","bottom",s,this._translations.moreOptions))}_getActionBar(){return i("calcite-action-bar",{expandDisabled:!0,expanded:!0,id:this._getId("bar"),layout:"horizontal"},i("div",{class:"border-end",id:"solutions-map-layer-picker-container"},i("map-layer-picker",{appearance:"transparent",mapView:this.mapView,onLayerSelectionChange:t=>this._layerSelectionChanged(t),onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,placeholderIcon:"layers",scale:"l",showTables:!0,type:"dropdown"})),this._getActions())}_getActions(){return this._getActionItems().reduce(((t,i)=>(i&&!i.isOverflow&&t.push(i.isDanger?this._getDangerAction(i.icon,i.label,i.func,i.disabled):this._getAction(i.icon,i.label,i.func,i.disabled)),t)),[])}_validateEnabledActions(){const t=this._featuresSelected(),i=["zoom-to-object","trash","erase","selected-items-filter"];this._toolInfos.forEach((s=>{s&&i.indexOf(s.icon)>-1&&(s.disabled=!t)}))}_initToolInfos(){var t;const i=this._featuresSelected(),s=this._featuresEmpty();this._toolInfos=[this.enableZoom?{icon:"zoom-to-object",label:this._translations.zoom,func:()=>this._zoom(),disabled:!i,isOverflow:!1}:void 0,(null===(t=this.mapInfo)||void 0===t?void 0:t.filters)?{icon:"filter",label:this._translations.filters,func:()=>this._filter(),disabled:!1,isOverflow:!1}:void 0,this._deleteEnabled?{icon:"trash",label:this._translations.delete,func:()=>this._delete(),disabled:!i,isDanger:!0,isOverflow:!1}:void 0,{icon:"erase",label:this._translations.clearSelection,func:()=>this._clearSelection(),disabled:!i,isOverflow:!1},{icon:"selected-items-filter",label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!i,isOverflow:!1},{icon:"list-check-all",func:()=>this._selectAll(),label:this._translations.selectAll,disabled:s,isOverflow:!1},{icon:"compare",func:()=>this._switchSelected(),label:this._translations.switchSelected,disabled:s,isOverflow:!1},{icon:"refresh",func:()=>this._refresh(),label:this._translations.refresh,disabled:!1,isOverflow:!1},this.enableCSV?{icon:"export",func:()=>{this._exportToCSV()},label:this._translations.exportCSV,disabled:s,isOverflow:!1}:void 0],this._defaultVisibleToolSizeInfos=void 0}_featuresSelected(){return this._selectedIndexes.length>0}_featuresEmpty(){return 0===this._allIds.length}_updateToolbar(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((()=>{clearTimeout(this._timeout),this._setToolbarSizeInfos();const t=this._toolbar.offsetWidth;let i=this._toolbarSizeInfos.reduce(((t,i)=>t+i.width),0);const s=["solutions-more","solutions-map-layer-picker-container"];if(i>t){if(this._toolbarSizeInfos.length>0){const e=[...this._toolbarSizeInfos].reverse().reduce(((e,a)=>(s.indexOf(a.id)<0&&(i>t?i-=a.width:e.push(a)),e)),[]).reverse();this._setControlsThatFit(e,s)}}else if(this._defaultVisibleToolSizeInfos){const e=this._toolbarSizeInfos.reduce(((t,i)=>(t.push(i.id),t)),[]);let a=!1;const h=[...this._defaultVisibleToolSizeInfos].reduce(((h,o)=>(!a&&s.indexOf(o.id)<0&&(e.indexOf(o.id)>-1||i+o.width<=t)?(e.indexOf(o.id)<0&&(i+=o.width),h.push(o)):s.indexOf(o.id)<0&&i+o.width>t&&(a=!0),h)),[]);this._setControlsThatFit(h,s)}}),5)}_setControlsThatFit(t,i){let s=JSON.stringify(t)!==JSON.stringify(this._controlsThatFit);document.getElementById("solutions-action-bar").childNodes.forEach((t=>{i.indexOf(t.id)<0&&!s&&(s=this._controlsThatFit.map((t=>t.id)).indexOf(t.id)<0)})),s&&(this._controlsThatFit=[...t])}_setToolbarSizeInfos(){let t=!1;this._toolbarSizeInfos=[],this._toolbar.childNodes.forEach(((i,s)=>{0===s?i.childNodes.forEach((i=>{this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0)})):i.referenceElement||(this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0))})),t&&!this._defaultVisibleToolSizeInfos&&(this._defaultVisibleToolSizeInfos=[...this._toolbarSizeInfos])}_getActionItems(){return this._toolInfos.filter((t=>t&&!t.isOverflow))}_getDropdown(t){const s=this._getDropdownItems();return s.length>0?i("calcite-dropdown",{disabled:void 0===this._layer,id:"solutions-more"},i("calcite-action",{appearance:"solid",id:t,label:"",slot:"trigger",text:""},i("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),i("calcite-dropdown-group",{"selection-mode":"none"},s.map((t=>i("calcite-dropdown-item",{iconStart:t.icon,onClick:t.func},t.label))))):void 0}_getDropdownItems(){return this._toolInfos.filter((t=>t&&t.isOverflow))}_getAction(t,s,e,a){const h=void 0===this._layer||a;return i("div",{class:"display-flex",id:this._getId(t)},i("calcite-action",{appearance:"solid",disabled:h,icon:t,id:t,label:s,onClick:e,text:s,textEnabled:!0}),this._getToolTip("","bottom",t,s))}_getToolTip(t,s,e,a){return i("calcite-tooltip",{label:t,placement:s,"reference-element":e},i("span",null,a))}_getId(t){return`solutions-action-${t}`}_getDangerAction(t,s,e,a){const h=void 0===this._layer||a;return i("div",{class:"display-flex",id:this._getId(t)},i("calcite-action",{appearance:"solid",disabled:h,id:t,onClick:e,text:""},i("calcite-button",{appearance:"transparent",iconStart:t,kind:"danger"},s)),this._getToolTip("","bottom",t,s))}async _getTable(t,i){this._layer&&(await this._layer.when((()=>{this._table=new this.FeatureTable({autoRefreshEnabled:this.enableAutoRefresh,layer:this._layer,view:this.mapView,editingEnabled:this._editEnabled&&this.enableInlineEdit,highlightEnabled:!0,multiSortEnabled:!1,visibleElements:{header:!1,menu:!1},tableTemplate:{columnTemplates:i},container:t})})),this._checkEditEnabled(),await this._table.when((()=>{this._table.highlightIds.on("change",(()=>{this._selectedIndexes=this._table.highlightIds.toArray().reverse(),this._showOnlySelected&&(this._featuresSelected()?this._table.filterBySelection():this._toggleShowSelected()),this.featureSelectionChange.emit(this._selectedIndexes)})),this.reactiveUtils.watch((()=>this._table.activeSortOrders),(t=>{var i,s,e,a;this._sortActive=!!this._layer&&(t.length>0&&"asc"===(null===(i=t[0])||void 0===i?void 0:i.direction)||"desc"===(null===(s=t[0])||void 0===s?void 0:s.direction)||null===(null===(e=t[0])||void 0===e?void 0:e.direction)&&(null===(a=t[0])||void 0===a?void 0:a.fieldName)===this._layer.objectIdField)}))})))}async _resetTable(){var t,i;this._clearSelection(),this._allIds=[],this.featureSelectionChange.emit(this._selectedIndexes);const s=this._getColumnTemplates(this._layer.id,null===(i=null===(t=this._layer)||void 0===t?void 0:t.popupTemplate)||void 0===i?void 0:i.fieldInfos);this._allIds=await d(this._layer),this._table?s&&(this._table.tableTemplate.columnTemplates=s):await this._getTable(this._tableNode,s),this._table.layer=this._layer,this._table.view=this.mapView,this._checkEditEnabled(),this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,this._initToolInfos(),await this._table.when((()=>{this._table.highlightIds.removeAll(),this._table.clearSelectionFilter()})),this._showOnlySelected=!1,this._sortActive=!1,await this._sortTable()}_checkEditEnabled(){this._editEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsUpdate,this._deleteEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsDelete}async _sortTable(){this._table&&this._layer&&!this._sortActive&&!this._tableSorting&&this.showNewestFirst&&(this._tableSorting=!0,await this._table.when(),await this._layer.when((()=>{this._table.sortColumn(this._layer.objectIdField,"desc"),this._tableSorting=!1})))}_deleteMessage(){return i("calcite-modal",{"aria-labelledby":"modal-title",kind:"danger",onCalciteModalClose:()=>this._deleteClosed(),open:this._confirmDelete},i("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},this._translations.deleteFeature),i("div",{slot:"content"},this._translations.confirm),i("calcite-button",{appearance:"outline",kind:"danger",onClick:()=>this._deleteClosed(),slot:"secondary",width:"full"},this._translations.cancel),i("calcite-button",{kind:"danger",loading:this._isDeleting,onClick:()=>{this._deleteFeatures()},slot:"primary",width:"full"},this._translations.delete))}async _deleteFeatures(){this._isDeleting=!0;const t=this._table.highlightIds.toArray().map((t=>({objectId:t})));await this._layer.applyEdits({deleteFeatures:t}),await this._table.refresh(),this._allIds=await d(this._layer),this._isDeleting=!1,this._deleteClosed()}async _mapClicked(t){const i={include:this._layer},s=await this.mapView.hitTest(t.screenPoint,i);s.results.length>0&&(s.results.forEach((t=>{this._clearSelection();const i=t.graphic.getObjectId(),s=this._table.highlightIds.indexOf(i);s>-1?this._table.highlightIds.removeAt(s):this._table.highlightIds.add(i)})),this._showOnlySelected&&this._table.filterBySelection())}_deleteClosed(){this._confirmDelete=!1}_selectAll(){const t=this._allIds;this._table.highlightIds.addMany(t),this._selectedIndexes=t}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._showOnlySelected?this._table.filterBySelection():this._table.clearSelectionFilter()}_clearSelection(){var t;this._selectedIndexes=[],null===(t=this._table)||void 0===t||t.highlightIds.removeAll()}_filter(){this.openFilterOptions.emit()}_switchSelected(){const t=[...this._selectedIndexes];this._table.highlightIds.removeAll();const i=this._allIds.reduce(((i,s)=>(t.indexOf(s)<0&&i.push(s),i)),[]).sort(((t,i)=>t-i));this._table.highlightIds.addMany(i),this._selectedIndexes=i}async _exportToCSV(){const t={},i=this._table.highlightIds.toArray();t[this._layer.id]={selectionSetNames:[this._layer.title],ids:i,layer:this._layer},c(null,t,!1,!1,!0)}async _refresh(){await this._table.refresh(),this.featureSelectionChange.emit(this._selectedIndexes)}_zoom(){this._table.zoomToSelection()}_delete(){this._confirmDelete=!0}async _layerSelectionChanged(t){var i;const s=t.detail[0];if(s!==(null===(i=this._layer)||void 0===i?void 0:i.id)||this._featuresEmpty()){this._fetchingData=!0;const t=await l(this.mapView,s);await t.when((()=>{this._layer=t}))}this._fetchingData=!1}_getColumnTemplates(t,i){var s;let e;null===(s=this.mapInfo.layerInfos)||void 0===s||s.some((i=>{if(i.id===t)return e=i,!0}));let a=null==e?void 0:e.columnTemplates;return i&&(a=a?a.map((t=>(i.some((i=>{if(i.fieldName===t.fieldName)return t.label=i.label,!0})),t))):i.map((t=>({type:"field",fieldName:t.fieldName,label:t.label})))),a}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}get el(){return e(this)}static get watchers(){return{enableZoom:["enableZoomWatchHandler"],enableCSV:["enableCSVWatchHandler"],enableInlineEdit:["enableInlineEditWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"],mapView:["mapViewWatchHandler"],_layer:["_layerWatchHandler"],_selectedIndexes:["_selectedIndexesWatchHandler"],_sortActive:["_sortActiveWatchHandler"]}}};u.style=':host{display:block}.height-full{height:100%}.height-full-adjusted{height:calc(100% - 20px)}.width-full{width:100%}.display-flex{display:flex}.table-border{border:1px solid var(--calcite-ui-border-2)}.border-end{border-inline-end:1px solid var(--calcite-ui-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-ui-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51{height:51px}.bottom-left{position:absolute;left:0;bottom:0;padding-left:5px}html[dir="rtl"] .bottom-left{position:absolute;right:0;bottom:0;padding-right:5px}.height-19{height:19px}.background{background-color:var(--calcite-ui-background)}.text-color{color:var(--calcite-ui-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-ui-danger)}.esri-feature-table vaadin-grid{border:none !important}vaadin-grid-cell-content{padding:var(--lumo-space-xs) var(--lumo-space-m) !important;font-size:14px !important}';const b=class{constructor(i){t(this,i),this.mapChanged=a(this,"mapChanged",7),this.beforeMapChanged=a(this,"beforeMapChanged",7),this._loadedId="",this.enableHome=void 0,this.enableLegend=void 0,this.enableFloorFilter=void 0,this.enableFullscreen=void 0,this.enableSearch=void 0,this.enableBasemap=void 0,this.basemapConfig=void 0,this.hidden=void 0,this.mapInfos=[],this.mapView=void 0,this._searchConfiguration=void 0,this._webMapInfo=void 0}enableHomeWatchHandler(){this._initHome()}async mapInfoChange(t){await this._loadMap(t.detail)}async componentWillLoad(){await this._initModules()}render(){const t=this.hidden?"visibility-hidden":"";return i(s,null,i("map-picker",{mapInfos:this.mapInfos}),i("div",{class:`map-height ${t}`,ref:t=>this._mapDiv=t}),i("map-tools",{basemapConfig:this.basemapConfig,class:"box-shadow",enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableLegend:this.enableLegend,enableSearch:this.enableSearch,mapView:this.mapView,ref:t=>this._mapTools=t,searchConfiguration:this._searchConfiguration}))}async _initModules(){const[t,i,s]=await r(["esri/WebMap","esri/views/MapView","esri/widgets/Home"]);this.WebMap=t,this.MapView=i,this.Home=s}async _loadMap(t){let i=null==t?void 0:t.id;if(this._webMapInfo=(""===i||!i)&&this.mapInfos.length>0?this.mapInfos[0]:t,i=this._webMapInfo.id,this._loadedId!==i){const t=new this.WebMap({portalItem:{id:i}});this.mapView=new this.MapView({container:this._mapDiv,map:t,resizeAlign:"top-left"}),this._loadedId=i,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),await this.mapView.when((()=>{this._initHome(),this.mapView.ui.add(this._mapTools,{position:"top-right",index:0}),this.mapChanged.emit({id:i,mapView:this.mapView})}))}}_initHome(){this.enableHome?(this._homeWidget=new this.Home({view:this.mapView}),this.mapView.ui.add(this._homeWidget,{position:"top-left",index:3})):this._homeWidget&&this.mapView.ui.remove(this._homeWidget)}get el(){return e(this)}static get watchers(){return{enableHome:["enableHomeWatchHandler"]}}};b.style=":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.map-height{height:calc(100% - 51px)}.box-shadow{box-shadow:none !important}.visibility-hidden{visibility:hidden}";export{p as card_manager,u as layer_table,b as map_card}
@@ -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{r as t,h as e,f as i,g as s,c as o,H as a,F as l}from"./p-91c78d98.js";import{c as n,d as c}from"./p-73c50d50.js";import{a as r,i as h,s as d,u as p,n as b,d as u,y as m,z as g,t as f,e as x,g as v}from"./p-4b9ba22d.js";import{c as w,d as k}from"./p-bf9d3381.js";import{c as y}from"./p-2f9bab49.js";import{c as z,s as C,d as _,u as L}from"./p-29120ecd.js";import{C as T}from"./p-3760847f.js";import{g as I}from"./p-361b44ed.js";import{c as H}from"./p-efc041d0.js";import{c as M,d as j,u as A}from"./p-2ee3afea.js";import{s as S,a as W,c as D}from"./p-3a668467.js";import{q as F,m as R,d as E,a as $,s as N,h as O,b as U,g as B,k as P,t as V,i as J,c as q,f as K,e as G,n as X,r as Y,j as Q,l as Z,o as tt,p as et,L as it}from"./p-946a0023.js";import{d as st,a as ot,c as at}from"./p-1406bcc4.js";import{C as lt,S as nt}from"./p-1229516f.js";import{I as ct}from"./p-3003e56a.js";import{g as rt}from"./p-99d8a839.js";import{s as ht}from"./p-d0544f24.js";import{d as dt}from"./p-2a58e378.js";import{E as pt}from"./p-ff0d7712.js";import"./p-34fb2a6e.js";import"./p-86f482ca.js";import"./p-7d7e6744.js";import"./p-59d706b4.js";import"./p-a82f35c9.js";import"./p-e1a4994d.js";import"./p-482534a7.js";import"./p-ecc95259.js";
6
+ import{r as t,h as e,f as i,g as s,c as o,H as a,F as l}from"./p-91c78d98.js";import{c as n,d as c}from"./p-73c50d50.js";import{a as r,i as h,s as d,u as p,n as b,d as u,y as m,z as g,t as f,e as x,g as v}from"./p-4b9ba22d.js";import{c as w,d as k}from"./p-bf9d3381.js";import{c as y}from"./p-2f9bab49.js";import{c as z,s as C,d as _,u as L}from"./p-29120ecd.js";import{C as T}from"./p-3760847f.js";import{g as I}from"./p-361b44ed.js";import{c as H}from"./p-efc041d0.js";import{c as M,d as j,u as A}from"./p-2ee3afea.js";import{s as S,a as W,c as D}from"./p-3a668467.js";import{q as F,m as R,d as E,a as $,s as N,h as O,b as U,g as B,k as P,t as V,i as J,c as q,f as K,e as G,n as X,r as Y,j as Q,l as Z,o as tt,p as et,L as it}from"./p-946a0023.js";import{d as st,a as ot,c as at}from"./p-1406bcc4.js";import{C as lt,S as nt}from"./p-1229516f.js";import{I as ct}from"./p-3003e56a.js";import{g as rt}from"./p-99d8a839.js";import{s as ht}from"./p-89b4b401.js";import{d as dt}from"./p-2a58e378.js";import{E as pt}from"./p-ff0d7712.js";import"./p-34fb2a6e.js";import"./p-86f482ca.js";import"./p-7d7e6744.js";import"./p-59d706b4.js";import"./p-a82f35c9.js";import"./p-e1a4994d.js";import"./p-482534a7.js";import"./p-5856dc4f.js";
7
7
  /*!
8
8
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
9
9
  * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
@@ -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,h as e,H as s,g as a}from"./p-91c78d98.js";import{s as l}from"./p-d0544f24.js";import{g as n}from"./p-99d8a839.js";import{n as c}from"./p-1b228f97.js";import"./p-482534a7.js";import"./p-2a58e378.js";import"./p-ff0d7712.js";import"./p-e1a4994d.js";import"./p-ecc95259.js";const r=class{constructor(e){t(this,e),this.solutionItemSelected=i(this,"solutionItemSelected",7),this.selectedItemId=void 0,this.templateHierarchy=[]}valueWatchHandler(t,i){t&&t!==i&&Array.isArray(t)&&t.length>0&&this._treeItemSelected(t[0].id)}componentWillLoad(){this.valueWatchHandler(this.templateHierarchy,[])}render(){return e(s,null,e("calcite-tree",null,this.renderHierarchy(this.templateHierarchy)))}renderHierarchy(t){return t.map((t=>{const i=this.selectedItemId&&this.selectedItemId===t.id;return t.dependencies&&t.dependencies.length>0?e("calcite-tree-item",{onClick:i=>this._treeItemSelected(t.id,i),selected:i},e("solution-item-icon",{type:t.type,typeKeywords:t.typeKeywords}),e("span",{class:"icon-text",title:t.title},t.title),e("calcite-tree",{slot:"children"},this.renderHierarchy(t.dependencies))):e("calcite-tree-item",{onClick:i=>this._treeItemSelected(t.id,i),selected:i},e("solution-item-icon",{type:t.type,typeKeywords:t.typeKeywords}),e("span",{class:"icon-text",title:t.title},t.title))}))}_treeItemSelected(t,i){var e;const s=null===(e=null==i?void 0:i.target)||void 0===e?void 0:e.closest("calcite-tree-item");s&&(s.expanded=!(null==s?void 0:s.expanded)),this.selectedItemId=t,this.solutionItemSelected.emit(t)}static get assetsDirs(){return["item-type-icons"]}get el(){return a(this)}static get watchers(){return{templateHierarchy:["valueWatchHandler"]}}};r.style=".icon-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";const o=class{constructor(i){t(this,i),this.authentication=void 0,this.itemId="",this.solutionVariables="",this.organizationVariables="",this.itemType=void 0,this._translations=void 0}itemIdWatchHandler(){const t=l.getItemInfo(this.itemId);this.itemType=t.type}async componentWillLoad(){return this._getTranslations()}render(){return e(s,null,e("div",{class:"configuration-container"},e("div",{class:"configuration"},this._showGroupTabs("Group"===this.itemType),this._showItemTabs("Group"!==this.itemType))))}_showGroupTabs(t){return e("calcite-tabs",{class:"config-tabs",style:{display:t?"inherit":"none"}},e("calcite-tab-nav",{slot:"tab-nav"},e("calcite-tab-title",null,this._translations.groupDetailsTab),e("calcite-tab-title",null,this._translations.sharingTab)),e("calcite-tab",{class:"config-tab",id:"group-tab",selected:!0},e("solution-item-details",{"item-id":this.itemId})),e("calcite-tab",{class:"config-tab",id:"share-tab"},e("solution-item-sharing",{"group-id":this.itemId})))}_showItemTabs(t){return e("calcite-tabs",{class:"config-tabs",style:{display:t?"inherit":"none"}},e("calcite-tab-nav",{slot:"tab-nav"},e("calcite-tab-title",null,this._translations.itemDetailsTab),e("calcite-tab-title",null,this._translations.dataTab),e("calcite-tab-title",null,this._translations.propertiesTab),e("calcite-tab-title",null,this._translations.resourcesTab)),e("calcite-tab",{class:"config-tab",selected:!0},e("solution-item-details",{"item-id":this.itemId})),e("calcite-tab",{class:"config-tab",id:"data-tab"},e("solution-template-data",{instanceid:"data","item-id":this.itemId,"organization-variables":this.organizationVariables,"solution-variables":this.solutionVariables})),e("calcite-tab",{class:"config-tab",id:"props-tab"},e("solution-template-data",{instanceid:"properties","item-id":this.itemId,"organization-variables":this.organizationVariables,"solution-variables":this.solutionVariables})),e("calcite-tab",{class:"config-tab",id:"resources-tab"},e("solution-resource-item",{authentication:this.authentication,class:"solutions-resource-container","item-id":this.itemId})))}async _getTranslations(){const t=await n(this.el);this._translations=t[0]}get el(){return a(this)}static get watchers(){return{itemId:["itemIdWatchHandler"]}}};o.style=".configuration-container{position:relative;height:100%;width:100%}.configuration{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:flex;padding:0.5rem;border:1px #808080 solid}.config-tabs{width:100%}.config-tab{width:100%;overflow-y:auto;height:inherit}";const h=class{constructor(e){t(this,e),this.featureServiceSpatialReferenceChange=i(this,"featureServiceSpatialReferenceChange",7),this.defaultWkid=102100,this.loaded=!1,this.locked=!0,this.services=[],this.value=this.defaultWkid.toString(),this._srSearchText=void 0,this._translations=void 0}componentWillLoad(){return this._getTranslations()}render(){return e(s,null,e("div",{class:"spatial-ref"},e("div",{class:"spatial-ref-desc"},e("calcite-label",null,this._translations.paramDescription)),e("label",{class:"switch-label"},e("calcite-switch",{checked:!this.locked,class:"spatial-ref-switch",onCalciteSwitchChange:t=>this._updateLocked(t),scale:"m"}),this._translations.specifyParam),e("div",{class:"spatial-ref-component",id:"spatialRefDefn"},e("calcite-label",null,this._translations.spatialReferenceInfo,e("label",{class:"spatial-ref-default"},e("spatial-ref",{defaultWkid:this.defaultWkid,disabled:this.locked,value:this.value}))),this._getFeatureServices(this.services))))}spatialReferenceChange(t){this.value=t.detail.newValue}_updateLocked(t){this.locked=!t.detail.switched,this._updateStore(),this.loaded||(t.detail.switched&&this._setFeatureServiceDefaults(this.services),this.loaded=!0)}_setFeatureServiceDefaults(t){c(this.el.getElementsByClassName("spatial-ref-item-switch")).forEach((t=>t.checked=!0)),t.forEach((t=>this._updateEnabledServices({detail:{switched:!0}},t)))}_getFeatureServices(t){const i=l.getStoreInfo("spatialReferenceInfo"),s=t.filter((t=>Object.keys(i.services).some((i=>i===t))));return s&&s.length>0?e("div",null,e("label",{class:"spatial-ref-item-title"},this._translations.featureServicesHeading),s.map((t=>e("label",{class:"switch-label"},e("calcite-switch",{checked:i.services[t],class:"spatial-ref-item-switch",disabled:this.locked,onCalciteSwitchChange:i=>this._updateEnabledServices(i,t),scale:"m"}),t)))):null}_updateStore(){const t=l.getStoreInfo("spatialReferenceInfo");t.enabled=!this.locked,t.spatialReference=this.value,l.setStoreInfo("spatialReferenceInfo",t)}_updateEnabledServices(t,i){const e=l.getStoreInfo("spatialReferenceInfo");e.services[i]=t.detail.switched,l.setStoreInfo("spatialReferenceInfo",e),this.featureServiceSpatialReferenceChange.emit({name:i,enabled:t.detail.switched})}async _getTranslations(){const t=await n(this.el);this._translations=t[0]}get el(){return a(this)}};h.style=".spatial-ref-switch{margin-inline-end:0.5rem}.spatial-ref-component{margin-top:0.625rem;margin-inline-start:2.5rem}#spatialRefDefn .sc-calcite-label-h label.sc-calcite-label{margin:0px;background-color:#CBC3E3}.spatial-ref-default{margin:0px}.spatial-ref-item-title{margin-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}.spatial-ref-item-switch{margin-inline-end:0.5rem}.switch-label{margin:0.25rem;font-size:0.875rem;line-height:1.25rem}.disabled-div{pointer-events:none;opacity:0.4}.spatial-ref-desc{padding-bottom:0.5rem;padding-inline-start:0.25rem}";export{r as solution_contents,o as solution_item,h as solution_spatial_ref}
6
+ import{r as t,c as i,h as e,H as s,g as a}from"./p-91c78d98.js";import{s as l}from"./p-89b4b401.js";import{g as n}from"./p-99d8a839.js";import{n as c}from"./p-1b228f97.js";import"./p-482534a7.js";import"./p-2a58e378.js";import"./p-ff0d7712.js";import"./p-e1a4994d.js";import"./p-5856dc4f.js";const r=class{constructor(e){t(this,e),this.solutionItemSelected=i(this,"solutionItemSelected",7),this.selectedItemId=void 0,this.templateHierarchy=[]}valueWatchHandler(t,i){t&&t!==i&&Array.isArray(t)&&t.length>0&&this._treeItemSelected(t[0].id)}componentWillLoad(){this.valueWatchHandler(this.templateHierarchy,[])}render(){return e(s,null,e("calcite-tree",null,this.renderHierarchy(this.templateHierarchy)))}renderHierarchy(t){return t.map((t=>{const i=this.selectedItemId&&this.selectedItemId===t.id;return t.dependencies&&t.dependencies.length>0?e("calcite-tree-item",{onClick:i=>this._treeItemSelected(t.id,i),selected:i},e("solution-item-icon",{type:t.type,typeKeywords:t.typeKeywords}),e("span",{class:"icon-text",title:t.title},t.title),e("calcite-tree",{slot:"children"},this.renderHierarchy(t.dependencies))):e("calcite-tree-item",{onClick:i=>this._treeItemSelected(t.id,i),selected:i},e("solution-item-icon",{type:t.type,typeKeywords:t.typeKeywords}),e("span",{class:"icon-text",title:t.title},t.title))}))}_treeItemSelected(t,i){var e;const s=null===(e=null==i?void 0:i.target)||void 0===e?void 0:e.closest("calcite-tree-item");s&&(s.expanded=!(null==s?void 0:s.expanded)),this.selectedItemId=t,this.solutionItemSelected.emit(t)}static get assetsDirs(){return["item-type-icons"]}get el(){return a(this)}static get watchers(){return{templateHierarchy:["valueWatchHandler"]}}};r.style=".icon-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";const o=class{constructor(i){t(this,i),this.authentication=void 0,this.itemId="",this.solutionVariables="",this.organizationVariables="",this.itemType=void 0,this._translations=void 0}itemIdWatchHandler(){const t=l.getItemInfo(this.itemId);this.itemType=t.type}async componentWillLoad(){return this._getTranslations()}render(){return e(s,null,e("div",{class:"configuration-container"},e("div",{class:"configuration"},this._showGroupTabs("Group"===this.itemType),this._showItemTabs("Group"!==this.itemType))))}_showGroupTabs(t){return e("calcite-tabs",{class:"config-tabs",style:{display:t?"inherit":"none"}},e("calcite-tab-nav",{slot:"tab-nav"},e("calcite-tab-title",null,this._translations.groupDetailsTab),e("calcite-tab-title",null,this._translations.sharingTab)),e("calcite-tab",{class:"config-tab",id:"group-tab",selected:!0},e("solution-item-details",{"item-id":this.itemId})),e("calcite-tab",{class:"config-tab",id:"share-tab"},e("solution-item-sharing",{"group-id":this.itemId})))}_showItemTabs(t){return e("calcite-tabs",{class:"config-tabs",style:{display:t?"inherit":"none"}},e("calcite-tab-nav",{slot:"tab-nav"},e("calcite-tab-title",null,this._translations.itemDetailsTab),e("calcite-tab-title",null,this._translations.dataTab),e("calcite-tab-title",null,this._translations.propertiesTab),e("calcite-tab-title",null,this._translations.resourcesTab)),e("calcite-tab",{class:"config-tab",selected:!0},e("solution-item-details",{"item-id":this.itemId})),e("calcite-tab",{class:"config-tab",id:"data-tab"},e("solution-template-data",{instanceid:"data","item-id":this.itemId,"organization-variables":this.organizationVariables,"solution-variables":this.solutionVariables})),e("calcite-tab",{class:"config-tab",id:"props-tab"},e("solution-template-data",{instanceid:"properties","item-id":this.itemId,"organization-variables":this.organizationVariables,"solution-variables":this.solutionVariables})),e("calcite-tab",{class:"config-tab",id:"resources-tab"},e("solution-resource-item",{authentication:this.authentication,class:"solutions-resource-container","item-id":this.itemId})))}async _getTranslations(){const t=await n(this.el);this._translations=t[0]}get el(){return a(this)}static get watchers(){return{itemId:["itemIdWatchHandler"]}}};o.style=".configuration-container{position:relative;height:100%;width:100%}.configuration{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:flex;padding:0.5rem;border:1px #808080 solid}.config-tabs{width:100%}.config-tab{width:100%;overflow-y:auto;height:inherit}";const h=class{constructor(e){t(this,e),this.featureServiceSpatialReferenceChange=i(this,"featureServiceSpatialReferenceChange",7),this.defaultWkid=102100,this.loaded=!1,this.locked=!0,this.services=[],this.value=this.defaultWkid.toString(),this._srSearchText=void 0,this._translations=void 0}componentWillLoad(){return this._getTranslations()}render(){return e(s,null,e("div",{class:"spatial-ref"},e("div",{class:"spatial-ref-desc"},e("calcite-label",null,this._translations.paramDescription)),e("label",{class:"switch-label"},e("calcite-switch",{checked:!this.locked,class:"spatial-ref-switch",onCalciteSwitchChange:t=>this._updateLocked(t),scale:"m"}),this._translations.specifyParam),e("div",{class:"spatial-ref-component",id:"spatialRefDefn"},e("calcite-label",null,this._translations.spatialReferenceInfo,e("label",{class:"spatial-ref-default"},e("spatial-ref",{defaultWkid:this.defaultWkid,disabled:this.locked,value:this.value}))),this._getFeatureServices(this.services))))}spatialReferenceChange(t){this.value=t.detail.newValue}_updateLocked(t){this.locked=!t.detail.switched,this._updateStore(),this.loaded||(t.detail.switched&&this._setFeatureServiceDefaults(this.services),this.loaded=!0)}_setFeatureServiceDefaults(t){c(this.el.getElementsByClassName("spatial-ref-item-switch")).forEach((t=>t.checked=!0)),t.forEach((t=>this._updateEnabledServices({detail:{switched:!0}},t)))}_getFeatureServices(t){const i=l.getStoreInfo("spatialReferenceInfo"),s=t.filter((t=>Object.keys(i.services).some((i=>i===t))));return s&&s.length>0?e("div",null,e("label",{class:"spatial-ref-item-title"},this._translations.featureServicesHeading),s.map((t=>e("label",{class:"switch-label"},e("calcite-switch",{checked:i.services[t],class:"spatial-ref-item-switch",disabled:this.locked,onCalciteSwitchChange:i=>this._updateEnabledServices(i,t),scale:"m"}),t)))):null}_updateStore(){const t=l.getStoreInfo("spatialReferenceInfo");t.enabled=!this.locked,t.spatialReference=this.value,l.setStoreInfo("spatialReferenceInfo",t)}_updateEnabledServices(t,i){const e=l.getStoreInfo("spatialReferenceInfo");e.services[i]=t.detail.switched,l.setStoreInfo("spatialReferenceInfo",e),this.featureServiceSpatialReferenceChange.emit({name:i,enabled:t.detail.switched})}async _getTranslations(){const t=await n(this.el);this._translations=t[0]}get el(){return a(this)}};h.style=".spatial-ref-switch{margin-inline-end:0.5rem}.spatial-ref-component{margin-top:0.625rem;margin-inline-start:2.5rem}#spatialRefDefn .sc-calcite-label-h label.sc-calcite-label{margin:0px;background-color:#CBC3E3}.spatial-ref-default{margin:0px}.spatial-ref-item-title{margin-bottom:0.5rem;font-size:0.875rem;line-height:1.25rem}.spatial-ref-item-switch{margin-inline-end:0.5rem}.switch-label{margin:0.25rem;font-size:0.875rem;line-height:1.25rem}.disabled-div{pointer-events:none;opacity:0.4}.spatial-ref-desc{padding-bottom:0.5rem;padding-inline-start:0.25rem}";export{r as solution_contents,o as solution_item,h as solution_spatial_ref}
@@ -0,0 +1,36 @@
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,h as e,H as i,g as n}from"./p-91c78d98.js";import{s as r}from"./p-89b4b401.js";import"./p-ff0d7712.js";import{r as s,N as o,c as a,e as h,A as u,a as c}from"./p-5856dc4f.js";import{g as l}from"./p-99d8a839.js";import"./p-482534a7.js";import"./p-2a58e378.js";import"./p-e1a4994d.js";
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+ var f=function(){return f=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},f.apply(this,arguments)};function d(t,e){var i=e;return i.rawResponse=!1,s(t,i).then((function(t){var e={token:t.access_token,username:t.username,expires:new Date(Date.now()+(1e3*t.expires_in-1e3)),ssl:!0===t.ssl};return t.refresh_token&&(e.refreshToken=t.refresh_token),e}))}function p(t,e){var i=e;return i.params.referer="undefined"!=typeof window&&window.location&&window.location.host?window.location.host:o,s(t,i)}var w=/^https?:\/\/(\S+)\.arcgis\.com.+/;function v(t){return w.test(t)}function g(t){if(!w.test(t))return null;var e=t.match(w)[1].split(".").pop();return e.includes("dev")?"dev":e.includes("qa")?"qa":"production"}var m=function(){function t(t){if(this.clientId=t.clientId,this._refreshToken=t.refreshToken,this._refreshTokenExpires=t.refreshTokenExpires,this.username=t.username,this.password=t.password,this._token=t.token,this._tokenExpires=t.tokenExpires,this.portal=t.portal?a(t.portal):"https://www.arcgis.com/sharing/rest",this.ssl=t.ssl,this.provider=t.provider||"arcgis",this.tokenDuration=t.tokenDuration||20160,this.redirectUri=t.redirectUri,this.refreshTokenTTL=t.refreshTokenTTL||20160,this.server=t.server,this.federatedServers={},this.trustedDomains=[],t.server){var e=this.getServerRootUrl(t.server);this.federatedServers[e]={token:t.token,expires:t.tokenExpires}}this._pendingTokenRequests={}}return Object.defineProperty(t.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tokenExpires",{get:function(){return this._tokenExpires},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refreshToken",{get:function(){return this._refreshToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refreshTokenExpires",{get:function(){return this._refreshTokenExpires},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trustedServers",{get:function(){return console.log("DEPRECATED: use federatedServers instead"),this.federatedServers},enumerable:!1,configurable:!0}),t.beginOAuth2=function(e,i){void 0===i&&(i=window),e.duration&&console.log("DEPRECATED: 'duration' is deprecated - use 'expiration' instead");var n,r=f({portal:"https://www.arcgis.com/sharing/rest",provider:"arcgis",expiration:20160,popup:!0,popupWindowFeatures:"height=400,width=600,menubar=no,location=yes,resizable=yes,scrollbars=yes,status=yes",state:e.clientId,locale:""},e),s=r.portal,o=r.provider,a=r.clientId,c=r.expiration,l=r.redirectUri,d=r.popup,p=r.popupWindowFeatures,w=r.state,v=r.locale,g=r.params;if(n="arcgis"===o?s+"/oauth2/authorize?client_id="+a+"&response_type=token&expiration="+(e.duration||c)+"&redirect_uri="+encodeURIComponent(l)+"&state="+w+"&locale="+v:s+"/oauth2/social/authorize?client_id="+a+"&socialLoginProviderName="+o+"&autoAccountCreateForSocial=true&response_type=token&expiration="+(e.duration||c)+"&redirect_uri="+encodeURIComponent(l)+"&state="+w+"&locale="+v,g&&(n=n+"&"+h(g)),d){var m,b=((m={promise:null,resolve:null,reject:null}).promise=new Promise((function(t,e){m.resolve=t,m.reject=e})),m);return i["__ESRI_REST_AUTH_HANDLER_"+a]=function(e,i){if(e){var n=JSON.parse(e);b.reject(new u(n.errorMessage,n.error))}else if(i){var r=JSON.parse(i);b.resolve(new t({clientId:a,portal:s,ssl:r.ssl,token:r.token,tokenExpires:new Date(r.expires),username:r.username}))}},i.open(n,"oauth-window",p),b.promise}i.location.href=n},t.completeOAuth2=function(e,i){void 0===i&&(i=window);var n=f({portal:"https://www.arcgis.com/sharing/rest",popup:!0},e),r=n.portal,s=n.clientId,o=n.popup;function a(e,n){try{var a=void 0,h="__ESRI_REST_AUTH_HANDLER_"+s;if(o&&(i.opener?i.opener.parent&&i.opener.parent[h]?a=i.opener.parent[h]:i.opener&&i.opener[h]&&(a=i.opener[h]):i!==i.parent&&i.parent&&i.parent[h]&&(a=i.parent[h]),a))return a(e?JSON.stringify(e):void 0,JSON.stringify(n)),void i.close()}catch(t){throw new u('Unable to complete authentication. It\'s possible you specified popup based oAuth2 but no handler from "beginOAuth2()" present. This generally happens because the "popup" option differs between "beginOAuth2()" and "completeOAuth2()".')}if(e)throw new u(e.errorMessage,e.error);return new t({clientId:s,portal:r,ssl:n.ssl,token:n.token,tokenExpires:n.expires,username:n.username})}var h=i.location.hash.replace(/^#/,"").split("&").reduce((function(t,e){var i=function(t){var e=t.split("="),i=e[1];return{key:decodeURIComponent(e[0]),value:decodeURIComponent(i)}}(e);return t[i.key]=i.value,t}),{});if(!h.access_token){var c=void 0,l="Unknown error";return h.error&&(c=h.error,l=h.error_description),a({error:c,errorMessage:l})}return a(void 0,{token:h.access_token,expires:new Date(Date.now()+1e3*parseInt(h.expires_in,10)-6e4),ssl:"true"===h.ssl,username:h.username})},t.fromParent=function(e,i){var n;return!i&&window&&(i=window),new Promise((function(r,s){i.addEventListener("message",n=function(e){if(e.source===i.parent&&e.data)try{return r(t.parentMessageHandler(e))}catch(t){return s(t)}},!1),i.parent.postMessage({type:"arcgis:auth:requestCredential"},e)})).then((function(t){return i.removeEventListener("message",n,!1),t}))},t.authorize=function(t,e){t.duration&&console.log("DEPRECATED: 'duration' is deprecated - use 'expiration' instead");var i=f({portal:"https://arcgis.com/sharing/rest",expiration:20160},t);e.writeHead(301,{Location:i.portal+"/oauth2/authorize?client_id="+i.clientId+"&expiration="+(t.duration||i.expiration)+"&response_type=code&redirect_uri="+encodeURIComponent(i.redirectUri)}),e.end()},t.exchangeAuthorizationCode=function(e,i){var n=f({portal:"https://www.arcgis.com/sharing/rest",refreshTokenTTL:20160},e),r=n.portal,s=n.clientId,o=n.redirectUri,a=n.refreshTokenTTL;return d(r+"/oauth2/token",{params:{grant_type:"authorization_code",client_id:s,redirect_uri:o,code:i}}).then((function(e){return new t({clientId:s,portal:r,ssl:e.ssl,redirectUri:o,refreshToken:e.refreshToken,refreshTokenTTL:a,refreshTokenExpires:new Date(Date.now()+60*(a-1)*1e3),token:e.token,tokenExpires:e.expires,username:e.username})}))},t.deserialize=function(e){var i=JSON.parse(e);return new t({clientId:i.clientId,refreshToken:i.refreshToken,refreshTokenExpires:new Date(i.refreshTokenExpires),username:i.username,password:i.password,token:i.token,tokenExpires:new Date(i.tokenExpires),portal:i.portal,ssl:i.ssl,tokenDuration:i.tokenDuration,redirectUri:i.redirectUri,refreshTokenTTL:i.refreshTokenTTL})},t.fromCredential=function(e){var i=void 0===e.ssl||e.ssl,n=e.expires||Date.now()+72e5;return new t({portal:e.server.includes("sharing/rest")?e.server:e.server+"/sharing/rest",ssl:i,token:e.token,username:e.userId,tokenExpires:new Date(n)})},t.parentMessageHandler=function(e){if("arcgis:auth:credential"===e.data.type)return t.fromCredential(e.data.credential);if("arcgis:auth:error"===e.data.type){var i=new Error(e.data.error.message);throw i.name=e.data.error.name,i}throw new Error("Unknown message type.")},t.prototype.toCredential=function(){return{expires:this.tokenExpires.getTime(),server:this.portal,ssl:this.ssl,token:this.token,userId:this.username}},t.prototype.getUser=function(t){var e=this;if(this._pendingUserRequest)return this._pendingUserRequest;if(this._user)return Promise.resolve(this._user);var i=this.portal+"/community/self",n=f(f({httpMethod:"GET",authentication:this},t),{rawResponse:!1});return this._pendingUserRequest=s(i,n).then((function(t){return e._user=t,e._pendingUserRequest=null,t})),this._pendingUserRequest},t.prototype.getPortal=function(t){var e=this;if(this._pendingPortalRequest)return this._pendingPortalRequest;if(this._portalInfo)return Promise.resolve(this._portalInfo);var i=this.portal+"/portals/self",n=f(f({httpMethod:"GET",authentication:this},t),{rawResponse:!1});return this._pendingPortalRequest=s(i,n).then((function(t){return e._portalInfo=t,e._pendingPortalRequest=null,t})),this._pendingPortalRequest},t.prototype.getUsername=function(){return this.username?Promise.resolve(this.username):this._user?Promise.resolve(this._user.username):this.getUser().then((function(t){return t.username}))},t.prototype.getToken=function(t,e){return n=t,r=v(i=this.portal),s=v(n),o=g(i),a=g(n),r&&s&&o===a||new RegExp(this.portal,"i").test(t)?this.getFreshToken(e):this.getTokenForServer(t,e);var i,n,r,s,o,a},t.prototype.validateAppAccess=function(t){return this.getToken(this.portal).then((function(e){return function(t,e,i){return void 0===i&&(i="https://www.arcgis.com/sharing/rest"),s(i+"/oauth2/validateAppAccess",{method:"POST",params:{f:"json",client_id:e,token:t}})}(e,t)}))},t.prototype.toJSON=function(){return{clientId:this.clientId,refreshToken:this.refreshToken,refreshTokenExpires:this.refreshTokenExpires,username:this.username,password:this.password,token:this.token,tokenExpires:this.tokenExpires,portal:this.portal,ssl:this.ssl,tokenDuration:this.tokenDuration,redirectUri:this.redirectUri,refreshTokenTTL:this.refreshTokenTTL}},t.prototype.serialize=function(){return JSON.stringify(this)},t.prototype.enablePostMessageAuth=function(t,e){!e&&window&&(e=window),this._hostHandler=this.createPostMessageHandler(t),e.addEventListener("message",this._hostHandler,!1)},t.prototype.disablePostMessageAuth=function(t){!t&&window&&(t=window),t.removeEventListener("message",this._hostHandler,!1)},t.prototype.refreshSession=function(t){return this._user=null,this.username&&this.password?this.refreshWithUsernameAndPassword(t):this.clientId&&this.refreshToken?this.refreshWithRefreshToken():Promise.reject(new u("Unable to refresh token."))},t.prototype.getServerRootUrl=function(t){var e=a(t).split(/\/rest(\/admin)?\/services(?:\/|#|\?|$)/)[0].match(/(https?:\/\/)(.+)/),i=e[1],n=e[2].split("/"),r=n[0],s=n.slice(1);return""+i+r.toLowerCase()+"/"+s.join("/")},t.prototype.getDomainCredentials=function(t){return this.trustedDomains&&this.trustedDomains.length&&this.trustedDomains.some((function(e){return t.startsWith(e)}))?"include":"same-origin"},t.prototype.createPostMessageHandler=function(t){var e=this;return function(i){var n=t.indexOf(i.origin)>-1,r="arcgis:auth:requestCredential"===i.data.type,s=e.tokenExpires.getTime()>Date.now();if(n&&r){var o={};if(s){var a=e.toCredential();a.server=a.server.replace("/sharing/rest",""),o={type:"arcgis:auth:credential",credential:a}}else o={type:"arcgis:auth:error",error:{name:"tokenExpiredError",message:"Session token was expired, and not returned to the child application"}};i.source.postMessage(o,i.origin)}}},t.prototype.getTokenForServer=function(t,e){var i=this,n=this.getServerRootUrl(t),r=this.federatedServers[n];return r&&r.expires&&r.expires.getTime()>Date.now()?Promise.resolve(r.token):(this._pendingTokenRequests[n]||(this._pendingTokenRequests[n]=this.fetchAuthorizedDomains().then((function(){return s(n+"/rest/info",{credentials:i.getDomainCredentials(t)}).then((function(r){if(r.owningSystemUrl){if(o=r.owningSystemUrl,h=a(function(t){if(!w.test(t))return t;switch(g(t)){case"dev":return"https://devext.arcgis.com/sharing/rest";case"qa":return"https://qaext.arcgis.com/sharing/rest";default:return"https://www.arcgis.com/sharing/rest"}}(i.portal)).replace(/https?:\/\//,""),c=a(o).replace(/https?:\/\//,""),new RegExp(c,"i").test(h))return s(r.owningSystemUrl+"/sharing/rest/info",e);throw new u(t+" is not federated with "+i.portal+".","NOT_FEDERATED")}var o,h,c;if(r.authInfo&&void 0!==i.federatedServers[n])return Promise.resolve({authInfo:r.authInfo});throw new u(t+" is not federated with any portal and is not explicitly trusted.","NOT_FEDERATED")})).then((function(t){return t.authInfo.tokenServicesUrl})).then((function(e){return i.token&&i.tokenExpires.getTime()>Date.now()?p(e,{params:{token:i.token,serverUrl:t,expiration:i.tokenDuration,client:"referer"}}):p(e,{params:{username:i.username,password:i.password,expiration:i.tokenDuration,client:"referer"}}).then((function(t){return i._token=t.token,i._tokenExpires=new Date(t.expires),t}))})).then((function(t){return i.federatedServers[n]={expires:new Date(t.expires),token:t.token},delete i._pendingTokenRequests[n],t.token}))}))),this._pendingTokenRequests[n])},t.prototype.getFreshToken=function(t){var e=this;return this.token&&!this.tokenExpires||this.token&&this.tokenExpires&&this.tokenExpires.getTime()>Date.now()?Promise.resolve(this.token):(this._pendingTokenRequests[this.portal]||(this._pendingTokenRequests[this.portal]=this.refreshSession(t).then((function(t){return e._pendingTokenRequests[e.portal]=null,t.token}))),this._pendingTokenRequests[this.portal])},t.prototype.refreshWithUsernameAndPassword=function(t){var e=this,i=f({params:{username:this.username,password:this.password,expiration:this.tokenDuration}},t);return p(this.portal+"/generateToken",i).then((function(t){return e._token=t.token,e._tokenExpires=new Date(t.expires),e}))},t.prototype.refreshWithRefreshToken=function(t){var e=this;if(this.refreshToken&&this.refreshTokenExpires&&this.refreshTokenExpires.getTime()<Date.now())return this.refreshRefreshToken(t);var i=f({params:{client_id:this.clientId,refresh_token:this.refreshToken,grant_type:"refresh_token"}},t);return d(this.portal+"/oauth2/token",i).then((function(t){return e._token=t.token,e._tokenExpires=t.expires,e}))},t.prototype.refreshRefreshToken=function(t){var e=this,i=f({params:{client_id:this.clientId,refresh_token:this.refreshToken,redirect_uri:this.redirectUri,grant_type:"exchange_refresh_token"}},t);return d(this.portal+"/oauth2/token",i).then((function(t){return e._token=t.token,e._tokenExpires=t.expires,e._refreshToken=t.refreshToken,e._refreshTokenExpires=new Date(Date.now()+60*(e.refreshTokenTTL-1)*1e3),e}))},t.prototype.fetchAuthorizedDomains=function(){var t=this;return this.server||!this.portal?Promise.resolve(this):this.getPortal().then((function(e){return e.authorizedCrossOriginDomains&&e.authorizedCrossOriginDomains.length&&(t.trustedDomains=e.authorizedCrossOriginDomains.filter((function(t){return!t.startsWith("http://")})).map((function(t){return t.startsWith("https://")?t:"https://"+t}))),t}))},t}();
22
+ /** @license
23
+ * Copyright 2022 Esri
24
+ *
25
+ * Licensed under the Apache License, Version 2.0 (the "License");
26
+ * you may not use this file except in compliance with the License.
27
+ * You may obtain a copy of the License at
28
+ *
29
+ * http://www.apache.org/licenses/LICENSE-2.0
30
+ *
31
+ * Unless required by applicable law or agreed to in writing, software
32
+ * distributed under the License is distributed on an "AS IS" BASIS,
33
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
+ * See the License for the specific language governing permissions and
35
+ * limitations under the License.
36
+ */function b(t){const e=function(t){const e=[];function i(e,r,s=[]){const o=function(t,e){const i=t.findIndex((t=>e===t.itemId));return i>=0?t[i]:null}(t,e);if(o){const t={id:e,dependencies:[]};s.indexOf(e)<0&&(s.push(e),o.dependencies.forEach((e=>{const r=n.indexOf(e);r>=0&&n.splice(r,1),i(e,t.dependencies,s)}))),r.push(t)}}let n=function(t){const e=t.map((t=>t.itemId));return t.forEach((t=>{(t.dependencies||[]).forEach((t=>{const i=e.indexOf(t);i>=0&&e.splice(i,1)}))})),e}(t);const r=t.filter((t=>n.indexOf(t.itemId)<0)).sort(((t,e)=>e.dependencies.length-t.dependencies.length));n=n.concat(r.map((t=>t.itemId)));let s=n.shift();for(;void 0!==s;)i(s,e),s=n.shift();return e}(t),i=e.reduce(((t,e)=>(t.push(e.id),t)),[]);return t.reduce(((n,r)=>{if(i.indexOf(r.itemId)>-1){const i=e.filter((t=>t.id===r.itemId));n.push(y(r,t,i[0].dependencies))}return n}),[])}function k(t,e,i,n){t.forEach((t=>{const r=t.name&&t.name.indexOf("||")>-1?t.name.split("||")[1].replace("}}","").trim():t.name;e.dependencies.push({id:i.itemId,title:`${r} (${n.id})`,value:`{{${i.itemId}.layer${t.id}.id}}`}),e.dependencies.push({id:i.itemId,title:`${r} (${n.name})`,value:`{{${i.itemId}.layer${t.id}.name||${r}}}`})}))}function y(t,e,i){return{id:t.itemId||"",title:t.item.title||"",dependencies:x(i,e),type:t.item.type||"",typeKeywords:t.item.typeKeywords||[]}}function x(t,e){const i=[],n=t.reduce(((t,e)=>(t.push(e.id),i.push(e),t)),[]);return e.reduce(((t,r)=>{const s=n.indexOf(r.itemId);return s>-1&&t.push(y(r,e,i[s].dependencies)),t}),[])}const E=class{async serializedAuthenticationWatchHandler(){this.authentication=this.serializedAuthentication?m.deserialize(this.serializedAuthentication):new m({})}async valueWatchHandler(){await this._loadSolution(this.solutionItemId)}constructor(e){t(this,e),this._solutionStoreHasChanges=!1,this._solutionEditorHasChanges=!1,this._solutionEditorHasErrors=!1,this._canSave=!1,this.authentication=new m({}),this.serializedAuthentication="",this.solutionItemId="",this.showLoading=!1,this._currentEditItemId="",this._organizationVariables="",this._solutionContentsComponent=void 0,this._solutionIsLoaded=!1,this._solutionVariables="",this._templateHierarchy=[],this._translations=void 0,this._treeOpen=!0,this.serializedAuthentication&&(this.authentication=m.deserialize(this.serializedAuthentication)),this._loadSolution(this.solutionItemId),window.addEventListener("solutionStoreHasChanges",(t=>{this._updateSaveability(this._solutionStoreHasChanges=t.detail,this._solutionEditorHasChanges,this._solutionEditorHasErrors)})),window.addEventListener("solutionEditorHasChanges",(t=>{this._updateSaveability(this._solutionStoreHasChanges,this._solutionEditorHasChanges=t.detail,this._solutionEditorHasErrors)})),window.addEventListener("solutionEditorHasErrors",(t=>{this._updateSaveability(this._solutionStoreHasChanges,this._solutionEditorHasChanges,this._solutionEditorHasErrors=t.detail)}))}async componentWillLoad(){return this._getTranslations()}render(){const t=c(r.getStoreInfo("spatialReferenceInfo"),"spatialReference"),n=r.getStoreInfo("featureServices").length>0,s=r.getStoreInfo("solutionData");var o;return this._solutionVariables=JSON.stringify(function(t,e){const i=[];return t.forEach((t=>{const n={id:t.itemId,title:t.item.title||t.item.name,type:t.type,value:void 0,dependencies:[{id:t.itemId,title:e.itemId,value:`{{${t.itemId}.itemId}}`}]};t.item.url&&n.dependencies.push({id:t.itemId,title:e.url,value:`{{${t.itemId}.url}}`}),"Feature Service"===t.type&&(n.dependencies.push({id:t.itemId,title:e.solutionExtent,value:`{{${t.itemId}.solutionExtent}}`}),k(t.properties.layers||[],n,t,e),k(t.properties.tables||[],n,t,e)),i.push(n)})),i}(s.templates,this._translations)),this._organizationVariables=JSON.stringify([{id:"",title:(o=this._translations).geocodeUrl,value:"{{organization.helperServices.geocode:getDefaultLocatorURL}}"},{id:"",title:o.geometryUrl,value:"{{organization.helperServices.geometry.url}}"},{id:"",title:o.portalBaseUrl,value:"{{portalBaseUrl}}"},{id:"",title:o.routeUrl,value:"{{organization.helperServices.route.url}}"},{id:"",title:o.solutionItemExtent,value:"{{solutionItemExtent}}"}]),e(i,null,this._solutionIsLoaded?null:e("calcite-loader",{label:""}),e("div",{class:"configuration-container"},e("div",{class:"configuration"},e("calcite-tabs",{class:"config-tabs"},e("calcite-tab-nav",{slot:"tab-nav"},e("calcite-tab-title",null,this._translations.definitionTab),n?e("calcite-tab-title",null,this._translations.spatialReferenceTab):null),e("calcite-tab",{class:"config-tab",selected:!0},e("div",{class:"config-solution"},e("div",{class:this._treeOpen?"config-inventory":"config-inventory-hide"},e("solution-contents",{id:"configInventory",key:`${this.solutionItemId}-contents`,ref:t=>this._solutionContentsComponent=t})),e("calcite-button",{appearance:"transparent",class:"collapse-btn","icon-start":this._treeOpen?"chevrons-left":"chevrons-right",id:"collapse-vars",onClick:()=>this._toggleTree(),scale:"s",title:this._treeOpen?this._translations.collapse:this._translations.expand}),e("div",{class:"config-item"},e("solution-item",{authentication:this.authentication,"item-id":this._currentEditItemId,key:`${this.solutionItemId}-item`,"organization-variables":this._organizationVariables,"solution-item-id":this.solutionItemId,"solution-variables":this._solutionVariables})))),n?e("calcite-tab",{class:"config-tab"},e("div",{class:"config-solution"},e("solution-spatial-ref",{defaultWkid:t,id:"configure-solution-spatial-ref",key:`${this.solutionItemId}-spatial-ref`,locked:!t,services:r.getStoreInfo("featureServices").map((t=>t.name))}))):null))))}_solutionItemSelected(t){this._currentEditItemId=t.detail}async getSpatialReferenceInfo(){return Promise.resolve(r.getStoreInfo("spatialReferenceInfo"))}async saveSolution(){this._solutionIsLoaded=!1,await r.saveSolution(),this._solutionIsLoaded=!0,this.solutionItemId=null}async unloadSolution(){this.solutionItemId=null}_initProps(){const t=r.getStoreInfo("solutionData");let e;this._templateHierarchy=[...b(t.templates)],this._solutionContentsComponent&&(this._solutionContentsComponent.templateHierarchy=this._templateHierarchy),this._templateHierarchy.length>0&&(e=r.getItemInfo(this._templateHierarchy[0].id)),this._currentEditItemId=e?e.itemId:""}async _loadSolution(t){return t?(this._solutionIsLoaded=!1,await r.loadSolution(t,this.authentication),this._initProps(),this._solutionIsLoaded=!0):this._reset(),Promise.resolve()}_reset(){this._currentEditItemId="",this._organizationVariables="",this._solutionVariables="",this._templateHierarchy=[]}_toggleTree(){this._treeOpen=!this._treeOpen}_updateSaveability(t,e,i){const n=(t||e)&&!i;this._canSave!==n&&window.dispatchEvent(new CustomEvent("solutionCanSave",{detail:n,bubbles:!0,cancelable:!1,composed:!0})),this._canSave=n}async _getTranslations(){const t=await l(this.el);this._translations=t[0]}get el(){return n(this)}static get watchers(){return{serializedAuthentication:["serializedAuthenticationWatchHandler"],solutionItemId:["valueWatchHandler"]}}};E.style=".configuration-container{position:relative;height:100%;width:100%}.configuration{position:absolute;top:0px;right:0px;bottom:0px;left:0px;display:flex;padding:0.5rem;border:1px #808080 solid}.config-tabs{width:100%}.config-tab{width:100%}.config-solution{position:absolute;top:3.5rem;right:-1px;bottom:-1px;left:-1px;display:flex;padding:0.5rem}.config-inventory{display:inline;max-width:-moz-min-content;max-width:min-content;flex-grow:0;overflow-y:auto}.config-inventory-hide{display:none;max-width:-moz-min-content;max-width:min-content;flex-grow:0;overflow-y:auto}.config-item{position:relative;display:inline;flex-grow:1;overflow-y:auto;margin-inline-start:0.5rem}solution-contents{position:relative;height:100%}solution-item{position:relative;height:100%}solution-spatial-ref{position:relative;height:100%;width:100%;overflow-y:auto}";export{E as solution_configuration}
@@ -0,0 +1,36 @@
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{c as t}from"./p-2a58e378.js";
7
+ /** @license
8
+ * Copyright 2022 Esri
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */async function n(t){const n=t.createQuery();return n.where=t.definitionExpression||"1=1",await t.queryObjectIds(n)}async function a(t,n){let a=[];const s=t?t.map((t=>async function(t,n){const a=n.createQuery();return a.spatialRelationship="intersects",a.geometry=t,n.queryObjectIds(a)}
22
+ /** @license
23
+ * Copyright 2022 Esri
24
+ *
25
+ * Licensed under the Apache License, Version 2.0 (the "License");
26
+ * you may not use this file except in compliance with the License.
27
+ * You may obtain a copy of the License at
28
+ *
29
+ * http://www.apache.org/licenses/LICENSE-2.0
30
+ *
31
+ * Unless required by applicable law or agreed to in writing, software
32
+ * distributed under the License is distributed on an "AS IS" BASIS,
33
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
+ * See the License for the specific language governing permissions and
35
+ * limitations under the License.
36
+ */(t,n))):[Promise.resolve()];return(await Promise.all(s)).forEach((t=>{a=[...a,...t||[]]})),a}async function s(t,n,a,c,o){var e;const i=null===(e=n.capabilities)||void 0===e?void 0:e.query.maxRecordCount,r=n.createQuery();r.start=0,r.returnGeometry=c,r.objectIds=t.slice(0,i),i&&(r.num=i),o&&(r.outSpatialReference=o);const u=await n.queryFeatures(r);a=a.concat(u.features);const f=t.slice(i,t.length);return f.length>0?s(f,n,a,c,o):Promise.resolve(a)}async function c(t,n,a,s){const o=n.capabilities.query.maxRecordCount,e=n.createQuery();e.start=t,e.num=o,e.geometry=a;const i=await n.queryFeatures(e);return s[n.id]=s[n.id].concat(i.features),i.exceededTransferLimit?c(t+=o,n,a,s):Promise.resolve(s)}function o(t,n){return[...e(t,"polygon",n),...e(t,"polyline",n),...e(t,"point",n)]}function e(t,n,a){const s=(null==t?void 0:t.filter((t=>t.type===n)))||[];return s.length<=1?s:[a.union(s)]}async function i(t,n){let a;return await t.when((()=>{a=t.map.allLayers.toArray().reduce(((t,n)=>("feature"===n.type&&(t[n.id]={name:n.title,supportsUpdate:void 0}),t)),{})})),u(n,a,t)}async function r(t,n){let a;return await t.when((()=>{a=t.map.allTables.toArray().reduce(((t,n)=>(t[n.id]={name:n.title,supportsUpdate:void 0},t)),{})})),u(n,a,t)}async function u(t,n,a){if(t){const t={},s=Object.keys(n);for(let c=0;c<s.length;c++){const o=s[c],e=await w(a,o);await e.load(),await e.when(),t[o]={name:n[o].name,supportsUpdate:e.editingEnabled&&e.capabilities.operations.supportsUpdate}}return t}return n}async function f(t,n){const a=await w(t,n);return a?await t.whenLayerView(a):void 0}async function w(t,n){let a=[];return await t.when((()=>{a=[...t.map.allLayers.toArray(),...t.map.allTables.toArray()].filter((t=>t.id===n))})),a.length>0?a[0]:void 0}async function y(t){const n=t.map.allLayers.toArray();let a;return await t.when((()=>{a=n.map((n=>t.whenLayerView(n)))})),await Promise.allSettled(a),n}async function l(t,n,a,s=!1){return s&&await m(t,n,a,!1),n.highlight(t)}async function d(t){const n=p(t);return Object.keys(n).reduce(((t,a)=>{const s=n[a];return t.push(s.layerView.highlight(s.ids)),t}),[])}function p(n){return n.reduce(((n,a)=>{const s=a.layerView,c=null==s?void 0:s.layer.id;return c&&Object.keys(n).indexOf(c)>-1?n[c].ids=[...new Set([...a.selectedIds,...n[c].ids])]:c&&(n[c]={layerView:s,ids:a.selectedIds}),a.workflowType===t.REFINE&&Object.keys(a.refineInfos).forEach((t=>{const s=a.refineInfos[t];Object.keys(n).indexOf(t)>-1&&(n[t].ids=[...new Set([...s.addIds,...n[t].ids])],n[t].ids=n[t].ids.filter((t=>s.removeIds.indexOf(t)<0)))})),n}),{})}async function m(t,n,a,s=!0,c){const o=await async function(t,n){const a=n.createQuery();return a.objectIds=t,n.queryExtent(a)}(t,n.layer);await a.goTo(o.extent),s&&await async function(t,n,a){const s={objectIds:t};n.featureEffect=Object.assign(Object.assign({},a),{filter:s}),setTimeout((()=>{n.featureEffect=void 0}),1300)}(t,n,c)}export{w as a,n as b,a as c,o as d,f as e,c as f,m as g,l as h,p as i,d as j,y as k,i as l,r as m,s as q}
@@ -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 i,c as t,h as s,H as e,g as a}from"./p-91c78d98.js";import{l}from"./p-05948b48.js";import{g as h,h as n,c as o,d as r,e as d,f as c,i as p,j as g}from"./p-4807b2a1.js";import{c as b,e as u,f as v}from"./p-2a58e378.js";import{s as y}from"./p-375fd36b.js";import{a as m,g as w}from"./p-99d8a839.js";import{d as f,a as S}from"./p-a8661f1f.js";import"./p-482534a7.js";import"./p-e1a4994d.js";import"./p-ff0d7712.js";import"./p-5856dc4f.js";const _=class{constructor(s){i(this,s),this.selectionSetChange=t(this,"selectionSetChange",7),this._selectedIds=[],this._selectionLabel="",this._graphics=[],this._featuresCollection={},this.bufferColor=[227,139,79,.8],this.bufferOutlineColor=[255,255,255],this.customLabelEnabled=void 0,this.enabledLayerIds=[],this.defaultBufferDistance=void 0,this.defaultBufferUnit=void 0,this.geometries=[],this.isUpdate=!1,this.layerViews=[],this.mapView=void 0,this.noResultText=void 0,this.searchConfiguration=void 0,this.selectionSet=void 0,this.selectionLayerIds=[],this.selectLayerView=void 0,this.sketchLineSymbol=void 0,this.sketchPointSymbol=void 0,this.sketchPolygonSymbol=void 0,this._numSelected=0,this._searchDistanceEnabled=!1,this._searchTerm=void 0,this._selectionLoading=!1,this._translations=void 0,this._useLayerFeaturesEnabled=!1}async watchGeometriesHandler(i,t){if(i!==t){const t=0===i.length;if(await this._clearResults(t,t),i.length>0)return this._highlightWithOIDsOrGeoms()}}async watchSearchConfigurationHandler(i,t){JSON.stringify(i)!==JSON.stringify(t)&&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}}searchConfigurationChangeChanged(i){this.searchConfiguration=i.detail}async distanceChanged(i){await this._distanceChanged(i.detail)}async unitChanged(i){i.detail.newValue!==i.detail.oldValue&&(this._unit=i.detail.newValue,await this._updateLabel())}async componentWillLoad(){await this._getTranslations(),await this._initModules()}async componentDidLoad(){await this._init(),await this._searchWidget.when((()=>{this._searchWidget.allPlaceholder=this._translations.placeholder,this._searchWidget.defaultSources.forEach((i=>{i.placeholder=this._translations.placeholder}))}))}render(){return s(e,null,this._getMapLayerPicker(),s("div",{class:"border-bottom"}),s("div",{class:"padding-top-sides-1"},s("div",{class:"search-widget",ref:i=>{this._searchElement=i}}),s("div",{class:"padding-top-1"},s("map-draw-tools",{active:!0,editGraphicsEnabled:!this._useLayerFeaturesEnabled,graphics:this._graphics,mapView:this.mapView,onSketchGraphicsChange:i=>this._sketchGraphicsChanged(i),pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,ref:i=>{this._drawTools=i}})),this._getBufferOptions(),this._getUseLayerFeaturesOptions(),this._getNumSelected()),s("div",{class:"border-bottom"}),this._getNameInput())}_getBufferOptions(){var i,t;const e=this._searchDistanceEnabled?"search-distance":"div-not-visible",a="number"==typeof(null===(i=this.selectionSet)||void 0===i?void 0:i.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",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:a,geometries:this.geometries,onBufferComplete:i=>this._bufferComplete(i),ref:i=>this._bufferTools=i,unit:(null===(t=this.selectionSet)||void 0===t?void 0:t.unit)||this.defaultBufferUnit})))}_getUseLayerFeaturesOptions(){const i=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",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:i+" padding-top-1"},s("map-layer-picker",{enabledLayerIds:this.selectionLayerIds,mapView:this.mapView,onLayerSelectionChange:i=>{this._layerSelectionChange(i)},selectedIds:this.layerViews.map((i=>i.layer.id)),showTables:!1})))}_getNumSelected(){const i=m(this.el),t=i&&"en"===i?`${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:i=>{this._labelName=i},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,mapView:this.mapView,onLayerSelectionChange:i=>this._inputLayerSelectionChange(i),selectedIds:this.selectLayerView?[this.selectLayerView.layer.id]:this.selectionSet?[this.selectionSet.layerView.layer.id]:[],showTables:!1})))}async _initModules(){const[i,t,s,e,a]=await l(["esri/layers/GraphicsLayer","esri/Graphic","esri/widgets/Search","esri/geometry/geometryEngine","esri/layers/FeatureLayer"]);this.GraphicsLayer=i,this.Graphic=t,this.Search=s,this._geometryEngine=e,this.FeatureLayer=a}async _init(){this._initGraphicsLayer(),await this._initSelectionSet(),this._initSearchWidget()}async _initSelectionSet(){var i,t,s,e;this.selectionSet&&(this._searchTerm=null===(i=this.selectionSet.searchResult)||void 0===i?void 0:i.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=[...(null===(t=this.selectionSet)||void 0===t?void 0:t.geometries)||[]],this._graphics=this.geometries.map((i=>new this.Graphic({geometry:i,symbol:"point"===i.type?this.sketchPointSymbol:"polyline"===i.type?this.sketchLineSymbol:this.sketchPolygonSymbol}))),this._selectionLabel=null===(s=this.selectionSet)||void 0===s?void 0:s.label,this._useLayerFeaturesEnabled||null===(e=this._drawTools)||void 0===e||e.updateGraphics(),await h(this.selectionSet.selectedIds,this.selectionSet.layerView,this.mapView,!1))}_initSearchWidget(){if(this.mapView&&this._searchElement){const i=this._getSearchConfig(this.searchConfiguration,this.mapView),t=Object.assign({view:this.mapView,container:this._searchElement,searchTerm:this._searchTerm},i);this._searchWidget=new this.Search(t),this._searchWidget.popupEnabled=!1,this._searchWidget.resultGraphicEnabled=!1,this._searchWidget.on("search-clear",(()=>{const i=this._searchClearLabel();this._clearResults(!1,i)})),this._searchWidget.on("select-result",(i=>{var t,s;if(i.result){this._searchResult=i.result;const e=(null===(s=null===(t=i.source)||void 0===t?void 0:t.layer)||void 0===s?void 0:s.id)&&i.source.layer.id===this.selectLayerView.layer.id,a=e?[i.result.feature.getObjectId()]:void 0;this._workflowType=b.SEARCH,this._updateLabel();const l=[i.result.feature];this._updateSelection(l,e,a),this._drawTools.graphics=l,this._searchWidget.resultGraphic.visible=!1}else{const i=this._searchClearLabel();this._clearResults(!1,i)}}))}}_searchClearLabel(){var i;return(null===(i=this._searchResult)||void 0===i?void 0:i.name)&&this._labelName.value.indexOf(this._searchResult.name)>-1}_getSearchConfig(i,t){const s=null==i?void 0:i.sources;return(null==s?void 0:s.length)>0?(i.includeDefaultSources=!1,s.forEach((i=>{var s,e;if(i.hasOwnProperty("layer")){const a=i,l=null===(s=a.layer)||void 0===s?void 0:s.id,h=l?t.map.findLayerById(l):null,n=null===(e=null==a?void 0:a.layer)||void 0===e?void 0:e.url;h?a.layer=h:n&&(a.layer=new this.FeatureLayer(n))}})),null==s||s.forEach((i=>{if(i.hasOwnProperty("locator")){const t=i;"ArcGIS World Geocoding Service"===(null==t?void 0:t.name)&&(t.outFields=t.outFields||["Addr_type","Match_addr","StAddr","City"],t.singleLineFieldName="SingleLine"),t.url=t.url,delete t.url}}))):i=Object.assign(Object.assign({},i),{includeDefaultSources:!0}),i}_initGraphicsLayer(){const i=this._translations.bufferLayer,t=this.mapView.map.layers.findIndex((t=>t.title===i));if(t>-1)this._bufferGraphicsLayer=this.mapView.map.layers.getItemAt(t);else{this._bufferGraphicsLayer=new this.GraphicsLayer({title:i,listMode:"hide"}),y.managedLayers.push(i);const t=this.mapView.map.layers.findIndex((i=>i.title===this._translations.sketchLayer));t>-1?this.mapView.map.layers.add(this._bufferGraphicsLayer,t):this.mapView.map.layers.add(this._bufferGraphicsLayer)}}async _sketchGraphicsChanged(i,t=!1){const s=i.detail.graphics;if(s.length>0&&s[0])if(t||(this._sketchGraphic=s[0]),this._workflowType=this._useLayerFeaturesEnabled?b.SELECT:b.SKETCH,this._workflowType===b.SKETCH&&this._drawTools.updateGraphics(),await this._updateLabel(),this._clearSearchWidget(),this._useLayerFeaturesEnabled&&!t){const i=Array.isArray(s)?s.map((i=>i.geometry)):this.geometries;await this._selectLayerFeatures(i[0])}else{const t=s.reduce(((i,t)=>{var s;return(null===(s=null==t?void 0:t.layer)||void 0===s?void 0:s.objectIdField)?i.push(t.attributes[t.layer.objectIdField]):t.getObjectId&&i.push(t.getObjectId()),i}),[]),e=i.detail.useOIDs&&t.length>0;this._updateSelection(s,e,t),e&&await this._highlightFeatures(t)}else await this._clearResults(!0,!0)}async _highlightWithOIDsOrGeoms(){var i;return(null===(i=this._skipGeomOIDs)||void 0===i?void 0:i.length)>0?(this._selectedIds=this._skipGeomOIDs,this._highlightFeatures(this._selectedIds)):this._geomQuery(this.geometries)}async _highlightFeatures(i){y.removeHandles(),i.length>0&&y.highlightHandles.push(await n(i,this.selectLayerView,this.mapView)),this._numSelected=i.length,this.selectionSetChange.emit(i.length)}async _selectFeatures(i){this._selectionLoading=!0,this._selectedIds=await o(i,this.selectLayerView.layer),this._selectionLoading=!1,this._drawTools.graphics=this._graphics,await this._highlightFeatures(this._selectedIds)}async _bufferComplete(i){this._bufferGeometry=Array.isArray(i.detail)?i.detail[0]:i.detail;let t=this._bufferTools.distance,s=0;if(this._bufferGeometry){const i=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(i),await this._selectFeatures([this._bufferGeometry]),await this.mapView.goTo(i.geometry.extent),s=t,t=0}else this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),await this._highlightWithOIDsOrGeoms();await this._distanceChanged({oldValue:t,newValue:s})}_geomQuery(i){const t=r(i,this._geometryEngine);return this._selectFeatures(t)}async _clearResults(i=!0,t=!1){var s;this._selectedIds=[],this._distance=void 0,this._unit=void 0,t&&(this._selectionLabel="",this._labelName.value=""),this._bufferGraphicsLayer&&this._bufferGraphicsLayer.removeAll(),i&&this._searchWidget&&this._clearSearchWidget(),y.removeHandles(),(null===(s=this._drawTools)||void 0===s?void 0:s.clear)&&(this._graphics=[],await this._drawTools.clear()),this.selectionSetChange.emit(this._selectedIds.length)}_clearSearchWidget(){this._searchWidget.clear(),this._searchResult=void 0}_updateSelection(i,t,s){this._selectedIds=t&&s?s:this._selectedIds,this._skipGeomOIDs=t?s:void 0,this.geometries=Array.isArray(i)?i.map((i=>i.geometry)):this.geometries,this._graphics=i}async _updateLabel(){var i,t;const s=this._selectionLabel.indexOf(this._translations.sketch)>-1,e=this._selectionLabel.indexOf(this._translations.select)>-1,a=this._selectionLabel.indexOf(null===(i=this._searchResult)||void 0===i?void 0:i.name)>-1,l=this._workflowType===b.SEARCH?null===(t=this._searchResult)||void 0===t?void 0:t.name:this._workflowType===b.SELECT?this._translations.select:this._translations.sketch,h=this._unit?this._unit:this._bufferTools.unit,n=await this._bufferTools.getTranslatedUnit(h),o=isNaN(this._distance)?this._bufferTools.distance:this._distance;this._selectionLabel=s||e||a||!this._selectionLabel?`${l} ${o} ${n}`:this._selectionLabel,this._labelName.value=this._selectionLabel}async _layerSelectionChange(i){if(Array.isArray(i.detail)&&i.detail.length>0){const t=i.detail.map((i=>d(this.mapView,i)));return Promise.all(t).then((i=>{this.layerViews=i,this._featuresCollection={},this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}))}}async _inputLayerSelectionChange(i){var t;const s=(null===(t=null==i?void 0:i.detail)||void 0===t?void 0:t.length)>0?i.detail[0]:"";this.selectLayerView&&s===this.selectLayerView.layer.id||(this.selectLayerView=await d(this.mapView,s),await this._updateLabel(),this._bufferGeometry?await this._selectFeatures([this._bufferGeometry]):await this._highlightWithOIDsOrGeoms())}async _distanceChanged(i){i.newValue!==i.oldValue&&(this._distance=i.newValue,await this._updateLabel())}async _selectLayerFeatures(i){this._selectionLoading=!0;const t=this.layerViews.map((t=>(this._featuresCollection[t.layer.id]=[],c(0,t.layer,i,this._featuresCollection))));return Promise.all(t).then((async i=>{this._selectionLoading=!1;let t=[];i.forEach((i=>{Object.keys(i).forEach((s=>{t=t.concat(i[s])}))}));let s=!1;t.forEach((i=>{var t;const e=i.geometry;i.symbol="point"===e.type?this.sketchPointSymbol:"polyline"===e.type?this.sketchLineSymbol:"polygon"===e.type?this.sketchPolygonSymbol:void 0,s=(null===(t=null==i?void 0:i.layer)||void 0===t?void 0:t.hasOwnProperty("objectIdField"))||i.hasOwnProperty("getObjectId")}));const e=this.layerViews[0].layer.title===this.selectLayerView.layer.title&&s;await this._sketchGraphicsChanged({detail:{graphics:t,useOIDs:e}},!0)}))}_useLayerFeaturesEnabledChanged(){this._useLayerFeaturesEnabled=!this._useLayerFeaturesEnabled,this._sketchGraphic&&this._sketchGraphicsChanged({detail:{graphics:[this._sketchGraphic],useOIDs:!1}})}async _getTranslations(){const i=await w(this.el);this._translations=i[0]}get el(){return a(this)}static get watchers(){return{geometries:["watchGeometriesHandler"],searchConfiguration:["watchSearchConfigurationHandler"]}}};_.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-ui-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-ui-border-2)}.search-distance{display:flex;padding-top:1rem}.font-bold{font:bold}.border-bottom{border-bottom:1px solid var(--calcite-ui-border-2)}.tooltip-container{display:flex}.padding-start-1-2{padding-inline-start:0.5rem}.icon{--calcite-ui-icon-color:var(--calcite-ui-brand)}.tooltip-message{padding:5px 8px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-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}}]}),P=class{constructor(t){i(this,t),this.defaultNumLabelsPerPage=void 0,this.disabled=!1,this._translations=void 0}async downloadCSV(i,t,s,e=!0){return f(i,t,!0,s,e)}async downloadPDF(i,t,s=!1,e="",a=""){var l;return S(i,t,null===(l=this._labelInfoElement.selectedOption)||void 0===l?void 0:l.value,s,e,a)}async componentWillLoad(){await this._getTranslations(),await this._initModules()}render(){return s(e,null,s("calcite-select",{disabled:this.disabled,label:"",ref:i=>{this._labelInfoElement=i}}))}componentDidLoad(){this._renderOptions()}async _initModules(){const[i]=await l(["esri/intl"]);this._intl=i}_getLabelSizeText(i){const t="&lrm;"+i.descriptionPDF.labelWidthDisplay+" x "+i.descriptionPDF.labelHeightDisplay+"&rlm;";return this._translations.pdfLabel.replace("{{n}}",i.descriptionPDF.labelsPerPageDisplay).replace("{{labelSize}}",t)}async _getTranslations(){const i=await w(this.el);this._translations=i[0]}_renderOptions(){(L.default||L).sort(((i,t)=>{const s=parseInt(i.descriptionPDF.labelsPerPageDisplay,10),e=parseInt(t.descriptionPDF.labelsPerPageDisplay,10);return s<e?-1:s>e?1:0})).forEach(((i,t)=>{const s=document.createElement("calcite-option");s.value=i,s.innerHTML=this._getLabelSizeText(i),this._labelInfoElement.appendChild(s),(this.defaultNumLabelsPerPage?parseInt(i.descriptionPDF.labelsPerPageDisplay,10)===this.defaultNumLabelsPerPage:0===t)&&(s.selected=!0,this._labelInfoElement.selectedOption=s)}))}get el(){return a(this)}};P.style=":host{display:block}";const x=class{constructor(s){i(this,s),this.selectionLoadingChange=t(this,"selectionLoadingChange",7),this.selectionSetsChanged=t(this,"selectionSetsChanged",7),this._addEnabled=!0,this._refineSets=[],this._enabledLayerIds=[],this._featuresCollection={},this.addresseeLayer=void 0,this.enabledLayerIds=[],this.mapView=void 0,this.selectionSets=[],this.sketchLineSymbol=void 0,this.sketchPointSymbol=void 0,this.sketchPolygonSymbol=void 0,this._translations=void 0,this._selectionMode=u.ADD,this._refineLayer=void 0}async componentWillLoad(){await this._getTranslations(),this._enabledLayerIds=this._getEnabledLayerIds(),await this._setRefineSet(this._enabledLayerIds[0])}render(){var i,t;return s(e,null,s("div",{class:(this._enabledLayerIds.length>1?"display-block":"display-none")+" padding-top-sides-1"},s("div",{class:"display-flex"},s("calcite-label",{class:"font-bold width-full label-margin-0"},s("div",{class:"display-flex"},this._translations.inputLayer,s("calcite-icon",{class:"padding-start-1-2 icon",icon:"question",id:"refine-input-layer",scale:"s"})),s("map-layer-picker",{enabledLayerIds:this._enabledLayerIds,mapView:this.mapView,onLayerSelectionChange:i=>{this._layerSelectionChange(i)},ref:i=>{this._layerPicker=i},selectedIds:[this._refineLayer.layer.id],showTables:!1})),s("calcite-popover",{closable:!0,label:"",referenceElement:"refine-input-layer"},s("span",{class:"tooltip-message"},this._translations.inputLayerTip)))),s("div",{class:"padding-1"},s("div",{class:"padding-bottom-1"},s("calcite-segmented-control",{class:"w-100"},s("calcite-segmented-control-item",{checked:this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(u.ADD),value:u.ADD},s("span",{class:"font-weight-500"},this._translations.add)),s("calcite-segmented-control-item",{checked:!this._addEnabled,class:"w-50 word-wrap-anywhere",onClick:()=>this._setSelectionMode(u.REMOVE),value:u.REMOVE},s("span",{class:"font-weight-500"},this._translations.remove)))),s("div",null,s("map-draw-tools",{active:!0,drawMode:v.REFINE,mapView:this.mapView,onDrawRedo:()=>this._redo(),onDrawUndo:()=>this._undo(),onSketchGraphicsChange:i=>this._sketchGraphicsChanged(i),pointSymbol:this.sketchPointSymbol,polygonSymbol:this.sketchPolygonSymbol,polylineSymbol:this.sketchLineSymbol,redoEnabled:(null===(i=this._refineSelectionSet)||void 0===i?void 0:i.redoStack.length)>0,ref:i=>{this._drawTools=i},undoEnabled:(null===(t=this._refineSelectionSet)||void 0===t?void 0:t.undoStack.length)>0})),s("br",null),s("calcite-list",{class:"list-border"},this._getRefineSelectionSetList())))}_layerSelectionChange(i){this._setRefineSet(i.detail[0])}_setSelectionMode(i){this._selectionMode=i}_sketchGraphicsChanged(i){var t;const s=null===(t=i.detail)||void 0===t?void 0:t.graphics[0].geometry;this._selectFeatures(s)}_getEnabledLayerIds(){return this.selectionSets.reduce(((i,t)=>{var s;const e=null===(s=null==t?void 0:t.layerView)||void 0===s?void 0:s.layer.id;return e&&i.indexOf(e)<0?i.push(e):t.workflowType===b.REFINE&&Object.keys(t.refineInfos).forEach((t=>{i.indexOf(t)<0&&i.push(t)})),i}),[])}async _setRefineSet(i){this.selectionSets.some((t=>{if(t.workflowType===b.REFINE)return this._refineSelectionSet=t,Object.keys(t.refineInfos).indexOf(i)>-1}))||await this._initRefineSet(i,this._refineSelectionSet),this._refineLayer=this._refineSelectionSet.refineInfos[i].layerView}async _initRefineSet(i,t){const s={};s[i]={addIds:[],removeIds:[],layerView:await d(this.mapView,i)},t?t.refineInfos=Object.assign(Object.assign({},t.refineInfos),s):(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:b.REFINE,searchDistanceEnabled:!1,useLayerFeaturesEnabled:!1,refineInfos:s,redoStack:[],undoStack:[],sketchGraphic:void 0},this.selectionSets.push(this._refineSelectionSet))}_undo(){const i=this._refineSelectionSet.undoStack.pop();this._updateIds(i.ids,i.mode===u.ADD?u.REMOVE:u.ADD,this._refineSelectionSet.redoStack,i.layerView)}_redo(){const i=this._refineSelectionSet.redoStack.pop();this._updateIds(i.ids,i.mode===u.ADD?u.REMOVE:u.ADD,this._refineSelectionSet.undoStack,i.layerView)}_getRefineSelectionSetList(){const i=this._getTotal(this.selectionSets);let t;this.selectionSets.some((i=>{if(i.workflowType===b.REFINE)return t=i,!0}));let e=0,a=0;return Object.keys(t.refineInfos).forEach((i=>{e+=t.refineInfos[i].addIds.length,a+=t.refineInfos[i].removeIds.length})),[s("calcite-list-item",{label:this._translations.featuresAdded.replace("{{n}}",e.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}}",i.toString()),"non-interactive":!0})]}_getTotal(i){const t=p(i);return Object.keys(t).reduce(((i,s)=>i+t[s].ids.length),0)}async _getTranslations(){const i=await w(this.el);this._translations=i[0]}async _selectFeatures(i){var t,s;this.selectionLoadingChange.emit(!0),this._featuresCollection[null===(t=this._refineLayer)||void 0===t?void 0:t.layer.id]=[];const e=await c(0,null===(s=this._refineLayer)||void 0===s?void 0:s.layer,i,this._featuresCollection);this.selectionLoadingChange.emit(!1);let a=[];Object.keys(e).forEach((i=>{var t;i===(null===(t=this._refineLayer)||void 0===t?void 0:t.layer.id)&&(a=a.concat(e[i]))}));const l=Array.isArray(a)?a.map((i=>{var t;return i.attributes[null===(t=null==i?void 0:i.layer)||void 0===t?void 0:t.objectIdField]})):[];await this._updateIds(l,this._selectionMode,this._refineSelectionSet.undoStack,this._refineLayer),this._drawTools.clear()}async _highlightFeatures(){this._clearHighlight(),y.highlightHandles=await g(this.selectionSets)}_clearHighlight(){y.removeHandles()}async _updateIds(i,t,s,e){let a=!1;const l=this._refineSelectionSet.refineInfos,h=e.layer.id,n={};n[h]={addIds:[],removeIds:[],layerView:e};const o=Object.keys(l).indexOf(h)>-1?l[h]:n[h];if(t===u.ADD)o.addIds=[...new Set([...i,...o.addIds])],o.addIds.length>0&&s.push({ids:i,mode:t,layerView:e}),o.removeIds.length>0&&(o.removeIds=o.removeIds.filter((t=>i.indexOf(t)<0)));else{const l=this.selectionSets.reduce(((t,s)=>(i.forEach((i=>{s.workflowType!==b.REFINE?s.selectedIds.indexOf(i)>-1&&t.push(i):Object.keys(s.refineInfos).some((a=>{const l=s.refineInfos[a];if(l.layerView.layer.id===e.layer.id&&l.addIds.indexOf(i)>-1)return t.push(i),!0}))})),t)),[]);o.removeIds=[...new Set([...l,...o.removeIds])],o.addIds=o.addIds.filter((i=>l.indexOf(i)<0)),o.removeIds.length>0&&s.push({ids:l,mode:t,layerView:e}),this.selectionSets=this.selectionSets.reduce(((i,t)=>(t.workflowType!==b.REFINE&&t.layerView.layer.id===e.layer.id?(t.selectedIds=t.selectedIds.filter((i=>o.removeIds.indexOf(i)<0)),t.selectedIds.length>0?i.push(t):a=!0):i.push(t),i)),[])}this._refineSelectionSet.refineInfos[h]=o,this.selectionSets=[...this.selectionSets],a&&this.selectionSetsChanged.emit(this.selectionSets),await this._highlightFeatures()}get el(){return a(this)}};x.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-ui-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-ui-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{_ as map_select_tools,P as pdf_download,x as refine_selection}
@@ -0,0 +1,66 @@
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"./p-ff0d7712.js";
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t])},n(e,t)},e=function(){return e=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},e.apply(this,arguments)};function t(n){return Object.keys(n).some((function(e){var t=n[e];if(!t)return!1;switch(t&&t.toParam&&(t=t.toParam()),t.constructor.name){case"Array":case"Object":case"Date":case"Function":case"Boolean":case"String":case"Number":return!1;default:return!0}}))}function r(n){var e={};return Object.keys(n).forEach((function(t){var r,o,i=n[t];if(i&&i.toParam&&(i=i.toParam()),i||0===i||"boolean"==typeof i||"string"==typeof i){var a;switch(i.constructor.name){case"Array":var u=null===(o=null===(r=i[0])||void 0===r?void 0:r.constructor)||void 0===o?void 0:o.name;a="Array"===u?i:"Object"===u?JSON.stringify(i):i.join(",");break;case"Object":a=JSON.stringify(i);break;case"Date":a=i.valueOf();break;case"Function":a=null;break;case"Boolean":a=i+"";break;default:a=i}(a||0===a||"string"==typeof a||Array.isArray(a))&&(e[t]=a)}})),e}function o(n,e){return Array.isArray(e)&&e[0]&&Array.isArray(e[0])?e.map((function(e){return o(n,e)})).join("&"):encodeURIComponent(n)+"="+encodeURIComponent(e)}function i(n){var e=r(n);return Object.keys(e).map((function(n){return o(n,e[n])})).join("&")}var a=function(n,e,t,r,o){n=n||"UNKNOWN_ERROR",e=e||"UNKNOWN_ERROR_CODE",this.name="ArcGISRequestError",this.message="UNKNOWN_ERROR_CODE"===e?n:e+": "+n,this.originalMessage=n,this.code=e,this.response=t,this.url=r,this.options=o};a.prototype=Object.create(Error.prototype),a.prototype.constructor=a;var u="@esri/arcgis-rest-js",c={httpMethod:"POST",params:{f:"json"}},s=function(t){function r(n,e,r,o,i){void 0===n&&(n="AUTHENTICATION_ERROR"),void 0===e&&(e="AUTHENTICATION_ERROR_CODE");var a=t.call(this,n,e,r,o,i)||this;return a.name="ArcGISAuthError",a.message="AUTHENTICATION_ERROR_CODE"===e?n:e+": "+n,a}return function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(r,t),r.prototype.retry=function(n,t){var r=this;void 0===t&&(t=3);var o=0,i=function(a,u){n(r.url,r.options).then((function(n){var t=e(e({},r.options),{authentication:n});return o+=1,f(r.url,t)})).then((function(n){a(n)})).catch((function(n){"ArcGISAuthError"===n.name&&o<t?i(a,u):u("ArcGISAuthError"===n.name&&o>=t?r:n)}))};return new Promise((function(n,e){i(n,e)}))},r}(a);function f(n,o){void 0===o&&(o={params:{f:"json"}});var f=e(e(e({httpMethod:"POST"},c),o),{params:e(e({},c.params),o.params),headers:e(e({},c.headers),o.headers)}),l=[],d=[];if(f.fetch||"undefined"==typeof fetch?(l.push("`fetch`"),d.push("`node-fetch`")):f.fetch=fetch.bind(Function("return this")()),"undefined"==typeof Promise&&(l.push("`Promise`"),d.push("`es6-promise`")),"undefined"==typeof FormData&&(l.push("`FormData`"),d.push("`isomorphic-form-data`")),!f.fetch||"undefined"==typeof Promise||"undefined"==typeof FormData)throw new Error("`arcgis-rest-request` requires a `fetch` implementation and global variables for `Promise` and `FormData` to be present in the global scope. You are missing "+l.join(", ")+". We recommend installing the "+d.join(", ")+" modules at the root of your application to add these to the global scope. See https://bit.ly/2KNwWaJ for more info.");var p=f.httpMethod,h=f.authentication,m=f.rawResponse,w=e({f:"json"},f.params),O=null,v={method:p,credentials:f.credentials||"same-origin"};return f.headers&&f.headers["X-Esri-Auth-Client-Id"]&&n.indexOf("/oauth2/platformSelf")>-1&&(v.credentials="include"),(h?h.getToken(n,{fetch:f.fetch}).catch((function(e){return e.url=n,e.options=f,O=e,Promise.resolve("")})):Promise.resolve("")).then((function(o){o.length&&(w.token=o),h&&h.getDomainCredentials&&(v.credentials=h.getDomainCredentials(n));var a={};if("GET"===v.method){w.token&&f.hideToken&&"undefined"==typeof window&&(a["X-Esri-Authorization"]="Bearer "+w.token,delete w.token);var c=""===i(w)?n:n+"?"+i(w);f.maxUrlLength&&c.length>f.maxUrlLength||w.token&&f.hideToken?(v.method="POST",o.length&&f.hideToken&&(w.token=o,delete a["X-Esri-Authorization"])):n=c}var s=new RegExp("/items/.+/updateResources").test(n);return"POST"===v.method&&(v.body=function(n,e){var o=t(n)||e,a=r(n);if(o){var u=new FormData;return Object.keys(a).forEach((function(n){"undefined"!=typeof Blob&&a[n]instanceof Blob?u.append(n,a[n],a.fileName||a[n].name||n):u.append(n,a[n])})),u}return i(n)}(w,s)),v.headers=e(e({},a),f.headers),"undefined"!=typeof window||v.headers.referer||(v.headers.referer=u),t(w)||s||(v.headers["Content-Type"]="application/x-www-form-urlencoded"),f.fetch(n,v)})).then((function(e){if(!e.ok)throw new a(e.statusText,"HTTP "+e.status,e,n,f);if(m)return e;switch(w.f){case"json":case"geojson":return e.json();case"html":case"text":return e.text();default:return e.blob()}})).then((function(e){if("json"!==w.f&&"geojson"!==w.f||m)return e;var t=function(n,e,t,r,o){if(n.code>=400)throw new a(u=n.message,c=n.code,n,e,r);if(n.error){var i=n.error,u=i.message,c=i.code,f=i.messageCode,l=f||c||"UNKNOWN_ERROR_CODE";if(498===c||499===c||"GWM_0003"===f||400===c&&"Unable to generate token."===u)throw o||new s(u,l,n,e,r);throw new a(u,l,n,e,r)}if("failed"===n.status||"failure"===n.status){u=void 0,c="UNKNOWN_ERROR_CODE";try{u=JSON.parse(n.statusMessage).message,c=JSON.parse(n.statusMessage).code}catch(e){u=n.statusMessage||n.message}throw new a(u,c,n,e,r)}return n}(e,n,0,f,O);if(O){var r=n.toLowerCase().split(/\/rest(\/admin)?\/services\//)[0];f.authentication.federatedServers[r]={token:[],expires:new Date(Date.now()+864e5)},O=null}return t}))}function l(n){return"string"!=typeof n||"/"===(n=n.trim())[n.length-1]&&(n=n.slice(0,-1)),n}
21
+ /** @license
22
+ * Copyright 2020 Esri
23
+ *
24
+ * Licensed under the Apache License, Version 2.0 (the "License");
25
+ * you may not use this file except in compliance with the License.
26
+ * You may obtain a copy of the License at
27
+ *
28
+ * http://www.apache.org/licenses/LICENSE-2.0
29
+ *
30
+ * Unless required by applicable law or agreed to in writing, software
31
+ * distributed under the License is distributed on an "AS IS" BASIS,
32
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33
+ * See the License for the specific language governing permissions and
34
+ * limitations under the License.
35
+ */
36
+ /** @license
37
+ * Copyright 2018 Esri
38
+ *
39
+ * Licensed under the Apache License, Version 2.0 (the "License");
40
+ * you may not use this file except in compliance with the License.
41
+ * You may obtain a copy of the License at
42
+ *
43
+ * http://www.apache.org/licenses/LICENSE-2.0
44
+ *
45
+ * Unless required by applicable law or agreed to in writing, software
46
+ * distributed under the License is distributed on an "AS IS" BASIS,
47
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48
+ * See the License for the specific language governing permissions and
49
+ * limitations under the License.
50
+ */
51
+ function d(n){return new Promise((e=>{h(n).then((n=>{try{e(JSON.parse(n))}catch(n){e(null)}}),(()=>e(null)))}))}function p(n,e,t){return n?function(n,e,t){let r;try{r=new File(n,e,t)}catch(o){r=function(){void 0===t&&(t={type:""});const r=new Blob(n,t);return r.lastModified=new Date,r.name=e,r}()}return r}([n],e||"",{type:t||n.type}):null}function h(n){return new Promise((e=>{const t=new FileReader;t.onload=function(n){e(n.target.result||"")},t.readAsText(n)}))}function m(n){return n?n.endsWith("/")?n:n+"/":n}function w(n,e){return e.split(".").reduce((function(n,e){return n?n[e]:void 0}),n)}function O(n,e,t){const r=e.split(".");r.reduce(((n,e,o)=>o===r.length-1?(n[e]=t,t):(n[e]||(n[e]={}),n[e])),n)}function v(n,e,t={}){return n?f(n,{authentication:e,rawResponse:!0,...t}).then((n=>n.blob())):Promise.reject("Url must be provided")}
52
+ /** @license
53
+ * Copyright 2018 Esri
54
+ *
55
+ * Licensed under the Apache License, Version 2.0 (the "License");
56
+ * you may not use this file except in compliance with the License.
57
+ * You may obtain a copy of the License at
58
+ *
59
+ * http://www.apache.org/licenses/LICENSE-2.0
60
+ *
61
+ * Unless required by applicable law or agreed to in writing, software
62
+ * distributed under the License is distributed on an "AS IS" BASIS,
63
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64
+ * See the License for the specific language governing permissions and
65
+ * limitations under the License.
66
+ */const b="PK";function R(n,e,t=[]){return new Promise(((r,o)=>{v(n,e).then((n=>{j(n).then((n=>{"application/json"===n.type?d(n).then((e=>{if(e?.error){const n=e.error.code;void 0!==n&&t.indexOf(n)>=0?r(null):o(e)}else r(n)})):r(n)}),o)}),o)}))}function y(n,e){return new Promise((t=>{(function(n,e){return new Promise((t=>{const r=function(n,e){return`${function(n){return w(n,"portal")||"https://www.arcgis.com/sharing/rest"}(e)}/content/items/${n}/data`}(n,e);R(r,e,[400,500]).then((n=>t(j(n))),(()=>t(null)))}))})(n,e).then((n=>t(d(n))),(()=>t(null)))}))}function N(n,e){return v(n,e,{httpMethod:"GET"}).then((n=>j(n))).then((n=>"application/json"===n.type?d(n):Promise.resolve(null)))}function E(n,e,t){return new Promise((r=>{(function(n,e,t,r=[],o){return new Promise(((i,a)=>{R(n,t,r).then((n=>i(n?p(n,e,o):null)),a)}))})(n,e,t,[500]).then(r,(()=>r(null)))}))}function j(n){return new Promise(((e,t)=>{n&&n.size>0&&(n.type.startsWith("text/plain")||n.type.startsWith("application/json"))?h(n).then((t=>{try{JSON.parse(t),e(new Blob([n],{type:"application/json"}))}catch(r){t.length>4&&t.substr(0,4)===b?e(new Blob([n],{type:"application/zip"})):t.startsWith("<")?e(new Blob([n],{type:"text/xml"})):e(n)}}),t):n?e(n):t()}))}export{s as A,u as N,e as _,w as a,p as b,l as c,m as d,i as e,E as f,N as g,y as h,f as r,O as s}
@@ -0,0 +1,145 @@
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{c as e}from"./p-482534a7.js";import{d as t}from"./p-2a58e378.js";import{E as r,j as i,S as s}from"./p-ff0d7712.js";import{c as n,r as a,b as o,d as c,f as u,h as l,a as f,s as p}from"./p-5856dc4f.js";
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+ var m=function(){return m=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},m.apply(this,arguments)};function d(e){return void 0===e&&(e={}),e.portal?n(e.portal):e.authentication?e.authentication.portal:"https://www.arcgis.com/sharing/rest"}function h(e){return e.owner?Promise.resolve(e.owner):e.item&&e.item.owner?Promise.resolve(e.item.owner):e.authentication&&e.authentication.getUsername?e.authentication.getUsername():Promise.reject(new Error("Could not determine the owner of this item. Pass the `owner`, `item.owner`, or `authentication` option."))}
22
+ /** @license
23
+ * Copyright 2020 Esri
24
+ *
25
+ * Licensed under the Apache License, Version 2.0 (the "License");
26
+ * you may not use this file except in compliance with the License.
27
+ * You may obtain a copy of the License at
28
+ *
29
+ * http://www.apache.org/licenses/LICENSE-2.0
30
+ *
31
+ * Unless required by applicable law or agreed to in writing, software
32
+ * distributed under the License is distributed on an "AS IS" BASIS,
33
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
+ * See the License for the specific language governing permissions and
35
+ * limitations under the License.
36
+ */
37
+ function v(e,t=0){const i=e.split("/");let s=i.pop(),n="";const a=i.shift();let o=r.Resource;if(a)if(a.endsWith("_info_thumbnail"))o=r.Thumbnail;else if(a.endsWith("_info_metadata"))o=r.Metadata,s="metadata.xml";else if(a.endsWith("_info_data"))o=r.Data;else if(a.endsWith("_info_dataz"))s=s.replace(/\.zip$/,""),o=r.Data;else if(t<1){const e=a.indexOf("_");e>0&&(n=a.substr(e+1))}else n=i.join("/");return{type:o,folder:n,filename:s}}
38
+ /** @license
39
+ * Copyright 2021 Esri
40
+ *
41
+ * Licensed under the Apache License, Version 2.0 (the "License");
42
+ * you may not use this file except in compliance with the License.
43
+ * You may obtain a copy of the License at
44
+ *
45
+ * http://www.apache.org/licenses/LICENSE-2.0
46
+ *
47
+ * Unless required by applicable law or agreed to in writing, software
48
+ * distributed under the License is distributed on an "AS IS" BASIS,
49
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50
+ * See the License for the specific language governing permissions and
51
+ * limitations under the License.
52
+ */function w(e,t,r){return{...e,fetchedFromSource:t,copiedToDestination:r}}
53
+ /** @license
54
+ * Copyright 2021 Esri
55
+ *
56
+ * Licensed under the Apache License, Version 2.0 (the "License");
57
+ * you may not use this file except in compliance with the License.
58
+ * You may obtain a copy of the License at
59
+ *
60
+ * http://www.apache.org/licenses/LICENSE-2.0
61
+ *
62
+ * Unless required by applicable law or agreed to in writing, software
63
+ * distributed under the License is distributed on an "AS IS" BASIS,
64
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
65
+ * See the License for the specific language governing permissions and
66
+ * limitations under the License.
67
+ */
68
+ /** @license
69
+ * Copyright 2021 Esri
70
+ *
71
+ * Licensed under the Apache License, Version 2.0 (the "License");
72
+ * you may not use this file except in compliance with the License.
73
+ * You may obtain a copy of the License at
74
+ *
75
+ * http://www.apache.org/licenses/LICENSE-2.0
76
+ *
77
+ * Unless required by applicable law or agreed to in writing, software
78
+ * distributed under the License is distributed on an "AS IS" BASIS,
79
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
80
+ * See the License for the specific language governing permissions and
81
+ * limitations under the License.
82
+ */
83
+ function S(e,t,r,s=40){return new Promise((n=>{let a=[];const o=[];e.length>0&&function(e,t){const r=[];let i=0;for(;i<e.length;)r.push(e.slice(i,i+t)),i+=t;return r}(e,s).forEach(((e,t)=>{const r={filename:`resources${t}.zip`,zip:new i,filelist:[]};a=a.concat(e.map((e=>function(e,t){return e.folder?t.zip.folder(e.folder).file(e.filename,e.file,{binary:!0}):t.zip.file(e.filename,e.file,{binary:!0}),t.filelist.push(e),w(e,!0)}
84
+ /** @license
85
+ * Copyright 2021 Esri
86
+ *
87
+ * Licensed under the Apache License, Version 2.0 (the "License");
88
+ * you may not use this file except in compliance with the License.
89
+ * You may obtain a copy of the License at
90
+ *
91
+ * http://www.apache.org/licenses/LICENSE-2.0
92
+ *
93
+ * Unless required by applicable law or agreed to in writing, software
94
+ * distributed under the License is distributed on an "AS IS" BASIS,
95
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
96
+ * See the License for the specific language governing permissions and
97
+ * limitations under the License.
98
+ */(e,r)))),o.push(r)})),a.length>0?Promise.all(a).then((e=>{e=e.filter((e=>!(e.fetchedFromSource&&void 0===e.copiedToDestination))),function(e,t,r){return new Promise((i=>{const s=e.filter((e=>Object.keys(e.zip.files).length>0));s.length>0?_(s,t,r).then((e=>{i(e)})):i([])}))}(o,t,r).then((t=>{n(e.concat(t))}))})):n([])}))}function _(e,t,r){return new Promise((i=>{let s=[];const n=e.pop();let c=Promise.resolve([]);e.length>0&&(c=_(e,t,r)),c.then((e=>(s=e,new Promise((e=>{setTimeout((()=>e()),1e3)}))))).then((()=>function(e,t,r){return new Promise((i=>{e.zip.generateAsync({type:"blob"}).then((t=>o(t,e.filename,"application/zip"))).then((e=>{return h(i={id:t,resource:e,authentication:r,params:{archive:!0}}).then((function(e){var t=d(i)+"/content/users/"+e+"/items/"+i.id+"/addResources";return i.params=m({file:i.resource,fileName:i.name,resourcesPrefix:i.prefix,text:i.content,access:i.private?"private":"inherit"},i.params),a(t,i)}));var i})).then((()=>i(w(e,!0,!0))),(()=>i(w(e,!0,!1))))}))}(n,t,r))).then((e=>{e.filelist.forEach((t=>{s.push(w(t,!0,e.copiedToDestination))})),i(s)}))}))}
99
+ /** @license
100
+ * Copyright 2018 Esri
101
+ *
102
+ * Licensed under the Apache License, Version 2.0 (the "License");
103
+ * you may not use this file except in compliance with the License.
104
+ * You may obtain a copy of the License at
105
+ *
106
+ * http://www.apache.org/licenses/LICENSE-2.0
107
+ *
108
+ * Unless required by applicable law or agreed to in writing, software
109
+ * distributed under the License is distributed on an "AS IS" BASIS,
110
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
111
+ * See the License for the specific language governing permissions and
112
+ * limitations under the License.
113
+ */
114
+ /** @license
115
+ * Copyright 2022 Esri
116
+ *
117
+ * Licensed under the Apache License, Version 2.0 (the "License");
118
+ * you may not use this file except in compliance with the License.
119
+ * You may obtain a copy of the License at
120
+ *
121
+ * http://www.apache.org/licenses/LICENSE-2.0
122
+ *
123
+ * Unless required by applicable law or agreed to in writing, software
124
+ * distributed under the License is distributed on an "AS IS" BASIS,
125
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
126
+ * See the License for the specific language governing permissions and
127
+ * limitations under the License.
128
+ */
129
+ const b={solutionItemId:"",defaultWkid:void 0,solutionData:{metadata:{},templates:[]},templateEdits:{},featureServices:[],spatialReferenceInfo:{enabled:!1,services:{},spatialReference:void 0}},g=class{static get Store(){return this._instance||(this._instance=new this)}constructor(){this._hasChanges=!1,this._store=e(Object.assign({},b))}getItemInfo(e){let t;return this._store.get("solutionData").templates.some((r=>e==r.itemId&&(t=r,!0))),t}getStoreInfo(e){return this._store.get(e)}async loadSolution(e,t){this._authentication=t;const r=await l(e,t);if(r){const i=f(r,"params.wkid.default");await this._prepareSolutionItemsForEditing(e,r.templates,t);const s=this._getFeatureServices(r.templates),n=this._getSpatialReferenceInfo(s,i);this._store.set("solutionItemId",e),this._store.set("defaultWkid",i),this._store.set("solutionData",r),this._store.set("featureServices",s),this._store.set("spatialReferenceInfo",n)}this._flagStoreHasChanges(!1)}replaceItemThumbnail(e){e.resourceFilePaths.forEach((e=>{e.type===r.Thumbnail&&(e.updateType===t.None?e.updateType=t.Remove:e.updateType!==t.Add&&e.updateType!==t.Update||(e.updateType=t.Obsolete))})),e.resourceFilePaths=e.resourceFilePaths.filter((e=>e.updateType!=t.Obsolete)),e.resourceFilePaths.push({blob:e.thumbnail,filename:e.thumbnail.name,type:r.Thumbnail,updateType:t.Add}),this.setItemInfo(e)}async saveSolution(){const e=this._store.get("solutionItemId"),t=this._store.get("solutionData"),r=this._store.get("spatialReferenceInfo");await this._prepareSolutionItemsForStorage(e,t.templates,this._authentication);const i=this._setSpatialReferenceInfo(r,t.templates);p(t,"params.wkid",i?{label:"Spatial Reference",default:i,valueType:"spatialReference",attributes:{required:"true"}}:{});const s={id:e,text:t};
130
+ /** @license
131
+ * Copyright 2018 Esri
132
+ *
133
+ * Licensed under the Apache License, Version 2.0 (the "License");
134
+ * you may not use this file except in compliance with the License.
135
+ * You may obtain a copy of the License at
136
+ *
137
+ * http://www.apache.org/licenses/LICENSE-2.0
138
+ *
139
+ * Unless required by applicable law or agreed to in writing, software
140
+ * distributed under the License is distributed on an "AS IS" BASIS,
141
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
142
+ * See the License for the specific language governing permissions and
143
+ * limitations under the License.
144
+ */
145
+ await function(e,t){return new Promise(((r,i)=>{var s;(s={item:e,folderId:void 0,authentication:t,params:{}},h(s).then((function(e){var t,r,i,n=s.folderId?d(s)+"/content/users/"+e+"/"+s.folderId+"/items/"+s.item.id+"/update":d(s)+"/content/users/"+e+"/items/"+s.item.id+"/update";return s.params=m(m({},s.params),(t=s.item,(r=JSON.parse(JSON.stringify(t))).data&&("undefined"!=typeof Blob&&t.data instanceof Blob||"ReadStream"===t.data.constructor.name?r.file=t.data:r.text=t.data,delete r.data),r)),s.params.extent&&(i=s.params.extent,Array.isArray(i)&&Array.isArray(i[0])&&Array.isArray(i[1]))&&(s.params.extent=function(e){return e.join(",")}(s.params.extent)),a(n,s)}))).then((e=>e.success?r(e):i(e)),(e=>i(e)))}))}(s,this._authentication)}setItemInfo(e){const t=this._store.get("solutionData");t.templates.some((r=>e.itemId==r.itemId&&(r=e,this._store.set("solutionData",t),this._flagStoreHasChanges(!0),!0)))}setStoreInfo(e,t){this._store.set(e,t),this._flagStoreHasChanges(!0)}_testAccess(e,t,r,i){switch(e){case"_emptyTheStore":this._emptyTheStore();break;case"_getFeatureServices":return this._getFeatureServices(t);case"_getItemsSharedWithThisGroup":return this._getItemsSharedWithThisGroup(t,r);case"_getResourceFilePaths":return this._getResourceFilePaths(t,r,i);case"_getResourceStorageName":return this._getResourceStorageName(t,r);case"_getSpatialReferenceInfo":return this._getSpatialReferenceInfo(t,r);case"_prepareSolutionItemsForEditing":return this._prepareSolutionItemsForEditing(t,r,i);case"_prepareSolutionItemsForStorage":return this._prepareSolutionItemsForStorage(t,r,i);case"_setSpatialReferenceInfo":return this._setSpatialReferenceInfo(t,r);case"_splitFilename":return this._splitFilename(t)}return null}_emptyTheStore(){this._store.set("solutionItemId",b.solutionItemId),this._store.set("defaultWkid",b.defaultWkid),this._store.set("solutionData",b.solutionData),this._store.set("templateEdits",b.templateEdits),this._store.set("featureServices",b.featureServices),this._store.set("spatialReferenceInfo",b.spatialReferenceInfo)}_flagStoreHasChanges(e){this._hasChanges!==e&&window.dispatchEvent(new CustomEvent("solutionStoreHasChanges",{detail:e,bubbles:!0,cancelable:!1,composed:!0})),this._hasChanges=e}_getCustomizableFeatureServices(e){return e.reduce(((e,t)=>("Feature Service"===t.type&&t.item.typeKeywords.indexOf("View Service")<0&&e.push(t),e)),[])}_getFeatureServices(e){return this._getCustomizableFeatureServices(e).map((e=>({name:e.item.title||e.item.name,enabled:f(e,"properties.service.spatialReference.wkid").toString().startsWith("{{params.wkid||")})))}_getItemsSharedWithThisGroup(e,t){return t.reduce(((t,r)=>(r.itemId!==e.itemId&&"Group"!==r.type&&t.push({id:r.itemId,title:r.item.name||r.item.title,isShared:(r.groups||[]).indexOf(e.itemId)>-1,shareItem:(r.groups||[]).indexOf(e.itemId)>-1,type:r.type,typeKeywords:r.item.typeKeywords}),t)),[])}_getResourceFilePaths(e,r,i){return function(e,t,r=[],i=0){return r.map((r=>{return{url:(s=e,n=t,a=r,c(s)+"content/items/"+n+"/resources/"+a),...v(r,i)};var s,n,a}))}(i,e,r.resources,s).map((e=>(e.updateType=t.None,e)))}_getResourceStorageName(e,t){let i=e;switch(t.type){case r.Data:i=`${i}_info_data`;break;case r.Info:i=`${i}_info`;break;case r.Metadata:i=`${i}_info_metadata`;break;case r.Resource:break;case r.Thumbnail:i=`${i}_info_thumbnail`}let s=t.filename;return t.type==r.Data&&s&&!function(e){const t=e.match(/\.([a-z]+)$/i);return!!t&&"|.json|.xml|.txt|.png|.pbf|.zip|.jpeg|.jpg|.gif|.bmp|.gz|.svg|.svgz|.geodatabase|".indexOf("|"+t[0]+"|")>=0}(s)&&(s+=".zip",i+="z"),i+"/"+(t.folder?t.folder+"/"+s:s)}_getSpatialReferenceInfo(e,t){const r={};return e.forEach((e=>{r[e.name]=e.enabled})),{enabled:void 0!==t,services:r,spatialReference:t||void 0}}async _prepareSolutionItemsForEditing(e,t,i){const s=[];t.forEach((n=>{n.resourceFilePaths=this._getResourceFilePaths(e,n,i.portal),s.push(n.resourceFilePaths.length>0?function(e,t){let i,s;return t.forEach((e=>{e.type===r.Thumbnail&&(i=e.url,s=e.filename)})),i?u(i,s,e):Promise.resolve(null)}(i,n.resourceFilePaths):Promise.resolve()),n.groupDetails="Group"===n.type?this._getItemsSharedWithThisGroup(n,t):[]}));const n=await Promise.all(s);return t.forEach(((e,t)=>{e.thumbnail=n[t]?n[t]:void 0})),Promise.resolve()}async _prepareSolutionItemsForStorage(e,r,i){const s=[],n=[];return r.forEach((r=>{r.resourceFilePaths.forEach((async o=>{const c=this._getResourceStorageName(r.itemId,o);switch(o.updateType){case t.Add:const{prefix:u,suffix:l}=this._splitFilename(c);r.resources.push(c),s.push({itemId:r.itemId,file:o.blob,folder:u,filename:l});break;case t.Update:n.push(new Promise((async t=>{try{await function(e,t,r,i){const s=t.split("/"),n=s.length>1?s.slice(0,s.length-1).join("/"):void 0;return h(o={id:e,prefix:n,name:s[s.length-1],resource:r,authentication:i}).then((function(e){var t=d(o)+"/content/users/"+e+"/items/"+o.id+"/updateResources";return o.params=m({file:o.resource,fileName:o.name,resourcesPrefix:o.prefix,text:o.content},o.params),void 0!==o.private&&(o.params.access=o.private?"private":"inherit"),a(t,o)}));var o}(e,c,o.blob,i)}catch(e){console.log("Unable to update "+c+" for item "+r.itemId+": "+JSON.stringify(e))}t()})));break;case t.Remove:n.push(new Promise((async t=>{try{await function(e,t,r){return h(i={id:e,resource:t,authentication:r}).then((function(e){var t=d(i)+"/content/users/"+e+"/items/"+i.id+"/removeResources";return i.params=m(m({},i.params),{resource:i.resource}),void 0!==i.deleteAll&&(i.params.deleteAll=i.deleteAll),a(t,i)}));var i}(e,c,i),r.resources=r.resources.filter((e=>e!==c))}catch(e){console.log("Unable to remove "+c+" for item "+r.itemId+": "+JSON.stringify(e))}t()})))}return Promise.resolve()})),delete r.resourceFilePaths,delete r.thumbnail,delete r.groupDetails})),Promise.all(n).then((async()=>{var t,r,n;return s.length>0&&await(t=s,r=e,n=i,new Promise((e=>{S(t,r,n).then((t=>{e(t.filter((e=>e.fetchedFromSource&&e.copiedToDestination)).map((e=>e.folder+"/"+e.filename)))}))}))),Promise.resolve()}))}_setSpatialReferenceInfo(e,t){const r="{{params.wkid||",i=this._getCustomizableFeatureServices(t);return e.enabled?(i.forEach((t=>{let i;e.services[t.item.title||t.item.name]?(i=`{{params.wkid||${e.spatialReference}}}`,p(t,"properties.service.spatialReference.wkid",i)):(i=f(t,"properties.service.spatialReference.wkid"),i.toString().startsWith(r)&&(i=i.toString().substring(15,i.length-2),p(t,"properties.service.spatialReference.wkid",i)))})),e.spatialReference):void i.forEach((e=>{const t=f(e,"properties.service.spatialReference.wkid");t.toString().startsWith(r)&&p(e,"properties.service.spatialReference.wkid",t.toString().substring(15,t.length-2))}))}_splitFilename(e){const t=e.split("/");return{prefix:t.length>1?t.slice(0,t.length-1).join("/"):void 0,suffix:t[t.length-1]}}}.Store;export{g as s}
@@ -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{r as t,c as i,h as n,H as e,g as s}from"./p-91c78d98.js";import{u as a,t as o,g as l,x as r}from"./p-4b9ba22d.js";import{s as c,a as h,c as d}from"./p-3a668467.js";import{c as p,d as u,n as m}from"./p-bf9d3381.js";import{o as g}from"./p-abc50d38.js";import{c as v,s as f,d as b,u as w}from"./p-29120ecd.js";import{K as x}from"./p-c24040ec.js";import{g as y}from"./p-866837f6.js";import{c as k}from"./p-efc041d0.js";import{l as z}from"./p-05948b48.js";import{g as C}from"./p-99d8a839.js";import{k as _}from"./p-15070568.js";import"./p-361b44ed.js";import"./p-3760847f.js";import"./p-34fb2a6e.js";import"./p-e1a4994d.js";import"./p-2a58e378.js";
6
+ import{r as t,c as i,h as n,H as e,g as s}from"./p-91c78d98.js";import{u as a,t as o,g as l,x as r}from"./p-4b9ba22d.js";import{s as c,a as h,c as d}from"./p-3a668467.js";import{c as p,d as u,n as m}from"./p-bf9d3381.js";import{o as g}from"./p-abc50d38.js";import{c as v,s as f,d as b,u as w}from"./p-29120ecd.js";import{K as x}from"./p-c24040ec.js";import{g as y}from"./p-866837f6.js";import{c as k}from"./p-efc041d0.js";import{l as z}from"./p-05948b48.js";import{g as C}from"./p-99d8a839.js";import{k as _}from"./p-4807b2a1.js";import"./p-361b44ed.js";import"./p-3760847f.js";import"./p-34fb2a6e.js";import"./p-e1a4994d.js";import"./p-2a58e378.js";
7
7
  /*!
8
8
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
9
9
  * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.