@esri/solutions-components 5.1.0-next.101 → 5.1.0-next.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/cdn/{Q6M7TE6U.js → 24OJQL75.js} +1 -1
  2. package/dist/cdn/2AXKBNIN.js +2 -0
  3. package/dist/cdn/{VFBHL5I3.js → 2HGZUNIC.js} +1 -1
  4. package/dist/cdn/{BEFZMWNT.js → 3NPBN2B4.js} +1 -1
  5. package/dist/cdn/{3N6JSBDY.js → 45UNI2VP.js} +1 -1
  6. package/dist/cdn/4SPIPOYO.js +2 -0
  7. package/dist/cdn/{3TISGUGU.js → 5LX6ROQC.js} +148 -123
  8. package/dist/cdn/{AGWF7JS3.js → 64ZLSOK3.js} +1 -1
  9. package/dist/cdn/{5MJRRAR3.js → 6UTDTBHM.js} +1 -1
  10. package/dist/cdn/{KFUDOMCU.js → 7EPZDMA2.js} +1 -1
  11. package/dist/cdn/{NAP64TVV.js → 7SFTLJTV.js} +1 -1
  12. package/dist/cdn/{OVUYJGIC.js → 7X5K32QE.js} +1 -1
  13. package/dist/cdn/{YVHMD4UA.js → A2SX6EF7.js} +1 -1
  14. package/dist/cdn/{52NCESZ3.js → ADTHTFGI.js} +1 -1
  15. package/dist/cdn/{R2DPK4DM.js → AFMPPVMO.js} +1 -1
  16. package/dist/cdn/{RPW7LJQH.js → ANZVLZYR.js} +1 -1
  17. package/dist/cdn/{WBOSBQON.js → AO3QYZNQ.js} +1 -1
  18. package/dist/cdn/{LN4MOERJ.js → AOTEIDXK.js} +1 -1
  19. package/dist/cdn/{V5CN55C4.js → AYO5GP4M.js} +1 -1
  20. package/dist/cdn/{QY5DNKV4.js → B4EWPUMU.js} +1 -1
  21. package/dist/cdn/{AXOVJQ27.js → BELRJU3A.js} +1 -1
  22. package/dist/cdn/{6GS6GAPJ.js → BYU5RVVM.js} +1 -1
  23. package/dist/cdn/{FMBNUELT.js → CNY6H6U2.js} +1 -1
  24. package/dist/cdn/{HQELLKEZ.js → CZZN3R4F.js} +1 -1
  25. package/dist/cdn/{TUMD7SXH.js → DINEURA2.js} +1 -1
  26. package/dist/cdn/{4CTPT5BL.js → G4OMMOS4.js} +1 -1
  27. package/dist/cdn/{QLCCVERE.js → GU4QAZMD.js} +1 -1
  28. package/dist/cdn/{NBWWIDDN.js → IGIHPCRS.js} +1 -1
  29. package/dist/cdn/{ULMPSDVQ.js → IIOO4ABM.js} +1 -1
  30. package/dist/cdn/{5HEWMGPZ.js → JPJ2PWRJ.js} +1 -1
  31. package/dist/cdn/{PUKJZLBU.js → LYNVZ7EL.js} +1 -1
  32. package/dist/cdn/{K6MXQSMI.js → MSEGWVWC.js} +2 -2
  33. package/dist/cdn/{WVESDJHN.js → MT2QHKUQ.js} +1 -1
  34. package/dist/cdn/{FFUTLAI6.js → N3FJFS6W.js} +1 -1
  35. package/dist/cdn/{P6I6DQ26.js → NBJK6Z7L.js} +1 -1
  36. package/dist/cdn/{YZHE6356.js → O5PAINAH.js} +1 -1
  37. package/dist/cdn/O7TCCL6B.js +2 -0
  38. package/dist/cdn/P2QWXLFJ.js +2 -0
  39. package/dist/cdn/{7XZPMBE6.js → P76UNULK.js} +1 -1
  40. package/dist/cdn/{RNJB26Y3.js → PDE6N2YM.js} +1 -1
  41. package/dist/cdn/{IBUNGLNK.js → PQPNCADS.js} +1 -1
  42. package/dist/cdn/{PTRLHLU7.js → RQIBNHBN.js} +1 -1
  43. package/dist/cdn/{BYMRDTAH.js → SR53JCI4.js} +1 -1
  44. package/dist/cdn/{7NJD2NA4.js → TDY54Z67.js} +1 -1
  45. package/dist/cdn/{32CHXOKC.js → TS7GYVPR.js} +1 -1
  46. package/dist/cdn/{RCDAQADA.js → TWO6FJHP.js} +1 -1
  47. package/dist/cdn/{XT5YSGV5.js → UUGWRXGN.js} +1 -1
  48. package/dist/cdn/{6YK4PYP4.js → UUMJMH3T.js} +1 -1
  49. package/dist/cdn/{377WBJCF.js → VB5C4Z27.js} +1 -1
  50. package/dist/cdn/{ABL2KXLF.js → VK6ZOC6A.js} +1 -1
  51. package/dist/cdn/{QUXKMFKN.js → WNH3PY6X.js} +1 -1
  52. package/dist/cdn/{TXNMM6GI.js → WU7QCA5H.js} +1 -1
  53. package/dist/cdn/{4IPMIMO5.js → WZ22NICV.js} +1 -1
  54. package/dist/cdn/{RG2D7ZRS.js → Y2ROEEOX.js} +2 -2
  55. package/dist/cdn/{JL4NGXC2.js → YXJJ5QPI.js} +1 -1
  56. package/dist/cdn/{VMGLKQNQ.js → ZPOWEU76.js} +1 -1
  57. package/dist/cdn/{VFVRYSDK.js → ZT5TOVYM.js} +1 -1
  58. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.en.json +1 -1
  59. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.json +1 -1
  60. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.en.json +1 -1
  61. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.json +1 -1
  62. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.en.json +1 -1
  63. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.json +1 -1
  64. package/dist/cdn/index.js +1 -1
  65. package/dist/chunks/cardsHelpers.js +3 -3
  66. package/dist/components/arcgis-solutions-assistant/customElement.d.ts +2 -0
  67. package/dist/components/arcgis-solutions-assistant/customElement.js +7973 -7270
  68. package/dist/components/solution-builder-assistant/customElement.js +57 -57
  69. package/dist/components/solution-deployed-card-panel/customElement.d.ts +2 -0
  70. package/dist/components/solution-deployed-card-panel/customElement.js +50 -38
  71. package/dist/components/solution-details-panel/customElement.js +14 -10
  72. package/dist/components/solution-item-accordion/customElement.js +1 -1
  73. package/dist/components/solutions-deploy-app/customElement.js +1 -1
  74. package/dist/components/solutions-deployed-list/customElement.d.ts +2 -0
  75. package/dist/components/solutions-deployed-list/customElement.js +29 -24
  76. package/dist/docs/api.json +1 -1
  77. package/dist/docs/docs.json +1 -1
  78. package/dist/docs/web-types.json +1 -1
  79. package/dist/loader.js +3 -3
  80. package/dist/solutions-components_commit.txt +7 -7
  81. package/dist/types/lumina.d.ts +1 -1
  82. package/dist/types/preact.d.ts +1 -1
  83. package/dist/types/react.d.ts +1 -1
  84. package/dist/types/stencil.d.ts +1 -1
  85. package/package.json +1 -1
  86. package/dist/cdn/7HBL3GLY.js +0 -2
  87. package/dist/cdn/ANSQV6XB.js +0 -2
  88. package/dist/cdn/IND3UUYC.js +0 -2
  89. package/dist/cdn/RR6KWZJ6.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import d from"./6GOYDVLJ.js";import{a as Z}from"./BM666UZR.js";import c from"./K6MXQSMI.js";import"./US5FON7D.js";import"./VVZAS55G.js";import{a as z}from"./YKQDHR27.js";import"./TXNMM6GI.js";import b from"./2C4DK6YC.js";import a from"./WV7QX3ED.js";import{a as J}from"./R67EKKSL.js";import"./BVWAUO73.js";import"./K3DQKY7V.js";import"./TEHBW75B.js";import"./ALSK2SPM.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./3IHLJADI.js";import"./BMBNSJZQ.js";import"./5HZMUGQD.js";import"./5VDDAINK.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LPBP7CBN.js";import"./3FMOO3PJ.js";import"./XQQ52NKX.js";import"./JUUVYK2H.js";import"./DKD2EGQP.js";import"./4HFHJOS3.js";import"./45M33Q5G.js";import"./FES7B3SJ.js";import{b as H,c as B}from"./KIUBUHVM.js";import{E as f,F as u,G as j,I as v,h as M,i as l,l as T,q as A,r as G,t as U}from"./H5E6ISYP.js";import"./QPIMTXPL.js";export default $arcgis.t(([oe,le,ne,ee,L,O,,{g:W,j:q},{a:X,d:Y,e:Q,f:K}])=>{var re=M`@layer{:host{display:block;--calcite-input-message-spacing-value: 0}.align-center{align-items:center}.border-bottom-1{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-color-border-3)}.action-bar-size{height:3.5rem;width:100%}.w-1-2{width:50%}.w-1-3{width:33.33%}.width-full{width:100%}.height-full{height:100%}.padding-1{padding:1rem}.padding-bottom-0{padding-bottom:0!important}.padding-inline-start-0{padding-inline-start:0!important}.padding-top-sides-1{padding-block-start:1rem;padding-inline-start:1rem;padding-inline-end:1rem}.padding-block-start-1{padding-block-start:1rem}.padding-sides-1{padding-inline-start:1rem;padding-inline-end:1rem}.padding-top-1-2{padding-block-start:.5rem!important}.padding-top-1{padding-top:1rem}.indent-group{border-inline-start:1px solid var(--calcite-color-border-2);margin-bottom:.5rem;padding-inline-start:1rem;margin-inline-start:.5rem}.margin-bottom-0-5{margin-bottom:.5rem}.margin-top-0-5{margin-top:.5rem!important}.instructional-text{line-height:1;padding:0!important;margin:0;color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--2)}.info-blue{color:var(--calcite-color-status-info)}.info-message{justify-content:center;display:grid}.font-bold{font-weight:700}.header-label{font-weight:700;font-size:var(--calcite-font-size-0)}.display-flex{display:flex}.display-block{display:block}.display-none{display:none}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-start-1-2{padding-inline-start:.5rem}.list-border{border:1px solid var(--calcite-color-border-2)}.margin-sides-1{margin-inline-start:1rem;margin-inline-end:1rem}.margin-start-1-2{margin-inline-start:.5rem}.margin-top-0{margin-block-start:0!important}.margin-top-1{margin-top:1rem!important}.label-margin-0{--calcite-label-margin-bottom: 0}.list-label{color:var(--calcite-color-text-1);font-weight:var(--calcite-font-weight-bold)!important}.list-label,.list-description{font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);overflow-wrap:break-word;word-break:break-word}.list-description{margin-block-start:.125rem;color:var(--calcite-color-text-3)}.img-container{width:100%;height:100%}.font-weight-500{font-weight:500}.background-override{height:100%;width:100%;--calcite-color-surface-4: var(--calcite-color-brand);--calcite-color-surface-3: var(--calcite-color-brand-hover);--calcite-color-text-1: var(--calcite-color-text-inverse)}.word-wrap-anywhere{word-wrap:anywhere}.list-container{padding:0 1rem 1rem}.list-items{align-items:center;background-color:#fff;box-shadow:0 1px 3px #0000001a;font-family:sans-serif;padding:12px 16px}.list-item{display:flex;align-items:center;justify-content:space-between}.item-label{color:#4a4a4a;font-size:16px}.tooltip-message{padding:5px 8px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-color-text-2);max-width:400px}calcite-segmented-control{--calcite-segmented-control-border-color: var(--calcite-color-border-2)}calcite-segmented-control-item{--calcite-segmented-control-color: var(--calcite-color-text-3)}calcite-segmented-control-item[checked]{--calcite-segmented-control-border-color: var(--calcite-color-surface-highlight);--calcite-segmented-control-background-color: var(--calcite-color-surface-highlight);--calcite-segmented-control-color: var(--calcite-color-text-highlight)}calcite-action-bar{--calcite-internal-action-bar-gap: 0px;--calcite-internal-action-bar-padding: 0px}}`,R=class extends G{constructor(){super(),this.managedLayers={},this.managedTables=[],this.highlightHandles=[]}removeHandles(){this.highlightHandles.forEach(e=>{e?.remove()}),this.highlightHandles=[]}},V=class extends j{constructor(){super(),this.addresseeLayerIds=[],this.bufferColor=[227,139,79,.8],this.bufferOutlineColor=[255,255,255],this.customLabelEnabled=!1,this.customExport=!1,this.customExportURL="",this.defaultBufferDistance=0,this.defaultBufferUnit="feet",this.defaultExportTitle="",this.defaultNumLabelsPerPage=6,this.enableLayerFeatures=!0,this.enableLayerFeaturesOnLoad=!1,this.enableSearchDistance=!0,this.enableSearchDistanceOnLoad=!1,this.enableSketchTools=!0,this.featureHighlightEnabled=!1,this.noResultText="",this.initialNotice="",this.selectionLayerIds=[],this.showRefineSelection=!1,this.showSearchSettings=!0,this._exportGraphics=!1,this._addMap=!1,this._addResults=!0,this._addTitle=!1,this._downloadActive=!0,this._exportType="PDF",this._fetchingData=!1,this._isMobile=!1,this._numDuplicates=0,this._pageType="LIST",this._saveEnabled=!1,this._selectionSets=[],this._segmentType="STANDARD",this._selectedReportingLayerId="",this._isInitialLoading=!0,this._layoutTemplates=[],this._translations=J({name:"public-notification",blocking:!0}),this._downloadTools=f(),this.layoutTemplateSelectRef=f(),this.reportTemplateSelectRef=f(),this._onboardingImageUrl="",this._popupsEnabled=!1,this._removeDuplicates=f(),this._selectTools=f(),this._refineSelection=f(),this._titleElement=f(),this._titleValue=void 0,this._numSelected=0,this._pnStateContextProvider=z({context:Z}),this._refineGraphics=[],this._reportTemplates=[],this._reportTemplatesInfo=[],this.searchConfigurationChange=A(),this.listenOn(window,"selectionSetsChanged",this.selectionSetsChanged),this._pnState=new R,this._pnStateContextProvider.setValue(this._pnState)}static{this.properties={addresseeLayerIds:0,bufferColor:1,bufferOutlineColor:1,customLabelEnabled:5,customExport:5,customExportURL:1,defaultBufferDistance:9,defaultBufferUnit:1,defaultExportTitle:1,defaultNumLabelsPerPage:9,enableLayerFeatures:5,enableLayerFeaturesOnLoad:5,enableSearchDistance:5,enableSearchDistanceOnLoad:5,enableSketchTools:5,featureEffect:0,featureHighlightEnabled:5,mapView:0,noResultText:1,initialNotice:1,searchConfiguration:0,selectionLayerIds:0,showRefineSelection:5,showSearchSettings:5,sketchLineSymbol:0,sketchPointSymbol:0,sketchPolygonSymbol:0,_exportGraphics:16,_addMap:16,_addResults:16,_addTitle:16,_downloadActive:16,_exportType:16,_fetchingData:16,_isMobile:16,_numDuplicates:16,_pageType:16,_saveEnabled:16,_selectionSets:16,_segmentType:16,_selectedReportingLayerId:16,_isInitialLoading:16,_layoutTemplates:16,_translations:16}}static{this.styles=re}static{this.shadowRootOptions=U}willUpdate(e){e.has("mapView")&&this.mapView&&this.mapViewWatchHandler(this.mapView),e.has("searchConfiguration")&&this.searchConfiguration&&this.watchSearchConfigurationHandler(this.searchConfiguration,e.get("searchConfiguration")),e.has("sketchLineSymbol")&&this.sketchLineSymbolWatchHandler(this.sketchLineSymbol,e.get("sketchLineSymbol")),e.has("sketchPointSymbol")&&this.sketchPointSymbolWatchHandler(this.sketchPointSymbol,e.get("sketchPointSymbol")),e.has("sketchPolygonSymbol")&&this.sketchPolygonSymbolWatchHandler(this.sketchPolygonSymbol,e.get("sketchPolygonSymbol")),e.has("_pageType")&&(this.hasUpdated||this._pageType!=="LIST")&&this.pageTypeWatchHandler(this._pageType,e.get("_pageType")),(e.has("customExport")||e.has("customExportURL"))&&this.hasUpdated&&this._setTemplates()}async mapViewWatchHandler(e){e?.popup&&(this._popupsEnabled=e?.popupEnabled),this.searchConfiguration&&this._initSearchConfiguration(this.searchConfiguration)}async watchSearchConfigurationHandler(e,t){let i=JSON.stringify(e);this.mapView&&(i!==JSON.stringify(t)||i&&!this._searchConfiguration)&&(this._searchConfiguration=JSON.parse(i),this._searchConfiguration&&this.searchConfigurationChange.emit(this._searchConfiguration),this._home())}async sketchLineSymbolWatchHandler(e,t){e&&JSON.stringify(e)!==JSON.stringify(t)&&this._setLineSymbol(e)}async sketchPointSymbolWatchHandler(e,t){e&&JSON.stringify(e)!==JSON.stringify(t)&&this._setPointSymbol(e)}async sketchPolygonSymbolWatchHandler(e,t){e&&JSON.stringify(e)!==JSON.stringify(t)&&this._setPolygonSymbol(e)}async pageTypeWatchHandler(e,t){if(this._checkPopups(),this.mapView?.popup&&(this.mapView.popupEnabled=e!=="LIST"?!1:this._popupsEnabled),e==="EXPORT"&&(this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._updateExportGraphics(),this._fetchingData=!1),this._clearHighlight(),(t==="SELECT"||t==="REFINE")&&await this._clearSelection(),t==="EXPORT"&&this._removeExportGraphics(),e!=="SELECT")return this._highlightFeatures()}selectionSetsChanged(e){this._selectionSets=[...e.detail]}connectedCallback(){super.connectedCallback(),this._mediaQuery=window.matchMedia("(max-width: 600px)"),this.listenOn(this._mediaQuery,"change",e=>this._setIsMobile(e))}async load(){this._initSymbols(),this._onboardingImageUrl=B("assets/public-notification/images/onboarding.png")}render(){let e=this._isMobile?"footer":"header";return l`<calcite-shell>${this._isInitialLoading?l`<calcite-loader label></calcite-loader>`:l`<calcite-action-bar class="border-bottom-1 action-bar-size" expand-disabled layout=horizontal slot=${e??T}>${this._getActionGroup("list-check","LIST",this._translations.myLists)}${this.showRefineSelection?this._getActionGroup("test-data","REFINE",this._translations.refineSelection):null}${this._getActionGroup("export","EXPORT",this._translations.export)}</calcite-action-bar>${this._getPage(this._pageType)}`}</calcite-shell>`}async loaded(){this.searchConfiguration&&this._initSearchConfiguration(this.searchConfiguration),this.customExport&&this.customExportURL&&await this._setTemplates(),this._isInitialLoading=!1}_initSearchConfiguration(e){this.searchConfiguration&&!this._searchConfiguration&&this.mapView&&(this._searchConfiguration=e,this.searchConfigurationChange.emit(this._searchConfiguration),this._home())}_initSymbols(){this._setLineSymbol(this.sketchLineSymbol),this._setPointSymbol(this.sketchPointSymbol),this._setPolygonSymbol(this.sketchPolygonSymbol)}_setLineSymbol(e){let t=e?.type==="simple-line";this.sketchLineSymbol=t?e:this._jsonUtils?.fromJSON(e||{type:"esriSLS",color:[130,130,130,255],width:2,style:"esriSLSSolid"})}_setPointSymbol(e){let t=e?.type==="simple-marker";this.sketchPointSymbol=t?e:this._jsonUtils?.fromJSON(e||{type:"esriSMS",color:[255,255,255,255],angle:0,xoffset:0,yoffset:0,size:6,style:"esriSMSCircle",outline:{type:"esriSLS",color:[50,50,50,255],width:1,style:"esriSLSSolid"}})}_setPolygonSymbol(e){let t=e?.type==="simple-fill";this.sketchPolygonSymbol=t?e:this._jsonUtils?.fromJSON(e||{type:"esriSFS",color:[150,150,150,51],outline:{type:"esriSLS",color:[50,50,50,255],width:2,style:"esriSLSSolid"},style:"esriSFSSolid"})}_setIsMobile(e){this._isMobile=e.matches}_getActionGroup(e,t,i){let s=this.showRefineSelection?"w-1-3":"w-1-2";return l`<calcite-action-group class=${v(s)} layout=horizontal><div class="background-override"><calcite-action .active=${this._pageType===t} alignment=center appearance=solid class="width-full height-full" .icon=${e} id=${e??T} @click=${()=>{this._setPageType(t)}} text></calcite-action></div><calcite-tooltip label placement=bottom .referenceElement=${e}><span>${i}</span></calcite-tooltip></calcite-action-group>`}_setPageType(e){this._pageType=e}_getPage(e){let t;switch(e){case"LIST":t=this._getListPage();break;case"SELECT":t=this._getSelectPage();break;case"EXPORT":t=this._getExportPage();break;case"REFINE":t=this._getRefinePage();break}return t}_getListPage(){let e=this._hasSelections(),t=e?this._translations.listHasSetsTip:this.initialNotice!==""?this.initialNotice:this._translations.selectLayerAndAdd;return l`<calcite-panel>${this._getLabel(this._translations.myLists,!1,"header-label")}${this._getNotice(t||"","padding-sides-1 padding-bottom-1","word-wrap-anywhere")}${e?this._getSelectionSetList():this._getOnboardingImage()}<div class="display-flex padding-1"><calcite-button @click=${()=>{this._setPageType("SELECT")}} width=full><span class="font-weight-500">${this._translations.add}</span></calcite-button></div></calcite-panel>`}_getOnboardingImage(){return l`<div class="display-flex padding-sides-1"><img class="img-container" role=presentation src=${this._onboardingImageUrl??T}></div>`}_getSelectionSetList(){return l`<div class="padding-top-1-2 padding-bottom-1-2"><calcite-list class="list-border margin-sides-1" label>${this._selectionSets.reduce((e,t,i)=>{let s=this._getSelectionSetIds(t),a=!0;return t.workflowType==="REFINE"&&(a=Object.keys(t.refineInfos).reduce((o,h)=>{let c=t.refineInfos[h];return o+=c.addIds.length+c.removeIds.length,o},0)>0),a&&e.push(l`<calcite-list-item .label=${t.label} @click=${()=>this.mapView&&this._gotoSelection(t,this.mapView)}><div slot=content><div class="list-label">${t.label}</div><div class="list-description">${t?.layerView?.layer.title}</div><div class="list-description">${this._translations.selectedFeatures.replace("{{n}}",s.length.toString())}</div></div>${this._getAction(!0,"pencil","",o=>this._openSelection(t,o),!1,"actions-end")}${this._getAction(!0,"x","",o=>this._deleteSelection(i,o),!1,"actions-end")}</calcite-list-item>`),e},[])}</calcite-list></div>`}_getSelectionSetIds(e){return e.workflowType!=="REFINE"?e.selectedIds:Object.keys(e.refineInfos).reduce((t,i)=>[...t,...e.refineInfos[i].addIds],[])}_hasSelections(e=!1){let t=[],i=this._selectionSets.some(s=>s.workflowType==="REFINE"?(t=this._getSelectionSetIds(s),!0):!1);return e&&i?t.length>0||this._selectionSets.length>1:this._selectionSets.length>0}async _getNumDuplicates(){let e=this._getExportInfos(),t=this.mapView?.map&&await X(this.mapView.map,e),i=t&&Y(t);return t&&i?t.length-i.length:0}_getExportInfos(){return this._selectionSets.reduce((e,t)=>{if(t.download)if(t.workflowType!=="REFINE"&&t?.layerView){let i=t.layerView.layer.id;i!==void 0&&this._updateIds(i,t.layerView,t.selectedIds,e)}else Object.keys(t.refineInfos).forEach(i=>{let s=t.refineInfos[i];s.addIds.length>0&&this._updateIds(i,s.layerView,s.addIds,e)});return e},{})}_updateIds(e,t,i,s){return s[e]?s[e].ids=s[e].ids.concat(i):s[e]={layerView:t,ids:i},s}_getSelectPage(){let e=this._translations.selectSearchTip;return l`<calcite-panel>${this._getLabel(this._translations?.stepTwoFull,!0,"header-label")}${this._getNotice(e,"padding-1","word-wrap-anywhere")}<div><map-select-tools .bufferColor=${this.bufferColor} .bufferOutlineColor=${this.bufferOutlineColor} class="" .customLabelEnabled=${this.customLabelEnabled} .defaultBufferDistance=${this.defaultBufferDistance} .defaultBufferUnit=${this.defaultBufferUnit} .enableLayerFeatures=${this.enableLayerFeatures} .enableLayerFeaturesOnLoad=${this.enableLayerFeaturesOnLoad} .enableSearchDistance=${this.enableSearchDistance} .enableSearchDistanceOnLoad=${this.enableSearchDistanceOnLoad} .enableSketchTools=${this.enableSketchTools} .enabledLayerIds=${this.addresseeLayerIds} header-label-class .isUpdate=${!!this._activeSelection} .mapView=${this.mapView} .noResultText=${this.noResultText} @selectionSetChange=${this._updateForSelection} .searchConfiguration=${this._searchConfiguration} .searchDistanceEnabled=${this.enableSearchDistanceOnLoad} .selectionLayerIds=${this.selectionLayerIds} .selectionSet=${this._activeSelection} .sketchLineSymbol=${this.sketchLineSymbol} .sketchPointSymbol=${this.sketchPointSymbol} .sketchPolygonSymbol=${this.sketchPolygonSymbol} .useLayerFeaturesEnabled=${this.enableLayerFeaturesOnLoad} ${u(this._selectTools)}></map-select-tools></div>${this._getPageNavButtons(this._translations.done,this._numSelected===0,()=>{this._saveSelection()},this._translations.cancel,!1,()=>{this._home()})}</calcite-panel>`}_getExportPage(){let e=this._hasSelections(this.showRefineSelection),t=this._numDuplicates>0?"display-block":"display-none",i=this.customExport&&this.customExportURL&&this._layoutTemplates.length;return l`<calcite-panel><div>${this._getLabel(this._translations.export,!1,"header-label")}${e?l`<div>${this._getNotice(this._translations.exportTip,"padding-sides-1")}${this._getLabel(this._translations.exportListsLabel,!1,"")}${this._getExportSelectionLists()}<div class=${`padding-sides-1 ${t}`}><div class="display-flex"><calcite-label layout=inline><calcite-checkbox ${u(this._removeDuplicates)}></calcite-checkbox><div class="display-flex">${this._translations.removeDuplicate}<div class="info-message padding-start-1-2"><calcite-input-message class="info-blue margin-top-0" scale=m>${` ${this._translations.numDuplicates.replace("{{n}}",this._numDuplicates.toString())}`}</calcite-input-message></div></div></calcite-label><calcite-icon class="padding-start-1-2 icon" .flipRtl=${this._translations._lang?.toLowerCase()!=="he"} icon=question id=remove-duplicates-icon scale=s></calcite-icon></div><calcite-popover closable label overlay-positioning=fixed reference-element=remove-duplicates-icon><span class="tooltip-message">${this._translations.duplicatesTip}</span></calcite-popover></div><div class="border-bottom"></div><div class="segmented-controls padding-top-sides-1">${this._getLabel(this._translations.exportOptions,!0,"","margin-bottom-0-5")}${this._getSegmentedControls()}</div>${i?this._getCustomPrintOptions():l`<div class="padding-1 padding-bottom-0">${this._getExportOptions()}</div>`}<div class="padding-1 display-flex"><calcite-button .disabled=${!this._downloadActive||this._fetchingData||!this._addMap&&!this._addResults} .loading=${this._fetchingData} @click=${()=>this._segmentType==="CUSTOM"?this._customExport():void this._standardExport()} width=full><span class="font-weight-500">${this._translations.export}</span></calcite-button></div></div>`:this._getNotice(this._translations.downloadNoLists,"padding-sides-1 padding-bottom-1")}</div></calcite-panel>`}_customExport(){if(!this.mapView)return;let e=this.layoutTemplateSelectRef.value?this.layoutTemplateSelectRef.value.selectedOption.value:"",t=this.reportTemplateSelectRef.value?this.reportTemplateSelectRef.value.selectedOption.value:"";this._fetchingData=!0;let i=this._reportTemplatesInfo.find(c=>c.reportTemplate===t),s=i?{...i.reportOptions}:{},a=this._selectedReportingLayerId;s?.reportSectionOverrides&&Object.keys(s.reportSectionOverrides).forEach(c=>{s.reportSectionOverrides[c].sourceId=a});let o=new le({layout:e,report:t,format:"pdf",layoutOptions:{titleText:this._titleElement.value?.value},reportOptions:s}),h=new ne({view:this.mapView,template:o});ee.execute(this.customExportURL,h).then(c=>{let g=this._titleValue;if(!g){let d=this._getSelectionIdsAndViews(this._selectionSets,!0),m=K(d);g=Q(m)}c.url&&g&&this._downloadCustomPDF(c.url,g),this._fetchingData=!1}).catch(c=>{this._fetchingData=!1,console.error(c)})}async _downloadCustomPDF(e,t){try{let i=await fetch(e);if(!i.ok)throw new Error(`Failed to fetch PDF: ${i.statusText}`);let s=await i.blob(),a=window.URL.createObjectURL(s),o=document.createElement("a");o.href=a,o.download=t||"download.pdf";let h=document.getElementById("custom-export-div");h&&(h.appendChild(o),o.click(),window.URL.revokeObjectURL(a),h.removeChild(o))}catch(i){console.error("Download failed:",i)}}_exportTypeChange(e){this._exportType=e.target.value}_segmentTypeChange(e){this._titleValue="",this._segmentType=e.target.value}_getSegmentedControls(){return this.customExport&&this.customExportURL&&this._layoutTemplates.length?this._getStandardAndCustomSegmentedControl():this._getPDFAndCSVSementedControl()}_getPDFAndCSVSementedControl(){return l`<calcite-segmented-control class="w-100 calcite-segments" @calciteSegmentedControlChange=${this._exportTypeChange} width=full><calcite-segmented-control-item .checked=${this._exportType==="PDF"} class="w-50 end-border" value=PDF><span class="font-weight-500">${this._translations.pdf}</span></calcite-segmented-control-item><calcite-segmented-control-item .checked=${this._exportType==="CSV"} class="w-50" value=CSV><span class="font-weight-500">${this._translations.csv}</span></calcite-segmented-control-item></calcite-segmented-control>`}_getStandardAndCustomSegmentedControl(){return l`<calcite-segmented-control class="w-100 calcite-segments" @calciteSegmentedControlChange=${this._segmentTypeChange} width=full><calcite-segmented-control-item .checked=${this._segmentType==="STANDARD"} class="w-50 end-border" value=STANDARD><span class="font-weight-500">${this._translations.standard}</span></calcite-segmented-control-item><calcite-segmented-control-item .checked=${this._segmentType==="CUSTOM"} class="w-50" value=CUSTOM><span class="font-weight-500">${this._translations.custom}</span></calcite-segmented-control-item></calcite-segmented-control>`}_getCustomPrintOptions(){return this._segmentType==="STANDARD"?this._getStandardExportOptions():this._getCustomExportOptions()}_getStandardExportOptions(){return l`<div class="padding-1 padding-bottom-0"><calcite-label layout=inline alignment=start scale=m><calcite-radio-button .checked=${this._exportType==="PDF"} scale=m value=PDF @calciteRadioButtonChange=${this._exportTypeChange}></calcite-radio-button>${this._translations.pdf}</calcite-label><div class=indent-group>${this._getExportOptions()}</div><calcite-label layout=inline class="margin-top-1" alignment=start scale=m><calcite-radio-button .checked=${this._exportType==="CSV"} scale=m value=CSV @calciteRadioButtonChange=${this._exportTypeChange}></calcite-radio-button>${this._translations.csv}</calcite-label></div>`}_getCustomExportOptions(){let e=this._titleValue?this._titleValue:this.defaultExportTitle?this.defaultExportTitle:"",t=[],i=this._getSelectionIdsAndViews(this._selectionSets,!0);return Object.keys(i).forEach(s=>{i[s].ids.length&&t.push(s)}),l`<div id=custom-export-div class="padding-top-sides-1"><p class="instructional-text">${this._translations.formattingTip}</p>${t.length>1&&l`<p class="instructional-text margin-top-0-5">${this._translations.selectMatchingInputLayersLabel}</p>`||""}<div class=${"margin-top-1"}>${this._getLabel(this._translations.title,!0,"","none")}<calcite-input-text class="padding-inline-start-0 padding-top-1-2" @calciteInputTextInput=${()=>this._changeTitle()} .placeholder=${this._translations.titlePlaceholder} .value=${e} ${u(this._titleElement)}></calcite-input-text></div><div class=${"margin-top-1"}>${this._getLabel(this._translations.layoutTemplate,!0,"","none")}</div><calcite-select class="padding-inline-start-0 padding-top-1-2" label ${u(this.layoutTemplateSelectRef)}>${this._layoutTemplates.map((s,a)=>l`<calcite-option .selected=${a===0} .value=${s}>${s}</calcite-option>`)}</calcite-select>${this._reportTemplates?.length&&l`<div class=${"margin-top-1"}>${this._getLabel(this._translations.reportTemplate,!0,"","none")}</div><calcite-select class="padding-inline-start-0 padding-top-1-2" label ${u(this.reportTemplateSelectRef)}>${this._reportTemplates.map((s,a)=>l`<calcite-option .selected=${a===0} .value=${s}>${s}</calcite-option>`)}</calcite-select><div class=${"padding-top-sides-1 padding-inline-start-0 display-flex margin-bottom-0-5"}><calcite-label class="label-margin-0" layout=inline>${this._translations.reportLayer}</calcite-label><calcite-icon class="padding-start-1-2 icon" .flipRtl=${this._translations._lang?.toLowerCase()!=="he"} icon=information id=filter-message-info scale=s></calcite-icon><calcite-popover closable label overlay-positioning=fixed reference-element=filter-message-info><span class="tooltip-message">${this._translations.sourceLayerWarning}</span></calcite-popover></div><map-layer-picker .disabled=${t.length<=1} .enabledLayerIds=${t} .mapView=${this.mapView} @layerSelectionChange=${s=>{this._selectedReportingLayerId=s.detail[0]}} .selectedIds=${[this._selectedReportingLayerId]}></map-layer-picker>`||""}</div>`}async _setTemplates(){if(!this.customExportURL||!this.customExport){this.resetCustomExport();return}let e=this.customExportURL,t=`${e.split("/GPServer")?.[0]}/GPServer`;try{let i=await this.getTasksInfo(t),s="",a=i.tasks?.map(async d=>{await this.getTaskType(d,t)==="GetReportTemplatesInfo"&&(s=`${t}/${d}`)});a&&await Promise.all(a),s&&i.executionType&&await this._fetchReportTemplates(s,i.executionType);let o=(await O(e,{authMode:"auto",responseType:"json",query:{f:"json"}}))?.data,h=o.parameters.find(d=>d.name==="Layout_Template"&&Array.isArray(d.choiceList)),c=o.parameters.find(d=>d.name==="Report_Template"&&Array.isArray(d.choiceList));this._layoutTemplates=h?h.choiceList:[];let g=c?c.choiceList:[];this._reportTemplates=this._reportTemplatesInfo.length?g.filter(d=>this._reportTemplatesInfo.some(m=>m.reportTemplate===d)):[]}catch(i){this.resetCustomExport(),console.error(i)}}resetCustomExport(){this._layoutTemplates=[],this._reportTemplates=[],this._segmentType="STANDARD"}async getTaskType(e,t){if(!e||!t)return Promise.resolve("");let i=`${t}/${e}`;try{let s=(await O(i,{authMode:"auto",responseType:"json",query:{f:"json"}}))?.data?.name||"";return Promise.resolve(s)}catch(s){return console.error(s),Promise.resolve("")}}async getTasksInfo(e){if(!e)return Promise.resolve({});let t=`${e}?f=json`,i={authMode:"auto",responseType:"json",query:{f:"json"}};try{let s=(await O(t,i))?.data,a=s?.tasks,o=s?.executionType==="esriExecutionTypeSynchronous"?"execute":"submitJob";return{tasks:a,supportedOperations:o,executionType:s?.executionType}}catch(s){return this.resetCustomExport(),console.error(s),{}}}async _fetchReportTemplates(e,t){if(e)try{if(t==="esriExecutionTypeSynchronous"){let i=(await L.execute(e,{}))?.results?.find(s=>s.paramName==="Output_JSON");this._reportTemplatesInfo=i?.value??[]}else{let i=await L.submitJob(e,{});await i.waitForJobCompletion();let s=await i.fetchResultData("Output_JSON");this._reportTemplatesInfo=s?.value??[]}this._reportTemplatesInfo=this._reportTemplatesInfo.filter(i=>{let s=i.reportOptions;if(s?.reportSectionOverrides){let a=0;return Object.keys(s.reportSectionOverrides).forEach(o=>{s.reportSectionOverrides[o].hasOwnProperty("sourceId")&&a++}),a<=1}else return!0})}catch(i){console.error("Failed to fetch report templates:",i)}}_getExportOptions(){let e=this._exportType==="PDF"?"display-block":"display-none",t=this._addTitle?"display-block":"display-none",i=this._addMap?"display-flex":"display-none",s=this._titleValue?this._titleValue:this.defaultExportTitle?this.defaultExportTitle:"",a=this._addResults?"":"display-none";return l`<div class=${v(e)}><p class="instructional-text">${this._translations.selectContentTip}</p><div class="padding-top-sides-1 padding-inline-start-0"><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._addResults} @calciteCheckboxChange=${()=>this._addResults=!this._addResults}></calcite-checkbox>${this._translations.addResults}</calcite-label></div><div class=${`indent-group margin-top-1 ${a}`}><div class="margin-bottom-0-5"><calcite-label class="label-margin-0">${this._translations.selectPDFLabelOption}</calcite-label></div><div><pdf-download .defaultNumLabelsPerPage=${Number.parseInt(this.defaultNumLabelsPerPage.toString(),10)} .disabled=${!this._downloadActive} ${u(this._downloadTools)}></pdf-download></div></div><div class="padding-top-sides-1 padding-inline-start-0"><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._addTitle} @calciteCheckboxChange=${()=>this._addTitle=!this._addTitle}></calcite-checkbox>${this._translations.title}</calcite-label></div><div class=${`${t} indent-group margin-top-0-5`}><calcite-input-text class="padding-inline-start-0 padding-top-1-2" @calciteInputTextInput=${()=>this._changeTitle()} .placeholder=${this._translations.titlePlaceholder} .value=${s} ${u(this._titleElement)}></calcite-input-text></div><div class="padding-top-sides-1 padding-inline-start-0"><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._addMap} @calciteCheckboxChange=${()=>this._handleAddMapChange()}></calcite-checkbox>${this._translations.includeMap}</calcite-label></div><div class=${`padding-top-sides-1 padding-inline-start-0 ${i}`}><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._exportGraphics} @calciteCheckboxChange=${()=>this._handleExportGraphicsChange()}></calcite-checkbox>${this._translations.listGraphics}</calcite-label><calcite-icon class="padding-start-1-2 icon" .flipRtl=${this._translations._lang?.toLowerCase()!=="he"} icon=question id=list-graphics-icon scale=s></calcite-icon><calcite-popover closable label overlay-positioning=fixed reference-element=list-graphics-icon><span class="tooltip-message">${this._translations.listGraphicsTip}</span></calcite-popover></div></div>`}_handleAddMapChange(){this._addMap=!this._addMap,this._updateExportGraphics()}_handleExportGraphicsChange(){this._exportGraphics=!this._exportGraphics,this._updateExportGraphics()}_getManagedLayer(e){let t,i=this._pnStateContextProvider.value;return Object.keys(i.managedLayers).some(s=>{let a=this.mapView?.map.layers.findIndex(o=>o.title===s);return i.managedLayers[s]===e&&a!==void 0?(t=this.mapView?.map.layers.getItemAt(a),!0):!1}),t}_updateExportGraphics(e=!1){(e||!this._exportGraphics||!this._addMap)&&this._removeExportGraphics(),this._exportGraphics&&this._addMap&&this._addExportGraphics()}_removeExportGraphics(){let e=this._getManagedLayer("sketch"),t=this._getManagedLayer("buffer");e&&e.graphics.removeAll(),t&&t.graphics.removeAll()}_addExportGraphics(){let e=this._getManagedLayer("sketch"),t=this._getManagedLayer("buffer");this._refineGraphics.forEach(i=>{e?.add(i.drawnGraphic),t?.add(i.bufferGraphic)}),this._selectionSets.forEach(i=>{if(i.download&&(e&&i.sketchGraphic&&e.graphics.add(i.sketchGraphic),t)){let s={type:"simple-fill",color:this.bufferColor,outline:{color:this.bufferOutlineColor,width:1}},a=new oe({geometry:i.buffer,symbol:s});a&&t.graphics.add(a)}})}async _getExportCropArea(){if(!this.mapView)return;let[e,t]=this.mapView.size||[0,0];if(e<=0||t<=0)return;let i=[],s=n=>{n&&isFinite(n.xmin)&&isFinite(n.ymin)&&isFinite(n.xmax)&&isFinite(n.ymax)&&i.push({xmin:n.xmin,ymin:n.ymin,xmax:n.xmax,ymax:n.ymax,sr:n.spatialReference})},a=n=>{n?.graphics.forEach(r=>{let p=r?.geometry;p&&(p.extent?s(p.extent):typeof p.x=="number"&&typeof p.y=="number"&&i.push({xmin:p.x,ymin:p.y,xmax:p.x,ymax:p.y,sr:p.spatialReference}))})};a(this._getManagedLayer("buffer")),a(this._getManagedLayer("sketch"));let o=[];if(this._selectionSets.forEach(n=>{let r=(p,$)=>{p&&$?.length&&o.push(p.queryExtent({objectIds:$}).then(ae=>ae?.extent??null).catch(()=>null))};n.workflowType==="REFINE"&&n.refineInfos?Object.keys(n.refineInfos).forEach(p=>{let $=n.refineInfos[p];r($?.layerView,$?.addIds||[])}):r(n.layerView,n.selectedIds||[])}),o.length>0&&(await Promise.all(o)).forEach(n=>s(n)),i.length===0)return;let h=i[0].sr,c=i[0].xmin,g=i[0].ymin,d=i[0].xmax,m=i[0].ymax;for(let n=1;n<i.length;++n){let r=i[n];r.xmin<c&&(c=r.xmin),r.ymin<g&&(g=r.ymin),r.xmax>d&&(d=r.xmax),r.ymax>m&&(m=r.ymax)}let E=[{x:c,y:g,spatialReference:h},{x:c,y:m,spatialReference:h},{x:d,y:g,spatialReference:h},{x:d,y:m,spatialReference:h}],b=Number.POSITIVE_INFINITY,y=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY,w=Number.NEGATIVE_INFINITY;for(let n of E){let r=this.mapView.toScreen(n);!r||!isFinite(r.x)||!isFinite(r.y)||(r.x<b&&(b=r.x),r.y<y&&(y=r.y),r.x>S&&(S=r.x),r.y>w&&(w=r.y))}if(!isFinite(b)||!isFinite(y)||!isFinite(S)||!isFinite(w))return;let k=24;b=Math.max(0,Math.floor(b-k)),y=Math.max(0,Math.floor(y-k)),S=Math.min(e,Math.ceil(S+k)),w=Math.min(t,Math.ceil(w+k));let D=S-b,N=w-y;if(D<=0||N<=0)return;let F=8/10.5,ie=(b+S)/2,se=(y+w)/2,_=Math.max(D,N*F),x=_/F,I=Math.min(e/_,t/x);I>1&&(_*=I,x*=I),_>e&&(_=e),x>t&&(x=t);let C=ie-_/2,P=se-x/2;return C=Math.max(0,Math.min(C,e-_)),P=Math.max(0,Math.min(P,t-x)),{x:Math.floor(C),y:Math.floor(P),width:Math.floor(_),height:Math.floor(x)}}_getRefinePage(){let e=this._hasSelections();return l`<calcite-panel>${this._getLabel(this._translations.refineSelection,!1,"header-label")}${e?l`<div>${this._getNotice(this._translations.refineTip,"padding-sides-1")}<refine-selection .enabledLayerIds=${this.selectionLayerIds} .mapView=${this.mapView} .drawnGraphicsArr=${this._refineGraphics} .selectionSets=${this._selectionSets} .sketchLineSymbol=${this.sketchLineSymbol} .sketchPointSymbol=${this.sketchPointSymbol} .sketchPolygonSymbol=${this.sketchPolygonSymbol} .bufferColor=${this.bufferColor} .bufferOutlineColor=${this.bufferOutlineColor} .defaultBufferDistance=${this.defaultBufferDistance} .defaultBufferUnit=${this.defaultBufferUnit} .enableSearchDistance=${this.enableSearchDistance} .enableSearchDistanceOnLoad=${this.enableSearchDistanceOnLoad} .searchDistanceEnabled=${this.enableSearchDistanceOnLoad} ${u(this._refineSelection)}></refine-selection></div>`:this._getNotice(this._translations.refineTipNoSelections,"padding-sides-1")}</calcite-panel>`}_getPageNavButtons(e,t,i,s,a,o){return l`<div class="padding-bottom-1"><div class="display-flex padding-top-sides-1"><calcite-button .disabled=${t} @click=${i} width=full><span class="font-weight-500">${e}</span></calcite-button></div><div class="display-flex padding-top-1-2 padding-sides-1"><calcite-button appearance=outline .disabled=${a} @click=${o} width=full><span class="font-weight-500">${s}</span></calcite-button></div></div>`}_changeTitle(){this._titleElement.value?.value&&(this._titleValue=this._titleElement.value.value||"")}_getNotice(e,t="padding-1",i=""){return l`<calcite-notice class=${v(t)} icon=lightbulb kind=success open><div class=${v(i)} slot=message>${e}</div></calcite-notice>`}_getLabel(e,t=!1,i="font-bold",s="padding-top-sides-1"){return i+=t?" label-margin-0":"",l`<div class=${v(s)}><calcite-label class=${v(i)}>${e}</calcite-label></div>`}_getExportSelectionLists(){return this._selectionSets.reduce((e,t)=>{let i=this._getSelectionSetIds(t),s=t.workflowType!=="REFINE"||i.length>0;return!this._downloadActive&&t.download&&s&&(this._downloadActive=!0),s&&e.push(l`<div class="display-flex padding-sides-1 padding-bottom-1"><calcite-checkbox .checked=${t.download} class="align-center" @calciteCheckboxChange=${()=>{this._toggleDownload(t.id)}}></calcite-checkbox><calcite-list class="list-border margin-start-1-2 width-full" id=download-list label><calcite-list-item .disabled=${!t.download} .label=${t.label} @click=${()=>{this._toggleDownload(t.id)}}><div slot=content><div class="list-label">${t.label}</div><div class="list-description">${t.layerView?.layer.title}</div><div class="list-description">${this._translations.selectedFeatures.replace("{{n}}",i.length.toString())}</div></div></calcite-list-item></calcite-list></div>`),e},[])||l`<div></div>`}async _toggleDownload(e){let t=!1;this._selectionSets=this._selectionSets.map(i=>{let s=!1;return i.refineInfos&&Object.keys(i.refineInfos).forEach(a=>{i.refineInfos[a].addIds.length&&(s=!0)}),(i.workflowType!=="REFINE"||s)&&(i.download=i.id===e?!i.download:i.download,t=i.download?!0:t),i}),this._updateExportGraphics(!0),this._downloadActive=t,this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._fetchingData=!1,await this._highlightFeatures()}async _standardExport(){let e=this._addResults?this._getSelectionIdsAndViews(this._selectionSets,!0):{};if(this._exportType==="PDF"){let t="";if(this._addMap&&this.mapView){let i=await this._getExportCropArea(),[s,a]=this.mapView.size||[0,0],o=2e3,h=i?.width??s,c=i?.height??a,g=1500,d=2e3;if(h>0&&c>0){let E=o/Math.max(h,c);g=Math.max(1,Math.round(h*E)),d=Math.max(1,Math.round(c*E))}let m={width:g,height:d};i&&(m.area=i),t=(await this.mapView.takeScreenshot(m))?.dataUrl}this._fetchingData=!0,this._downloadTools.value&&this._removeDuplicates.value&&this.mapView?.map&&await this._downloadTools.value.downloadPDF(this.mapView.map,e,this._removeDuplicates.value.checked,this._addTitle&&this._titleElement.value?this._titleElement.value.value:"",t),this._fetchingData=!1}this._exportType==="CSV"&&(this._fetchingData=!0,this._downloadTools.value&&this.mapView?.map&&await this._downloadTools.value.downloadCSV(this.mapView.map,e,this._removeDuplicates.value?.checked||!1),this._fetchingData=!1)}_getSelectionIdsAndViews(e,t=!1){return(t?e.filter(i=>i.download):e).reduce((i,s)=>{if(s.workflowType==="REFINE")Object.keys(s.refineInfos).forEach(a=>{let o=s.refineInfos[a];if(o.addIds){let h=o.layerView.layer.id;i=this._updateExportInfos(i,h,s.label,o.addIds,o.layerView)}});else{let a=s?.layerView?.layer.id;a!==void 0&&s.layerView&&(i=this._updateExportInfos(i,a,s.label,s.selectedIds,s.layerView))}return i},{})}_updateExportInfos(e,t,i,s,a){return t&&Object.keys(e).indexOf(t)>-1?(e[t].ids=[...new Set([...e[t].ids,...s])],e[t].selectionSetNames.push(i)):t&&(e[t]={ids:s,layerView:a,selectionSetNames:[i]}),e}_getAction(e,t,i,s,a=!1,o=""){return l`<calcite-action appearance=solid .disabled=${!e} .icon=${t} icon-flip-rtl .indicator=${a} @click=${s} slot=${o??T} .text=${i}></calcite-action>`}_updateForSelection(e){this._numSelected=e.detail,this._saveEnabled=this._numSelected>0}async _home(){await this._clearSelection(),this._setPageType("LIST")}async _saveSelection(){let e=await this._selectTools.value?.getSelection();if(e){let t=this._selectTools.value?.isUpdate;this._selectionSets=t?this._selectionSets.map(i=>i.id===e.id?e:i):[...this._selectionSets,e]}return this._home()}async _clearSelection(){await this._selectTools.value?.clearSelection(),this._numSelected=0,this._activeSelection=void 0}async _deleteSelection(e,t){return t.stopPropagation(),this._selectionSets=this._selectionSets.filter((i,s)=>(i.workflowType==="REFINE"&&(this._refineGraphics=[]),s!==e?i:!1)),this._highlightFeatures()}_gotoSelection(e,t){e.selectedIds&&e.layerView&&q(e.selectedIds,e.layerView,t,this.featureHighlightEnabled,this.featureEffect)}_openSelection(e,t){t.stopPropagation(),this._activeSelection=e,this._pageType=e.workflowType==="REFINE"?"REFINE":"SELECT"}async _highlightFeatures(){let e=this._pnStateContextProvider.value;this._clearHighlight();let t=this._getSelectionIdsAndViews(this._selectionSets,this._pageType==="EXPORT"),i=Object.keys(t);if(i.length>0)for(let s=0;s<i.length;s++){let a=t[i[s]];if(a.layerView&&this.mapView){let o=await W(a.ids,a.layerView,this.mapView);e.highlightHandles.push(o)}}}_checkPopups(){typeof this._popupsEnabled!="boolean"&&(this._popupsEnabled=!!this.mapView?.popupEnabled)}_clearHighlight(){let e=this._pnStateContextProvider.value;e&&e.highlightHandles&&e.removeHandles()}};H("public-notification",V);return V},"Graphic","rest/support/PrintTemplate","rest/support/PrintParameters","rest/print","rest/geoprocessor","request",a,b,c,d)
2
+ import d from"./6GOYDVLJ.js";import{a as Z}from"./BM666UZR.js";import c from"./MSEGWVWC.js";import"./US5FON7D.js";import"./VVZAS55G.js";import{a as z}from"./YKQDHR27.js";import"./WU7QCA5H.js";import b from"./2C4DK6YC.js";import a from"./WV7QX3ED.js";import{a as J}from"./R67EKKSL.js";import"./BVWAUO73.js";import"./K3DQKY7V.js";import"./TEHBW75B.js";import"./ALSK2SPM.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./3IHLJADI.js";import"./BMBNSJZQ.js";import"./5HZMUGQD.js";import"./5VDDAINK.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LPBP7CBN.js";import"./3FMOO3PJ.js";import"./XQQ52NKX.js";import"./JUUVYK2H.js";import"./DKD2EGQP.js";import"./4HFHJOS3.js";import"./45M33Q5G.js";import"./FES7B3SJ.js";import{b as H,c as B}from"./KIUBUHVM.js";import{E as f,F as u,G as j,I as v,h as M,i as l,l as T,q as A,r as G,t as U}from"./H5E6ISYP.js";import"./QPIMTXPL.js";export default $arcgis.t(([oe,le,ne,ee,L,O,,{g:W,j:q},{a:X,d:Y,e:Q,f:K}])=>{var re=M`@layer{:host{display:block;--calcite-input-message-spacing-value: 0}.align-center{align-items:center}.border-bottom-1{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-color-border-3)}.action-bar-size{height:3.5rem;width:100%}.w-1-2{width:50%}.w-1-3{width:33.33%}.width-full{width:100%}.height-full{height:100%}.padding-1{padding:1rem}.padding-bottom-0{padding-bottom:0!important}.padding-inline-start-0{padding-inline-start:0!important}.padding-top-sides-1{padding-block-start:1rem;padding-inline-start:1rem;padding-inline-end:1rem}.padding-block-start-1{padding-block-start:1rem}.padding-sides-1{padding-inline-start:1rem;padding-inline-end:1rem}.padding-top-1-2{padding-block-start:.5rem!important}.padding-top-1{padding-top:1rem}.indent-group{border-inline-start:1px solid var(--calcite-color-border-2);margin-bottom:.5rem;padding-inline-start:1rem;margin-inline-start:.5rem}.margin-bottom-0-5{margin-bottom:.5rem}.margin-top-0-5{margin-top:.5rem!important}.instructional-text{line-height:1;padding:0!important;margin:0;color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--2)}.info-blue{color:var(--calcite-color-status-info)}.info-message{justify-content:center;display:grid}.font-bold{font-weight:700}.header-label{font-weight:700;font-size:var(--calcite-font-size-0)}.display-flex{display:flex}.display-block{display:block}.display-none{display:none}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-start-1-2{padding-inline-start:.5rem}.list-border{border:1px solid var(--calcite-color-border-2)}.margin-sides-1{margin-inline-start:1rem;margin-inline-end:1rem}.margin-start-1-2{margin-inline-start:.5rem}.margin-top-0{margin-block-start:0!important}.margin-top-1{margin-top:1rem!important}.label-margin-0{--calcite-label-margin-bottom: 0}.list-label{color:var(--calcite-color-text-1);font-weight:var(--calcite-font-weight-bold)!important}.list-label,.list-description{font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);overflow-wrap:break-word;word-break:break-word}.list-description{margin-block-start:.125rem;color:var(--calcite-color-text-3)}.img-container{width:100%;height:100%}.font-weight-500{font-weight:500}.background-override{height:100%;width:100%;--calcite-color-surface-4: var(--calcite-color-brand);--calcite-color-surface-3: var(--calcite-color-brand-hover);--calcite-color-text-1: var(--calcite-color-text-inverse)}.word-wrap-anywhere{word-wrap:anywhere}.list-container{padding:0 1rem 1rem}.list-items{align-items:center;background-color:#fff;box-shadow:0 1px 3px #0000001a;font-family:sans-serif;padding:12px 16px}.list-item{display:flex;align-items:center;justify-content:space-between}.item-label{color:#4a4a4a;font-size:16px}.tooltip-message{padding:5px 8px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-color-text-2);max-width:400px}calcite-segmented-control{--calcite-segmented-control-border-color: var(--calcite-color-border-2)}calcite-segmented-control-item{--calcite-segmented-control-color: var(--calcite-color-text-3)}calcite-segmented-control-item[checked]{--calcite-segmented-control-border-color: var(--calcite-color-surface-highlight);--calcite-segmented-control-background-color: var(--calcite-color-surface-highlight);--calcite-segmented-control-color: var(--calcite-color-text-highlight)}calcite-action-bar{--calcite-internal-action-bar-gap: 0px;--calcite-internal-action-bar-padding: 0px}}`,R=class extends G{constructor(){super(),this.managedLayers={},this.managedTables=[],this.highlightHandles=[]}removeHandles(){this.highlightHandles.forEach(e=>{e?.remove()}),this.highlightHandles=[]}},V=class extends j{constructor(){super(),this.addresseeLayerIds=[],this.bufferColor=[227,139,79,.8],this.bufferOutlineColor=[255,255,255],this.customLabelEnabled=!1,this.customExport=!1,this.customExportURL="",this.defaultBufferDistance=0,this.defaultBufferUnit="feet",this.defaultExportTitle="",this.defaultNumLabelsPerPage=6,this.enableLayerFeatures=!0,this.enableLayerFeaturesOnLoad=!1,this.enableSearchDistance=!0,this.enableSearchDistanceOnLoad=!1,this.enableSketchTools=!0,this.featureHighlightEnabled=!1,this.noResultText="",this.initialNotice="",this.selectionLayerIds=[],this.showRefineSelection=!1,this.showSearchSettings=!0,this._exportGraphics=!1,this._addMap=!1,this._addResults=!0,this._addTitle=!1,this._downloadActive=!0,this._exportType="PDF",this._fetchingData=!1,this._isMobile=!1,this._numDuplicates=0,this._pageType="LIST",this._saveEnabled=!1,this._selectionSets=[],this._segmentType="STANDARD",this._selectedReportingLayerId="",this._isInitialLoading=!0,this._layoutTemplates=[],this._translations=J({name:"public-notification",blocking:!0}),this._downloadTools=f(),this.layoutTemplateSelectRef=f(),this.reportTemplateSelectRef=f(),this._onboardingImageUrl="",this._popupsEnabled=!1,this._removeDuplicates=f(),this._selectTools=f(),this._refineSelection=f(),this._titleElement=f(),this._titleValue=void 0,this._numSelected=0,this._pnStateContextProvider=z({context:Z}),this._refineGraphics=[],this._reportTemplates=[],this._reportTemplatesInfo=[],this.searchConfigurationChange=A(),this.listenOn(window,"selectionSetsChanged",this.selectionSetsChanged),this._pnState=new R,this._pnStateContextProvider.setValue(this._pnState)}static{this.properties={addresseeLayerIds:0,bufferColor:1,bufferOutlineColor:1,customLabelEnabled:5,customExport:5,customExportURL:1,defaultBufferDistance:9,defaultBufferUnit:1,defaultExportTitle:1,defaultNumLabelsPerPage:9,enableLayerFeatures:5,enableLayerFeaturesOnLoad:5,enableSearchDistance:5,enableSearchDistanceOnLoad:5,enableSketchTools:5,featureEffect:0,featureHighlightEnabled:5,mapView:0,noResultText:1,initialNotice:1,searchConfiguration:0,selectionLayerIds:0,showRefineSelection:5,showSearchSettings:5,sketchLineSymbol:0,sketchPointSymbol:0,sketchPolygonSymbol:0,_exportGraphics:16,_addMap:16,_addResults:16,_addTitle:16,_downloadActive:16,_exportType:16,_fetchingData:16,_isMobile:16,_numDuplicates:16,_pageType:16,_saveEnabled:16,_selectionSets:16,_segmentType:16,_selectedReportingLayerId:16,_isInitialLoading:16,_layoutTemplates:16,_translations:16}}static{this.styles=re}static{this.shadowRootOptions=U}willUpdate(e){e.has("mapView")&&this.mapView&&this.mapViewWatchHandler(this.mapView),e.has("searchConfiguration")&&this.searchConfiguration&&this.watchSearchConfigurationHandler(this.searchConfiguration,e.get("searchConfiguration")),e.has("sketchLineSymbol")&&this.sketchLineSymbolWatchHandler(this.sketchLineSymbol,e.get("sketchLineSymbol")),e.has("sketchPointSymbol")&&this.sketchPointSymbolWatchHandler(this.sketchPointSymbol,e.get("sketchPointSymbol")),e.has("sketchPolygonSymbol")&&this.sketchPolygonSymbolWatchHandler(this.sketchPolygonSymbol,e.get("sketchPolygonSymbol")),e.has("_pageType")&&(this.hasUpdated||this._pageType!=="LIST")&&this.pageTypeWatchHandler(this._pageType,e.get("_pageType")),(e.has("customExport")||e.has("customExportURL"))&&this.hasUpdated&&this._setTemplates()}async mapViewWatchHandler(e){e?.popup&&(this._popupsEnabled=e?.popupEnabled),this.searchConfiguration&&this._initSearchConfiguration(this.searchConfiguration)}async watchSearchConfigurationHandler(e,t){let i=JSON.stringify(e);this.mapView&&(i!==JSON.stringify(t)||i&&!this._searchConfiguration)&&(this._searchConfiguration=JSON.parse(i),this._searchConfiguration&&this.searchConfigurationChange.emit(this._searchConfiguration),this._home())}async sketchLineSymbolWatchHandler(e,t){e&&JSON.stringify(e)!==JSON.stringify(t)&&this._setLineSymbol(e)}async sketchPointSymbolWatchHandler(e,t){e&&JSON.stringify(e)!==JSON.stringify(t)&&this._setPointSymbol(e)}async sketchPolygonSymbolWatchHandler(e,t){e&&JSON.stringify(e)!==JSON.stringify(t)&&this._setPolygonSymbol(e)}async pageTypeWatchHandler(e,t){if(this._checkPopups(),this.mapView?.popup&&(this.mapView.popupEnabled=e!=="LIST"?!1:this._popupsEnabled),e==="EXPORT"&&(this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._updateExportGraphics(),this._fetchingData=!1),this._clearHighlight(),(t==="SELECT"||t==="REFINE")&&await this._clearSelection(),t==="EXPORT"&&this._removeExportGraphics(),e!=="SELECT")return this._highlightFeatures()}selectionSetsChanged(e){this._selectionSets=[...e.detail]}connectedCallback(){super.connectedCallback(),this._mediaQuery=window.matchMedia("(max-width: 600px)"),this.listenOn(this._mediaQuery,"change",e=>this._setIsMobile(e))}async load(){this._initSymbols(),this._onboardingImageUrl=B("assets/public-notification/images/onboarding.png")}render(){let e=this._isMobile?"footer":"header";return l`<calcite-shell>${this._isInitialLoading?l`<calcite-loader label></calcite-loader>`:l`<calcite-action-bar class="border-bottom-1 action-bar-size" expand-disabled layout=horizontal slot=${e??T}>${this._getActionGroup("list-check","LIST",this._translations.myLists)}${this.showRefineSelection?this._getActionGroup("test-data","REFINE",this._translations.refineSelection):null}${this._getActionGroup("export","EXPORT",this._translations.export)}</calcite-action-bar>${this._getPage(this._pageType)}`}</calcite-shell>`}async loaded(){this.searchConfiguration&&this._initSearchConfiguration(this.searchConfiguration),this.customExport&&this.customExportURL&&await this._setTemplates(),this._isInitialLoading=!1}_initSearchConfiguration(e){this.searchConfiguration&&!this._searchConfiguration&&this.mapView&&(this._searchConfiguration=e,this.searchConfigurationChange.emit(this._searchConfiguration),this._home())}_initSymbols(){this._setLineSymbol(this.sketchLineSymbol),this._setPointSymbol(this.sketchPointSymbol),this._setPolygonSymbol(this.sketchPolygonSymbol)}_setLineSymbol(e){let t=e?.type==="simple-line";this.sketchLineSymbol=t?e:this._jsonUtils?.fromJSON(e||{type:"esriSLS",color:[130,130,130,255],width:2,style:"esriSLSSolid"})}_setPointSymbol(e){let t=e?.type==="simple-marker";this.sketchPointSymbol=t?e:this._jsonUtils?.fromJSON(e||{type:"esriSMS",color:[255,255,255,255],angle:0,xoffset:0,yoffset:0,size:6,style:"esriSMSCircle",outline:{type:"esriSLS",color:[50,50,50,255],width:1,style:"esriSLSSolid"}})}_setPolygonSymbol(e){let t=e?.type==="simple-fill";this.sketchPolygonSymbol=t?e:this._jsonUtils?.fromJSON(e||{type:"esriSFS",color:[150,150,150,51],outline:{type:"esriSLS",color:[50,50,50,255],width:2,style:"esriSLSSolid"},style:"esriSFSSolid"})}_setIsMobile(e){this._isMobile=e.matches}_getActionGroup(e,t,i){let s=this.showRefineSelection?"w-1-3":"w-1-2";return l`<calcite-action-group class=${v(s)} layout=horizontal><div class="background-override"><calcite-action .active=${this._pageType===t} alignment=center appearance=solid class="width-full height-full" .icon=${e} id=${e??T} @click=${()=>{this._setPageType(t)}} text></calcite-action></div><calcite-tooltip label placement=bottom .referenceElement=${e}><span>${i}</span></calcite-tooltip></calcite-action-group>`}_setPageType(e){this._pageType=e}_getPage(e){let t;switch(e){case"LIST":t=this._getListPage();break;case"SELECT":t=this._getSelectPage();break;case"EXPORT":t=this._getExportPage();break;case"REFINE":t=this._getRefinePage();break}return t}_getListPage(){let e=this._hasSelections(),t=e?this._translations.listHasSetsTip:this.initialNotice!==""?this.initialNotice:this._translations.selectLayerAndAdd;return l`<calcite-panel>${this._getLabel(this._translations.myLists,!1,"header-label")}${this._getNotice(t||"","padding-sides-1 padding-bottom-1","word-wrap-anywhere")}${e?this._getSelectionSetList():this._getOnboardingImage()}<div class="display-flex padding-1"><calcite-button @click=${()=>{this._setPageType("SELECT")}} width=full><span class="font-weight-500">${this._translations.add}</span></calcite-button></div></calcite-panel>`}_getOnboardingImage(){return l`<div class="display-flex padding-sides-1"><img class="img-container" role=presentation src=${this._onboardingImageUrl??T}></div>`}_getSelectionSetList(){return l`<div class="padding-top-1-2 padding-bottom-1-2"><calcite-list class="list-border margin-sides-1" label>${this._selectionSets.reduce((e,t,i)=>{let s=this._getSelectionSetIds(t),a=!0;return t.workflowType==="REFINE"&&(a=Object.keys(t.refineInfos).reduce((o,h)=>{let c=t.refineInfos[h];return o+=c.addIds.length+c.removeIds.length,o},0)>0),a&&e.push(l`<calcite-list-item .label=${t.label} @click=${()=>this.mapView&&this._gotoSelection(t,this.mapView)}><div slot=content><div class="list-label">${t.label}</div><div class="list-description">${t?.layerView?.layer.title}</div><div class="list-description">${this._translations.selectedFeatures.replace("{{n}}",s.length.toString())}</div></div>${this._getAction(!0,"pencil","",o=>this._openSelection(t,o),!1,"actions-end")}${this._getAction(!0,"x","",o=>this._deleteSelection(i,o),!1,"actions-end")}</calcite-list-item>`),e},[])}</calcite-list></div>`}_getSelectionSetIds(e){return e.workflowType!=="REFINE"?e.selectedIds:Object.keys(e.refineInfos).reduce((t,i)=>[...t,...e.refineInfos[i].addIds],[])}_hasSelections(e=!1){let t=[],i=this._selectionSets.some(s=>s.workflowType==="REFINE"?(t=this._getSelectionSetIds(s),!0):!1);return e&&i?t.length>0||this._selectionSets.length>1:this._selectionSets.length>0}async _getNumDuplicates(){let e=this._getExportInfos(),t=this.mapView?.map&&await X(this.mapView.map,e),i=t&&Y(t);return t&&i?t.length-i.length:0}_getExportInfos(){return this._selectionSets.reduce((e,t)=>{if(t.download)if(t.workflowType!=="REFINE"&&t?.layerView){let i=t.layerView.layer.id;i!==void 0&&this._updateIds(i,t.layerView,t.selectedIds,e)}else Object.keys(t.refineInfos).forEach(i=>{let s=t.refineInfos[i];s.addIds.length>0&&this._updateIds(i,s.layerView,s.addIds,e)});return e},{})}_updateIds(e,t,i,s){return s[e]?s[e].ids=s[e].ids.concat(i):s[e]={layerView:t,ids:i},s}_getSelectPage(){let e=this._translations.selectSearchTip;return l`<calcite-panel>${this._getLabel(this._translations?.stepTwoFull,!0,"header-label")}${this._getNotice(e,"padding-1","word-wrap-anywhere")}<div><map-select-tools .bufferColor=${this.bufferColor} .bufferOutlineColor=${this.bufferOutlineColor} class="" .customLabelEnabled=${this.customLabelEnabled} .defaultBufferDistance=${this.defaultBufferDistance} .defaultBufferUnit=${this.defaultBufferUnit} .enableLayerFeatures=${this.enableLayerFeatures} .enableLayerFeaturesOnLoad=${this.enableLayerFeaturesOnLoad} .enableSearchDistance=${this.enableSearchDistance} .enableSearchDistanceOnLoad=${this.enableSearchDistanceOnLoad} .enableSketchTools=${this.enableSketchTools} .enabledLayerIds=${this.addresseeLayerIds} header-label-class .isUpdate=${!!this._activeSelection} .mapView=${this.mapView} .noResultText=${this.noResultText} @selectionSetChange=${this._updateForSelection} .searchConfiguration=${this._searchConfiguration} .searchDistanceEnabled=${this.enableSearchDistanceOnLoad} .selectionLayerIds=${this.selectionLayerIds} .selectionSet=${this._activeSelection} .sketchLineSymbol=${this.sketchLineSymbol} .sketchPointSymbol=${this.sketchPointSymbol} .sketchPolygonSymbol=${this.sketchPolygonSymbol} .useLayerFeaturesEnabled=${this.enableLayerFeaturesOnLoad} ${u(this._selectTools)}></map-select-tools></div>${this._getPageNavButtons(this._translations.done,this._numSelected===0,()=>{this._saveSelection()},this._translations.cancel,!1,()=>{this._home()})}</calcite-panel>`}_getExportPage(){let e=this._hasSelections(this.showRefineSelection),t=this._numDuplicates>0?"display-block":"display-none",i=this.customExport&&this.customExportURL&&this._layoutTemplates.length;return l`<calcite-panel><div>${this._getLabel(this._translations.export,!1,"header-label")}${e?l`<div>${this._getNotice(this._translations.exportTip,"padding-sides-1")}${this._getLabel(this._translations.exportListsLabel,!1,"")}${this._getExportSelectionLists()}<div class=${`padding-sides-1 ${t}`}><div class="display-flex"><calcite-label layout=inline><calcite-checkbox ${u(this._removeDuplicates)}></calcite-checkbox><div class="display-flex">${this._translations.removeDuplicate}<div class="info-message padding-start-1-2"><calcite-input-message class="info-blue margin-top-0" scale=m>${` ${this._translations.numDuplicates.replace("{{n}}",this._numDuplicates.toString())}`}</calcite-input-message></div></div></calcite-label><calcite-icon class="padding-start-1-2 icon" .flipRtl=${this._translations._lang?.toLowerCase()!=="he"} icon=question id=remove-duplicates-icon scale=s></calcite-icon></div><calcite-popover closable label overlay-positioning=fixed reference-element=remove-duplicates-icon><span class="tooltip-message">${this._translations.duplicatesTip}</span></calcite-popover></div><div class="border-bottom"></div><div class="segmented-controls padding-top-sides-1">${this._getLabel(this._translations.exportOptions,!0,"","margin-bottom-0-5")}${this._getSegmentedControls()}</div>${i?this._getCustomPrintOptions():l`<div class="padding-1 padding-bottom-0">${this._getExportOptions()}</div>`}<div class="padding-1 display-flex"><calcite-button .disabled=${!this._downloadActive||this._fetchingData||!this._addMap&&!this._addResults} .loading=${this._fetchingData} @click=${()=>this._segmentType==="CUSTOM"?this._customExport():void this._standardExport()} width=full><span class="font-weight-500">${this._translations.export}</span></calcite-button></div></div>`:this._getNotice(this._translations.downloadNoLists,"padding-sides-1 padding-bottom-1")}</div></calcite-panel>`}_customExport(){if(!this.mapView)return;let e=this.layoutTemplateSelectRef.value?this.layoutTemplateSelectRef.value.selectedOption.value:"",t=this.reportTemplateSelectRef.value?this.reportTemplateSelectRef.value.selectedOption.value:"";this._fetchingData=!0;let i=this._reportTemplatesInfo.find(c=>c.reportTemplate===t),s=i?{...i.reportOptions}:{},a=this._selectedReportingLayerId;s?.reportSectionOverrides&&Object.keys(s.reportSectionOverrides).forEach(c=>{s.reportSectionOverrides[c].sourceId=a});let o=new le({layout:e,report:t,format:"pdf",layoutOptions:{titleText:this._titleElement.value?.value},reportOptions:s}),h=new ne({view:this.mapView,template:o});ee.execute(this.customExportURL,h).then(c=>{let g=this._titleValue;if(!g){let d=this._getSelectionIdsAndViews(this._selectionSets,!0),m=K(d);g=Q(m)}c.url&&g&&this._downloadCustomPDF(c.url,g),this._fetchingData=!1}).catch(c=>{this._fetchingData=!1,console.error(c)})}async _downloadCustomPDF(e,t){try{let i=await fetch(e);if(!i.ok)throw new Error(`Failed to fetch PDF: ${i.statusText}`);let s=await i.blob(),a=window.URL.createObjectURL(s),o=document.createElement("a");o.href=a,o.download=t||"download.pdf";let h=document.getElementById("custom-export-div");h&&(h.appendChild(o),o.click(),window.URL.revokeObjectURL(a),h.removeChild(o))}catch(i){console.error("Download failed:",i)}}_exportTypeChange(e){this._exportType=e.target.value}_segmentTypeChange(e){this._titleValue="",this._segmentType=e.target.value}_getSegmentedControls(){return this.customExport&&this.customExportURL&&this._layoutTemplates.length?this._getStandardAndCustomSegmentedControl():this._getPDFAndCSVSementedControl()}_getPDFAndCSVSementedControl(){return l`<calcite-segmented-control class="w-100 calcite-segments" @calciteSegmentedControlChange=${this._exportTypeChange} width=full><calcite-segmented-control-item .checked=${this._exportType==="PDF"} class="w-50 end-border" value=PDF><span class="font-weight-500">${this._translations.pdf}</span></calcite-segmented-control-item><calcite-segmented-control-item .checked=${this._exportType==="CSV"} class="w-50" value=CSV><span class="font-weight-500">${this._translations.csv}</span></calcite-segmented-control-item></calcite-segmented-control>`}_getStandardAndCustomSegmentedControl(){return l`<calcite-segmented-control class="w-100 calcite-segments" @calciteSegmentedControlChange=${this._segmentTypeChange} width=full><calcite-segmented-control-item .checked=${this._segmentType==="STANDARD"} class="w-50 end-border" value=STANDARD><span class="font-weight-500">${this._translations.standard}</span></calcite-segmented-control-item><calcite-segmented-control-item .checked=${this._segmentType==="CUSTOM"} class="w-50" value=CUSTOM><span class="font-weight-500">${this._translations.custom}</span></calcite-segmented-control-item></calcite-segmented-control>`}_getCustomPrintOptions(){return this._segmentType==="STANDARD"?this._getStandardExportOptions():this._getCustomExportOptions()}_getStandardExportOptions(){return l`<div class="padding-1 padding-bottom-0"><calcite-label layout=inline alignment=start scale=m><calcite-radio-button .checked=${this._exportType==="PDF"} scale=m value=PDF @calciteRadioButtonChange=${this._exportTypeChange}></calcite-radio-button>${this._translations.pdf}</calcite-label><div class=indent-group>${this._getExportOptions()}</div><calcite-label layout=inline class="margin-top-1" alignment=start scale=m><calcite-radio-button .checked=${this._exportType==="CSV"} scale=m value=CSV @calciteRadioButtonChange=${this._exportTypeChange}></calcite-radio-button>${this._translations.csv}</calcite-label></div>`}_getCustomExportOptions(){let e=this._titleValue?this._titleValue:this.defaultExportTitle?this.defaultExportTitle:"",t=[],i=this._getSelectionIdsAndViews(this._selectionSets,!0);return Object.keys(i).forEach(s=>{i[s].ids.length&&t.push(s)}),l`<div id=custom-export-div class="padding-top-sides-1"><p class="instructional-text">${this._translations.formattingTip}</p>${t.length>1&&l`<p class="instructional-text margin-top-0-5">${this._translations.selectMatchingInputLayersLabel}</p>`||""}<div class=${"margin-top-1"}>${this._getLabel(this._translations.title,!0,"","none")}<calcite-input-text class="padding-inline-start-0 padding-top-1-2" @calciteInputTextInput=${()=>this._changeTitle()} .placeholder=${this._translations.titlePlaceholder} .value=${e} ${u(this._titleElement)}></calcite-input-text></div><div class=${"margin-top-1"}>${this._getLabel(this._translations.layoutTemplate,!0,"","none")}</div><calcite-select class="padding-inline-start-0 padding-top-1-2" label ${u(this.layoutTemplateSelectRef)}>${this._layoutTemplates.map((s,a)=>l`<calcite-option .selected=${a===0} .value=${s}>${s}</calcite-option>`)}</calcite-select>${this._reportTemplates?.length&&l`<div class=${"margin-top-1"}>${this._getLabel(this._translations.reportTemplate,!0,"","none")}</div><calcite-select class="padding-inline-start-0 padding-top-1-2" label ${u(this.reportTemplateSelectRef)}>${this._reportTemplates.map((s,a)=>l`<calcite-option .selected=${a===0} .value=${s}>${s}</calcite-option>`)}</calcite-select><div class=${"padding-top-sides-1 padding-inline-start-0 display-flex margin-bottom-0-5"}><calcite-label class="label-margin-0" layout=inline>${this._translations.reportLayer}</calcite-label><calcite-icon class="padding-start-1-2 icon" .flipRtl=${this._translations._lang?.toLowerCase()!=="he"} icon=information id=filter-message-info scale=s></calcite-icon><calcite-popover closable label overlay-positioning=fixed reference-element=filter-message-info><span class="tooltip-message">${this._translations.sourceLayerWarning}</span></calcite-popover></div><map-layer-picker .disabled=${t.length<=1} .enabledLayerIds=${t} .mapView=${this.mapView} @layerSelectionChange=${s=>{this._selectedReportingLayerId=s.detail[0]}} .selectedIds=${[this._selectedReportingLayerId]}></map-layer-picker>`||""}</div>`}async _setTemplates(){if(!this.customExportURL||!this.customExport){this.resetCustomExport();return}let e=this.customExportURL,t=`${e.split("/GPServer")?.[0]}/GPServer`;try{let i=await this.getTasksInfo(t),s="",a=i.tasks?.map(async d=>{await this.getTaskType(d,t)==="GetReportTemplatesInfo"&&(s=`${t}/${d}`)});a&&await Promise.all(a),s&&i.executionType&&await this._fetchReportTemplates(s,i.executionType);let o=(await O(e,{authMode:"auto",responseType:"json",query:{f:"json"}}))?.data,h=o.parameters.find(d=>d.name==="Layout_Template"&&Array.isArray(d.choiceList)),c=o.parameters.find(d=>d.name==="Report_Template"&&Array.isArray(d.choiceList));this._layoutTemplates=h?h.choiceList:[];let g=c?c.choiceList:[];this._reportTemplates=this._reportTemplatesInfo.length?g.filter(d=>this._reportTemplatesInfo.some(m=>m.reportTemplate===d)):[]}catch(i){this.resetCustomExport(),console.error(i)}}resetCustomExport(){this._layoutTemplates=[],this._reportTemplates=[],this._segmentType="STANDARD"}async getTaskType(e,t){if(!e||!t)return Promise.resolve("");let i=`${t}/${e}`;try{let s=(await O(i,{authMode:"auto",responseType:"json",query:{f:"json"}}))?.data?.name||"";return Promise.resolve(s)}catch(s){return console.error(s),Promise.resolve("")}}async getTasksInfo(e){if(!e)return Promise.resolve({});let t=`${e}?f=json`,i={authMode:"auto",responseType:"json",query:{f:"json"}};try{let s=(await O(t,i))?.data,a=s?.tasks,o=s?.executionType==="esriExecutionTypeSynchronous"?"execute":"submitJob";return{tasks:a,supportedOperations:o,executionType:s?.executionType}}catch(s){return this.resetCustomExport(),console.error(s),{}}}async _fetchReportTemplates(e,t){if(e)try{if(t==="esriExecutionTypeSynchronous"){let i=(await L.execute(e,{}))?.results?.find(s=>s.paramName==="Output_JSON");this._reportTemplatesInfo=i?.value??[]}else{let i=await L.submitJob(e,{});await i.waitForJobCompletion();let s=await i.fetchResultData("Output_JSON");this._reportTemplatesInfo=s?.value??[]}this._reportTemplatesInfo=this._reportTemplatesInfo.filter(i=>{let s=i.reportOptions;if(s?.reportSectionOverrides){let a=0;return Object.keys(s.reportSectionOverrides).forEach(o=>{s.reportSectionOverrides[o].hasOwnProperty("sourceId")&&a++}),a<=1}else return!0})}catch(i){console.error("Failed to fetch report templates:",i)}}_getExportOptions(){let e=this._exportType==="PDF"?"display-block":"display-none",t=this._addTitle?"display-block":"display-none",i=this._addMap?"display-flex":"display-none",s=this._titleValue?this._titleValue:this.defaultExportTitle?this.defaultExportTitle:"",a=this._addResults?"":"display-none";return l`<div class=${v(e)}><p class="instructional-text">${this._translations.selectContentTip}</p><div class="padding-top-sides-1 padding-inline-start-0"><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._addResults} @calciteCheckboxChange=${()=>this._addResults=!this._addResults}></calcite-checkbox>${this._translations.addResults}</calcite-label></div><div class=${`indent-group margin-top-1 ${a}`}><div class="margin-bottom-0-5"><calcite-label class="label-margin-0">${this._translations.selectPDFLabelOption}</calcite-label></div><div><pdf-download .defaultNumLabelsPerPage=${Number.parseInt(this.defaultNumLabelsPerPage.toString(),10)} .disabled=${!this._downloadActive} ${u(this._downloadTools)}></pdf-download></div></div><div class="padding-top-sides-1 padding-inline-start-0"><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._addTitle} @calciteCheckboxChange=${()=>this._addTitle=!this._addTitle}></calcite-checkbox>${this._translations.title}</calcite-label></div><div class=${`${t} indent-group margin-top-0-5`}><calcite-input-text class="padding-inline-start-0 padding-top-1-2" @calciteInputTextInput=${()=>this._changeTitle()} .placeholder=${this._translations.titlePlaceholder} .value=${s} ${u(this._titleElement)}></calcite-input-text></div><div class="padding-top-sides-1 padding-inline-start-0"><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._addMap} @calciteCheckboxChange=${()=>this._handleAddMapChange()}></calcite-checkbox>${this._translations.includeMap}</calcite-label></div><div class=${`padding-top-sides-1 padding-inline-start-0 ${i}`}><calcite-label class="label-margin-0" layout=inline><calcite-checkbox .checked=${this._exportGraphics} @calciteCheckboxChange=${()=>this._handleExportGraphicsChange()}></calcite-checkbox>${this._translations.listGraphics}</calcite-label><calcite-icon class="padding-start-1-2 icon" .flipRtl=${this._translations._lang?.toLowerCase()!=="he"} icon=question id=list-graphics-icon scale=s></calcite-icon><calcite-popover closable label overlay-positioning=fixed reference-element=list-graphics-icon><span class="tooltip-message">${this._translations.listGraphicsTip}</span></calcite-popover></div></div>`}_handleAddMapChange(){this._addMap=!this._addMap,this._updateExportGraphics()}_handleExportGraphicsChange(){this._exportGraphics=!this._exportGraphics,this._updateExportGraphics()}_getManagedLayer(e){let t,i=this._pnStateContextProvider.value;return Object.keys(i.managedLayers).some(s=>{let a=this.mapView?.map.layers.findIndex(o=>o.title===s);return i.managedLayers[s]===e&&a!==void 0?(t=this.mapView?.map.layers.getItemAt(a),!0):!1}),t}_updateExportGraphics(e=!1){(e||!this._exportGraphics||!this._addMap)&&this._removeExportGraphics(),this._exportGraphics&&this._addMap&&this._addExportGraphics()}_removeExportGraphics(){let e=this._getManagedLayer("sketch"),t=this._getManagedLayer("buffer");e&&e.graphics.removeAll(),t&&t.graphics.removeAll()}_addExportGraphics(){let e=this._getManagedLayer("sketch"),t=this._getManagedLayer("buffer");this._refineGraphics.forEach(i=>{e?.add(i.drawnGraphic),t?.add(i.bufferGraphic)}),this._selectionSets.forEach(i=>{if(i.download&&(e&&i.sketchGraphic&&e.graphics.add(i.sketchGraphic),t)){let s={type:"simple-fill",color:this.bufferColor,outline:{color:this.bufferOutlineColor,width:1}},a=new oe({geometry:i.buffer,symbol:s});a&&t.graphics.add(a)}})}async _getExportCropArea(){if(!this.mapView)return;let[e,t]=this.mapView.size||[0,0];if(e<=0||t<=0)return;let i=[],s=n=>{n&&isFinite(n.xmin)&&isFinite(n.ymin)&&isFinite(n.xmax)&&isFinite(n.ymax)&&i.push({xmin:n.xmin,ymin:n.ymin,xmax:n.xmax,ymax:n.ymax,sr:n.spatialReference})},a=n=>{n?.graphics.forEach(r=>{let p=r?.geometry;p&&(p.extent?s(p.extent):typeof p.x=="number"&&typeof p.y=="number"&&i.push({xmin:p.x,ymin:p.y,xmax:p.x,ymax:p.y,sr:p.spatialReference}))})};a(this._getManagedLayer("buffer")),a(this._getManagedLayer("sketch"));let o=[];if(this._selectionSets.forEach(n=>{let r=(p,$)=>{p&&$?.length&&o.push(p.queryExtent({objectIds:$}).then(ae=>ae?.extent??null).catch(()=>null))};n.workflowType==="REFINE"&&n.refineInfos?Object.keys(n.refineInfos).forEach(p=>{let $=n.refineInfos[p];r($?.layerView,$?.addIds||[])}):r(n.layerView,n.selectedIds||[])}),o.length>0&&(await Promise.all(o)).forEach(n=>s(n)),i.length===0)return;let h=i[0].sr,c=i[0].xmin,g=i[0].ymin,d=i[0].xmax,m=i[0].ymax;for(let n=1;n<i.length;++n){let r=i[n];r.xmin<c&&(c=r.xmin),r.ymin<g&&(g=r.ymin),r.xmax>d&&(d=r.xmax),r.ymax>m&&(m=r.ymax)}let E=[{x:c,y:g,spatialReference:h},{x:c,y:m,spatialReference:h},{x:d,y:g,spatialReference:h},{x:d,y:m,spatialReference:h}],b=Number.POSITIVE_INFINITY,y=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY,w=Number.NEGATIVE_INFINITY;for(let n of E){let r=this.mapView.toScreen(n);!r||!isFinite(r.x)||!isFinite(r.y)||(r.x<b&&(b=r.x),r.y<y&&(y=r.y),r.x>S&&(S=r.x),r.y>w&&(w=r.y))}if(!isFinite(b)||!isFinite(y)||!isFinite(S)||!isFinite(w))return;let k=24;b=Math.max(0,Math.floor(b-k)),y=Math.max(0,Math.floor(y-k)),S=Math.min(e,Math.ceil(S+k)),w=Math.min(t,Math.ceil(w+k));let D=S-b,N=w-y;if(D<=0||N<=0)return;let F=8/10.5,ie=(b+S)/2,se=(y+w)/2,_=Math.max(D,N*F),x=_/F,I=Math.min(e/_,t/x);I>1&&(_*=I,x*=I),_>e&&(_=e),x>t&&(x=t);let C=ie-_/2,P=se-x/2;return C=Math.max(0,Math.min(C,e-_)),P=Math.max(0,Math.min(P,t-x)),{x:Math.floor(C),y:Math.floor(P),width:Math.floor(_),height:Math.floor(x)}}_getRefinePage(){let e=this._hasSelections();return l`<calcite-panel>${this._getLabel(this._translations.refineSelection,!1,"header-label")}${e?l`<div>${this._getNotice(this._translations.refineTip,"padding-sides-1")}<refine-selection .enabledLayerIds=${this.selectionLayerIds} .mapView=${this.mapView} .drawnGraphicsArr=${this._refineGraphics} .selectionSets=${this._selectionSets} .sketchLineSymbol=${this.sketchLineSymbol} .sketchPointSymbol=${this.sketchPointSymbol} .sketchPolygonSymbol=${this.sketchPolygonSymbol} .bufferColor=${this.bufferColor} .bufferOutlineColor=${this.bufferOutlineColor} .defaultBufferDistance=${this.defaultBufferDistance} .defaultBufferUnit=${this.defaultBufferUnit} .enableSearchDistance=${this.enableSearchDistance} .enableSearchDistanceOnLoad=${this.enableSearchDistanceOnLoad} .searchDistanceEnabled=${this.enableSearchDistanceOnLoad} ${u(this._refineSelection)}></refine-selection></div>`:this._getNotice(this._translations.refineTipNoSelections,"padding-sides-1")}</calcite-panel>`}_getPageNavButtons(e,t,i,s,a,o){return l`<div class="padding-bottom-1"><div class="display-flex padding-top-sides-1"><calcite-button .disabled=${t} @click=${i} width=full><span class="font-weight-500">${e}</span></calcite-button></div><div class="display-flex padding-top-1-2 padding-sides-1"><calcite-button appearance=outline .disabled=${a} @click=${o} width=full><span class="font-weight-500">${s}</span></calcite-button></div></div>`}_changeTitle(){this._titleElement.value?.value&&(this._titleValue=this._titleElement.value.value||"")}_getNotice(e,t="padding-1",i=""){return l`<calcite-notice class=${v(t)} icon=lightbulb kind=success open><div class=${v(i)} slot=message>${e}</div></calcite-notice>`}_getLabel(e,t=!1,i="font-bold",s="padding-top-sides-1"){return i+=t?" label-margin-0":"",l`<div class=${v(s)}><calcite-label class=${v(i)}>${e}</calcite-label></div>`}_getExportSelectionLists(){return this._selectionSets.reduce((e,t)=>{let i=this._getSelectionSetIds(t),s=t.workflowType!=="REFINE"||i.length>0;return!this._downloadActive&&t.download&&s&&(this._downloadActive=!0),s&&e.push(l`<div class="display-flex padding-sides-1 padding-bottom-1"><calcite-checkbox .checked=${t.download} class="align-center" @calciteCheckboxChange=${()=>{this._toggleDownload(t.id)}}></calcite-checkbox><calcite-list class="list-border margin-start-1-2 width-full" id=download-list label><calcite-list-item .disabled=${!t.download} .label=${t.label} @click=${()=>{this._toggleDownload(t.id)}}><div slot=content><div class="list-label">${t.label}</div><div class="list-description">${t.layerView?.layer.title}</div><div class="list-description">${this._translations.selectedFeatures.replace("{{n}}",i.length.toString())}</div></div></calcite-list-item></calcite-list></div>`),e},[])||l`<div></div>`}async _toggleDownload(e){let t=!1;this._selectionSets=this._selectionSets.map(i=>{let s=!1;return i.refineInfos&&Object.keys(i.refineInfos).forEach(a=>{i.refineInfos[a].addIds.length&&(s=!0)}),(i.workflowType!=="REFINE"||s)&&(i.download=i.id===e?!i.download:i.download,t=i.download?!0:t),i}),this._updateExportGraphics(!0),this._downloadActive=t,this._fetchingData=!0,this._numDuplicates=await this._getNumDuplicates(),this._fetchingData=!1,await this._highlightFeatures()}async _standardExport(){let e=this._addResults?this._getSelectionIdsAndViews(this._selectionSets,!0):{};if(this._exportType==="PDF"){let t="";if(this._addMap&&this.mapView){let i=await this._getExportCropArea(),[s,a]=this.mapView.size||[0,0],o=2e3,h=i?.width??s,c=i?.height??a,g=1500,d=2e3;if(h>0&&c>0){let E=o/Math.max(h,c);g=Math.max(1,Math.round(h*E)),d=Math.max(1,Math.round(c*E))}let m={width:g,height:d};i&&(m.area=i),t=(await this.mapView.takeScreenshot(m))?.dataUrl}this._fetchingData=!0,this._downloadTools.value&&this._removeDuplicates.value&&this.mapView?.map&&await this._downloadTools.value.downloadPDF(this.mapView.map,e,this._removeDuplicates.value.checked,this._addTitle&&this._titleElement.value?this._titleElement.value.value:"",t),this._fetchingData=!1}this._exportType==="CSV"&&(this._fetchingData=!0,this._downloadTools.value&&this.mapView?.map&&await this._downloadTools.value.downloadCSV(this.mapView.map,e,this._removeDuplicates.value?.checked||!1),this._fetchingData=!1)}_getSelectionIdsAndViews(e,t=!1){return(t?e.filter(i=>i.download):e).reduce((i,s)=>{if(s.workflowType==="REFINE")Object.keys(s.refineInfos).forEach(a=>{let o=s.refineInfos[a];if(o.addIds){let h=o.layerView.layer.id;i=this._updateExportInfos(i,h,s.label,o.addIds,o.layerView)}});else{let a=s?.layerView?.layer.id;a!==void 0&&s.layerView&&(i=this._updateExportInfos(i,a,s.label,s.selectedIds,s.layerView))}return i},{})}_updateExportInfos(e,t,i,s,a){return t&&Object.keys(e).indexOf(t)>-1?(e[t].ids=[...new Set([...e[t].ids,...s])],e[t].selectionSetNames.push(i)):t&&(e[t]={ids:s,layerView:a,selectionSetNames:[i]}),e}_getAction(e,t,i,s,a=!1,o=""){return l`<calcite-action appearance=solid .disabled=${!e} .icon=${t} icon-flip-rtl .indicator=${a} @click=${s} slot=${o??T} .text=${i}></calcite-action>`}_updateForSelection(e){this._numSelected=e.detail,this._saveEnabled=this._numSelected>0}async _home(){await this._clearSelection(),this._setPageType("LIST")}async _saveSelection(){let e=await this._selectTools.value?.getSelection();if(e){let t=this._selectTools.value?.isUpdate;this._selectionSets=t?this._selectionSets.map(i=>i.id===e.id?e:i):[...this._selectionSets,e]}return this._home()}async _clearSelection(){await this._selectTools.value?.clearSelection(),this._numSelected=0,this._activeSelection=void 0}async _deleteSelection(e,t){return t.stopPropagation(),this._selectionSets=this._selectionSets.filter((i,s)=>(i.workflowType==="REFINE"&&(this._refineGraphics=[]),s!==e?i:!1)),this._highlightFeatures()}_gotoSelection(e,t){e.selectedIds&&e.layerView&&q(e.selectedIds,e.layerView,t,this.featureHighlightEnabled,this.featureEffect)}_openSelection(e,t){t.stopPropagation(),this._activeSelection=e,this._pageType=e.workflowType==="REFINE"?"REFINE":"SELECT"}async _highlightFeatures(){let e=this._pnStateContextProvider.value;this._clearHighlight();let t=this._getSelectionIdsAndViews(this._selectionSets,this._pageType==="EXPORT"),i=Object.keys(t);if(i.length>0)for(let s=0;s<i.length;s++){let a=t[i[s]];if(a.layerView&&this.mapView){let o=await W(a.ids,a.layerView,this.mapView);e.highlightHandles.push(o)}}}_checkPopups(){typeof this._popupsEnabled!="boolean"&&(this._popupsEnabled=!!this.mapView?.popupEnabled)}_clearHighlight(){let e=this._pnStateContextProvider.value;e&&e.highlightHandles&&e.removeHandles()}};H("public-notification",V);return V},"Graphic","rest/support/PrintTemplate","rest/support/PrintParameters","rest/print","rest/geoprocessor","request",a,b,c,d)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import a from"./ABL2KXLF.js";export default $arcgis.t(([,,,{a:s}])=>{function f(t,n){let r=i(n),o=s([{k:"id",v:t}])||"";return r?`${r}/home/item.html${o}`:""}function l(t,n,r,o){let e=o||i(r);return e?`${e}/sharing/rest/content/items/${t}/resources/${n}`:""}function i(t){return t?.PortalSubset?.orgUrl||t?.PortalUrl||""}function $(t,n){let r=new URL(t);return r.searchParams.set("token",n),r.toString()}return{a:f,b:l,c:$}},"identity/IdentityManager","identity/OAuthInfo","portal/Portal",a)
2
+ import a from"./VK6ZOC6A.js";export default $arcgis.t(([,,,{a:s}])=>{function f(t,n){let r=i(n),o=s([{k:"id",v:t}])||"";return r?`${r}/home/item.html${o}`:""}function l(t,n,r,o){let e=o||i(r);return e?`${e}/sharing/rest/content/items/${t}/resources/${n}`:""}function i(t){return t?.PortalSubset?.orgUrl||t?.PortalUrl||""}function $(t,n){let r=new URL(t);return r.searchParams.set("token",n),r.toString()}return{a:f,b:l,c:$}},"identity/IdentityManager","identity/OAuthInfo","portal/Portal",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import a from"./ABL2KXLF.js";import{a as f,b as v}from"./2B4SGB3I.js";import{b as r}from"./YKQDHR27.js";import{a as b}from"./R67EKKSL.js";import{b as g}from"./KIUBUHVM.js";import{E as s,F as l,G as p,J as u,h as d,i,j as h,q as o}from"./H5E6ISYP.js";export default $arcgis.t(([{q:m,r:x}])=>{var w=d`calcite-shell-panel{z-index:var(--calcite-z-index-1)}.display-flex{display:flex}.flex-1,.flex-grow{flex:1}.flex-shrink-0{flex:0 0 auto}.leader-1{margin-top:var(--calcite-spacing-xxl)}.trailer-1{margin-bottom:var(--calcite-spacing-xxl)}.warning-text{max-width:35em;margin-left:auto;margin-right:auto;font-size:var(--calcite-font-size-md)}.text-center{text-align:center}.border-override{border-top-width:var(--calcite-border-width-none);border-bottom-width:var(--calcite-border-width-none)}.header-override{--calcite-panel-header-content-space: var(--calcite-spacing-none);--calcite-panel-header-background-color: var(--calcite-color-surface-3)}.panel-override{--calcite-panel-background-color: var(--calcite-color-surface-3);--calcite-panel-border-color: none}.label-override{--calcite-label-margin-bottom: var(--calcite-spacing-none);font-weight:var(--calcite-font-weight-medium)}.header-content-wrapper{padding-inline-start:var(--calcite-spacing-xxs)}.header-button-padding{padding-top:var(--calcite-spacing-sm);padding-bottom:var(--calcite-spacing-sm);padding-inline-start:var(--calcite-spacing-lg);padding-inline-end:var(--calcite-spacing-lg)}.padding-start{padding-inline-start:var(--calcite-spacing-lg)}.align-items-center{align-items:center}.justify-content-end{justify-content:end}.justify-content-start{justify-content:start}.filter-width-350{--calcite-shell-panel-width: 350px}.z-index-2{z-index:2}.mock-fab{--calcite-fab-shadow-internal: 0 6px 20px -4px rgba(0, 0, 0, .1), 0 4px 12px -2px rgba(0, 0, 0, .08);box-shadow:var(--calcite-fab-shadow, var(--calcite-fab-shadow-internal));--calcite-button-background-color: var(--calcite-fab-background-color);--calcite-button-border-color: var(--calcite-fab-border-color);--calcite-button-text-color: var(--calcite-fab-text-color);--calcite-button-loader-color: var(--calcite-fab-loader-color)}.position-relative{position:relative;height:100%;overflow:hidden}.height-100{height:100%}.height-50{height:50px}.sign-in-prompt{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%}.sign-in-icon{transform:translate(-20px)}.height-150{height:150px}.width-150{width:150px}.padding-top-8{padding-top:8px}`,c=class extends p{constructor(){super(),this.solutionsCount=0,this.filterOpen=!0,this.isMobile=!1,this._translations=b({name:"solutions-deployed-shell",blocking:!0}),this._configContextConsumer=r({context:v,subscribe:!0}),this._isMobileContextConsumer=r({context:f,subscribe:!0,callback:e=>this.isMobile=e}),this._solutionsDeployedPanelRef=s(),this._mainPanelRef=s(),this._panelFixed=!1,this.filterRemoved=o(),this.tokenRefreshed=o(),this._handleSignIn=()=>{let e=window.location.pathname.endsWith("deployments")?"":"deployments";this._configContextConsumer.value?.authentication?.signIn(e)},this.listenOn(window,"deployedCardFetchFailed",e=>{let t=e.detail;x({kind:"danger",icon:"exclamation-mark-triangle",title:t.title,message:t.message,autoClose:!1})})}static{this.properties={solutionsCount:9,filterOpen:16,isMobile:16,_translations:16}}static{this.styles=w}willUpdate(e){e.has("isMobile")&&(this.filterOpen=!this.isMobile)}async searchSolutions(e){this._solutionsDeployedPanelRef.value?.setSearchOptions(e),("sortType"in e||"searchTerm"in e)&&this._solutionsDeployedPanelRef.value?.searchSolutions(e)}async load(){this._isMobileContextConsumer.value&&(this.isMobile=this._isMobileContextConsumer.value)}updated(){this._fixPanelContentWrapperFocus()}_fixPanelContentWrapperFocus(){if(!this._panelFixed&&this._mainPanelRef.value){let e=this._mainPanelRef.value;e.componentOnReady?.().then(()=>{if(e.shadowRoot){let t=e.shadowRoot.querySelector(".content-wrapper");t&&(t.tabIndex=-1,this._panelFixed=!0,this._setupPanelObserver())}}).catch(()=>{this._panelFixed=!0})}}_setupPanelObserver(){if(this._panelObserver)return;this._panelObserver=new MutationObserver(t=>{t.forEach(n=>{if(n.type==="attributes"&&n.attributeName==="tabindex"){let a=n.target;a.classList.contains("content-wrapper")&&a.tabIndex===0&&(a.tabIndex=-1)}})});let e=this._mainPanelRef.value;if(e?.shadowRoot){let t=e.shadowRoot.querySelector(".content-wrapper");t&&this._panelObserver.observe(t,{attributes:!0,attributeFilter:["tabindex"]})}}disconnectedCallback(){super.disconnectedCallback(),this._panelObserver?.disconnect()}render(){if(!this._configContextConsumer.value?.authentication?.IsSignedIn)return this._getSignInPrompt();let e=this.isMobile?"justify-content-start":"";return i`<calcite-shell class="position-relative"><calcite-panel class="border-override header-override panel-override z-index-1" ${l(this._mainPanelRef)}><div class=${`display-flex align-items-center height-50 header-content-wrapper ${e}`} slot=header-content><calcite-label class="label-override flex-shrink-0 padding-top-8" layout=inline>${this._translations.numberOfDeployments?.replace("{{count}}",this.solutionsCount.toString())}</calcite-label></div>${this._getSolutionsDeployedPanel()}</calcite-panel></calcite-shell>`}_getSignInPrompt(){return i`<div class="sign-in-prompt">${this._getSignInIcon()}<div class="text-center leader-1 warning-text trailer-1">${this._translations.signInMessage}</div><calcite-button appearance=outline @click=${this._handleSignIn} @keydown=${e=>m(e,()=>this._handleSignIn())} scale=l>${this._translations.signIn}</calcite-button></div>`}_getSolutionsDeployedPanel(){let e=this.isMobile&&this.filterOpen?{display:"none"}:"";return i`<div><solutions-deployed-panel @deployedCardsFetched=${this._updateSolutionCount} style=${u(e)} ${l(this._solutionsDeployedPanelRef)}></solutions-deployed-panel></div>`}_updateSolutionCount(e){this.solutionsCount=e.detail}_getSignInIcon(){return i`<div class="sign-in-icon"><svg viewBox="0 0 64 64" width=200 height=200 xmlns=http://www.w3.org/2000/svg>${h`<path d="M56.9 4.1V60h-.8V4.9H23.3l25.6 7.47v39.26l-28.8 8.4V35h.8v23.97l27.2-7.94V12.97L20.9 5.03V30h-.8V4.1h36.8zM30.735 41.7l.565.566 9.766-9.766-9.766-9.766-.565.567 8.799 8.799H5v.8h34.534l-8.8 8.8z" fill=var(--calcite-color-text-3) />`}</svg></div>`}};g("solutions-deployed-shell",c);return c},a)
2
+ import a from"./VK6ZOC6A.js";import{a as f,b as v}from"./2B4SGB3I.js";import{b as r}from"./YKQDHR27.js";import{a as b}from"./R67EKKSL.js";import{b as g}from"./KIUBUHVM.js";import{E as s,F as l,G as p,J as u,h as d,i,j as h,q as o}from"./H5E6ISYP.js";export default $arcgis.t(([{q:m,r:x}])=>{var w=d`calcite-shell-panel{z-index:var(--calcite-z-index-1)}.display-flex{display:flex}.flex-1,.flex-grow{flex:1}.flex-shrink-0{flex:0 0 auto}.leader-1{margin-top:var(--calcite-spacing-xxl)}.trailer-1{margin-bottom:var(--calcite-spacing-xxl)}.warning-text{max-width:35em;margin-left:auto;margin-right:auto;font-size:var(--calcite-font-size-md)}.text-center{text-align:center}.border-override{border-top-width:var(--calcite-border-width-none);border-bottom-width:var(--calcite-border-width-none)}.header-override{--calcite-panel-header-content-space: var(--calcite-spacing-none);--calcite-panel-header-background-color: var(--calcite-color-surface-3)}.panel-override{--calcite-panel-background-color: var(--calcite-color-surface-3);--calcite-panel-border-color: none}.label-override{--calcite-label-margin-bottom: var(--calcite-spacing-none);font-weight:var(--calcite-font-weight-medium)}.header-content-wrapper{padding-inline-start:var(--calcite-spacing-xxs)}.header-button-padding{padding-top:var(--calcite-spacing-sm);padding-bottom:var(--calcite-spacing-sm);padding-inline-start:var(--calcite-spacing-lg);padding-inline-end:var(--calcite-spacing-lg)}.padding-start{padding-inline-start:var(--calcite-spacing-lg)}.align-items-center{align-items:center}.justify-content-end{justify-content:end}.justify-content-start{justify-content:start}.filter-width-350{--calcite-shell-panel-width: 350px}.z-index-2{z-index:2}.mock-fab{--calcite-fab-shadow-internal: 0 6px 20px -4px rgba(0, 0, 0, .1), 0 4px 12px -2px rgba(0, 0, 0, .08);box-shadow:var(--calcite-fab-shadow, var(--calcite-fab-shadow-internal));--calcite-button-background-color: var(--calcite-fab-background-color);--calcite-button-border-color: var(--calcite-fab-border-color);--calcite-button-text-color: var(--calcite-fab-text-color);--calcite-button-loader-color: var(--calcite-fab-loader-color)}.position-relative{position:relative;height:100%;overflow:hidden}.height-100{height:100%}.height-50{height:50px}.sign-in-prompt{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%}.sign-in-icon{transform:translate(-20px)}.height-150{height:150px}.width-150{width:150px}.padding-top-8{padding-top:8px}`,c=class extends p{constructor(){super(),this.solutionsCount=0,this.filterOpen=!0,this.isMobile=!1,this._translations=b({name:"solutions-deployed-shell",blocking:!0}),this._configContextConsumer=r({context:v,subscribe:!0}),this._isMobileContextConsumer=r({context:f,subscribe:!0,callback:e=>this.isMobile=e}),this._solutionsDeployedPanelRef=s(),this._mainPanelRef=s(),this._panelFixed=!1,this.filterRemoved=o(),this.tokenRefreshed=o(),this._handleSignIn=()=>{let e=window.location.pathname.endsWith("deployments")?"":"deployments";this._configContextConsumer.value?.authentication?.signIn(e)},this.listenOn(window,"deployedCardFetchFailed",e=>{let t=e.detail;x({kind:"danger",icon:"exclamation-mark-triangle",title:t.title,message:t.message,autoClose:!1})})}static{this.properties={solutionsCount:9,filterOpen:16,isMobile:16,_translations:16}}static{this.styles=w}willUpdate(e){e.has("isMobile")&&(this.filterOpen=!this.isMobile)}async searchSolutions(e){this._solutionsDeployedPanelRef.value?.setSearchOptions(e),("sortType"in e||"searchTerm"in e)&&this._solutionsDeployedPanelRef.value?.searchSolutions(e)}async load(){this._isMobileContextConsumer.value&&(this.isMobile=this._isMobileContextConsumer.value)}updated(){this._fixPanelContentWrapperFocus()}_fixPanelContentWrapperFocus(){if(!this._panelFixed&&this._mainPanelRef.value){let e=this._mainPanelRef.value;e.componentOnReady?.().then(()=>{if(e.shadowRoot){let t=e.shadowRoot.querySelector(".content-wrapper");t&&(t.tabIndex=-1,this._panelFixed=!0,this._setupPanelObserver())}}).catch(()=>{this._panelFixed=!0})}}_setupPanelObserver(){if(this._panelObserver)return;this._panelObserver=new MutationObserver(t=>{t.forEach(n=>{if(n.type==="attributes"&&n.attributeName==="tabindex"){let a=n.target;a.classList.contains("content-wrapper")&&a.tabIndex===0&&(a.tabIndex=-1)}})});let e=this._mainPanelRef.value;if(e?.shadowRoot){let t=e.shadowRoot.querySelector(".content-wrapper");t&&this._panelObserver.observe(t,{attributes:!0,attributeFilter:["tabindex"]})}}disconnectedCallback(){super.disconnectedCallback(),this._panelObserver?.disconnect()}render(){if(!this._configContextConsumer.value?.authentication?.IsSignedIn)return this._getSignInPrompt();let e=this.isMobile?"justify-content-start":"";return i`<calcite-shell class="position-relative"><calcite-panel class="border-override header-override panel-override z-index-1" ${l(this._mainPanelRef)}><div class=${`display-flex align-items-center height-50 header-content-wrapper ${e}`} slot=header-content><calcite-label class="label-override flex-shrink-0 padding-top-8" layout=inline>${this._translations.numberOfDeployments?.replace("{{count}}",this.solutionsCount.toString())}</calcite-label></div>${this._getSolutionsDeployedPanel()}</calcite-panel></calcite-shell>`}_getSignInPrompt(){return i`<div class="sign-in-prompt">${this._getSignInIcon()}<div class="text-center leader-1 warning-text trailer-1">${this._translations.signInMessage}</div><calcite-button appearance=outline @click=${this._handleSignIn} @keydown=${e=>m(e,()=>this._handleSignIn())} scale=l>${this._translations.signIn}</calcite-button></div>`}_getSolutionsDeployedPanel(){let e=this.isMobile&&this.filterOpen?{display:"none"}:"";return i`<div><solutions-deployed-panel @deployedCardsFetched=${this._updateSolutionCount} style=${u(e)} ${l(this._solutionsDeployedPanelRef)}></solutions-deployed-panel></div>`}_updateSolutionCount(e){this.solutionsCount=e.detail}_getSignInIcon(){return i`<div class="sign-in-icon"><svg viewBox="0 0 64 64" width=200 height=200 xmlns=http://www.w3.org/2000/svg>${h`<path d="M56.9 4.1V60h-.8V4.9H23.3l25.6 7.47v39.26l-28.8 8.4V35h.8v23.97l27.2-7.94V12.97L20.9 5.03V30h-.8V4.1h36.8zM30.735 41.7l.565.566 9.766-9.766-9.766-9.766-.565.567 8.799 8.799H5v.8h34.534l-8.8 8.8z" fill=var(--calcite-color-text-3) />`}</svg></div>`}};g("solutions-deployed-shell",c);return c},a)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as S3,b as f3}from"./TUMD7SXH.js";import{a as r3}from"./GKT3GU2L.js";import a from"./ABL2KXLF.js";import{b as w2}from"./2B4SGB3I.js";import{b as k2}from"./YKQDHR27.js";import{$ as Y1,$a as E7,$b as Z9,A as M2,Aa as J2,Ab as p7,B as F2,Ba as $2,Bb as g7,C as E1,Ca as q2,Cb as h7,D as Z,Da as F9,E as R2,Ea as R9,Eb as T7,F as $1,Fa as Y2,G as I1,Ga as X2,Gb as Z7,H as A,Ha as w1,Hb as U7,I as I9,Ia as p9,Ib as W7,J as p2,Ja as Q2,Jb as O7,K as u,Ka as e7,Kb as n1,L as g2,La as a7,Lb as K7,Ma as x7,Mb as H7,N as c1,Na as t7,Nb as v7,O as D,Oa as n7,Ob as B7,P as C1,Pa as m7,Pb as L7,Q as h2,Qa as i7,Qb as j7,R as c9,Ra as l7,Rb as _7,S as C9,Sa as d7,Sb as V7,T as q1,Ta as y7,Tb as z7,U as J,Ua as o7,Ub as J7,V as T2,Va as u7,Vb as $7,W as Z2,Wa as r7,Wb as q7,X as U2,Xa as g9,Xb as Y7,Y as v,Ya as a9,Yb as X7,Z as W2,Za as S7,Zb as Q7,_ as j,_a as f7,_b as e3,a as K1,aa as O2,ab as t1,ac as t9,ba as G9,bb as k7,bc as U9,c as O,ca as x1,cb as w7,cc as M1,da as N,db as b7,dc as n9,e as e1,ea as c,eb as s7,ec as a3,f as P2,fa as X,fb as N7,fc as x3,g as d1,ga as X1,gb as A7,gc as t3,h as S,ha as K2,hb as P7,hc as n3,i as P9,ia as H2,ib as D7,ic as m3,j as u1,ja as M9,jb as I7,jc as i3,k as L1,ka as v2,kb as c7,kc as l3,l as S1,lb as G1,lc as F1,m as j1,ma as B2,mb as M,mc as m9,n as _1,na as L2,nb as x9,nc as i9,o as D9,oa as j2,oc as d3,p as I2,pa as _2,pc as l9,qa as V2,qb as C7,qc as y3,r as V1,ra as g,rb as G7,s as c2,sa as k1,sb as B,t as z1,ta as $,tb as M7,u as J1,ub as b1,v as a1,va as Q1,vb as q,w as C2,wa as e9,wb as F7,x as f1,xa as z2,xb as h9,y as G2,yb as R7,z as k,zb as T9}from"./TXNMM6GI.js";import{a as E2}from"./R67EKKSL.js";import{a as r1,g as D1}from"./ALSK2SPM.js";import{a as K}from"./ZCU2WWVN.js";import{a as z,b as H1,c as v1,d as B1}from"./KOIDWEP3.js";import{e as V,f as N2,j as U1,l as W1,o as A2,s as O1}from"./XQQ52NKX.js";import{a as b2,g as s2}from"./JUUVYK2H.js";import{a as D2}from"./4HFHJOS3.js";import{a as H}from"./45M33Q5G.js";import{b as f2}from"./KIUBUHVM.js";import{E as T1,F as Z1,G as r2,K as S2,h as u2,i as _,q as o1}from"./H5E6ISYP.js";import{c as W}from"./QPIMTXPL.js";export default $arcgis.t(([{g:o3,h:u3}])=>{function s1(e,a="application/octet-stream"){if(typeof Blob<"u"){let x=[];for(let n=0;n<e.length;n++)x[n]=e.charCodeAt(n);let t=new Uint8Array(x);return new Blob([t],{type:a})}else throw new Error("stringToBlob is not currently supported on Node")}function E3(e){if(typeof Blob<"u")return new Blob([JSON.stringify(e)],{type:"application/json"});throw new Error("objectToJsonBlob is not currently supported on Node")}var d9={};W(d9,{_mostRecentlyEditedLayer:()=>W9,convertItemToTemplate:()=>x0,createItemFromTemplate:()=>t0,postProcess:()=>n0});function x0(e,a,x,t){return new Promise((n,m)=>{let i=j(e);I7(e.groupDesignations)?a7(i,x).then(d=>n(d),d=>m(A(d))):(i.estimatedDeploymentCostFactor=10,$(i.item.id,x).then(d=>{i.data=d,A7(i,x).then(y=>{y.item.modified=Math.max(y.item.modified,W9(i.properties.layers),W9(i.properties.tables)),b7(y,x).then(o=>{y.dependencies=o.map(r=>r.id),n(Y2(y,o,!1,t))},o=>m(A(o)))},y=>m(A(y)))}))})}function t0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),delete m.item.thumbnail,$1(m,"properties.service.size");let i=X2(m.data);E7(m,x,a).then(l=>{l.success?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.serviceItemId)?(m=p9(m,a,l),n7(m,a,i,x).then(()=>{m=p9(m,a,l),b1({...m.item,url:void 0},m.data,x,e.item.thumbnail,void 0,a).then(()=>{t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,l.serviceItemId)?g(m.itemId,x).then(d=>{m.item=d,u(m,"item.url")&&!m.item.url.endsWith("/")&&(m.item.url+="/"),n({item:m,id:l.serviceItemId,type:m.type,postProcess:x1({item:m.item,data:m.data})||g9(m)})},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))}):(t(e.itemId,S.Cancelled,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type))))},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))})},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))})):(t(e.itemId,S.Cancelled,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}function n0(e,a,x,t,n,m,i){return new Promise((l,d)=>{q(e,m,i).then(y=>{g9(t)?(t=N(t,m),a9(t,i,t.item.url,m).then(l,d)):l(y)},d)})}function W9(e){let a=0;return e.forEach(x=>{a=x.editingInfo?.lastEditDate?Math.max(a,x.editingInfo.lastEditDate):a}),a}var f={};W(f,{convertItemToTemplate:()=>m0,createItemFromTemplate:()=>i0});function m0(e,a,x){return new Promise(t=>{let n=j(e);n.item.id=c(n.item.id,n.item.id,".itemId");let m=new Promise(l=>{k1(n.itemId,n.item.name,x).then(d=>{!d||d.size===0?l(null):l(d)})}),i=Promise.resolve({});Promise.all([m,i]).then(l=>{let[d]=l;if(d){let y=a3(d,n.item.name);n.properties[y.filename]=y.mimeType;let o=n9(n.itemId,y.blob.name,1,y.blob.name===y.filename?M1.data:M1.fakezip),r={itemId:n.itemId,file:y.blob,folder:o.folder,filename:o.filename};n.dataFile=r,n.resources.push(o.folder+"/"+o.filename),t(n)}else t(n)})})}function i0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),e.item.thumbnail&&(m.item.thumbnail=e.item.thumbnail),t1(m.item,m.data,x,a.folderId).then(i=>{t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,i.id)?(m.itemId=i.id,a[e.itemId]={itemId:i.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,i.id),n({item:m,id:i.id,type:m.type,postProcess:!1})):(t(e.itemId,S.Cancelled,0),M(i.id,x).then(()=>n(k(e.type)),()=>n(k(e.type))))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}var Q9={};W(Q9,{_getFormDataFilename:()=>Q3,_replaceFeatureServiceURLs:()=>V3,_replaceItemIds:()=>z3,_replacePortalBaseUrls:()=>J3,_replaceWorkflowManagerBaseUrls:()=>$3,_updateZipObjectTextContent:()=>q3,convertItemToTemplate:()=>B0,createItemFromTemplate:()=>L0,postProcess:()=>X3,postProcessFormItems:()=>_0,swizzleFormObject:()=>Y9,templatizeFormData:()=>X9});function b3(e,a){return l0(e,a)}function l0(e,a){return["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"].forEach(t=>{let n=u(e,t);Array.isArray(n)&&n.forEach(m=>{m.type==="mapWidget"&&(e.dependencies.indexOf(m.itemId)<0&&e.dependencies.push(m.itemId),m.itemId=c(m.itemId,m.itemId,".itemId")),Array.isArray(m.datasets)&&d0(m,e,a)})}),e}function d0(e,a,x){e.datasets.forEach(t=>{if(u(t,"dataSource.type")!=="arcadeDataSource"){let m=u(t,"dataSource.itemId");if(m){a.dependencies.indexOf(m)<0&&a.dependencies.push(m);let i=u(t,"dataSource.layerId");w1(i?.toString(),m,"",x),t.dataSource.itemId=c(m,m,".itemId")}}})}function s3(e,a){let x=["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"];return x.forEach(t=>{let n=u(e,t);y0(n,a)}),x.forEach(t=>{o0(e,t,a)}),e}function y0(e,a){e&&Array.isArray(e)&&e.forEach(x=>{Array.isArray(x.datasets)&&x.datasets.forEach(t=>{let n=c9(u(t,"dataSource.itemId"));if(n){let m=C9(u(t,"dataSource.layerId"));a.some(i=>i.itemId===n&&i.layerId===m?(w3(i,x.id),!0):!1)}else{let m=u(t,"dataSource.id");if(m){let i=m.split("#")[1];a.some(l=>l.ids.indexOf(i)>-1?(w3(l,x.id),!0):!1)}}})})}function o0(e,a,x){let t=u(e,a);t&&D(e,a,u0(t,x))}function u0(e,a){return Array.isArray(e)?e.map(x=>{let t=x;return Array.isArray(t.events)&&(t.events=t.events.map(n=>{let m=n;return Array.isArray(m.actions)&&(m.actions=m.actions.map(i=>{let l=i;if(l.fieldMap&&l.targetId&&l.targetId.indexOf("#")>-1){let d=k3(l,a);if(d){let y=u(d,"fields"),o=u(d,"basePath");Array.isArray(y)&&o&&(l.fieldMap=l.fieldMap.map(r=>{let E=r;return E.targetName=X(E.targetName,y,o),E}))}}return l})),m})),Array.isArray(t.datasets)&&(t.datasets=t.datasets.map(n=>{let m=n;if(m.type==="serviceDataset"){let i=k3(n,a);if(i){let l=u(i,"fields"),d=u(i,"basePath");Array.isArray(l)&&d&&(t=X(t,l,d),m=X(m,l,d))}}return m})),t}):e}function k3(e,a){let x,t=u(e,"dataSource.id")||u(e,"targetId");if(t){let n=t.split("#")[1];if(!a.some(m=>(x=m.ids.indexOf(n)>-1?m:x,m.ids.indexOf(n)>-1))){let m=t.split("#")[0];a.some(i=>{let d=(i.references||[]).indexOf(m)>-1;return x=d?i:x,d})}}else{let n=c9(u(e,"dataSource.itemId")),m=C9(u(e,"dataSource.layerId"));n&&a.some(i=>{let l=n===i.itemId&&m===i.layerId;return x=l?i:x,l})}return x}function w3(e,a){e.references=Array.isArray(e.references)?e.references:[],e.references.indexOf(a)<0&&e.references.push(a)}var N1={};W(N1,{convertItemToTemplate:()=>A0,convertNotebookToTemplate:()=>z9,createItemFromTemplate:()=>P0,deleteProps:()=>R3,fineTuneCreatedItem:()=>V9,postProcess:()=>I0,postProcessNotebookTemplates:()=>D0});function P3(e,a,x,t){return new Promise((n,m)=>{let i="";if(e.item.url){let l=e.item.url,d=l.indexOf("//");e.item.url=v(J)+l.substring(l.indexOf("/",d+2),l.lastIndexOf("=")+1)+e.item.id,i=l.replace(l.substring(l.indexOf("/",d+2)),"")}e.dependencies=f0(e),D(e,"data.folderId","{{folderId}}"),w0(e,["data.map.itemId","data.map.appProxy.mapItemId","data.values.webmap","data.values.group"]),I3(e,"data.appItemId",e.itemId),j9(e,["data.logo","data.map.portalUrl","data.portalUrl","data.httpProxy.url"],v(J)),D(e,"data.geometryService",v(T2)),r0(e,x,i,t).then(()=>{A3(e,x,i,"data.widgetPool.widgets").then(l=>{A3(l,x,i,"data.widgetOnScreen.widgets",!0).then(d=>{S0(d,x,i,"data.values").then(y=>{n(y)},y=>m(A(y)))},d=>m(A(d)))},l=>m(A(l)))},l=>m(A(l)))})}function r0(e,a,x,t){return new Promise((n,m)=>{let i=u(e,"data.dataSource.dataSources");if(i&&Object.keys(i).length>0){let l=new Array;Object.keys(i).forEach(d=>{let y=i[d];D(y,"portalUrl",v(J));let o=u(y,"itemId");if(u(y,"url")){if(o){let E=y.url.substr(y.url.lastIndexOf("/")+1);w1(E.toString(),o,y.url,t),y.itemId=c(o,o,".layer"+E+".itemId")}let r=L9(y.url,x,[],[],a);l.push(new Promise((E,w)=>{B9(r.serviceRequests,r.requestUrls,r.testString).then(s=>{y.url=s,E()},s=>w(A(s)))}))}else o&&(y.itemId=c(o,o,".itemId"))}),Promise.all(l).then(()=>n(e),d=>m(A(d)))}else n(e)})}function A3(e,a,x,t,n=!1){return new Promise((m,i)=>{let l=u(e,t)||[],d=[],y=[];if(l.forEach(o=>{!n&&u(o,"icon")&&j9(o,["icon"],v(J));let r=o.config;if(r){let E=JSON.stringify(r),w=L9(E,x,y,d,a);o.config=JSON.parse(w.testString),d=w.serviceRequests,y=w.requestUrls}}),d.length>0){let o=JSON.stringify(l);B9(d,y,o).then(r=>{D(e,t,JSON.parse(r)),m(e)},r=>i(A(r)))}else m(e)})}function S0(e,a,x,t){return new Promise((n,m)=>{let i=u(e,t),l=[],d=[];if(i){u(i,"icon")&&j9(i,["icon"],v(J));let y=JSON.stringify(i),o=L9(y,x,d,l,a);i=JSON.parse(o.testString),l=o.serviceRequests,d=o.requestUrls}if(l.length>0){let y=JSON.stringify(i);B9(l,d,y).then(o=>{D(e,t,JSON.parse(o)),n(e)},o=>m(A(o)))}else n(e)})}function B9(e,a,x){return new Promise((t,n)=>{if(e&&e.length>0){let m=0;Promise.all(e).then(i=>{i.forEach(l=>{if(u(l,"serviceItemId")){let d="{{"+l.serviceItemId+(l.hasOwnProperty("id")?".layer"+l.id:"")+".url}}";x=y9(x,a[m],d,!0)}m++}),t(x)},i=>n(A(i)))}else t(x)})}function L9(e,a,x,t,n){let m={f:"json",authentication:n},i=e.match(/(\bhttps?:\/\/[-A-Z0-9/._]*)/gim);return i&&i.length&&i.forEach(l=>{l.indexOf("NAServer")>-1?e=y9(e,l,v(U2)):l.indexOf("GeocodeServer")>-1?e=y9(e,l,v(Z2)):a&&l.indexOf(a)>-1?e=y9(e,a,v(J)):l.indexOf("FeatureServer")>-1&&x.indexOf(l)===-1&&(x.push(l),t.push(O(l,m)))}),{testString:e,requestUrls:x,serviceRequests:t}}function y9(e,a,x,t=!1){let n=t&&e.indexOf('"')>-1,m=new RegExp(n?'"'+a+'"':a,"gmi");return e.replace(m,n?'"'+x+'"':x)}function j9(e,a,x){a.forEach(t=>{let n=u(e,t);if(n){let m=n.substring(n.indexOf("/",n.indexOf("//")+2));D(e,t,m!==n?x+m:x)}})}function D3(e,a,x,t){return new Promise(n=>{if(C1(e,["WAB2D","WAB3D","Web AppBuilder"])){let m={id:a.itemId,url:a.item.url,data:a.data},i=B(m,t),l={tags:e.item.tags,title:e.item.title,type:"Code Attachment",typeKeywords:["Code","Javascript","Web Mapping Application"],relationshipType:"WMA2Code",originItemId:a.itemId,url:J1(N(v(J),x))+"sharing/rest/content/items/"+a.itemId+"/package"},d=t1(l,{},t,x.folderId);Promise.all([i,d]).then(()=>n(null),()=>n(null))}else n(null)})}function f0(e){let a=E0;return C1(e,["WAB2D","WAB3D","Web AppBuilder"])&&(a=k0),a(e)}function E0(e){return g2(e,["data.values.webmap","data.values.group"])}function k0(e){let a=[],x=u(e,"data.map.itemId");x&&a.push(x);let t=u(e,"data.dataSource.dataSources");return t&&Object.keys(t).forEach(n=>{let m=t[n];m.itemId&&a.push(m.itemId)}),a}function w0(e,a){a.forEach(x=>{let t=u(e,x);I3(e,x,t)})}function I3(e,a,x){D(e,a,c(x,x,".itemId"))}function c3(e,a){let x=u(e,"data.dataSource.dataSources");x&&Object.keys(x).length>0&&(Object.keys(x).forEach(m=>{let i=x[m];x[m]=H9(i,a)}),D(e,"data.dataSource.dataSources",x)),["data.widgetPool.widgets","data.widgetOnScreen.widgets"].forEach(m=>{let i=u(e,m);i&&D(e,m,b0(i,a))});let n=u(e,"data.values");return n&&D(e,"data.values",H9(n,a)),e}function H9(e,a,x=!1){return e=N0(e,a,x),s0(e,a).forEach(n=>{e=X(e,n.fields,n.basePath,x)}),e}function b0(e,a){let x=["SmartEditor","Screening"];return e.map(t=>{if(t.config){let n=x.indexOf(t.name)>-1;t.config=H9(t.config,a,n)}return t})}function s0(e,a){let x=JSON.stringify(e);return a.filter(n=>K9(n,x)<4).sort((n,m)=>K9(n,x)-K9(m,x))}function K9(e,a){let x=e.url,t=e.itemId,n=e.layerId,m;return x&&!isNaN(n)&&(m=new RegExp(x.replace(/[.]/,".layer"+n+"."),"gm")),m&&m.test(a)||e.ids.length>0&&e.ids.some(i=>new RegExp(i,"gm").test(a))?1:x&&new RegExp(x,"gm").test(a)?2:t&&new RegExp(t,"gm").test(a)?3:4}function N0(e,a,x){let t=JSON.stringify(e),n=a.filter(m=>{let i;m.url&&!isNaN(m.layerId)&&(i=new RegExp(m.url.replace(/[.]/,".layer"+m.layerId+"."),"gm"));let l=!1;if(m.ids.length>0&&(l=m.ids.some(d=>new RegExp(d,"gm").test(t))),l||i&&i.test(t))return m});return n.length>0&&n.forEach(m=>{e=v9(e,m,x),m.ids.length>0&&m.ids.forEach(i=>{e=o9(e,m,i,x)})}),e}function v9(e,a,x){let t={},n=a.url,m=a.layerId,i;if(n&&!isNaN(m)&&(i=new RegExp(n.replace(/[.]/,".layer"+m+"."),"gm")),Array.isArray(e))t=e.map(l=>v9(l,a,x));else if(typeof e=="object")for(let l in e)e[l]!=null&&typeof e[l]=="object"?t[l]=v9(e[l],a,x):(i&&i.test(e[l])&&(e=X(e,a.fields,a.basePath,x)),t[l]=e[l]);else t=e;return t}function o9(e,a,x,t){let n={},m=new RegExp(x,"gm");if(Array.isArray(e))n=e.map(i=>o9(i,a,x,t));else if(typeof e=="object")for(let i in e)if(e[i]!==null){let l;try{l=JSON.parse(e[i])}catch{l=void 0}l&&typeof l=="object"?n[i]=JSON.stringify(o9(l,a,x,t)):typeof e[i]=="object"?(m.test(i)&&t&&(e[i]=X(e[i],a.fields,a.basePath,t)),n[i]=o9(e[i],a,x,t)):(m.test(e[i])&&(e=X(e,a.fields,a.basePath,t)),n[i]=e[i])}else n[i]=e[i];else n=e;return n}function C3(e,a,x,t){return r7(e,x,t)}function G3(e,a,x){return a9(e,a,"",x)}function Y(e,a,x,t,n){return new Promise((m,i)=>{function l(){n&&n.signal.aborted&&i(new Error("Operation was cancelled"))}if(l(),!t(e.itemId,S.Started,0))t(e.itemId,S.Ignored,0),m(k(e.type));else{let d=Z(e);d=N(d,a);let y;e.type==="Web Mapping Application"&&e.data?d=JSON.parse(N(JSON.stringify(d),a)):e.type==="QuickCapture Project"&&e.data&&(y=JSON.stringify(d.data.application),delete d.data),e.item.thumbnail&&(d.item.thumbnail=e.item.thumbnail),t1(d.item,d.data,x,a.folderId).then(o=>{if(l(),!t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,o.id))t(e.itemId,S.Cancelled,0),M(o.id,x).then(()=>m(k(e.type)),()=>m(k(e.type)));else{a[e.itemId]={itemId:o.id,itemUrl:a.portalBaseUrl+"/sharing/rest/content/items/"+o.id},d.itemId=o.id,d.type==="Web Mapping Application"&&e.data&&D(d,"data.appItemId",o.id);let r=x1(d.data),E=d.item.url;d=N(d,a),l();let w=Promise.resolve([]);if(d.relatedItems){let P=N(X1(d.relatedItems),a);w=S7(d.itemId,P,x)}l();let s;if(e.type==="Web Mapping Application"&&e.data&&C1(e,["WAB2D","WAB3D","Web AppBuilder"]))s=D3(e,d,a,x);else if(e.type==="Workforce Project")s=G3(d,x,a);else if(e.type==="QuickCapture Project"){if(y){let P=E1(N(JSON.parse(y),a),"qc.project.json");s=l3(P,d.itemId,"",P.name,x)}}else e.type==="Notebook"?s=V9(e,d,a,x):E!==d.item.url?(l(),s=new Promise((P,b)=>{F7(o.id,d.item.url,x).then(()=>P(),b)})):s=Promise.resolve(null);l(),Promise.all([w,s]).then(()=>{t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,o.id)?m({item:d,id:o.id,type:d.type,postProcess:r}):(t(e.itemId,S.Cancelled,0),M(o.id,x).then(()=>m(k(e.type)),()=>m(k(e.type))))},()=>{t(e.itemId,S.Failed,0),m(k(e.type))})}},()=>{t(e.itemId,S.Failed,0),m(k(e.type))})}})}function A0(e,a,x,t){return Q(e,a,x,t)}function P0(e,a,x,t){return Y(e,a,x,t)}function z9(e){return new Promise(a=>{R3(e.data),a(e)})}function D0(e,a){if(e.some(t=>t.type==="Notebook")){let t=Object.keys(a).filter(m=>m.indexOf("FeatureServer")>-1).sort().reverse(),n=e.reduce((m,i)=>(m=[...new Set([...m,...i.dependencies,i.itemId])],m),[]);e=e.map(m=>{if(m.type==="Notebook"){let i=m.data&&JSON.stringify(m.data);return n.forEach(l=>{new RegExp(l,"gim").test(i)&&(i=i.replace(l,"{{"+l+".itemId}}"),m.dependencies.indexOf(l)<0&&m.dependencies.push(l))}),t.forEach(l=>{let d=new RegExp(l,"gim");if(d.test(i)){let y=a[l];i=i.replace(d,y);let o=/[0-9A-F]{32}/gim,r=y.match(o)[0];m.dependencies.indexOf(r)<0&&m.dependencies.push(r)}}),m.data=JSON.parse(i),m}})}return e}function R3(e){if(e){let a=["metadata.interpreter","metadata.papermill"];I1(e,a),(e.cells||[]).forEach(x=>{I1(x,a)})}}function V9(e,a,x,t){return new Promise((n,m)=>{let i={id:a.itemId,url:a.item.url,data:E1(a.data,a.itemId+".ipynb")};B(i,t).then(()=>n(null),m)})}function I0(e,a,x,t,n,m,i){return q(e,m,i)}function g3(e,a,x){return new Promise((t,n)=>{c0(e,x).then(m=>{e.dependencies=m.dependencies,e.data?.properties&&(e.data.properties.ServiceURL=p3(e.data.properties.ServiceURL,m.urlHash),e.data.properties.OverviewURL=p3(e.data.properties.OverviewURL,m.urlHash)),t(e)},m=>n(A(m)))})}function c0(e,a){return new Promise((x,t)=>{let n=[];if(e.data?.properties){let m=[];e.data.properties.ServiceURL&&m.push(e.data.properties.ServiceURL),e.data.properties.OverviewURL&&e.data.properties.OverviewURL!==e.data.properties.ServiceURL&&m.push(e.data.properties.OverviewURL),C0(m,n,a).then(i=>{x(i)},i=>t(A(i)))}else x({dependencies:n,urlHash:{}})})}function C0(e,a,x){return new Promise((t,n)=>{let m={},i={f:"json",authentication:x},l=[],d={},y=e.filter(o=>{if(o){let r=/.+FeatureServer/g.exec(o),E=Array.isArray(r)&&r.length>0?r[0]:void 0;return E?(Object.keys(d).indexOf(E)<0&&(d[E]=O(o,i)),l.push(d[E]),!0):!1}else return!1});l.length>0?Promise.all(l).then(o=>{o.forEach((r,E)=>{if(u(r,"serviceItemId")){let w=r.serviceItemId;a.indexOf(w)<0&&a.push(w),m[y[E]]=w}}),t({dependencies:a,urlHash:m})},o=>n(A(o))):t({dependencies:a,urlHash:m})})}function p3(e,a){let x=e;if(e){let t=a[e];if(t){let n=e.substr(e.lastIndexOf("/")+1);x=c(t,t,".layer"+n+".url")}x=X1(x.replace(/.+?(?=\/home)/,"{{portalBaseUrl}}"))}return x}var R1={};W(R1,{_templatizeAdminEmail:()=>Z3,_templatizeApplication:()=>T3,_templatizeId:()=>J9,_templatizeUrl:()=>W3,_updateDependencies:()=>U3,convertItemToTemplate:()=>M0,convertQuickCaptureToTemplate:()=>$9,createItemFromTemplate:()=>F0});function M0(e,a,x,t){return Q(e,a,x,t)}function $9(e){return D(e,"data.application",T3(e.data.application,e)),e}function T3(e,a){J9(e,"itemId"),Z3(e);let x=e?.dataSources;return x&&Array.isArray(x)&&x.forEach(t=>{let n=t.featureServiceItemId;n&&(U3(n,a),W3(t,"featureServiceItemId","url"),J9(t,"featureServiceItemId"))}),e}function Z3(e){u(e,"preferences.adminEmail")&&D(e,"preferences.adminEmail","{{user.email}}")}function U3(e,a){a.dependencies.indexOf(e)===-1&&a.dependencies.push(e)}function W3(e,a,x){let t=u(e,a),n=u(e,x);if(n){let m=n.substr(n.lastIndexOf("/")+1);D(e,x,c(t,t,".layer"+m+".url"))}}function J9(e,a){let x=u(e,a);x&&D(e,a,c(x,x,".itemId"))}function F0(e,a,x,t){return Y(e,a,x,t)}var R0="home/webmap/viewer.html?webmap=";function O3(e,a,x,t){return new Promise((n,m)=>{e.type!=="Vector Tile Service"&&(e.item.url=e.item.url?J1(v(J))+R0+e.item.id:e.item.url),p0(e,x).then(i=>{e.dependencies=i.dependencies,e.data&&(e.data.baseMap?.baseMapLayers&&q9(e.data.baseMap.baseMapLayers,i.urlHash,t),e.data.operationalLayers&&q9(e.data.operationalLayers,i.urlHash,t),q9(e.data.tables,i.urlHash,t),g0(e.data)),n(e)},i=>m(A(i)))})}function p0(e,a){return new Promise((x,t)=>{let n=[];if(e.data){let m=e.data.baseMap?.baseMapLayers||[],i=e.data.operationalLayers||[],l=e.data.tables||[],d=m.concat(i).concat(l);h0(d,n,a).then(y=>{x(y)},y=>t(A(y)))}else x({dependencies:n,urlHash:{}})})}function g0(e){$1(e,"initialState")}function h0(e,a,x){return new Promise((t,n)=>{let m={},i={f:"json",authentication:x},l=[],d={},y=e.filter(o=>{if(o.itemId&&o.layerType==="VectorTileLayer")return l.push(g(o.itemId,x)),!0;if(o.url&&o.url.indexOf("{{velocityUrl}}")<0){let r=/.+FeatureServer/g.exec(o.url),E=Array.isArray(r)&&r.length>0?r[0]:void 0;return E?(Object.keys(d).indexOf(E)<0&&(d[E]=O(o.url,i)),l.push(d[E]),!0):!1}else return!1});l.length>0?Promise.all(l).then(o=>{o.forEach((r,E)=>{if(y[E].layerType==="VectorTileLayer"){let w=u(r,"typeKeywords");if(w&&w.includes("Vector Tile Style Editor")){a.indexOf(r.id)<0&&a.push(r.id),y[E].templatizeId=!0;let s=y[E].styleUrl.indexOf(r.id)+r.id.length;y[E].styleUrl=c(y[E].styleUrl.replace(y[E].styleUrl.substring(0,s),r.id),r.id,".itemUrl")}}else if(u(r,"serviceItemId")){let w=r.serviceItemId;a.indexOf(w)<0&&a.push(w),m[y[E].url]=w}}),t({dependencies:a,urlHash:m})},o=>n(A(o))):t({dependencies:a,urlHash:m})})}function q9(e=[],a,x){e.forEach(t=>{if(t.itemId&&t.layerType==="VectorTileLayer")t.templatizeId&&(t.itemId=c(t.itemId,t.itemId,".itemId"),delete t.templatizeId);else if(t.url){let n=t.url.substr(t.url.lastIndexOf("/")+1),m=Object.keys(a).indexOf(t.url)>-1?a[t.url]:void 0;m&&(w1(n,m,t.url,x),t.url=c(m,m,".layer"+n+".url"),t.itemId=c(m,m,".layer"+n+".itemId"))}})}function K3(e,a){return["data.operationalLayers","data.tables","data.applicationProperties.viewing.search.layers"].forEach(t=>T0(e,a,t)),e}function T0(e,a,x){let t=u(e,x);t&&D(e,x,Z0(t,a))}function Z0(e,a){return e.forEach(x=>{let t=U0(x,a);if(t){let n=t.fields.map(i=>i.name);l7(x,t,t.basePath,t.itemId,n),y7(x,t.basePath,n),x.layerDefinition&&(u7(x.layerDefinition,t.basePath,n),o7(x.layerDefinition,t.basePath,n));let m=u(x,"field.name");m&&D(x,"field.name",d7(m,x,t.itemId,t.basePath))}}),e}function U0(e,a){let x;return a.some(t=>t.ids.indexOf(e.id)>-1?(x=t,!0):!1),x}function Q(e,a,x,t){return new Promise((n,m)=>{let i=j(e);i.item.id=c(i.item.id,i.item.id,".itemId");let l=Q1(i.itemId,"forward",x),d=Promise.resolve({}),y=Promise.resolve([]);switch(e.type){case"Dashboard":case"Data Pipeline":case"Feature Collection":case"Feature Service":case"Hub Initiative":case"Hub Page":case"Hub Site Application":case"Insights Model":case"Oriented Imagery Catalog":case"Project Package":case"Style":case"Workforce Project":case"Web Map":case"Web Mapping Application":case"Web Scene":case"Notebook":d=new Promise(o=>{$(i.itemId,x).then(r=>o(r))});break;case"Form":d=k1(i.itemId,i.item.name,x);break;case"QuickCapture Project":y=e9(i.itemId,x);break}Promise.all([d,l,y]).then(o=>{let[r,E,w]=o;y3(i,t),i.data=l9(r,e.type,t);let s=E;i.dependencies=[],i.relatedItems=[],s.forEach(b=>{b.relationshipType!=="WMA2Code"&&(i.relatedItems.push(b),b.relatedItemIds.forEach(C=>{i.dependencies.indexOf(C)<0&&i.dependencies.push(C)}))}),e.type==="Data Pipeline"&&(i.dependencies=i.dependencies.concat(W0(r)));let P=Promise.resolve(i);switch(e.type){case"Dashboard":b3(i,t);break;case"Notebook":P=z9(i);break;case"Oriented Imagery Catalog":P=g3(i,a,x);break;case"QuickCapture Project":i.resources=w,P=new Promise(async b=>{let C=null,I=-1;w&&(w.some((y1,m1)=>{let i1=y1.name==="qc.project.json";return i1&&(C=y1,I=m1),i1}),I>=0&&w.splice(I,1)),C&&(i.data={application:{...await z1(C)},name:"qc.project.json"}),i.data.application?.basemap?.type==="Web Map"&&i.dependencies.push(i.data.application.basemap.itemId);let L=$9(i);b(L)});break;case"Vector Tile Service":case"Web Map":case"Web Scene":P=O3(i,a,x,t);break;case"Web Mapping Application":r&&(P=P3(i,a,x,t));break;case"Workforce Project":P=C3(i,a,x,t);break}P.then(n,b=>m(A(b)))})})}function W0(e){let a=[];return(e?.inputs??[]).concat(e?.outputs??[]).forEach(t=>{if(t.type==="FeatureServiceSource"||t.type==="FeatureServiceSink"){let n=u(t,"parameters.layer.value.itemId");n&&a.push(n)}}),a}var R={};W(R,{convertItemToTemplate:()=>O0,createItemFromTemplate:()=>K0,postProcess:()=>v0,postProcessFieldReferences:()=>H0});function O0(e,a,x,t){return Q(e,a,x,t)}function K0(e,a,x,t,n){return n?Y(e,a,x,t,n):Y(e,a,x,t)}function H0(e,a,x){switch(x){case"Web Mapping Application":c3(e,a);break;case"Dashboard":s3(e,a);break;case"Web Map":K3(e,a);break}return e}async function v0(e,a,x,t,n,m,i){if(a==="Web Map"&&t.resources.some(l=>l.indexOf(d1)>-1)){let l=t3(`${m.portalBaseUrl}/sharing/rest`,t.itemId,d1),d={httpMethod:"GET",authentication:i,params:{f:"json"},headers:{Accept:"application/json",Authorization:`Bearer ${i.token}`,"Content-Type":"application/json","X-Esri-Authorization":`Bearer ${i.token}`}};await O(l,d).then(async y=>{let o=JSON.stringify(y),r=N(o,m);if(o!==r){let E=JSON.parse(r),w={id:e,resource:E1(E,d1),name:d1,authentication:i,params:{}};await P2(w)}})}return q(e,m,i)}function B0(e,a,x,t){return R.convertItemToTemplate(e,a,x,t)}function u9(e){return!!u(e,"properties.services")}function B3(e,a="https://survey123.arcgis.com"){let x=`${a}/api/survey/create`,t={credentials:"same-origin",method:"POST",body:b2({f:"json",...e},!0)};return fetch(x,t).then(n=>n.json()).then(n=>{if(!n.success)throw new Error(`Failed to create survey: ${n.error.message}`);return{formId:n.id,featureServiceId:n.featureService.source.itemId,folderId:n.formItemInfo.ownerFolder}})}var L3=function(a){let x=Z(a),t=[["header","content"],["subHeader","content"],["footer","content"],["settings","thankYouScreenContent"]],n=(i,l)=>(i&&i[l]&&(i[l]=encodeURIComponent(i[l])),i);t.forEach(([i,l])=>n(x[i],l));let m=i=>n(i,"description");return x.questions=(x.questions||[]).map(i=>i.questions?{...i,questions:i.questions.map(m)}:m(i)),x};function j3(e,a,x){let{item:{title:t,description:n,tags:m,typeKeywords:i},properties:{form:l}}=e,{user:{username:d},portalBaseUrl:y,organization:{basemapGalleryGroupQuery:o,defaultBasemap:{title:r}}}=a,{token:E}=x.toCredential();return J2(o,r,x).then(w=>{let s="Survey-",P=h2(`${s}${t}`,a,"user.folders").replace(s,"");if(l.questions){let C=I=>(I.maps&&(I.maps=I.maps.map(L=>({...L,itemId:w.id}))),I);l.questions=l.questions.map(I=>I.questions?{...I,questions:I.questions.map(C)}:C(I))}let b=L3(l);return{description:n,form:b,portalUrl:y,tags:m,title:P,token:E,typeKeywords:i,username:d}})}function _3(e,a,x,t){let n=N(e,a),{survey123Url:m}=a;return j3(n,a,x).then(i=>B3(i,m)).then(i=>{let{formId:l,featureServiceId:d}=i,y=Promise.resolve(null);return e.item.thumbnail&&(y=b1({id:l},null,x,e.item.thumbnail)),y.then(()=>g(l,x)).then(o=>(a[n.itemId]={itemId:l},a[n.properties.info.serviceInfo.itemId]={itemId:d},t(n.itemId,S.Finished,n.estimatedDeploymentCostFactor,l),{item:{...e,item:o,itemId:l},id:l,type:"Form",postProcess:!0}))}).catch(i=>{throw t(n.itemId,S.Failed,0),i})}function L0(e,a,x,t){return u9(e)?_3(e,a,x,t):R.createItemFromTemplate(e,a,x,t)}async function Y9(e,a){let x=await T9(e),t=new Date;return t=new Date(t.valueOf()-864e5-t.getTimezoneOffset()*1e3*60),x.forEach(n=>{if(typeof n.content=="string"){let m=q3(n,a);e.file(n.file,m,{date:t})}else n.file.endsWith(".xlsx")&&e.file(n.file,n.content,{date:t})}),Promise.resolve(e)}async function X9(e,a){return(await T9(e)).forEach(t=>{if(t.file.endsWith(".info")||t.file.endsWith(".itemInfo")||t.file.endsWith(".json")||t.file.endsWith(".webform")||t.file.endsWith(".xml")){let n=t.content,m=/\b([0-9A-Fa-f]){32}_type/g;n=z3(n,a,m),n=V3(n,a,m),n=J3(n,a),n=$3(n,a),e.file(t.file,n)}}),Promise.resolve(e)}function V3(e,a,x){let t=e;return Object.keys(a).filter(m=>m.match(x)&&a[m].type==="Feature Service").forEach(m=>{let i=a[m].url,l=a[i];l&&(t=t.replace(new RegExp(i,"g"),l))}),t}function z3(e,a,x){let t=e;return Object.keys(a).filter(m=>m.match(x)&&a[m].type!=="Feature Service").map(m=>m.replace("_type","")).forEach(m=>{t=t.replace(new RegExp(m,"g"),`{{${m}.itemId}}`)}),t}function J3(e,a){let x=e;return a.portalBaseUrl&&(x=x.replace(new RegExp(a.portalBaseUrl,"g"),"{{portalBaseUrl}}")),x}function $3(e,a){let x=e;return a.workflowBaseUrl&&(x=x.replace(new RegExp(a.workflowBaseUrl,"g"),"{{workflowBaseUrl}}")),x}function q3(e,a){let x=M2(),t=e.content;return t=N(e.content,a),f1(t.match(x)??[]).forEach(m=>{let i=a[m];typeof i?.itemId=="string"&&(t=t.replace(new RegExp(m,"g"),`${i.itemId}`))}),t}function Y3(e,a,x,t,n,m,i){let l=t.properties.info.serviceInfo.itemId,{itemId:d}=m[l],y=N(t,m);return g(d,i).then(o=>{let r=[{id:e,title:y.item.title,snippet:y.item.snippet,extent:y.item.extent,culture:y.item.culture},{id:d,extent:y.item.extent,typeKeywords:[`source-${l}`].concat(o.typeKeywords)}],E=s=>B(s,i),w=r.map(E);return Promise.all(w).then(()=>{let s=[e,d],P=C=>V({itemId:C,folderId:m.folderId,authentication:i}),b=s.map(P);return Promise.all(b)}).then(()=>c7(o.ownerFolder,i)).then(()=>{let s=j(o);return n.push(s),t.dependencies.push(o.id),!0})})}async function X3(e,a,x,t,n,m,i){let l=await k1(e,"Form",i);if(l){let d=await h9(l),y=await Y9(d,m);t9(y,e,i)}else return await G2(5e3),X3(e,a,x,t,n,m,i);return u9(t)?Y3(e,a,x,t,n,m,i):q(e,m,i)}async function _0(e,a){for(let x of e)if(x.type==="Form"){let t=x.data;if(x.data=null,t){let n=await h9(t);n=await X9(n,a),x.item.name=Q3(x.item.name,t.name,`${x.itemId}.zip`);let m=await p7(n,x.item.name),i=n9(x.itemId,x.item.name,1,M1.data),l={itemId:x.itemId,file:m,folder:i.folder,filename:x.item.name};x.dataFile=l,x.resources.push(i.folder+"/"+i.filename)}}return Promise.resolve(e)}function Q3(e,a,x){let t=e||a;return t&&t!=="undefined"?t:x}var e2={};W(e2,{_initializeNewGroup:()=>e6,convertItemToTemplate:()=>V0,createItemFromTemplate:()=>z0,postProcess:()=>J0});function V0(e,a,x){return new Promise(t=>{let n=W2(e);n.item.id=c(n.item.id,n.item.id,".itemId"),V2(e.id,x).then(m=>{n.type="Group",_2(e.id,x).then(i=>{i.id=n.item.id,n.item={...i,type:"Group"},n.dependencies=m.concat(p2(i.tags)),t(n)},()=>t(n))},()=>t(n))})}function z0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),m.item.thumbnail=e.item.thumbnail;let i=e6(m.item);w7(i.title,i,a,x,R9(m)?a.locationTracking.owner:void 0).then(l=>{if(l.success)if(!t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id))t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)));else if(m.itemId=l.group.id,a[e.itemId]={itemId:l.group.id},m=N(m,a),a[e.itemId].itemId=l.group.id,!t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,l.group.id))t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)));else if(R9(m)){let d=a.locationTracking.owner;C7(l.group.id,d,x).then(y=>{y.success?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id)?G7(l.group.id,[x.username],x).then(o=>{Array.isArray(o.notRemoved)&&o.notRemoved.length===0?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id)?n({item:m,id:l.group.id,type:m.type,postProcess:x1(m)}):(t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))}):(t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))})}else n({item:m,id:l.group.id,type:m.type,postProcess:x1(m)});else t(e.itemId,S.Failed,0),n(k(e.type))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}function J0(e,a,x,t,n,m,i){let l=Promise.resolve({success:!0});return x.some(d=>{if(d.id===e){let y=d.item.item;return x1(y)&&(y=N(y,m),l=M7(y,i)),!0}}),l}function e6(e){let a={access:"private",description:e.description,owner:e.owner,snippet:e.snippet,tags:e.tags,thumbnail:e.thumbnail,title:e.title||"",typeKeywords:e.typeKeywords};return["autoJoin","displaySettings","isInvitationOnly","isOpenData","isViewOnly","membershipAccess","properties","sortField","sortOrder"].forEach(t=>{e.hasOwnProperty(t)&&(a[t]=e[t])}),a}var p1={};W(p1,{convertItemToTemplate:()=>$0,createItemFromTemplate:()=>q0,isAPage:()=>X0,postProcess:()=>Y0});function a6(e,a,x,t){return e=S1(e,x,{}),B7(e,{...t,allowList:[]}).then(()=>!0)}function r9(e){let a=z(e);return(e.dependencies||[]).forEach(t=>{let n=new RegExp(t,"g"),m=`{{${t}.itemId}}`;a.item=u1(a.item,n,m),a.data=u1(a.data,n,m),e.properties&&(a.properties=u1(a.properties,n,m))}),a}function S9(e,a,x){let t=K(V,{success:!0}),n=[t({itemId:e.item.id,folderId:a,authentication:x})];return H(e,"item.properties.parentInitiativeId")&&n.push(t({itemId:e.item.properties.parentInitiativeId,folderId:a,authentication:x})),Promise.all(n)}function $0(e,a,x=null){let t=0,n=0;return Promise.all([D1(e.id,{authentication:a}),n1(a)]).then(([m,i])=>(t=m.item.created,n=m.item.modified,j7(m,i))).then(m=>(m.item.created=t,m.item.modified=n,m.item.typeKeywords=H1(m.item.typeKeywords,"doNotDelete"),m.groups=[],m.estimatedDeploymentCostFactor=2,m.resources=[],H(m,"properties")||(m.properties={}),m=r9(m),m))}function q0(e,a,x,t){if(!t(e.itemId,S.Started,0))return Promise.resolve(k(e.type));if(e.assets&&e.resources&&delete e.assets,a.solutionItemExtent){let y=a.solutionItemExtent.split(",");a.organization.defaultExtentBBox=[[y[0],y[1]],[y[2],y[3]]]}let m={},i,l,d=e.item.thumbnail;return n1(x,a).then(y=>(l=y,_7(e,a,m,l))).then(y=>{let o=y,r={assets:o.assets||[]};return L7(o,r,l)}).then(y=>(i=y,S9(y,a.folderId,x))).then(()=>{let y={item:{id:i.item.id},params:{thumbnail:d},authentication:x};return e1(y)}).then(()=>{if(a[e.itemId]={itemId:i.item.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor||2,i.item.id)){let o={item:{...e,...a1(i)},id:i.item.id,type:e.type,postProcess:!0};return o.item.itemId=i.item.id,o}else return K(v7,{success:!0})(i,l).then(()=>Promise.resolve(k(e.type)))}).catch(y=>{throw t(e.itemId,S.Failed,0),y})}function Y0(e,a,x,t,n,m,i){let l;return n1(i).then(d=>(l=d,D1(e,{authentication:i}))).then(d=>a6(d,x,m,l))}function X0(e){let a=!1;return(e==="Hub Page"||e==="Site Page")&&(a=!0),a}var g1={};W(g1,{convertItemToTemplate:()=>Q0,createItemFromTemplate:()=>e5,isASite:()=>x5,postProcess:()=>a5});function x6(e,a,x){let t=a.filter(n=>n.type.indexOf("Page")>-1).map(n=>n.id);return Promise.all(t.map(n=>D1(n,x))).then(n=>Q7(e,n,x))}function t6(e,a,x,t){let n=a.filter(d=>d.id!==e.item.id),m=n.map(d=>({item:{id:d.id,type:d.type}})),i=[];i=i.concat(X7(e,m,t)),i=i.concat(x6(e,n,t));let l=n.map(d=>d.id);return e.item.properties.children=l,e=$7(e,x,{}),i.push(V7(e,{...t,allowList:void 0})),Promise.all(i).then(()=>!0)}function Q0(e,a,x=null){let t=0,n=0,m,i,l;return n1(a).then(d=>(l=d,D9(e.id,l))).then(d=>(t=d.item.created,n=d.item.modified,m=d.item.title,i=d.data.values.title,Y7(d,l))).then(d=>(d.item.created=t,d.item.modified=n,d.item.title=m,d.item.typeKeywords=H1(d.item.typeKeywords,"doNotDelete"),d.data.values.title=i,d.groups=[],d.estimatedDeploymentCostFactor=2,d.resources=[],u(d,"properties")||(d.properties={}),d.dependencies=f1(d.dependencies),d=r9(d),d))}function e5(e,a,x,t){if(!t(e.itemId,S.Started,0))return Promise.resolve(k(e.type));e.assets&&e.resources&&delete e.assets,a.solution||(a.solution={}),a.solution.title=a.title;let m={},i,l,d=e.item.thumbnail;return n1(x,a).then(y=>(l=y,q7(e,a,m,l))).then(y=>{let o={assets:y.assets||[]};return J7(y,o,l)}).then(y=>(i=y,S9(y,a.folderId,x))).then(()=>{let y={item:{id:i.item.id},params:{thumbnail:d},authentication:x};return e1(y)}).then(()=>{if(a[e.itemId]={itemId:i.item.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor||2,i.item.id)){let o={item:{...e,...a1(i)},id:i.item.id,type:e.type,postProcess:!0};return o.item.itemId=i.item.id,o}else return K(z7,{success:!0})(i,l).then(()=>Promise.resolve(k(e.type)))}).catch(y=>{throw t(e.itemId,S.Failed,0),y})}function a5(e,a,x,t,n,m,i){let l;return n1(i,m).then(d=>(l=d,D9(e,l))).then(d=>t6(d,x,m,l)).then(()=>Promise.resolve(!0))}function x5(e){let a=!1;return(e==="Hub Site Application"||e==="Site Application")&&(a=!0),a}var E9={};W(E9,{convertItemToTemplate:()=>m5,createItemFromTemplate:()=>i5,isAStoryMap:()=>l5});function n6(e={}){let a=0;return Object.keys(e).reduce((x,t)=>(H(e,`${t}.type`)==="webmap"&&t!==`webmap${a}`&&(x.push({original:t,updated:`webmap${a}`}),a++),x),[])}function m6(e){let a=H(e,"data.resources")||{};return Object.keys(a).reduce((x,t)=>(H(a,`${t}.type`)==="webmap"&&x.push(H(a,`${t}.data.itemId`)),x),[])}function l6(e){let a=Y1(e.item.id,e.item.type);a.key=`${L1(e.item.title)}_${v1("i")}`;let x=z(e);a.data=x.data;let t=x.item.created,n=x.item.modified;return a.item=_1(x.item),a.item.created=t,a.item.modified=n,a.item.url="{{storyMapTemplateUrl}}",n6(a.data.resources).forEach(l=>{a.data.resources[l.updated]=z(a.data.resources[l.original]),delete a.data.resources[l.original],a.data.nodes=u1(a.data.nodes,l.original,l.updated)}),a.item.typeKeywords.indexOf(i6)!==-1&&(a.item.typeKeywords=[t5].concat(a.item.typeKeywords.filter(l=>l!==i6))),a.properties={},a.properties.draftFileName="draft_{{timestamp}}.json",Object.assign(a.properties,n5),a.dependencies=m6(e),Promise.resolve(a)}var i6="smstatusunpublishedchanges",t5="smstatuspublished",n5={oembed:{version:"1.0",type:"rich",title:"Example StoryMap",url:"{{storyMapTemplateUrl}}",provider_name:"ArcGIS StoryMaps",provider_url:"{{storyMapBaseUrl}}",width:800,height:600,thumbnail_url:"{{storyMapThumbnailUrl}}",thumbnail_height:"100.5",thumbnail_width:"400",html:'<iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen></iframe>',cache_age:86400},oembedXML:`<?xml version="1.0" encoding="utf-8" standalone="yes"?>
2
+ import{a as S3,b as f3}from"./DINEURA2.js";import{a as r3}from"./GKT3GU2L.js";import a from"./VK6ZOC6A.js";import{b as w2}from"./2B4SGB3I.js";import{b as k2}from"./YKQDHR27.js";import{$ as Y1,$a as E7,$b as Z9,A as M2,Aa as J2,Ab as p7,B as F2,Ba as $2,Bb as g7,C as E1,Ca as q2,Cb as h7,D as Z,Da as F9,E as R2,Ea as R9,Eb as T7,F as $1,Fa as Y2,G as I1,Ga as X2,Gb as Z7,H as A,Ha as w1,Hb as U7,I as I9,Ia as p9,Ib as W7,J as p2,Ja as Q2,Jb as O7,K as u,Ka as e7,Kb as n1,L as g2,La as a7,Lb as K7,Ma as x7,Mb as H7,N as c1,Na as t7,Nb as v7,O as D,Oa as n7,Ob as B7,P as C1,Pa as m7,Pb as L7,Q as h2,Qa as i7,Qb as j7,R as c9,Ra as l7,Rb as _7,S as C9,Sa as d7,Sb as V7,T as q1,Ta as y7,Tb as z7,U as J,Ua as o7,Ub as J7,V as T2,Va as u7,Vb as $7,W as Z2,Wa as r7,Wb as q7,X as U2,Xa as g9,Xb as Y7,Y as v,Ya as a9,Yb as X7,Z as W2,Za as S7,Zb as Q7,_ as j,_a as f7,_b as e3,a as K1,aa as O2,ab as t1,ac as t9,ba as G9,bb as k7,bc as U9,c as O,ca as x1,cb as w7,cc as M1,da as N,db as b7,dc as n9,e as e1,ea as c,eb as s7,ec as a3,f as P2,fa as X,fb as N7,fc as x3,g as d1,ga as X1,gb as A7,gc as t3,h as S,ha as K2,hb as P7,hc as n3,i as P9,ia as H2,ib as D7,ic as m3,j as u1,ja as M9,jb as I7,jc as i3,k as L1,ka as v2,kb as c7,kc as l3,l as S1,lb as G1,lc as F1,m as j1,ma as B2,mb as M,mc as m9,n as _1,na as L2,nb as x9,nc as i9,o as D9,oa as j2,oc as d3,p as I2,pa as _2,pc as l9,qa as V2,qb as C7,qc as y3,r as V1,ra as g,rb as G7,s as c2,sa as k1,sb as B,t as z1,ta as $,tb as M7,u as J1,ub as b1,v as a1,va as Q1,vb as q,w as C2,wa as e9,wb as F7,x as f1,xa as z2,xb as h9,y as G2,yb as R7,z as k,zb as T9}from"./WU7QCA5H.js";import{a as E2}from"./R67EKKSL.js";import{a as r1,g as D1}from"./ALSK2SPM.js";import{a as K}from"./ZCU2WWVN.js";import{a as z,b as H1,c as v1,d as B1}from"./KOIDWEP3.js";import{e as V,f as N2,j as U1,l as W1,o as A2,s as O1}from"./XQQ52NKX.js";import{a as b2,g as s2}from"./JUUVYK2H.js";import{a as D2}from"./4HFHJOS3.js";import{a as H}from"./45M33Q5G.js";import{b as f2}from"./KIUBUHVM.js";import{E as T1,F as Z1,G as r2,K as S2,h as u2,i as _,q as o1}from"./H5E6ISYP.js";import{c as W}from"./QPIMTXPL.js";export default $arcgis.t(([{g:o3,h:u3}])=>{function s1(e,a="application/octet-stream"){if(typeof Blob<"u"){let x=[];for(let n=0;n<e.length;n++)x[n]=e.charCodeAt(n);let t=new Uint8Array(x);return new Blob([t],{type:a})}else throw new Error("stringToBlob is not currently supported on Node")}function E3(e){if(typeof Blob<"u")return new Blob([JSON.stringify(e)],{type:"application/json"});throw new Error("objectToJsonBlob is not currently supported on Node")}var d9={};W(d9,{_mostRecentlyEditedLayer:()=>W9,convertItemToTemplate:()=>x0,createItemFromTemplate:()=>t0,postProcess:()=>n0});function x0(e,a,x,t){return new Promise((n,m)=>{let i=j(e);I7(e.groupDesignations)?a7(i,x).then(d=>n(d),d=>m(A(d))):(i.estimatedDeploymentCostFactor=10,$(i.item.id,x).then(d=>{i.data=d,A7(i,x).then(y=>{y.item.modified=Math.max(y.item.modified,W9(i.properties.layers),W9(i.properties.tables)),b7(y,x).then(o=>{y.dependencies=o.map(r=>r.id),n(Y2(y,o,!1,t))},o=>m(A(o)))},y=>m(A(y)))}))})}function t0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),delete m.item.thumbnail,$1(m,"properties.service.size");let i=X2(m.data);E7(m,x,a).then(l=>{l.success?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.serviceItemId)?(m=p9(m,a,l),n7(m,a,i,x).then(()=>{m=p9(m,a,l),b1({...m.item,url:void 0},m.data,x,e.item.thumbnail,void 0,a).then(()=>{t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,l.serviceItemId)?g(m.itemId,x).then(d=>{m.item=d,u(m,"item.url")&&!m.item.url.endsWith("/")&&(m.item.url+="/"),n({item:m,id:l.serviceItemId,type:m.type,postProcess:x1({item:m.item,data:m.data})||g9(m)})},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))}):(t(e.itemId,S.Cancelled,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type))))},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))})},()=>{t(e.itemId,S.Failed,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))})):(t(e.itemId,S.Cancelled,0),M(l.serviceItemId,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}function n0(e,a,x,t,n,m,i){return new Promise((l,d)=>{q(e,m,i).then(y=>{g9(t)?(t=N(t,m),a9(t,i,t.item.url,m).then(l,d)):l(y)},d)})}function W9(e){let a=0;return e.forEach(x=>{a=x.editingInfo?.lastEditDate?Math.max(a,x.editingInfo.lastEditDate):a}),a}var f={};W(f,{convertItemToTemplate:()=>m0,createItemFromTemplate:()=>i0});function m0(e,a,x){return new Promise(t=>{let n=j(e);n.item.id=c(n.item.id,n.item.id,".itemId");let m=new Promise(l=>{k1(n.itemId,n.item.name,x).then(d=>{!d||d.size===0?l(null):l(d)})}),i=Promise.resolve({});Promise.all([m,i]).then(l=>{let[d]=l;if(d){let y=a3(d,n.item.name);n.properties[y.filename]=y.mimeType;let o=n9(n.itemId,y.blob.name,1,y.blob.name===y.filename?M1.data:M1.fakezip),r={itemId:n.itemId,file:y.blob,folder:o.folder,filename:o.filename};n.dataFile=r,n.resources.push(o.folder+"/"+o.filename),t(n)}else t(n)})})}function i0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),e.item.thumbnail&&(m.item.thumbnail=e.item.thumbnail),t1(m.item,m.data,x,a.folderId).then(i=>{t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,i.id)?(m.itemId=i.id,a[e.itemId]={itemId:i.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,i.id),n({item:m,id:i.id,type:m.type,postProcess:!1})):(t(e.itemId,S.Cancelled,0),M(i.id,x).then(()=>n(k(e.type)),()=>n(k(e.type))))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}var Q9={};W(Q9,{_getFormDataFilename:()=>Q3,_replaceFeatureServiceURLs:()=>V3,_replaceItemIds:()=>z3,_replacePortalBaseUrls:()=>J3,_replaceWorkflowManagerBaseUrls:()=>$3,_updateZipObjectTextContent:()=>q3,convertItemToTemplate:()=>B0,createItemFromTemplate:()=>L0,postProcess:()=>X3,postProcessFormItems:()=>_0,swizzleFormObject:()=>Y9,templatizeFormData:()=>X9});function b3(e,a){return l0(e,a)}function l0(e,a){return["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"].forEach(t=>{let n=u(e,t);Array.isArray(n)&&n.forEach(m=>{m.type==="mapWidget"&&(e.dependencies.indexOf(m.itemId)<0&&e.dependencies.push(m.itemId),m.itemId=c(m.itemId,m.itemId,".itemId")),Array.isArray(m.datasets)&&d0(m,e,a)})}),e}function d0(e,a,x){e.datasets.forEach(t=>{if(u(t,"dataSource.type")!=="arcadeDataSource"){let m=u(t,"dataSource.itemId");if(m){a.dependencies.indexOf(m)<0&&a.dependencies.push(m);let i=u(t,"dataSource.layerId");w1(i?.toString(),m,"",x),t.dataSource.itemId=c(m,m,".itemId")}}})}function s3(e,a){let x=["data.desktopView.header","data.desktopView.headerPanel.selectors","data.desktopView.leftPanel.selectors","data.desktopView.sidebar","data.desktopView.urlParameters","data.desktopView.widgets","data.header","data.headerPanel.selectors","data.leftPanel.selectors","data.mobileView.header","data.mobileView.headerPanel.selectors","data.mobileView.leftPanel.selectors","data.mobileView.sidebar","data.mobileView.urlParameters","data.mobileView.widgets","data.sidebar","data.urlParameters","data.widgets"];return x.forEach(t=>{let n=u(e,t);y0(n,a)}),x.forEach(t=>{o0(e,t,a)}),e}function y0(e,a){e&&Array.isArray(e)&&e.forEach(x=>{Array.isArray(x.datasets)&&x.datasets.forEach(t=>{let n=c9(u(t,"dataSource.itemId"));if(n){let m=C9(u(t,"dataSource.layerId"));a.some(i=>i.itemId===n&&i.layerId===m?(w3(i,x.id),!0):!1)}else{let m=u(t,"dataSource.id");if(m){let i=m.split("#")[1];a.some(l=>l.ids.indexOf(i)>-1?(w3(l,x.id),!0):!1)}}})})}function o0(e,a,x){let t=u(e,a);t&&D(e,a,u0(t,x))}function u0(e,a){return Array.isArray(e)?e.map(x=>{let t=x;return Array.isArray(t.events)&&(t.events=t.events.map(n=>{let m=n;return Array.isArray(m.actions)&&(m.actions=m.actions.map(i=>{let l=i;if(l.fieldMap&&l.targetId&&l.targetId.indexOf("#")>-1){let d=k3(l,a);if(d){let y=u(d,"fields"),o=u(d,"basePath");Array.isArray(y)&&o&&(l.fieldMap=l.fieldMap.map(r=>{let E=r;return E.targetName=X(E.targetName,y,o),E}))}}return l})),m})),Array.isArray(t.datasets)&&(t.datasets=t.datasets.map(n=>{let m=n;if(m.type==="serviceDataset"){let i=k3(n,a);if(i){let l=u(i,"fields"),d=u(i,"basePath");Array.isArray(l)&&d&&(t=X(t,l,d),m=X(m,l,d))}}return m})),t}):e}function k3(e,a){let x,t=u(e,"dataSource.id")||u(e,"targetId");if(t){let n=t.split("#")[1];if(!a.some(m=>(x=m.ids.indexOf(n)>-1?m:x,m.ids.indexOf(n)>-1))){let m=t.split("#")[0];a.some(i=>{let d=(i.references||[]).indexOf(m)>-1;return x=d?i:x,d})}}else{let n=c9(u(e,"dataSource.itemId")),m=C9(u(e,"dataSource.layerId"));n&&a.some(i=>{let l=n===i.itemId&&m===i.layerId;return x=l?i:x,l})}return x}function w3(e,a){e.references=Array.isArray(e.references)?e.references:[],e.references.indexOf(a)<0&&e.references.push(a)}var N1={};W(N1,{convertItemToTemplate:()=>A0,convertNotebookToTemplate:()=>z9,createItemFromTemplate:()=>P0,deleteProps:()=>R3,fineTuneCreatedItem:()=>V9,postProcess:()=>I0,postProcessNotebookTemplates:()=>D0});function P3(e,a,x,t){return new Promise((n,m)=>{let i="";if(e.item.url){let l=e.item.url,d=l.indexOf("//");e.item.url=v(J)+l.substring(l.indexOf("/",d+2),l.lastIndexOf("=")+1)+e.item.id,i=l.replace(l.substring(l.indexOf("/",d+2)),"")}e.dependencies=f0(e),D(e,"data.folderId","{{folderId}}"),w0(e,["data.map.itemId","data.map.appProxy.mapItemId","data.values.webmap","data.values.group"]),I3(e,"data.appItemId",e.itemId),j9(e,["data.logo","data.map.portalUrl","data.portalUrl","data.httpProxy.url"],v(J)),D(e,"data.geometryService",v(T2)),r0(e,x,i,t).then(()=>{A3(e,x,i,"data.widgetPool.widgets").then(l=>{A3(l,x,i,"data.widgetOnScreen.widgets",!0).then(d=>{S0(d,x,i,"data.values").then(y=>{n(y)},y=>m(A(y)))},d=>m(A(d)))},l=>m(A(l)))},l=>m(A(l)))})}function r0(e,a,x,t){return new Promise((n,m)=>{let i=u(e,"data.dataSource.dataSources");if(i&&Object.keys(i).length>0){let l=new Array;Object.keys(i).forEach(d=>{let y=i[d];D(y,"portalUrl",v(J));let o=u(y,"itemId");if(u(y,"url")){if(o){let E=y.url.substr(y.url.lastIndexOf("/")+1);w1(E.toString(),o,y.url,t),y.itemId=c(o,o,".layer"+E+".itemId")}let r=L9(y.url,x,[],[],a);l.push(new Promise((E,w)=>{B9(r.serviceRequests,r.requestUrls,r.testString).then(s=>{y.url=s,E()},s=>w(A(s)))}))}else o&&(y.itemId=c(o,o,".itemId"))}),Promise.all(l).then(()=>n(e),d=>m(A(d)))}else n(e)})}function A3(e,a,x,t,n=!1){return new Promise((m,i)=>{let l=u(e,t)||[],d=[],y=[];if(l.forEach(o=>{!n&&u(o,"icon")&&j9(o,["icon"],v(J));let r=o.config;if(r){let E=JSON.stringify(r),w=L9(E,x,y,d,a);o.config=JSON.parse(w.testString),d=w.serviceRequests,y=w.requestUrls}}),d.length>0){let o=JSON.stringify(l);B9(d,y,o).then(r=>{D(e,t,JSON.parse(r)),m(e)},r=>i(A(r)))}else m(e)})}function S0(e,a,x,t){return new Promise((n,m)=>{let i=u(e,t),l=[],d=[];if(i){u(i,"icon")&&j9(i,["icon"],v(J));let y=JSON.stringify(i),o=L9(y,x,d,l,a);i=JSON.parse(o.testString),l=o.serviceRequests,d=o.requestUrls}if(l.length>0){let y=JSON.stringify(i);B9(l,d,y).then(o=>{D(e,t,JSON.parse(o)),n(e)},o=>m(A(o)))}else n(e)})}function B9(e,a,x){return new Promise((t,n)=>{if(e&&e.length>0){let m=0;Promise.all(e).then(i=>{i.forEach(l=>{if(u(l,"serviceItemId")){let d="{{"+l.serviceItemId+(l.hasOwnProperty("id")?".layer"+l.id:"")+".url}}";x=y9(x,a[m],d,!0)}m++}),t(x)},i=>n(A(i)))}else t(x)})}function L9(e,a,x,t,n){let m={f:"json",authentication:n},i=e.match(/(\bhttps?:\/\/[-A-Z0-9/._]*)/gim);return i&&i.length&&i.forEach(l=>{l.indexOf("NAServer")>-1?e=y9(e,l,v(U2)):l.indexOf("GeocodeServer")>-1?e=y9(e,l,v(Z2)):a&&l.indexOf(a)>-1?e=y9(e,a,v(J)):l.indexOf("FeatureServer")>-1&&x.indexOf(l)===-1&&(x.push(l),t.push(O(l,m)))}),{testString:e,requestUrls:x,serviceRequests:t}}function y9(e,a,x,t=!1){let n=t&&e.indexOf('"')>-1,m=new RegExp(n?'"'+a+'"':a,"gmi");return e.replace(m,n?'"'+x+'"':x)}function j9(e,a,x){a.forEach(t=>{let n=u(e,t);if(n){let m=n.substring(n.indexOf("/",n.indexOf("//")+2));D(e,t,m!==n?x+m:x)}})}function D3(e,a,x,t){return new Promise(n=>{if(C1(e,["WAB2D","WAB3D","Web AppBuilder"])){let m={id:a.itemId,url:a.item.url,data:a.data},i=B(m,t),l={tags:e.item.tags,title:e.item.title,type:"Code Attachment",typeKeywords:["Code","Javascript","Web Mapping Application"],relationshipType:"WMA2Code",originItemId:a.itemId,url:J1(N(v(J),x))+"sharing/rest/content/items/"+a.itemId+"/package"},d=t1(l,{},t,x.folderId);Promise.all([i,d]).then(()=>n(null),()=>n(null))}else n(null)})}function f0(e){let a=E0;return C1(e,["WAB2D","WAB3D","Web AppBuilder"])&&(a=k0),a(e)}function E0(e){return g2(e,["data.values.webmap","data.values.group"])}function k0(e){let a=[],x=u(e,"data.map.itemId");x&&a.push(x);let t=u(e,"data.dataSource.dataSources");return t&&Object.keys(t).forEach(n=>{let m=t[n];m.itemId&&a.push(m.itemId)}),a}function w0(e,a){a.forEach(x=>{let t=u(e,x);I3(e,x,t)})}function I3(e,a,x){D(e,a,c(x,x,".itemId"))}function c3(e,a){let x=u(e,"data.dataSource.dataSources");x&&Object.keys(x).length>0&&(Object.keys(x).forEach(m=>{let i=x[m];x[m]=H9(i,a)}),D(e,"data.dataSource.dataSources",x)),["data.widgetPool.widgets","data.widgetOnScreen.widgets"].forEach(m=>{let i=u(e,m);i&&D(e,m,b0(i,a))});let n=u(e,"data.values");return n&&D(e,"data.values",H9(n,a)),e}function H9(e,a,x=!1){return e=N0(e,a,x),s0(e,a).forEach(n=>{e=X(e,n.fields,n.basePath,x)}),e}function b0(e,a){let x=["SmartEditor","Screening"];return e.map(t=>{if(t.config){let n=x.indexOf(t.name)>-1;t.config=H9(t.config,a,n)}return t})}function s0(e,a){let x=JSON.stringify(e);return a.filter(n=>K9(n,x)<4).sort((n,m)=>K9(n,x)-K9(m,x))}function K9(e,a){let x=e.url,t=e.itemId,n=e.layerId,m;return x&&!isNaN(n)&&(m=new RegExp(x.replace(/[.]/,".layer"+n+"."),"gm")),m&&m.test(a)||e.ids.length>0&&e.ids.some(i=>new RegExp(i,"gm").test(a))?1:x&&new RegExp(x,"gm").test(a)?2:t&&new RegExp(t,"gm").test(a)?3:4}function N0(e,a,x){let t=JSON.stringify(e),n=a.filter(m=>{let i;m.url&&!isNaN(m.layerId)&&(i=new RegExp(m.url.replace(/[.]/,".layer"+m.layerId+"."),"gm"));let l=!1;if(m.ids.length>0&&(l=m.ids.some(d=>new RegExp(d,"gm").test(t))),l||i&&i.test(t))return m});return n.length>0&&n.forEach(m=>{e=v9(e,m,x),m.ids.length>0&&m.ids.forEach(i=>{e=o9(e,m,i,x)})}),e}function v9(e,a,x){let t={},n=a.url,m=a.layerId,i;if(n&&!isNaN(m)&&(i=new RegExp(n.replace(/[.]/,".layer"+m+"."),"gm")),Array.isArray(e))t=e.map(l=>v9(l,a,x));else if(typeof e=="object")for(let l in e)e[l]!=null&&typeof e[l]=="object"?t[l]=v9(e[l],a,x):(i&&i.test(e[l])&&(e=X(e,a.fields,a.basePath,x)),t[l]=e[l]);else t=e;return t}function o9(e,a,x,t){let n={},m=new RegExp(x,"gm");if(Array.isArray(e))n=e.map(i=>o9(i,a,x,t));else if(typeof e=="object")for(let i in e)if(e[i]!==null){let l;try{l=JSON.parse(e[i])}catch{l=void 0}l&&typeof l=="object"?n[i]=JSON.stringify(o9(l,a,x,t)):typeof e[i]=="object"?(m.test(i)&&t&&(e[i]=X(e[i],a.fields,a.basePath,t)),n[i]=o9(e[i],a,x,t)):(m.test(e[i])&&(e=X(e,a.fields,a.basePath,t)),n[i]=e[i])}else n[i]=e[i];else n=e;return n}function C3(e,a,x,t){return r7(e,x,t)}function G3(e,a,x){return a9(e,a,"",x)}function Y(e,a,x,t,n){return new Promise((m,i)=>{function l(){n&&n.signal.aborted&&i(new Error("Operation was cancelled"))}if(l(),!t(e.itemId,S.Started,0))t(e.itemId,S.Ignored,0),m(k(e.type));else{let d=Z(e);d=N(d,a);let y;e.type==="Web Mapping Application"&&e.data?d=JSON.parse(N(JSON.stringify(d),a)):e.type==="QuickCapture Project"&&e.data&&(y=JSON.stringify(d.data.application),delete d.data),e.item.thumbnail&&(d.item.thumbnail=e.item.thumbnail),t1(d.item,d.data,x,a.folderId).then(o=>{if(l(),!t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,o.id))t(e.itemId,S.Cancelled,0),M(o.id,x).then(()=>m(k(e.type)),()=>m(k(e.type)));else{a[e.itemId]={itemId:o.id,itemUrl:a.portalBaseUrl+"/sharing/rest/content/items/"+o.id},d.itemId=o.id,d.type==="Web Mapping Application"&&e.data&&D(d,"data.appItemId",o.id);let r=x1(d.data),E=d.item.url;d=N(d,a),l();let w=Promise.resolve([]);if(d.relatedItems){let P=N(X1(d.relatedItems),a);w=S7(d.itemId,P,x)}l();let s;if(e.type==="Web Mapping Application"&&e.data&&C1(e,["WAB2D","WAB3D","Web AppBuilder"]))s=D3(e,d,a,x);else if(e.type==="Workforce Project")s=G3(d,x,a);else if(e.type==="QuickCapture Project"){if(y){let P=E1(N(JSON.parse(y),a),"qc.project.json");s=l3(P,d.itemId,"",P.name,x)}}else e.type==="Notebook"?s=V9(e,d,a,x):E!==d.item.url?(l(),s=new Promise((P,b)=>{F7(o.id,d.item.url,x).then(()=>P(),b)})):s=Promise.resolve(null);l(),Promise.all([w,s]).then(()=>{t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,o.id)?m({item:d,id:o.id,type:d.type,postProcess:r}):(t(e.itemId,S.Cancelled,0),M(o.id,x).then(()=>m(k(e.type)),()=>m(k(e.type))))},()=>{t(e.itemId,S.Failed,0),m(k(e.type))})}},()=>{t(e.itemId,S.Failed,0),m(k(e.type))})}})}function A0(e,a,x,t){return Q(e,a,x,t)}function P0(e,a,x,t){return Y(e,a,x,t)}function z9(e){return new Promise(a=>{R3(e.data),a(e)})}function D0(e,a){if(e.some(t=>t.type==="Notebook")){let t=Object.keys(a).filter(m=>m.indexOf("FeatureServer")>-1).sort().reverse(),n=e.reduce((m,i)=>(m=[...new Set([...m,...i.dependencies,i.itemId])],m),[]);e=e.map(m=>{if(m.type==="Notebook"){let i=m.data&&JSON.stringify(m.data);return n.forEach(l=>{new RegExp(l,"gim").test(i)&&(i=i.replace(l,"{{"+l+".itemId}}"),m.dependencies.indexOf(l)<0&&m.dependencies.push(l))}),t.forEach(l=>{let d=new RegExp(l,"gim");if(d.test(i)){let y=a[l];i=i.replace(d,y);let o=/[0-9A-F]{32}/gim,r=y.match(o)[0];m.dependencies.indexOf(r)<0&&m.dependencies.push(r)}}),m.data=JSON.parse(i),m}})}return e}function R3(e){if(e){let a=["metadata.interpreter","metadata.papermill"];I1(e,a),(e.cells||[]).forEach(x=>{I1(x,a)})}}function V9(e,a,x,t){return new Promise((n,m)=>{let i={id:a.itemId,url:a.item.url,data:E1(a.data,a.itemId+".ipynb")};B(i,t).then(()=>n(null),m)})}function I0(e,a,x,t,n,m,i){return q(e,m,i)}function g3(e,a,x){return new Promise((t,n)=>{c0(e,x).then(m=>{e.dependencies=m.dependencies,e.data?.properties&&(e.data.properties.ServiceURL=p3(e.data.properties.ServiceURL,m.urlHash),e.data.properties.OverviewURL=p3(e.data.properties.OverviewURL,m.urlHash)),t(e)},m=>n(A(m)))})}function c0(e,a){return new Promise((x,t)=>{let n=[];if(e.data?.properties){let m=[];e.data.properties.ServiceURL&&m.push(e.data.properties.ServiceURL),e.data.properties.OverviewURL&&e.data.properties.OverviewURL!==e.data.properties.ServiceURL&&m.push(e.data.properties.OverviewURL),C0(m,n,a).then(i=>{x(i)},i=>t(A(i)))}else x({dependencies:n,urlHash:{}})})}function C0(e,a,x){return new Promise((t,n)=>{let m={},i={f:"json",authentication:x},l=[],d={},y=e.filter(o=>{if(o){let r=/.+FeatureServer/g.exec(o),E=Array.isArray(r)&&r.length>0?r[0]:void 0;return E?(Object.keys(d).indexOf(E)<0&&(d[E]=O(o,i)),l.push(d[E]),!0):!1}else return!1});l.length>0?Promise.all(l).then(o=>{o.forEach((r,E)=>{if(u(r,"serviceItemId")){let w=r.serviceItemId;a.indexOf(w)<0&&a.push(w),m[y[E]]=w}}),t({dependencies:a,urlHash:m})},o=>n(A(o))):t({dependencies:a,urlHash:m})})}function p3(e,a){let x=e;if(e){let t=a[e];if(t){let n=e.substr(e.lastIndexOf("/")+1);x=c(t,t,".layer"+n+".url")}x=X1(x.replace(/.+?(?=\/home)/,"{{portalBaseUrl}}"))}return x}var R1={};W(R1,{_templatizeAdminEmail:()=>Z3,_templatizeApplication:()=>T3,_templatizeId:()=>J9,_templatizeUrl:()=>W3,_updateDependencies:()=>U3,convertItemToTemplate:()=>M0,convertQuickCaptureToTemplate:()=>$9,createItemFromTemplate:()=>F0});function M0(e,a,x,t){return Q(e,a,x,t)}function $9(e){return D(e,"data.application",T3(e.data.application,e)),e}function T3(e,a){J9(e,"itemId"),Z3(e);let x=e?.dataSources;return x&&Array.isArray(x)&&x.forEach(t=>{let n=t.featureServiceItemId;n&&(U3(n,a),W3(t,"featureServiceItemId","url"),J9(t,"featureServiceItemId"))}),e}function Z3(e){u(e,"preferences.adminEmail")&&D(e,"preferences.adminEmail","{{user.email}}")}function U3(e,a){a.dependencies.indexOf(e)===-1&&a.dependencies.push(e)}function W3(e,a,x){let t=u(e,a),n=u(e,x);if(n){let m=n.substr(n.lastIndexOf("/")+1);D(e,x,c(t,t,".layer"+m+".url"))}}function J9(e,a){let x=u(e,a);x&&D(e,a,c(x,x,".itemId"))}function F0(e,a,x,t){return Y(e,a,x,t)}var R0="home/webmap/viewer.html?webmap=";function O3(e,a,x,t){return new Promise((n,m)=>{e.type!=="Vector Tile Service"&&(e.item.url=e.item.url?J1(v(J))+R0+e.item.id:e.item.url),p0(e,x).then(i=>{e.dependencies=i.dependencies,e.data&&(e.data.baseMap?.baseMapLayers&&q9(e.data.baseMap.baseMapLayers,i.urlHash,t),e.data.operationalLayers&&q9(e.data.operationalLayers,i.urlHash,t),q9(e.data.tables,i.urlHash,t),g0(e.data)),n(e)},i=>m(A(i)))})}function p0(e,a){return new Promise((x,t)=>{let n=[];if(e.data){let m=e.data.baseMap?.baseMapLayers||[],i=e.data.operationalLayers||[],l=e.data.tables||[],d=m.concat(i).concat(l);h0(d,n,a).then(y=>{x(y)},y=>t(A(y)))}else x({dependencies:n,urlHash:{}})})}function g0(e){$1(e,"initialState")}function h0(e,a,x){return new Promise((t,n)=>{let m={},i={f:"json",authentication:x},l=[],d={},y=e.filter(o=>{if(o.itemId&&o.layerType==="VectorTileLayer")return l.push(g(o.itemId,x)),!0;if(o.url&&o.url.indexOf("{{velocityUrl}}")<0){let r=/.+FeatureServer/g.exec(o.url),E=Array.isArray(r)&&r.length>0?r[0]:void 0;return E?(Object.keys(d).indexOf(E)<0&&(d[E]=O(o.url,i)),l.push(d[E]),!0):!1}else return!1});l.length>0?Promise.all(l).then(o=>{o.forEach((r,E)=>{if(y[E].layerType==="VectorTileLayer"){let w=u(r,"typeKeywords");if(w&&w.includes("Vector Tile Style Editor")){a.indexOf(r.id)<0&&a.push(r.id),y[E].templatizeId=!0;let s=y[E].styleUrl.indexOf(r.id)+r.id.length;y[E].styleUrl=c(y[E].styleUrl.replace(y[E].styleUrl.substring(0,s),r.id),r.id,".itemUrl")}}else if(u(r,"serviceItemId")){let w=r.serviceItemId;a.indexOf(w)<0&&a.push(w),m[y[E].url]=w}}),t({dependencies:a,urlHash:m})},o=>n(A(o))):t({dependencies:a,urlHash:m})})}function q9(e=[],a,x){e.forEach(t=>{if(t.itemId&&t.layerType==="VectorTileLayer")t.templatizeId&&(t.itemId=c(t.itemId,t.itemId,".itemId"),delete t.templatizeId);else if(t.url){let n=t.url.substr(t.url.lastIndexOf("/")+1),m=Object.keys(a).indexOf(t.url)>-1?a[t.url]:void 0;m&&(w1(n,m,t.url,x),t.url=c(m,m,".layer"+n+".url"),t.itemId=c(m,m,".layer"+n+".itemId"))}})}function K3(e,a){return["data.operationalLayers","data.tables","data.applicationProperties.viewing.search.layers"].forEach(t=>T0(e,a,t)),e}function T0(e,a,x){let t=u(e,x);t&&D(e,x,Z0(t,a))}function Z0(e,a){return e.forEach(x=>{let t=U0(x,a);if(t){let n=t.fields.map(i=>i.name);l7(x,t,t.basePath,t.itemId,n),y7(x,t.basePath,n),x.layerDefinition&&(u7(x.layerDefinition,t.basePath,n),o7(x.layerDefinition,t.basePath,n));let m=u(x,"field.name");m&&D(x,"field.name",d7(m,x,t.itemId,t.basePath))}}),e}function U0(e,a){let x;return a.some(t=>t.ids.indexOf(e.id)>-1?(x=t,!0):!1),x}function Q(e,a,x,t){return new Promise((n,m)=>{let i=j(e);i.item.id=c(i.item.id,i.item.id,".itemId");let l=Q1(i.itemId,"forward",x),d=Promise.resolve({}),y=Promise.resolve([]);switch(e.type){case"Dashboard":case"Data Pipeline":case"Feature Collection":case"Feature Service":case"Hub Initiative":case"Hub Page":case"Hub Site Application":case"Insights Model":case"Oriented Imagery Catalog":case"Project Package":case"Style":case"Workforce Project":case"Web Map":case"Web Mapping Application":case"Web Scene":case"Notebook":d=new Promise(o=>{$(i.itemId,x).then(r=>o(r))});break;case"Form":d=k1(i.itemId,i.item.name,x);break;case"QuickCapture Project":y=e9(i.itemId,x);break}Promise.all([d,l,y]).then(o=>{let[r,E,w]=o;y3(i,t),i.data=l9(r,e.type,t);let s=E;i.dependencies=[],i.relatedItems=[],s.forEach(b=>{b.relationshipType!=="WMA2Code"&&(i.relatedItems.push(b),b.relatedItemIds.forEach(C=>{i.dependencies.indexOf(C)<0&&i.dependencies.push(C)}))}),e.type==="Data Pipeline"&&(i.dependencies=i.dependencies.concat(W0(r)));let P=Promise.resolve(i);switch(e.type){case"Dashboard":b3(i,t);break;case"Notebook":P=z9(i);break;case"Oriented Imagery Catalog":P=g3(i,a,x);break;case"QuickCapture Project":i.resources=w,P=new Promise(async b=>{let C=null,I=-1;w&&(w.some((y1,m1)=>{let i1=y1.name==="qc.project.json";return i1&&(C=y1,I=m1),i1}),I>=0&&w.splice(I,1)),C&&(i.data={application:{...await z1(C)},name:"qc.project.json"}),i.data.application?.basemap?.type==="Web Map"&&i.dependencies.push(i.data.application.basemap.itemId);let L=$9(i);b(L)});break;case"Vector Tile Service":case"Web Map":case"Web Scene":P=O3(i,a,x,t);break;case"Web Mapping Application":r&&(P=P3(i,a,x,t));break;case"Workforce Project":P=C3(i,a,x,t);break}P.then(n,b=>m(A(b)))})})}function W0(e){let a=[];return(e?.inputs??[]).concat(e?.outputs??[]).forEach(t=>{if(t.type==="FeatureServiceSource"||t.type==="FeatureServiceSink"){let n=u(t,"parameters.layer.value.itemId");n&&a.push(n)}}),a}var R={};W(R,{convertItemToTemplate:()=>O0,createItemFromTemplate:()=>K0,postProcess:()=>v0,postProcessFieldReferences:()=>H0});function O0(e,a,x,t){return Q(e,a,x,t)}function K0(e,a,x,t,n){return n?Y(e,a,x,t,n):Y(e,a,x,t)}function H0(e,a,x){switch(x){case"Web Mapping Application":c3(e,a);break;case"Dashboard":s3(e,a);break;case"Web Map":K3(e,a);break}return e}async function v0(e,a,x,t,n,m,i){if(a==="Web Map"&&t.resources.some(l=>l.indexOf(d1)>-1)){let l=t3(`${m.portalBaseUrl}/sharing/rest`,t.itemId,d1),d={httpMethod:"GET",authentication:i,params:{f:"json"},headers:{Accept:"application/json",Authorization:`Bearer ${i.token}`,"Content-Type":"application/json","X-Esri-Authorization":`Bearer ${i.token}`}};await O(l,d).then(async y=>{let o=JSON.stringify(y),r=N(o,m);if(o!==r){let E=JSON.parse(r),w={id:e,resource:E1(E,d1),name:d1,authentication:i,params:{}};await P2(w)}})}return q(e,m,i)}function B0(e,a,x,t){return R.convertItemToTemplate(e,a,x,t)}function u9(e){return!!u(e,"properties.services")}function B3(e,a="https://survey123.arcgis.com"){let x=`${a}/api/survey/create`,t={credentials:"same-origin",method:"POST",body:b2({f:"json",...e},!0)};return fetch(x,t).then(n=>n.json()).then(n=>{if(!n.success)throw new Error(`Failed to create survey: ${n.error.message}`);return{formId:n.id,featureServiceId:n.featureService.source.itemId,folderId:n.formItemInfo.ownerFolder}})}var L3=function(a){let x=Z(a),t=[["header","content"],["subHeader","content"],["footer","content"],["settings","thankYouScreenContent"]],n=(i,l)=>(i&&i[l]&&(i[l]=encodeURIComponent(i[l])),i);t.forEach(([i,l])=>n(x[i],l));let m=i=>n(i,"description");return x.questions=(x.questions||[]).map(i=>i.questions?{...i,questions:i.questions.map(m)}:m(i)),x};function j3(e,a,x){let{item:{title:t,description:n,tags:m,typeKeywords:i},properties:{form:l}}=e,{user:{username:d},portalBaseUrl:y,organization:{basemapGalleryGroupQuery:o,defaultBasemap:{title:r}}}=a,{token:E}=x.toCredential();return J2(o,r,x).then(w=>{let s="Survey-",P=h2(`${s}${t}`,a,"user.folders").replace(s,"");if(l.questions){let C=I=>(I.maps&&(I.maps=I.maps.map(L=>({...L,itemId:w.id}))),I);l.questions=l.questions.map(I=>I.questions?{...I,questions:I.questions.map(C)}:C(I))}let b=L3(l);return{description:n,form:b,portalUrl:y,tags:m,title:P,token:E,typeKeywords:i,username:d}})}function _3(e,a,x,t){let n=N(e,a),{survey123Url:m}=a;return j3(n,a,x).then(i=>B3(i,m)).then(i=>{let{formId:l,featureServiceId:d}=i,y=Promise.resolve(null);return e.item.thumbnail&&(y=b1({id:l},null,x,e.item.thumbnail)),y.then(()=>g(l,x)).then(o=>(a[n.itemId]={itemId:l},a[n.properties.info.serviceInfo.itemId]={itemId:d},t(n.itemId,S.Finished,n.estimatedDeploymentCostFactor,l),{item:{...e,item:o,itemId:l},id:l,type:"Form",postProcess:!0}))}).catch(i=>{throw t(n.itemId,S.Failed,0),i})}function L0(e,a,x,t){return u9(e)?_3(e,a,x,t):R.createItemFromTemplate(e,a,x,t)}async function Y9(e,a){let x=await T9(e),t=new Date;return t=new Date(t.valueOf()-864e5-t.getTimezoneOffset()*1e3*60),x.forEach(n=>{if(typeof n.content=="string"){let m=q3(n,a);e.file(n.file,m,{date:t})}else n.file.endsWith(".xlsx")&&e.file(n.file,n.content,{date:t})}),Promise.resolve(e)}async function X9(e,a){return(await T9(e)).forEach(t=>{if(t.file.endsWith(".info")||t.file.endsWith(".itemInfo")||t.file.endsWith(".json")||t.file.endsWith(".webform")||t.file.endsWith(".xml")){let n=t.content,m=/\b([0-9A-Fa-f]){32}_type/g;n=z3(n,a,m),n=V3(n,a,m),n=J3(n,a),n=$3(n,a),e.file(t.file,n)}}),Promise.resolve(e)}function V3(e,a,x){let t=e;return Object.keys(a).filter(m=>m.match(x)&&a[m].type==="Feature Service").forEach(m=>{let i=a[m].url,l=a[i];l&&(t=t.replace(new RegExp(i,"g"),l))}),t}function z3(e,a,x){let t=e;return Object.keys(a).filter(m=>m.match(x)&&a[m].type!=="Feature Service").map(m=>m.replace("_type","")).forEach(m=>{t=t.replace(new RegExp(m,"g"),`{{${m}.itemId}}`)}),t}function J3(e,a){let x=e;return a.portalBaseUrl&&(x=x.replace(new RegExp(a.portalBaseUrl,"g"),"{{portalBaseUrl}}")),x}function $3(e,a){let x=e;return a.workflowBaseUrl&&(x=x.replace(new RegExp(a.workflowBaseUrl,"g"),"{{workflowBaseUrl}}")),x}function q3(e,a){let x=M2(),t=e.content;return t=N(e.content,a),f1(t.match(x)??[]).forEach(m=>{let i=a[m];typeof i?.itemId=="string"&&(t=t.replace(new RegExp(m,"g"),`${i.itemId}`))}),t}function Y3(e,a,x,t,n,m,i){let l=t.properties.info.serviceInfo.itemId,{itemId:d}=m[l],y=N(t,m);return g(d,i).then(o=>{let r=[{id:e,title:y.item.title,snippet:y.item.snippet,extent:y.item.extent,culture:y.item.culture},{id:d,extent:y.item.extent,typeKeywords:[`source-${l}`].concat(o.typeKeywords)}],E=s=>B(s,i),w=r.map(E);return Promise.all(w).then(()=>{let s=[e,d],P=C=>V({itemId:C,folderId:m.folderId,authentication:i}),b=s.map(P);return Promise.all(b)}).then(()=>c7(o.ownerFolder,i)).then(()=>{let s=j(o);return n.push(s),t.dependencies.push(o.id),!0})})}async function X3(e,a,x,t,n,m,i){let l=await k1(e,"Form",i);if(l){let d=await h9(l),y=await Y9(d,m);t9(y,e,i)}else return await G2(5e3),X3(e,a,x,t,n,m,i);return u9(t)?Y3(e,a,x,t,n,m,i):q(e,m,i)}async function _0(e,a){for(let x of e)if(x.type==="Form"){let t=x.data;if(x.data=null,t){let n=await h9(t);n=await X9(n,a),x.item.name=Q3(x.item.name,t.name,`${x.itemId}.zip`);let m=await p7(n,x.item.name),i=n9(x.itemId,x.item.name,1,M1.data),l={itemId:x.itemId,file:m,folder:i.folder,filename:x.item.name};x.dataFile=l,x.resources.push(i.folder+"/"+i.filename)}}return Promise.resolve(e)}function Q3(e,a,x){let t=e||a;return t&&t!=="undefined"?t:x}var e2={};W(e2,{_initializeNewGroup:()=>e6,convertItemToTemplate:()=>V0,createItemFromTemplate:()=>z0,postProcess:()=>J0});function V0(e,a,x){return new Promise(t=>{let n=W2(e);n.item.id=c(n.item.id,n.item.id,".itemId"),V2(e.id,x).then(m=>{n.type="Group",_2(e.id,x).then(i=>{i.id=n.item.id,n.item={...i,type:"Group"},n.dependencies=m.concat(p2(i.tags)),t(n)},()=>t(n))},()=>t(n))})}function z0(e,a,x,t){return new Promise(n=>{if(!t(e.itemId,S.Started,0)){t(e.itemId,S.Ignored,0),n(k(e.type));return}let m=Z(e);m=N(m,a),m.item.thumbnail=e.item.thumbnail;let i=e6(m.item);w7(i.title,i,a,x,R9(m)?a.locationTracking.owner:void 0).then(l=>{if(l.success)if(!t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id))t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)));else if(m.itemId=l.group.id,a[e.itemId]={itemId:l.group.id},m=N(m,a),a[e.itemId].itemId=l.group.id,!t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor/2,l.group.id))t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)));else if(R9(m)){let d=a.locationTracking.owner;C7(l.group.id,d,x).then(y=>{y.success?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id)?G7(l.group.id,[x.username],x).then(o=>{Array.isArray(o.notRemoved)&&o.notRemoved.length===0?t(e.itemId,S.Created,e.estimatedDeploymentCostFactor/2,l.group.id)?n({item:m,id:l.group.id,type:m.type,postProcess:x1(m)}):(t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))}):(t(e.itemId,S.Cancelled,0),G1(l.group.id,x).then(()=>n(k(e.type)),()=>n(k(e.type)))):(t(e.itemId,S.Failed,0),n(k(e.type)))})}else n({item:m,id:l.group.id,type:m.type,postProcess:x1(m)});else t(e.itemId,S.Failed,0),n(k(e.type))},()=>{t(e.itemId,S.Failed,0),n(k(e.type))})})}function J0(e,a,x,t,n,m,i){let l=Promise.resolve({success:!0});return x.some(d=>{if(d.id===e){let y=d.item.item;return x1(y)&&(y=N(y,m),l=M7(y,i)),!0}}),l}function e6(e){let a={access:"private",description:e.description,owner:e.owner,snippet:e.snippet,tags:e.tags,thumbnail:e.thumbnail,title:e.title||"",typeKeywords:e.typeKeywords};return["autoJoin","displaySettings","isInvitationOnly","isOpenData","isViewOnly","membershipAccess","properties","sortField","sortOrder"].forEach(t=>{e.hasOwnProperty(t)&&(a[t]=e[t])}),a}var p1={};W(p1,{convertItemToTemplate:()=>$0,createItemFromTemplate:()=>q0,isAPage:()=>X0,postProcess:()=>Y0});function a6(e,a,x,t){return e=S1(e,x,{}),B7(e,{...t,allowList:[]}).then(()=>!0)}function r9(e){let a=z(e);return(e.dependencies||[]).forEach(t=>{let n=new RegExp(t,"g"),m=`{{${t}.itemId}}`;a.item=u1(a.item,n,m),a.data=u1(a.data,n,m),e.properties&&(a.properties=u1(a.properties,n,m))}),a}function S9(e,a,x){let t=K(V,{success:!0}),n=[t({itemId:e.item.id,folderId:a,authentication:x})];return H(e,"item.properties.parentInitiativeId")&&n.push(t({itemId:e.item.properties.parentInitiativeId,folderId:a,authentication:x})),Promise.all(n)}function $0(e,a,x=null){let t=0,n=0;return Promise.all([D1(e.id,{authentication:a}),n1(a)]).then(([m,i])=>(t=m.item.created,n=m.item.modified,j7(m,i))).then(m=>(m.item.created=t,m.item.modified=n,m.item.typeKeywords=H1(m.item.typeKeywords,"doNotDelete"),m.groups=[],m.estimatedDeploymentCostFactor=2,m.resources=[],H(m,"properties")||(m.properties={}),m=r9(m),m))}function q0(e,a,x,t){if(!t(e.itemId,S.Started,0))return Promise.resolve(k(e.type));if(e.assets&&e.resources&&delete e.assets,a.solutionItemExtent){let y=a.solutionItemExtent.split(",");a.organization.defaultExtentBBox=[[y[0],y[1]],[y[2],y[3]]]}let m={},i,l,d=e.item.thumbnail;return n1(x,a).then(y=>(l=y,_7(e,a,m,l))).then(y=>{let o=y,r={assets:o.assets||[]};return L7(o,r,l)}).then(y=>(i=y,S9(y,a.folderId,x))).then(()=>{let y={item:{id:i.item.id},params:{thumbnail:d},authentication:x};return e1(y)}).then(()=>{if(a[e.itemId]={itemId:i.item.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor||2,i.item.id)){let o={item:{...e,...a1(i)},id:i.item.id,type:e.type,postProcess:!0};return o.item.itemId=i.item.id,o}else return K(v7,{success:!0})(i,l).then(()=>Promise.resolve(k(e.type)))}).catch(y=>{throw t(e.itemId,S.Failed,0),y})}function Y0(e,a,x,t,n,m,i){let l;return n1(i).then(d=>(l=d,D1(e,{authentication:i}))).then(d=>a6(d,x,m,l))}function X0(e){let a=!1;return(e==="Hub Page"||e==="Site Page")&&(a=!0),a}var g1={};W(g1,{convertItemToTemplate:()=>Q0,createItemFromTemplate:()=>e5,isASite:()=>x5,postProcess:()=>a5});function x6(e,a,x){let t=a.filter(n=>n.type.indexOf("Page")>-1).map(n=>n.id);return Promise.all(t.map(n=>D1(n,x))).then(n=>Q7(e,n,x))}function t6(e,a,x,t){let n=a.filter(d=>d.id!==e.item.id),m=n.map(d=>({item:{id:d.id,type:d.type}})),i=[];i=i.concat(X7(e,m,t)),i=i.concat(x6(e,n,t));let l=n.map(d=>d.id);return e.item.properties.children=l,e=$7(e,x,{}),i.push(V7(e,{...t,allowList:void 0})),Promise.all(i).then(()=>!0)}function Q0(e,a,x=null){let t=0,n=0,m,i,l;return n1(a).then(d=>(l=d,D9(e.id,l))).then(d=>(t=d.item.created,n=d.item.modified,m=d.item.title,i=d.data.values.title,Y7(d,l))).then(d=>(d.item.created=t,d.item.modified=n,d.item.title=m,d.item.typeKeywords=H1(d.item.typeKeywords,"doNotDelete"),d.data.values.title=i,d.groups=[],d.estimatedDeploymentCostFactor=2,d.resources=[],u(d,"properties")||(d.properties={}),d.dependencies=f1(d.dependencies),d=r9(d),d))}function e5(e,a,x,t){if(!t(e.itemId,S.Started,0))return Promise.resolve(k(e.type));e.assets&&e.resources&&delete e.assets,a.solution||(a.solution={}),a.solution.title=a.title;let m={},i,l,d=e.item.thumbnail;return n1(x,a).then(y=>(l=y,q7(e,a,m,l))).then(y=>{let o={assets:y.assets||[]};return J7(y,o,l)}).then(y=>(i=y,S9(y,a.folderId,x))).then(()=>{let y={item:{id:i.item.id},params:{thumbnail:d},authentication:x};return e1(y)}).then(()=>{if(a[e.itemId]={itemId:i.item.id},t(e.itemId,S.Finished,e.estimatedDeploymentCostFactor||2,i.item.id)){let o={item:{...e,...a1(i)},id:i.item.id,type:e.type,postProcess:!0};return o.item.itemId=i.item.id,o}else return K(z7,{success:!0})(i,l).then(()=>Promise.resolve(k(e.type)))}).catch(y=>{throw t(e.itemId,S.Failed,0),y})}function a5(e,a,x,t,n,m,i){let l;return n1(i,m).then(d=>(l=d,D9(e,l))).then(d=>t6(d,x,m,l)).then(()=>Promise.resolve(!0))}function x5(e){let a=!1;return(e==="Hub Site Application"||e==="Site Application")&&(a=!0),a}var E9={};W(E9,{convertItemToTemplate:()=>m5,createItemFromTemplate:()=>i5,isAStoryMap:()=>l5});function n6(e={}){let a=0;return Object.keys(e).reduce((x,t)=>(H(e,`${t}.type`)==="webmap"&&t!==`webmap${a}`&&(x.push({original:t,updated:`webmap${a}`}),a++),x),[])}function m6(e){let a=H(e,"data.resources")||{};return Object.keys(a).reduce((x,t)=>(H(a,`${t}.type`)==="webmap"&&x.push(H(a,`${t}.data.itemId`)),x),[])}function l6(e){let a=Y1(e.item.id,e.item.type);a.key=`${L1(e.item.title)}_${v1("i")}`;let x=z(e);a.data=x.data;let t=x.item.created,n=x.item.modified;return a.item=_1(x.item),a.item.created=t,a.item.modified=n,a.item.url="{{storyMapTemplateUrl}}",n6(a.data.resources).forEach(l=>{a.data.resources[l.updated]=z(a.data.resources[l.original]),delete a.data.resources[l.original],a.data.nodes=u1(a.data.nodes,l.original,l.updated)}),a.item.typeKeywords.indexOf(i6)!==-1&&(a.item.typeKeywords=[t5].concat(a.item.typeKeywords.filter(l=>l!==i6))),a.properties={},a.properties.draftFileName="draft_{{timestamp}}.json",Object.assign(a.properties,n5),a.dependencies=m6(e),Promise.resolve(a)}var i6="smstatusunpublishedchanges",t5="smstatuspublished",n5={oembed:{version:"1.0",type:"rich",title:"Example StoryMap",url:"{{storyMapTemplateUrl}}",provider_name:"ArcGIS StoryMaps",provider_url:"{{storyMapBaseUrl}}",width:800,height:600,thumbnail_url:"{{storyMapThumbnailUrl}}",thumbnail_height:"100.5",thumbnail_width:"400",html:'<iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen></iframe>',cache_age:86400},oembedXML:`<?xml version="1.0" encoding="utf-8" standalone="yes"?>
3
3
  <oembed>
4
4
  <version>1.0</version>
5
5
  <type>rich</type>
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import c from"./6GS6GAPJ.js";import a from"./ABL2KXLF.js";import{K as b,ob as E,pb as f,r as I,ra as R}from"./TXNMM6GI.js";import{g as P}from"./JUUVYK2H.js";export default $arcgis.t(([{c:J,d:N,f:B,g:D,j:F,k:O},{a:U,b:h,e:u}])=>{var T=class{constructor(r,e,s){this.cMissingImageDataURI="https://static.arcgis.com/images/solution.png",this.cardCache=[],this.cardCacheParams={q:"",categoriesAsStr:"[]",sortField:"title",sortOrder:"asc"},this.locale=r,this.orgUrl=e,this.portalUrl=s,this.anonAgolSession=new P({}),this.agolPortalUrl=D(s)}addToCache(r){this.cardCache.push(r)}getCache(){return this.cardCache}removeFromCache(r){this.cardCache=this.cardCache.filter(e=>e.id!==r)}requestAvailableSolutionCards(r,e,s,t,c,g,a,i){let d=a?.start?a.start:1,m=a?.num?a.num:24,j=this.portalUrl+"/sharing/rest",k=this.agolPortalUrl+"/sharing/rest",K=this.anonAgolSession,S=JSON.stringify(r.categories);if(this.cardCacheParams.q!==r.q||this.cardCacheParams.categoriesAsStr!==S||r.sortField==="relevance"?(this.cardCache=[],this.cardCacheParams={q:r.q,categoriesAsStr:S,sortField:r.sortField,sortOrder:r.sortOrder}):(this.cardCacheParams.sortField!==r.sortField||this.cardCacheParams.sortOrder!==r.sortOrder)&&(this.cardCacheParams.sortField=r.sortField,this.cardCacheParams.sortOrder=r.sortOrder,this.cardCache=u(this.cardCache,this.cardCacheParams.sortField,this.cardCacheParams.sortOrder)),this.cardCache.length>0){let o;if(i&&i.size>0){let l=U(this.cardCache,i);o=h(l,d,m)}else o=h(this.cardCache,d,m);return Promise.resolve(o)}let y={filter:r.filter,sortField:r.sortField,sortOrder:r.sortOrder,categories:r?.categories?this.convertSearchCategories(r.categories):"",signal:g},C=[];if(e&&!c){let o=t||new P({});C.push(f(e,r.q,o,y,j))}return s&&c&&C.push(f(s,r.q,K,y,k)),Promise.allSettled(C).then(o=>{let l=[];o.forEach(n=>{if(n.status==="fulfilled"){let w=n.value,v="",q=!1;v=this.agolPortalUrl,q=!0,w.results.forEach(A=>{A.sourcePortalUrl=v,A.knownToBePublicSource=q}),l.push(w)}else if(n.status==="rejected")throw new Error(n.reason.message?n.reason.message:"cannotAccessAGO")}),l.length===0?this.cardCache=[]:l.length===1?this.cardCache=this.getCardsFromResponse(l[0]):this.cardCache=u(this.getCardsFromResponse(this.mergeResponses(l)),this.cardCacheParams.sortField,this.cardCacheParams.sortOrder);let p;if(i&&i.size>0){let n=U(this.cardCache,i);p=h(n,d,m)}else p=h(this.cardCache,d,m);return Promise.resolve(p)}).catch(o=>Promise.reject(new Error(o.message)))}requestDeployedSolutionCards(r,e,s="",t){let c=this.portalUrl+"/sharing/rest";if(t.aborted)return Promise.resolve([]);if(this.cardCacheParams.q!==r.q||this.cardCacheParams.categoriesAsStr!==JSON.stringify(r.q)||r.sortField==="relevance"?(this.cardCache=[],this.cardCacheParams={q:r.q,categoriesAsStr:"[]",sortField:r.sortField,sortOrder:r.sortOrder}):(this.cardCacheParams.sortField!==r.sortField||this.cardCacheParams.sortOrder!==r.sortOrder)&&(this.cardCacheParams.sortField=r.sortField,this.cardCacheParams.sortOrder=r.sortOrder,this.cardCache=u(this.cardCache,this.cardCacheParams.sortField,this.cardCacheParams.sortOrder)),t.aborted)return Promise.resolve([]);if(this.cardCache.length>0){let a=h(this.cardCache,1,this.cardCache.length);return Promise.resolve(a)}let g={q:r.q,filter:r.filter,sortField:r.sortField,sortOrder:r.sortOrder,authentication:e,portal:c,categories:r?.categories?JSON.stringify(r.categories):"",num:r.num,signal:t};return s?R(s,e).then(a=>{if(t.aborted)return Promise.resolve([]);this.cardCache=this.getCardsFromResponse({results:[a]});let i=h(this.cardCache,1,this.cardCache.length);return Promise.resolve(i)}).catch(a=>Promise.reject(new Error(a))):E(g).then(a=>{this.cardCache=this.getCardsFromResponse(a);let i=h(this.cardCache,1,this.cardCache.length);return Promise.resolve(i)}).catch(a=>Promise.reject(new Error(a)))}convertSearchCategories(r){return r&&(Array.isArray(r)?r=r.map(e=>JSON.stringify(Array.isArray(e)?e:[e])):r=JSON.stringify([r])),r}getCardsFromResponse(r){return r.results.length>0?I(r.results).map(e=>{let s=e.sourcePortalUrl?e.sourcePortalUrl:this.portalUrl,t=e.sourcePortalUrl?e.sourcePortalUrl:this.orgUrl,c={id:e.id,title:e.title,snippet:e.snippet||"",description:e.description||"",url:e.url||"",itemUrl:`${t}/home/item.html`+N([{k:"id",v:e.id}])||"",thumbnailFilename:e.thumbnail,thumbnailUrl:B(e.id,e.thumbnail,this.cMissingImageDataURI,s),tryitUrl:e.url||"",typeKeywords:e.typeKeywords,learnMoreUrl:e.properties?.learnMoreUrl||"",createdMs:e.created,created:F(e.created,this.locale),modified:F(e.modified,this.locale),numViews:e.numViews,tags:e.tags,categories:e.groupCategories&&e.groupCategories.length>0?e.groupCategories:e.categories||[],licenseInfo:J(e.licenseInfo),deployCommonId:O(e.typeKeywords||[],"solutionid-"),deployVersion:O(e.typeKeywords||[],"solutionversion-"),canDelete:e.created>16183314e5,preview:this.preparePreviewImageUrls(e.id,e.properties?.preview,s),sourcePortalUrl:e.sourcePortalUrl||"",knownToBePublicSource:e.knownToBePublicSource||!1,waitId:"",relatedSolutions:b(e,"properties.relatedSolutions")||[],owner:e.owner};return c.deployCommonId!==""&&c.deployVersion!==""?c:null}).filter(e=>e!=null):[]}mergeResponses(r){let e=0;r.forEach(t=>e+=t.total);let s=[];return r.forEach(t=>s=s.concat(t.results)),{query:r[0].query,start:1,num:e,nextStart:-1,total:e,results:s}}preparePreviewImageUrls(r,e,s){return e?e.map(t=>(t.format==="image"&&(t.name=s+"/sharing/rest/content/items/"+r+"/resources/"+t.name),t)):[]}};return T},a,c)
2
+ import c from"./BYU5RVVM.js";import a from"./VK6ZOC6A.js";import{K as b,ob as E,pb as f,r as I,ra as R}from"./WU7QCA5H.js";import{g as P}from"./JUUVYK2H.js";export default $arcgis.t(([{c:J,d:N,f:B,g:D,j:F,k:O},{a:U,b:h,e:u}])=>{var T=class{constructor(r,e,s){this.cMissingImageDataURI="https://static.arcgis.com/images/solution.png",this.cardCache=[],this.cardCacheParams={q:"",categoriesAsStr:"[]",sortField:"title",sortOrder:"asc"},this.locale=r,this.orgUrl=e,this.portalUrl=s,this.anonAgolSession=new P({}),this.agolPortalUrl=D(s)}addToCache(r){this.cardCache.push(r)}getCache(){return this.cardCache}removeFromCache(r){this.cardCache=this.cardCache.filter(e=>e.id!==r)}requestAvailableSolutionCards(r,e,s,t,c,g,a,i){let d=a?.start?a.start:1,m=a?.num?a.num:24,j=this.portalUrl+"/sharing/rest",k=this.agolPortalUrl+"/sharing/rest",K=this.anonAgolSession,S=JSON.stringify(r.categories);if(this.cardCacheParams.q!==r.q||this.cardCacheParams.categoriesAsStr!==S||r.sortField==="relevance"?(this.cardCache=[],this.cardCacheParams={q:r.q,categoriesAsStr:S,sortField:r.sortField,sortOrder:r.sortOrder}):(this.cardCacheParams.sortField!==r.sortField||this.cardCacheParams.sortOrder!==r.sortOrder)&&(this.cardCacheParams.sortField=r.sortField,this.cardCacheParams.sortOrder=r.sortOrder,this.cardCache=u(this.cardCache,this.cardCacheParams.sortField,this.cardCacheParams.sortOrder)),this.cardCache.length>0){let o;if(i&&i.size>0){let l=U(this.cardCache,i);o=h(l,d,m)}else o=h(this.cardCache,d,m);return Promise.resolve(o)}let y={filter:r.filter,sortField:r.sortField,sortOrder:r.sortOrder,categories:r?.categories?this.convertSearchCategories(r.categories):"",signal:g},C=[];if(e&&!c){let o=t||new P({});C.push(f(e,r.q,o,y,j))}return s&&c&&C.push(f(s,r.q,K,y,k)),Promise.allSettled(C).then(o=>{let l=[];o.forEach(n=>{if(n.status==="fulfilled"){let w=n.value,v="",q=!1;v=this.agolPortalUrl,q=!0,w.results.forEach(A=>{A.sourcePortalUrl=v,A.knownToBePublicSource=q}),l.push(w)}else if(n.status==="rejected")throw new Error(n.reason.message?n.reason.message:"cannotAccessAGO")}),l.length===0?this.cardCache=[]:l.length===1?this.cardCache=this.getCardsFromResponse(l[0]):this.cardCache=u(this.getCardsFromResponse(this.mergeResponses(l)),this.cardCacheParams.sortField,this.cardCacheParams.sortOrder);let p;if(i&&i.size>0){let n=U(this.cardCache,i);p=h(n,d,m)}else p=h(this.cardCache,d,m);return Promise.resolve(p)}).catch(o=>Promise.reject(new Error(o.message)))}requestDeployedSolutionCards(r,e,s="",t){let c=this.portalUrl+"/sharing/rest";if(t.aborted)return Promise.resolve([]);if(this.cardCacheParams.q!==r.q||this.cardCacheParams.categoriesAsStr!==JSON.stringify(r.q)||r.sortField==="relevance"?(this.cardCache=[],this.cardCacheParams={q:r.q,categoriesAsStr:"[]",sortField:r.sortField,sortOrder:r.sortOrder}):(this.cardCacheParams.sortField!==r.sortField||this.cardCacheParams.sortOrder!==r.sortOrder)&&(this.cardCacheParams.sortField=r.sortField,this.cardCacheParams.sortOrder=r.sortOrder,this.cardCache=u(this.cardCache,this.cardCacheParams.sortField,this.cardCacheParams.sortOrder)),t.aborted)return Promise.resolve([]);if(this.cardCache.length>0){let a=h(this.cardCache,1,this.cardCache.length);return Promise.resolve(a)}let g={q:r.q,filter:r.filter,sortField:r.sortField,sortOrder:r.sortOrder,authentication:e,portal:c,categories:r?.categories?JSON.stringify(r.categories):"",num:r.num,signal:t};return s?R(s,e).then(a=>{if(t.aborted)return Promise.resolve([]);this.cardCache=this.getCardsFromResponse({results:[a]});let i=h(this.cardCache,1,this.cardCache.length);return Promise.resolve(i)}).catch(a=>Promise.reject(new Error(a))):E(g).then(a=>{this.cardCache=this.getCardsFromResponse(a);let i=h(this.cardCache,1,this.cardCache.length);return Promise.resolve(i)}).catch(a=>Promise.reject(new Error(a)))}convertSearchCategories(r){return r&&(Array.isArray(r)?r=r.map(e=>JSON.stringify(Array.isArray(e)?e:[e])):r=JSON.stringify([r])),r}getCardsFromResponse(r){return r.results.length>0?I(r.results).map(e=>{let s=e.sourcePortalUrl?e.sourcePortalUrl:this.portalUrl,t=e.sourcePortalUrl?e.sourcePortalUrl:this.orgUrl,c={id:e.id,title:e.title,snippet:e.snippet||"",description:e.description||"",url:e.url||"",itemUrl:`${t}/home/item.html`+N([{k:"id",v:e.id}])||"",thumbnailFilename:e.thumbnail,thumbnailUrl:B(e.id,e.thumbnail,this.cMissingImageDataURI,s),tryitUrl:e.url||"",typeKeywords:e.typeKeywords,learnMoreUrl:e.properties?.learnMoreUrl||"",createdMs:e.created,created:F(e.created,this.locale),modified:F(e.modified,this.locale),numViews:e.numViews,tags:e.tags,categories:e.groupCategories&&e.groupCategories.length>0?e.groupCategories:e.categories||[],licenseInfo:J(e.licenseInfo),deployCommonId:O(e.typeKeywords||[],"solutionid-"),deployVersion:O(e.typeKeywords||[],"solutionversion-"),canDelete:e.created>16183314e5,preview:this.preparePreviewImageUrls(e.id,e.properties?.preview,s),sourcePortalUrl:e.sourcePortalUrl||"",knownToBePublicSource:e.knownToBePublicSource||!1,waitId:"",relatedSolutions:b(e,"properties.relatedSolutions")||[],owner:e.owner};return c.deployCommonId!==""&&c.deployVersion!==""?c:null}).filter(e=>e!=null):[]}mergeResponses(r){let e=0;r.forEach(t=>e+=t.total);let s=[];return r.forEach(t=>s=s.concat(t.results)),{query:r[0].query,start:1,num:e,nextStart:-1,total:e,results:s}}preparePreviewImageUrls(r,e,s){return e?e.map(t=>(t.format==="image"&&(t.name=s+"/sharing/rest/content/items/"+r+"/resources/"+t.name),t)):[]}};return T},a,c)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import a from"./K6MXQSMI.js";export default $arcgis.t(([a,u,{g:i}])=>{var c=class{async getPopupTitle(o,f){let s={};for(let[e,r]of Object.entries(o.attributes))s={...s,[`{${e.toUpperCase()}}`]:r};let p=o.layer,l=this._removeTags(p?.popupTemplate?.title);if(l.includes("{expression/expr")&&p?.popupTemplate?.expressionInfos!=null)for(let e=0;e<p.popupTemplate?.expressionInfos.length;e++){let r=p.popupTemplate.expressionInfos[e],n=a.createArcadeProfile("popup");try{let t=await(await a.createArcadeExecutor(r.expression,n)).executeAsync({$feature:o,$layer:p,$map:f});(t!==null||t!=="")&&(s[`{expression/${r.name}}`.toUpperCase()]=t)}catch(t){console.error(t);continue}}return p.popupTemplate?.fieldInfos&&p.fields.forEach(e=>{let r=o.attributes[e.name],n=(p?.popupTemplate?.fieldInfos||[]).find(m=>m.fieldName.toLowerCase()===e.name.toLowerCase()),t=i(r,e.type,e?.domain,n?.format,u);s[`{${e.name.toUpperCase()}}`]=t??r}),l?.replace(/{.*?}/g,e=>s[e.toUpperCase()]!=null?s[e.toUpperCase()]:"")}_removeTags(o){return o==null||o===""?"":o.toString().replace(/(<([^>]+)>)/gi,"")}};return c},"arcade","intl",a)
2
+ import a from"./MSEGWVWC.js";export default $arcgis.t(([a,u,{g:i}])=>{var c=class{async getPopupTitle(o,f){let s={};for(let[e,r]of Object.entries(o.attributes))s={...s,[`{${e.toUpperCase()}}`]:r};let p=o.layer,l=this._removeTags(p?.popupTemplate?.title);if(l.includes("{expression/expr")&&p?.popupTemplate?.expressionInfos!=null)for(let e=0;e<p.popupTemplate?.expressionInfos.length;e++){let r=p.popupTemplate.expressionInfos[e],n=a.createArcadeProfile("popup");try{let t=await(await a.createArcadeExecutor(r.expression,n)).executeAsync({$feature:o,$layer:p,$map:f});(t!==null||t!=="")&&(s[`{expression/${r.name}}`.toUpperCase()]=t)}catch(t){console.error(t);continue}}return p.popupTemplate?.fieldInfos&&p.fields.forEach(e=>{let r=o.attributes[e.name],n=(p?.popupTemplate?.fieldInfos||[]).find(m=>m.fieldName.toLowerCase()===e.name.toLowerCase()),t=i(r,e.type,e?.domain,n?.format,u);s[`{${e.name.toUpperCase()}}`]=t??r}),l?.replace(/{.*?}/g,e=>s[e.toUpperCase()]!=null?s[e.toUpperCase()]:"")}_removeTags(o){return o==null||o===""?"":o.toString().replace(/(<([^>]+)>)/gi,"")}};return c},"arcade","intl",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import b from"./5MJRRAR3.js";import a from"./ABL2KXLF.js";import{b as u}from"./2B4SGB3I.js";import{b as r}from"./YKQDHR27.js";import{d as c}from"./TXNMM6GI.js";import"./TEHBW75B.js";import"./ALSK2SPM.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./3IHLJADI.js";import"./BMBNSJZQ.js";import"./5HZMUGQD.js";import"./5VDDAINK.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LPBP7CBN.js";import"./3FMOO3PJ.js";import"./XQQ52NKX.js";import"./JUUVYK2H.js";import"./DKD2EGQP.js";import"./4HFHJOS3.js";import"./45M33Q5G.js";import"./FES7B3SJ.js";import{b as l}from"./KIUBUHVM.js";import{G as o,h as s,i as n}from"./H5E6ISYP.js";import"./QPIMTXPL.js";export default $arcgis.t(([,{c:m}])=>{var h=s`*[tabindex]:focus-visible{outline:2px solid var(--calcite-color-brand);outline-offset:2px}.avatar-container{align-items:center;display:flex;flex-direction:row;padding-top:var(--calcite-spacing-lg)}.full-name{margin-inline-start:0px;font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-navigation-user-full-name-text-color, var(--calcite-color-text-1))}.text-container{margin-block-start:.125rem;display:flex;flex-direction:column;padding-inline:1rem;text-align:start}.username{font-size:var(--calcite-font-size--1);color:var(--calcite-navigation-user-name-text-color, var(--calcite-color-text-2))}`,a=class extends o{constructor(){super(),this.lookupProfile=!1,this.username="",this._configContextConsumer=r({context:u,subscribe:!0}),this.listenOn(window,"sessionRefreshed",t=>{this._updateThumbnailToken(t.detail)})}static{this.properties={fullname:1,lookupProfile:5,thumbnailUrl:1,username:1}}static{this.styles=h}loaded(){this.lookupProfile&&this._lookupOwnerProfile(this.username)}willUpdate(t){t.has("username")&&this.lookupProfile&&this._lookupOwnerProfile(this.username)}render(){return n`<div class="avatar-container"><calcite-avatar scale=m .username=${this.username} .thumbnail=${this.thumbnailUrl??void 0} .fullName=${this.fullname??void 0}></calcite-avatar><div class="text-container"><span class="full-name" tabindex=0>${this.fullname??""}</span><span class="username" tabindex=0>${this.username}</span></div></div>`}async _lookupOwnerProfile(t){if(this.fullname=void 0,this.thumbnailUrl="",this.lookupProfile&&this._configContextConsumer.value){let{userSession:i}=this._configContextConsumer.value;if(i)try{let e=await c({authentication:i,username:t});e&&(e.fullName&&(this.fullname=e.fullName),e.thumbnail&&(this.thumbnailUrl=i.portal+"/community/users/"+e.id+"/info/"+e.thumbnail+"?token="+i.token))}catch{console.log("user not found")}}}_updateThumbnailToken(t){this.thumbnailUrl&&this.thumbnailUrl!==""&&(this.thumbnailUrl=m(this.thumbnailUrl,t))}};l("solution-user-avatar",a);return a},a,b)
2
+ import b from"./6UTDTBHM.js";import a from"./VK6ZOC6A.js";import{b as u}from"./2B4SGB3I.js";import{b as r}from"./YKQDHR27.js";import{d as c}from"./WU7QCA5H.js";import"./TEHBW75B.js";import"./ALSK2SPM.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./3IHLJADI.js";import"./BMBNSJZQ.js";import"./5HZMUGQD.js";import"./5VDDAINK.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LPBP7CBN.js";import"./3FMOO3PJ.js";import"./XQQ52NKX.js";import"./JUUVYK2H.js";import"./DKD2EGQP.js";import"./4HFHJOS3.js";import"./45M33Q5G.js";import"./FES7B3SJ.js";import{b as l}from"./KIUBUHVM.js";import{G as o,h as s,i as n}from"./H5E6ISYP.js";import"./QPIMTXPL.js";export default $arcgis.t(([,{c:m}])=>{var h=s`*[tabindex]:focus-visible{outline:2px solid var(--calcite-color-brand);outline-offset:2px}.avatar-container{align-items:center;display:flex;flex-direction:row;padding-top:var(--calcite-spacing-lg)}.full-name{margin-inline-start:0px;font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-navigation-user-full-name-text-color, var(--calcite-color-text-1))}.text-container{margin-block-start:.125rem;display:flex;flex-direction:column;padding-inline:1rem;text-align:start}.username{font-size:var(--calcite-font-size--1);color:var(--calcite-navigation-user-name-text-color, var(--calcite-color-text-2))}`,a=class extends o{constructor(){super(),this.lookupProfile=!1,this.username="",this._configContextConsumer=r({context:u,subscribe:!0}),this.listenOn(window,"sessionRefreshed",t=>{this._updateThumbnailToken(t.detail)})}static{this.properties={fullname:1,lookupProfile:5,thumbnailUrl:1,username:1}}static{this.styles=h}loaded(){this.lookupProfile&&this._lookupOwnerProfile(this.username)}willUpdate(t){t.has("username")&&this.lookupProfile&&this._lookupOwnerProfile(this.username)}render(){return n`<div class="avatar-container"><calcite-avatar scale=m .username=${this.username} .thumbnail=${this.thumbnailUrl??void 0} .fullName=${this.fullname??void 0}></calcite-avatar><div class="text-container"><span class="full-name" tabindex=0>${this.fullname??""}</span><span class="username" tabindex=0>${this.username}</span></div></div>`}async _lookupOwnerProfile(t){if(this.fullname=void 0,this.thumbnailUrl="",this.lookupProfile&&this._configContextConsumer.value){let{userSession:i}=this._configContextConsumer.value;if(i)try{let e=await c({authentication:i,username:t});e&&(e.fullName&&(this.fullname=e.fullName),e.thumbnail&&(this.thumbnailUrl=i.portal+"/community/users/"+e.id+"/info/"+e.thumbnail+"?token="+i.token))}catch{console.log("user not found")}}}_updateThumbnailToken(t){this.thumbnailUrl&&this.thumbnailUrl!==""&&(this.thumbnailUrl=m(this.thumbnailUrl,t))}};l("solution-user-avatar",a);return a},a,b)