@arcgis/core 4.32.0-next.20250213 → 4.32.0-next.20250214
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.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{ecd66dbc4ff446c64984.js → 10ca2107c99fab6bcc3b.js} +1 -1
- package/assets/esri/core/workers/chunks/{d31e25a63f967fedb149.js → 17fe69462cba5eb895b8.js} +1 -1
- package/assets/esri/core/workers/chunks/{4a4739cda8aac510004b.js → 2ebf66e21d155a27b23e.js} +1 -1
- package/assets/esri/core/workers/chunks/3eacb4d1275f2d87825f.js +1 -0
- package/assets/esri/core/workers/chunks/68c187dbf7dea7064ed8.js +1 -0
- package/assets/esri/core/workers/chunks/71a64fbea3512d9a1547.js +1 -0
- package/assets/esri/core/workers/chunks/{24964548c6a3e2eb527d.js → 8bfd97fc2569a6b55776.js} +1 -1
- package/assets/esri/core/workers/chunks/{31f0dd191602b93c02c2.js → 8d1845a773f66aeb3457.js} +1 -1
- package/assets/esri/core/workers/chunks/{5328b2de0d1ac2536ecf.js → c139e737f602c424de13.js} +1 -1
- package/assets/esri/core/workers/chunks/d58f4aa44ade81b0bb3a.js +1 -0
- package/assets/esri/core/workers/chunks/f33da631352920d49639.js +1 -0
- package/copyright.txt +26 -19
- package/core/colorUtils.js +1 -1
- package/interfaces.d.ts +489 -157
- package/intl/locale.js +1 -1
- package/layers/knowledgeGraph/supportUtils.d.ts +0 -2
- package/layers/support/TrackInfo.js +1 -1
- package/layers/support/rasterFunctions/creators/createLocalFunctions.js +1 -1
- package/layers/support/rasterFunctions/creators/createStatisticsFunctions.js +1 -1
- package/package.json +1 -1
- package/rest/support/NormalizationBinParametersMixin.d.ts +4 -0
- package/support/revision.js +1 -1
- package/symbols/support/previewSymbol2D.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
- package/views/2d/layers/features/schema/SourceSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureCache.js +5 -0
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ATileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/PagedTileLoadStrategy.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/i3s/BuildingFilterUtil.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/SymbologyInfo.js +5 -0
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +14 -14
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassIdentifier.js +5 -0
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +2 -2
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
- package/widgets/FeatureTemplates/featureTemplatesUtils.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/LayerList/ListItem.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/DigitizationAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/TableList/ListItem.js +1 -1
- package/widgets/TableList.js +1 -1
- package/assets/esri/core/workers/chunks/00e0c53d89e074399f04.js +0 -1
- package/assets/esri/core/workers/chunks/1a6b6d43eda7986d2349.js +0 -1
- package/assets/esri/core/workers/chunks/28dd172faa85080511c5.js +0 -1
- package/assets/esri/core/workers/chunks/4b56c0c109e10d7409b8.js +0 -1
- package/assets/esri/core/workers/chunks/f78b63620386b2676f1f.js +0 -1
- package/layers/knowledgeGraph/cypherUtils.d.ts +0 -3
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import{createTask as i}from"../core/asyncUtils.js";import a from"../core/Collection.js";import{deprecatedProperty as o}from"../core/deprecate.js";import s from"../core/Logger.js";import{isAbortError as n}from"../core/promiseUtils.js";import r from"../core/ReactiveMap.js";import{watch as l,initial as c,syncAndInitial as d,whenOnce as g}from"../core/reactiveUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import p from"./Widget.js";import{getAllArcPath as u}from"./OrientedImageryViewer/arcUtils.js";import{segmentArcs as v,sectorsRadii as y,featureCircleRadius as _,navigationToolDimensionLength as w}from"./OrientedImageryViewer/constants.js";import{css as b,navigation as M,navigationToolRotationFrom as T,navigationToolRotationTo as C,root as f}from"./OrientedImageryViewer/css.js";import{isFeatureAttachment as A,loadImageForAttachment as I,getThumbnailPixelBlock as O,renderImageWithRotation as L}from"./OrientedImageryViewer/galleryUtils.js";import k from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import E from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import S from"./OrientedImageryViewer/components/ImageLocationWidget.js";import F from"./OrientedImageryViewer/components/ImageOverlays.js";import{loadCalciteComponents as V}from"./support/componentsUtils.js";import{globalCss as P}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as x}from"./support/decorators/messageBundle.js";import{vmEvent as j}from"./support/decorators/vmEvent.js";import{tsx as z}from"./support/jsxFactory.js";import{substitute as G}from"../intl/substitute.js";const $={overlayMapFeatures:"overlay-map-features",overlayed:"overlayed",overlaysActionHandles:"overlays-action-handles"};let B=class extends p{constructor(e,t){super(e,t),this.digitizationEnabled=!1,this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.imageOverlaysOpened=!1,this.navigationToolActive=!1,this.viewModel=new k,this.messagesCommon=null,this.messagesSketch=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters",this.showCameraLocations=!1,this.showMapFeatures=!1,this.visibleElements=new E,this._actionItems=new r,this._imageMeasurementToolsLoaderTask=null,this._clearMeasurements=()=>{this.viewModel.measureType=null,this.viewModel.clearPreviousMeasurements()},this._clearImageLocation=()=>{this.imageLocationToolActive=!1},this._navigationToolExpanded=!1,this._navigationTool=null,this._warningTitleElement=null,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._overlayedLayers=new a,this._handleDigitizationLayerChange=e=>{this.digitizationLayer&&this.stopDigitization(this.digitizationLayer.id),this.digitizationLayer=this.digitizationLayer===e?null:e,this.digitizationLayer&&this.startDigitization(this.digitizationLayer)},this._handleOverlayLayerDeselect=e=>{const t=e.layer;this.viewModel.removeOverlayedGraphicsOnImage(`${t.id}`),this.removeHandles(`${$.overlayed}-${t.id}`)},this._handleOverlayLayerSelect=e=>{const t=e.layer;this.viewModel.overlayMapFeatures(t,this.showMapFeatures),this.addHandles(l((()=>t.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(t.id,t.visible)})),`${$.overlayed}-${t.id}`)},this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._onAction=e=>{const{target:t}=e,{dataset:{action:i}}=t;switch(i){case"draw-point":case"draw-polygon":case"draw-polyline":{const e=i.replace("draw-","");this.viewModel.digitizeCreate(e);break}case"save":this.viewModel.saveDrawing();break;case"select-feature":t.active=!t.active,this.viewModel.toggleSelection(t.active);break;case"delete-feature":this.viewModel.digitizeDelete()}},this._onImageOverlayClosed=()=>{this.imageOverlaysOpened=!1},this._onShowCameraLocationsChanged=e=>{this.showCameraLocations=e},this._onShowMapFeaturesChanged=e=>{this.showMapFeatures=e},this._removeActionElement=e=>{this._actionItems.delete(e.text)},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._sketchLoaderTask=null,this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([l((()=>[this.viewModel?.bestFeatureAngle,this._navigationTool]),(([e,t])=>{t&&this._updateNavigationTool(t)}),c),l((()=>this.currentCoverageVisible),(e=>this._onCurrentCoverageVisibilityChange(e))),l((()=>this.isAdditionalCoverageVisible),(e=>this._onAdditionalCoverageVisibilityChange(e))),l((()=>this.isAdditionalPointSourcesVisible),(e=>this._onAdditionalCameraLocationsVisibility(e))),l((()=>({features:this.currentBestFeature,showCameraLocations:this.showCameraLocations,state:this.viewModel.state})),(({showCameraLocations:e,state:t})=>{"image-loaded"===t&&this.viewModel.overlayCameraLocations(e)}),d),l((()=>({feature:this.currentBestFeature,showMapFeatures:this.showMapFeatures,state:this.viewModel.state})),((e,t)=>{e.showMapFeatures!==t?.showMapFeatures&&this.viewModel.toggleAllOverlayMapFeatures(e.showMapFeatures),null!=e.feature&&e.feature!==t?.feature&&g((()=>"image-loaded"===this.viewModel.state)).then((()=>{this.viewModel.removeAllOverlayMapFeatures(),this._overlayedLayers?.forEach((t=>{this.viewModel.overlayMapFeatures(t,e.showMapFeatures)}))}))}),c)])}loadDependencies(){return V({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),shell:()=>import("@esri/calcite-components/dist/components/calcite-shell"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect()}get accuracyParametersMissing(){return this.viewModel.accuracyParametersMissing}get activeLayer(){return o(s.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(s.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get digitizationLayer(){return this.viewModel.digitizationLayer}set digitizationLayer(e){this.viewModel.digitizationLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get imageLocationToolActive(){return this.viewModel.imageLocationToolState}set imageLocationToolActive(e){this.viewModel.imageLocationToolState=e}get invalidCameraHeading(){return this.viewModel.invalidCameraHeading}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get measureType(){return this.viewModel.measureType}set measureType(e){this.viewModel.measureType=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return"image-loaded"===t&&e}get referencePoint(){return this.viewModel.referencePoint??null}get sketchViewModel(){return this.viewModel.sketch}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}_renderActionBar(){return z("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},z("calcite-action-group",null,this._currentFootprintToggle(),this._additionalFootprintToggle(),this._additionalPointSourcesToggle()),z("calcite-action-group",null,this._mapImageConversionToggle(),this._navigationToolToggle(),this._imageEnhancementsToggle()),z("calcite-action-group",null,this._imageGalleryToggle(),this._imageOverlaysToggle(),this._openPopupAction()),z("calcite-action-group",null,this._measurementToolsToggle()),this._actionTooltips())}_actionTooltips(){return[...this._actionItems].map((([e,t])=>z("calcite-tooltip",{closeOnClick:!0,key:e,placement:"bottom",referenceElement:t},z("span",null,e))))}get _activeMeasurementIcon(){const{measureType:e,imageLocationToolActive:t}=this;if(t)return"pin-tear";switch(e){case"area":return"measure-area";case"height":return"measure-building-height-top-base";default:return"measure-line"}}get _activeMeasurementHeading(){const{measureType:e,messages:t}=this,{groundArea:i,heightAboveGround:a,groundDistance:o}=t;switch(e){case"area":return i;case"height":return a;default:return o}}_additionalFootprintToggle(){const{isAdditionalCoverageVisible:e,invalidCameraHeading:t,visibleElements:{additionalFootprintToggle:i}}=this;return i?z("calcite-action",{active:e,...this._commonActionProperties,class:b.addCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints}):null}_additionalPointSourcesToggle(){const{isAdditionalPointSourcesVisible:e,invalidCameraHeading:t,visibleElements:{additionalCameraLocationsToggle:i}}=this;return i?z("calcite-action",{active:e,...this._commonActionProperties,class:b.addExpPoints,disabled:t,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations}):null}get _measurementToggle(){const{viewModel:{state:e,measureType:t},id:i}=this;if("image-loaded"!==e||!t)return;this._imageMeasurementToolsLoaderTask||this._loadImageMeasurementResources();const a=this._imageMeasurementToolsLoaderTask?.value;return a?z("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:this._activeMeasurementHeading,id:`${i}-${t}-measurement`,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearMeasurements},z(a,{measurementType:t,measurementUnitMessages:this.measurementUnitMessages,messages:this.messages,oiViewModel:this.viewModel})):null}get _commonActionProperties(){return{afterCreate:this._storeActionElement,afterRemoved:this._removeActionElement,afterUpdate:this._storeActionElement,bind:this}}_renderRoot(){const{viewModel:{state:e}}=this;return z("calcite-panel",null,z("calcite-shell",null,z("calcite-panel",{bind:this,class:b.viewerContainer,heading:this.visibleElements.title?this.messages.title:void 0,loading:"image-loading"===e},this.visibleElements.menu?this._renderActionBar():null,this._imageViewer,this._panoramicViewer,this._messageBox,this.invalidCameraHeading?[this._renderWarning(this.messages.invalidCameraHeadingWarningTitle),this._renderWarningTooltip(this.messages.invalidCameraHeadingWarningDescription)]:[this._imageGalleryPanel,this._renderNavigation,this._imageOverlaysPanel],this._imageEnhancementTools,this._renderSketch()),this._measurementToggle,this._locationToggle))}_currentFootprintToggle(){const{currentCoverageVisible:e,invalidCameraHeading:t}=this,{currentFootprintToggle:i}=this.visibleElements;return i?z("calcite-action",{active:e,...this._commonActionProperties,class:b.currentCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint}):null}get _imageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:a,state:o}}=this;return e&&"image-loaded"===o?z("calcite-panel",{bind:this,class:b.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},z("div",{class:b.imageEnhancementTools},z("div",{class:b.imageEnhancementToolContainer},z("calcite-label",null,this.messages.brightness,z("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:t,onCalciteSliderInput:this._handleBrightnessChange}))),z("div",{class:b.imageEnhancementToolContainer},z("calcite-label",null,this.messages.contrast,z("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:i,onCalciteSliderInput:this._handleContrastChange}))),z("div",{class:b.imageEnhancementToolContainer},z("calcite-label",null,this.messages.sharpness,z("calcite-slider",{bind:this,labelTicks:!0,max:1,min:0,step:.1,ticks:.5,value:a,onCalciteSliderInput:this._handleSharpnessChange})))),z("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset})):null}_imageEnhancementsToggle(){const{state:e,mode:t}=this.viewModel,{imageEnhancement:i}=this.visibleElements;return i?z("calcite-action",{active:this.imageEnhancementToolActive,...this._commonActionProperties,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement}):null}get _imageGalleryPanel(){const{container:e,galleryOpened:t,imageGalleryEnabled:i}=this;return i&&t&&e?this._imageGalleryContext:null}get _imageGalleryContext(){const{galleryOpened:e,invalidCameraHeading:t}=this;return z("calcite-panel",{bind:this,class:b.carousel,closable:!0,closed:!e,disabled:t,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},z("div",{class:b.carouselContainer},this._renderThumbnails))}_imageGalleryToggle(){const{imageGalleryEnabled:e,invalidCameraHeading:t,visibleElements:{imageGallery:i}}=this;return i?z("calcite-action",{active:this.galleryOpened,...this._commonActionProperties,disabled:!e||t,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery}):null}get _imageOverlaysComponent(){return z(F,{closed:!this.imageOverlaysOpened,digitizationEnabled:this.digitizationEnabled,digitizationLayer:this.digitizationLayer,messages:this._imageOverlayMessages,overlayedLayers:this._overlayedLayers,showCameraLocations:this.showCameraLocations,showMapFeatures:this.showMapFeatures,view:this.view,onDigitizationLayerChanged:this._handleDigitizationLayerChange,onImageOverlaysClosed:this._onImageOverlayClosed,onLayerDeselected:this._handleOverlayLayerDeselect,onLayerSelected:this._handleOverlayLayerSelect,onShowCameraLocationsChanged:this._onShowCameraLocationsChanged,onShowMapFeaturesChanged:this._onShowMapFeaturesChanged})}get _imageOverlayMessages(){return{...this.messages,...this.messagesSketch}}get _imageSketchToolsMessages(){return{...this.messagesSketch,...this.messagesCommon}}get _imageOverlaysPanel(){const{imageOverlaysOpened:e,viewModel:{state:t}}=this;if(e&&"image-loaded"===t)return z("div",{class:b.imageOverlaysContainer,key:this.messages.imageOverlays},this._imageOverlaysComponent)}_imageOverlaysToggle(){const{viewModel:{state:e},imageOverlaysOpened:t,invalidCameraHeading:i,visibleElements:{imageOverlays:a}}=this;return a?z("calcite-action",{active:t,...this._commonActionProperties,disabled:"image-loaded"!==e||i,icon:"layers",onclick:this._toggleImageOverlays,text:this.messages.imageOverlays}):null}get _imageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i}=this.viewModel,a=null!=e||"default"!==i,o=this.classes({[b.viewer]:!a,[b.viewerHidden]:a});return z("calcite-panel",{afterCreate:t,bind:this,class:o},this._renderSketch())}get _locationToggle(){const{viewModel:{state:e,groundCoordinates:t},imageLocationToolActive:i,messages:{groundLocation:a}}=this;if("image-loaded"===e&&t&&i)return z("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:a,id:a,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearImageLocation},z(S,{groundCoordinates:t,messages:this.messages}))}_mapImageConversionToggle(){const{mapImageConversionToolState:e,viewModel:{state:t},invalidCameraHeading:i,visibleElements:{mapImageConversionTool:a}}=this;return a?z("calcite-action",{active:e,...this._commonActionProperties,disabled:"image-loaded"!==t||i,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool}):null}_measurementToolsToggle(){const{_activeMeasurementIcon:e,measureType:t,viewModel:i,accuracyParametersMissing:a,messages:o,visibleElements:{measurementTools:s}}=this,{state:n,mode:r}=i,{measurementTools:l,groundDistance:c,groundArea:d,heightAboveGround:g,groundLocation:m}=o;return s?z("calcite-dropdown",{disabled:a,key:"measurement-tools",width:"m"},z("calcite-action",{...this._commonActionProperties,icon:e,slot:"trigger",text:l}),z("calcite-dropdown-group",null,z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==n,iconStart:"measure-line",key:"distance-measurement",onclick:e=>this._toggleMeasurementSketch(e,"distance"),selected:"distance"===t},c),z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==n,iconStart:"measure-area",key:"area-measurement",onclick:e=>this._toggleMeasurementSketch(e,"area"),selected:"area"===t},d),z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==n||"panoramic"===r,iconStart:"measure-building-height-top-base",key:"height-dropdown",onclick:e=>this._toggleMeasurementSketch(e,"height"),selected:"height"===t},g),z("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==n,iconStart:"pin-tear",key:"surface-location",onclick:e=>this._toggleLocationTool(e),selected:this.imageLocationToolActive},m))):null}get _messageBox(){const{messages:e,viewModel:{displayMessage:t}}=this;if(!t)return null;const{data:i,key:a,map:o}=t,s=`${o?G(e[a],o):e[a]}`;return z("span",{class:b.messageBox},i?`${s} ${i}`:s)}_navigationToolToggle(){const{state:e}=this.viewModel,{visibleElements:{navigationTool:t}}=this;return t?z("calcite-action",{active:this.navigationToolActive,...this._commonActionProperties,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool}):null}_openPopupAction(){const{showPopupsAction:e}=this.visibleElements;return e?z("calcite-action",{...this._commonActionProperties,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups}):null}get _panoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i}=this.viewModel,a=null!=e||"panoramic"!==i,o=this.classes({[b.viewer]:!a,[b.viewerHidden]:a});return z("calcite-panel",{afterCreate:t,bind:this,class:o})}_closeAllImageTools(){this.imageEnhancementToolActive=!1,this.navigationToolActive=!1,this.imageOverlaysOpened=!1,this.galleryOpened=!1,this.measureType=null,this.imageLocationToolActive=!1}_handleBrightnessChange(e){this.viewModel.brightness=e.currentTarget.value??0}_handleContrastChange(e){this.viewModel.contrast=e.currentTarget.value??0}_handleSharpnessChange(e){this.viewModel.sharpness=e.currentTarget.value??0}_lazyLoadImage(e,t){e.forEach((async e=>{if(e.isIntersecting){const a=e.target,o=a.getAttribute("data-src"),r=a.getAttribute("data-rotation"),l=a.getAttribute("data-objectid"),c=r?parseFloat(r)%360:0,{layer:d,_galleryController:{signal:g}}=this;if(!o||!d||!l)return;let m;try{m=A(o)?await I(d,l,{signal:g}):await O(o,{signal:g})}catch(i){n(i)||s.getLogger("esri.widgets.OrientedImageryViewer").error("#lazyLoadImage()",i)}finally{t.unobserve(a)}if(!m)return;L(m,a,c)}}))}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_loadImageMeasurementResources(){this._imageMeasurementToolsLoaderTask=i((async()=>{const{default:e}=await import("./OrientedImageryViewer/components/ImageMeasurementWidget.js");return e}))}_loadSketchResources(){this._sketchLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/SketchTools.js")).default))}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderWarning(e){const{invalidCameraHeading:t,viewModel:{state:i}}=this;return t&&"image-loaded"===i?[z("calcite-notice",{class:b.alert,closable:!0,icon:"exclamation-mark-triangle-f",iconFlipRtl:!0,kind:"warning",open:!0,scale:"s"},z("div",{afterCreate:e=>this._storeWarningTitleElement(e),slot:"title"},e))]:null}_renderWarningTooltip(e){const{_warningTitleElement:t}=this;if(e?.length&&t)return z("calcite-tooltip",{closeOnClick:!0,referenceElement:t},e)}get _renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:a,state:o}}=this;if(!this.container||!a)return null;let s,n,r,l,c;if(i){const{x:e,y:t,direction:a}=i,[o,d,g,m]=v[a];s=`M ${e} ${t} L ${o} ${d} A ${y[2]} ${y[2]} 0 0 1 ${g} ${m} Z`,n=e,l=t,r=v[a][4],c=v[a][5]}const d=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},g=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:a}=t;i&&a&&this.viewModel.handleFeatureClick({sector:a,featureIndexInSector:+i})},m=e=>{e.removeEventListener("click",g)},h=a.attributes.objectId,p=e?.map((e=>e?.items)).filter(Boolean).flatMap((e=>e?.map((({x:e,y:t,objectID:i,featureIndexInSector:a,sector:o})=>z("circle",{afterRemoved:m,class:this.classes(b.feature,{selected:h===i}),cx:e,cy:t,"data-feature-index-in-sector":a,"data-sector":o,key:`${b.feature}-${i}`,onclick:g,r:_}))))),T=e=>{e.removeEventListener("click",d)},C=this.classes({[b.navigationWrapper]:!0,[b.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&"image-loaded"===o?z("div",{bind:this,class:C,key:this.messages.navigationTool},z("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?M:b.rotateWithAnimation,focusable:"false",height:w,role:"img",width:w,xmlns:"http://www.w3.org/2000/svg"},z("defs",null,z("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:n,x2:r,y1:l,y2:c},z("stop",{class:b.navigationPathOffset0,offset:0}),z("stop",{class:b.navigationPathOffset1,offset:1}))),z("g",null,z("circle",{class:this.classes(b.sector,b.outerSector),cx:y[3],cy:y[3],onclick:this._scaleNavigationTool,r:y[3]}),z("circle",{class:b.sector,cx:y[3],cy:y[3],r:y[2]}),z("circle",{class:b.sector,cx:y[3],cy:y[3],r:y[1]}),z("circle",{class:b.sector,cx:y[3],cy:y[3],r:y[0]}),z("path",{class:b.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${b.pointer}-west`}),z("path",{class:this.classes(b.pointer,b.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${b.pointer}-north`}),z("path",{class:b.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${b.pointer}-east`}),z("path",{class:b.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${b.pointer}-south`}),z("path",{class:this.classes(b.sector,b.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:b.sectorSeparator}),u([y[2],y[1],y[0]],y[3],y[3]).map(((t,i)=>z("path",{afterRemoved:T,class:this.classes(b.sector,e?.[i]?.length?b.sectorEnabled:b.sectorDisabled),d:t,"data-sector":`${i}`,key:`${b.sector}-${i}`,onclick:d}))),z("path",{class:this.classes(b.sector,b.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:b.sectorCross}),p,a.attributes.cameraPitch>=5&&s?z("path",{class:b.selectedFeaturePath,d:s,fill:`url(#${this.id}-coverage-fill)`,key:b.selectedFeaturePath}):null))):null}_renderSketch(){const{digitizationLayer:e,imageOverlaysOpened:t}=this;if(!e||t)return null;if(this._sketchLoaderTask||this._loadSketchResources(),!this._sketchLoaderTask?.value)return null;const{geometryType:i}=e,a="point"===i?"pin":"polyline"===i?"line":"polygon",o=this._sketchLoaderTask.value;return z("div",{class:b.sketchTools},z(o,{icon:a,messages:this._imageSketchToolsMessages,type:i,onAction:this._onAction}))}get _renderThumbnails(){const{currentBestFeature:e,thumbnails:t}=this.viewModel;return e?z("div",{class:b.carouselContent},t?.items.map((({url:t,objectId:i,rotation:a},o)=>z("div",{class:`${b.carouselItemWrapper}${e.attributes.objectId===i?"--selected":""}`,key:`${b.carouselItemWrapper}-${o}`},z("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:b.carouselItem,"data-objectid":`${i}`,"data-rotation":`${a}`,"data-src":t,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight}))))):null}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_storeActionElement(e){this._actionItems.set(e.text,e)}_storeNavigationToolReference(e){this._navigationTool=e}_storeWarningTitleElement(e){this._warningTitleElement=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation(),this.imageEnhancementToolActive=!this.imageEnhancementToolActive,this.imageEnhancementToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleImageOverlays(e){e.stopPropagation(),this.imageOverlaysOpened=!this.imageOverlaysOpened,this.imageOverlaysOpened&&(this.galleryOpened&&(this.galleryOpened=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1))}_toggleImageGallery(e){e.stopPropagation(),this.galleryOpened=!!this.imageGalleryEnabled&&!this.galleryOpened,this.galleryOpened&&(this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleLocationTool(e){const t=this.imageLocationToolActive;this._closeAllImageTools(),this.imageLocationToolActive=!t,e.stopPropagation()}_toggleMeasurementSketch(e,t){e.stopPropagation();const i=this.measureType;this._closeAllImageTools(),this.measureType=i===t?null:t,this.measureType===t&&(this.viewModel.displayNewMeasurementButton=!0)}_toggleNavigationTool(){this.navigationToolActive=!this.navigationToolActive,this.navigationToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,a=(i-t+540)%360-180;e.style.setProperty(T,`${t}deg`),e.style.setProperty(C,`${t+a}deg`)}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){return z("div",{class:this.classes(P.widget,f)},this._renderRoot())}startDigitization(e){this.viewModel.startDigitization(e)}stopDigitization(e){this.viewModel.stopDigitization(e)}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([m({readOnly:!0})],B.prototype,"accuracyParametersMissing",null),e([m()],B.prototype,"activeLayer",null),e([m()],B.prototype,"currentBestFeature",null),e([m()],B.prototype,"currentCoverageVisible",null),e([m()],B.prototype,"digitizationEnabled",void 0),e([m()],B.prototype,"digitizationLayer",null),e([m()],B.prototype,"disabled",null),e([m()],B.prototype,"features",null),e([m()],B.prototype,"imagePointsInView",null),e([m()],B.prototype,"galleryOpened",void 0),e([m()],B.prototype,"icon",null),e([m()],B.prototype,"imageEnhancementToolActive",void 0),e([m({readOnly:!0})],B.prototype,"imageGalleryEnabled",null),e([m()],B.prototype,"imageLocationToolActive",null),e([m()],B.prototype,"imageOverlaysOpened",void 0),e([m({readOnly:!0})],B.prototype,"invalidCameraHeading",null),e([m()],B.prototype,"isAdditionalCoverageVisible",null),e([m()],B.prototype,"isAdditionalPointSourcesVisible",null),e([m()],B.prototype,"mapImageConversionToolState",null),e([m()],B.prototype,"measureType",null),e([m()],B.prototype,"layer",null),e([m()],B.prototype,"navigationToolActive",void 0),e([j(["after-digitization-complete"]),m({type:k})],B.prototype,"viewModel",void 0),e([m(),x("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],B.prototype,"messages",void 0),e([m(),x("esri/core/t9n/Units")],B.prototype,"measurementUnitMessages",void 0),e([m(),x("esri/t9n/common")],B.prototype,"messagesCommon",void 0),e([m(),x("esri/widgets/Sketch/t9n/Sketch")],B.prototype,"messagesSketch",void 0),e([m()],B.prototype,"pixelMeasurementUnit",void 0),e([m()],B.prototype,"pixelAreaMeasurementUnit",void 0),e([m({readOnly:!0})],B.prototype,"popupEnabled",null),e([m()],B.prototype,"referencePoint",null),e([m()],B.prototype,"showCameraLocations",void 0),e([m()],B.prototype,"showMapFeatures",void 0),e([j(["create","delete","redo","undo","update"]),m({readOnly:!0})],B.prototype,"sketchViewModel",null),e([m()],B.prototype,"view",null),e([m({type:E,nonNullable:!0})],B.prototype,"visibleElements",void 0),e([m()],B.prototype,"determineWorkflowForFeature",null),e([m()],B.prototype,"updateFootprint",null),e([m()],B.prototype,"_actionItems",void 0),e([m()],B.prototype,"_activeMeasurementIcon",null),e([m()],B.prototype,"_activeMeasurementHeading",null),e([m()],B.prototype,"_imageMeasurementToolsLoaderTask",void 0),e([m()],B.prototype,"_measurementToggle",null),e([m()],B.prototype,"_commonActionProperties",null),e([m()],B.prototype,"_imageEnhancementTools",null),e([m()],B.prototype,"_imageGalleryPanel",null),e([m()],B.prototype,"_imageGalleryContext",null),e([m()],B.prototype,"_imageOverlaysComponent",null),e([m()],B.prototype,"_imageOverlayMessages",null),e([m()],B.prototype,"_imageSketchToolsMessages",null),e([m()],B.prototype,"_imageOverlaysPanel",null),e([m()],B.prototype,"_imageViewer",null),e([m()],B.prototype,"_locationToggle",null),e([m()],B.prototype,"_messageBox",null),e([m()],B.prototype,"_navigationToolExpanded",void 0),e([m()],B.prototype,"_navigationTool",void 0),e([m()],B.prototype,"_panoramicViewer",null),e([m()],B.prototype,"_warningTitleElement",void 0),e([m()],B.prototype,"_renderNavigation",null),e([m()],B.prototype,"_renderThumbnails",null),e([m()],B.prototype,"_sketchLoaderTask",void 0),B=e([h("esri.widgets.OrientedImageryViewer")],B);const H=B;export{H as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import{createTask as i}from"../core/asyncUtils.js";import a from"../core/Collection.js";import{deprecatedProperty as o}from"../core/deprecate.js";import s from"../core/Logger.js";import{isAbortError as r}from"../core/promiseUtils.js";import n from"../core/ReactiveMap.js";import{watch as l,initial as c,syncAndInitial as d,whenOnce as g}from"../core/reactiveUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{or as p}from"../layers/orientedImagery/transformations/utils.js";import u from"./Widget.js";import{getAllArcPath as v}from"./OrientedImageryViewer/arcUtils.js";import{segmentArcs as y,sectorsRadii as _,featureCircleRadius as w,navigationToolDimensionLength as b,getDelegatedEvents as M}from"./OrientedImageryViewer/constants.js";import{css as T,navigation as C,navigationToolRotationFrom as O,navigationToolRotationTo as f,root as A}from"./OrientedImageryViewer/css.js";import{isFeatureAttachment as I,loadImageForAttachment as L,getThumbnailPixelBlock as k,renderImageWithRotation as E}from"./OrientedImageryViewer/galleryUtils.js";import S from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import F from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import V from"./OrientedImageryViewer/components/ImageLocationWidget.js";import{loadCalciteComponents as P}from"./support/componentsUtils.js";import{globalCss as x}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as z}from"./support/decorators/messageBundle.js";import{vmEvent as $}from"./support/decorators/vmEvent.js";import{tsx as j}from"./support/jsxFactory.js";import{substitute as G}from"../intl/substitute.js";const H={overlayMapFeatures:"overlay-map-features",overlayed:"overlayed",overlaysActionHandles:"overlays-action-handles"};let D=class extends u{constructor(e,t){super(e,t),this.digitizationEnabled=!1,this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.imageOverlaysOpened=!1,this.navigationToolActive=!1,this.viewModel=new S,this.messagesCommon=null,this.messagesSketch=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters",this.showCameraLocations=!1,this.showMapFeatures=!1,this.visibleElements=new F,this._actionItems=new n,this._imageOverlaysLoaderTask=null,this._imageMeasurementToolsLoaderTask=null,this._clearMeasurements=()=>{this.viewModel.measureType=null,this.viewModel.clearPreviousMeasurements()},this._clearImageLocation=()=>{this.imageLocationToolActive=!1},this._navigationToolExpanded=!1,this._navigationTool=null,this._warningTitleElement=null,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._overlayedLayers=new a,this._previousAction=null,this._handleDigitizationLayerChange=e=>{this.digitizationLayer&&this.stopDigitization(this.digitizationLayer.id),this.digitizationLayer=this.digitizationLayer===e?null:e,this.digitizationLayer&&this.startDigitization(this.digitizationLayer)},this._handleOverlayLayerDeselect=e=>{const t=e.layer;this.viewModel.removeOverlayedGraphicsOnImage(`${t.id}`),t===this.digitizationLayer&&(this.stopDigitization(t.id),this.digitizationLayer=null),this.removeHandles(`${H.overlayed}-${t.id}`)},this._handleOverlayLayerSelect=e=>{const t=e.layer;this.viewModel.overlayMapFeatures(t,this.showMapFeatures),this.addHandles(l((()=>t.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(t.id,t.visible)})),`${H.overlayed}-${t.id}`)},this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._onAction=e=>{const{target:t}=e,{dataset:{action:i}}=t,{_previousAction:a}=this,o=a?.dataset.action,s=o?.includes("draw")??!1,r="select-feature"===o,n=o!==i;switch(i){case"draw-point":case"draw-polygon":case"draw-polyline":{a&&p(r,s&&n)&&(a.active=!1),t.active=!t.active;const e=i.replace("draw-","");this.viewModel.digitizeCreate(e),this._previousAction=t.active?t:null;break}case"save":this.viewModel.saveDrawing();break;case"select-feature":s&&(this._previousAction.active=!1),t.active=!t.active,this.viewModel.toggleSelection(t.active),this._previousAction=t.active?t:null;break;case"delete-feature":this.viewModel.digitizeDelete()}},this._onImageOverlayClosed=()=>{this.imageOverlaysOpened=!1},this._onShowCameraLocationsChanged=e=>{this.showCameraLocations=e},this._onShowMapFeaturesChanged=e=>{this.showMapFeatures=e},this._removeActionElement=e=>{this._actionItems.delete(e.text)},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._sketchLoaderTask=null,this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([l((()=>[this.viewModel?.bestFeatureAngle,this._navigationTool]),(([e,t])=>{t&&this._updateNavigationTool(t)}),c),l((()=>this.currentCoverageVisible),(e=>this._onCurrentCoverageVisibilityChange(e))),l((()=>this.isAdditionalCoverageVisible),(e=>this._onAdditionalCoverageVisibilityChange(e))),l((()=>this.isAdditionalPointSourcesVisible),(e=>this._onAdditionalCameraLocationsVisibility(e))),l((()=>({features:this.currentBestFeature,showCameraLocations:this.showCameraLocations,state:this.viewModel.state})),(({showCameraLocations:e,state:t})=>{"image-loaded"===t&&this.viewModel.overlayCameraLocations(e)}),d),l((()=>({feature:this.currentBestFeature,showMapFeatures:this.showMapFeatures,state:this.viewModel.state})),(async(e,t)=>{if(e.showMapFeatures!==t?.showMapFeatures&&this.viewModel.toggleAllOverlayMapFeatures(e.showMapFeatures),null!=e.feature&&e.feature!==t?.feature){if(this.viewModel.removeAllOverlayMapFeatures(),await g((()=>"image-loaded"===this.viewModel.state)),await Promise.all(this._overlayedLayers?.map((t=>{this.viewModel.overlayMapFeatures(t,e.showMapFeatures)}))),!this.digitizationLayer)return;this.stopDigitization(this.digitizationLayer.id),this.startDigitization(this.digitizationLayer)}}),c)])}loadDependencies(){return P({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),shell:()=>import("@esri/calcite-components/dist/components/calcite-shell"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect()}get accuracyParametersMissing(){return this.viewModel.accuracyParametersMissing}get activeLayer(){return o(s.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(s.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get digitizationLayer(){return this.viewModel.digitizationLayer}set digitizationLayer(e){this.viewModel.digitizationLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get imageLocationToolActive(){return this.viewModel.imageLocationToolState}set imageLocationToolActive(e){this.viewModel.imageLocationToolState=e}get invalidCameraHeading(){return this.viewModel.invalidCameraHeading}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get measureType(){return this.viewModel.measureType}set measureType(e){this.viewModel.measureType=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return"image-loaded"===t&&e}get referencePoint(){return this.viewModel.referencePoint??null}get sketchViewModel(){return this.viewModel.sketch}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}_renderActionBar(){return j("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},j("calcite-action-group",null,this._currentFootprintToggle(),this._additionalFootprintToggle(),this._additionalPointSourcesToggle()),j("calcite-action-group",null,this._mapImageConversionToggle(),this._navigationToolToggle(),this._imageEnhancementsToggle()),j("calcite-action-group",null,this._imageGalleryToggle(),this._imageOverlaysToggle(),this._openPopupAction()),j("calcite-action-group",null,this._measurementToolsToggle()),this._actionTooltips())}_actionTooltips(){return[...this._actionItems].map((([e,t])=>j("calcite-tooltip",{closeOnClick:!0,key:e,placement:"bottom",referenceElement:t},j("span",null,e))))}get _activeMeasurementIcon(){const{measureType:e,imageLocationToolActive:t}=this;if(t)return"pin-tear";switch(e){case"area":return"measure-area";case"height":return"measure-building-height-top-base";default:return"measure-line"}}get _activeMeasurementHeading(){const{measureType:e,messages:t}=this,{groundArea:i,heightAboveGround:a,groundDistance:o}=t;switch(e){case"area":return i;case"height":return a;default:return o}}_additionalFootprintToggle(){const{isAdditionalCoverageVisible:e,invalidCameraHeading:t,visibleElements:{additionalFootprintToggle:i}}=this;return i?j("calcite-action",{active:e,...this._commonActionProperties,class:T.addCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints}):null}_additionalPointSourcesToggle(){const{isAdditionalPointSourcesVisible:e,invalidCameraHeading:t,visibleElements:{additionalCameraLocationsToggle:i}}=this;return i?j("calcite-action",{active:e,...this._commonActionProperties,class:T.addExpPoints,disabled:t,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations}):null}get _measurementToggle(){const{viewModel:{state:e,measureType:t},id:i}=this;if("image-loaded"!==e||!t)return;this._imageMeasurementToolsLoaderTask||this._loadImageMeasurementResources();const a=this._imageMeasurementToolsLoaderTask?.value;return a?j("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:this._activeMeasurementHeading,id:`${i}-${t}-measurement`,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearMeasurements},j(a,{measurementType:t,measurementUnitMessages:this.measurementUnitMessages,messages:this.messages,oiViewModel:this.viewModel})):null}get _commonActionProperties(){return{afterCreate:this._storeActionElement,afterRemoved:this._removeActionElement,afterUpdate:this._storeActionElement,bind:this}}_renderRoot(){const{viewModel:{state:e}}=this;return j("calcite-panel",null,j("calcite-shell",null,j("calcite-panel",{bind:this,class:T.viewerContainer,heading:this.visibleElements.title?this.messages.title:void 0,loading:"image-loading"===e},this.visibleElements.menu?this._renderActionBar():null,this._imageViewer,this._panoramicViewer,this._messageBox,this.invalidCameraHeading?[this._renderWarning(this.messages.invalidCameraHeadingWarningTitle),this._renderWarningTooltip(this.messages.invalidCameraHeadingWarningDescription)]:[this._imageGalleryPanel,this._renderNavigation,this._imageOverlaysPanel],this._imageEnhancementTools,this._renderSketch()),this._measurementToggle,this._locationToggle))}_currentFootprintToggle(){const{currentCoverageVisible:e,invalidCameraHeading:t}=this,{currentFootprintToggle:i}=this.visibleElements;return i?j("calcite-action",{active:e,...this._commonActionProperties,class:T.currentCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint}):null}get _imageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:a,state:o}}=this;return e&&"image-loaded"===o?j("calcite-panel",{bind:this,class:T.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},j("div",{class:T.imageEnhancementTools},j("div",{class:T.imageEnhancementToolContainer},j("calcite-label",null,this.messages.brightness,j("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:t,onCalciteSliderInput:this._handleBrightnessChange}))),j("div",{class:T.imageEnhancementToolContainer},j("calcite-label",null,this.messages.contrast,j("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:i,onCalciteSliderInput:this._handleContrastChange}))),j("div",{class:T.imageEnhancementToolContainer},j("calcite-label",null,this.messages.sharpness,j("calcite-slider",{bind:this,labelTicks:!0,max:1,min:0,step:.1,ticks:.5,value:a,onCalciteSliderInput:this._handleSharpnessChange})))),j("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset})):null}_imageEnhancementsToggle(){const{state:e,mode:t}=this.viewModel,{imageEnhancement:i}=this.visibleElements;return i?j("calcite-action",{active:this.imageEnhancementToolActive,...this._commonActionProperties,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement}):null}get _imageGalleryPanel(){const{container:e,galleryOpened:t,imageGalleryEnabled:i}=this;return i&&t&&e?this._imageGalleryContext:null}get _imageGalleryContext(){const{galleryOpened:e,invalidCameraHeading:t}=this;return j("calcite-panel",{bind:this,class:T.carousel,closable:!0,closed:!e,disabled:t,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},j("div",{class:T.carouselContainer},this._renderThumbnails))}_imageGalleryToggle(){const{imageGalleryEnabled:e,invalidCameraHeading:t,visibleElements:{imageGallery:i}}=this;return i?j("calcite-action",{active:this.galleryOpened,...this._commonActionProperties,disabled:!e||t,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery}):null}get _imageOverlaysComponent(){const{_imageOverlayMessages:e,_imageOverlaysLoaderTask:t,_overlayedLayers:a,digitizationEnabled:o,digitizationLayer:s,imageOverlaysOpened:r,showCameraLocations:n,showMapFeatures:l,view:c}=this;t||(this._imageOverlaysLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/ImageOverlays.js")).default)));const d=this._imageOverlaysLoaderTask?.value;return d?j(d,{closed:!r,digitizationEnabled:o,digitizationLayer:s,messages:e,overlayedLayers:a,showCameraLocations:n,showMapFeatures:l,view:c,onDigitizationLayerChanged:this._handleDigitizationLayerChange,onImageOverlaysClosed:this._onImageOverlayClosed,onLayerDeselected:this._handleOverlayLayerDeselect,onLayerSelected:this._handleOverlayLayerSelect,onShowCameraLocationsChanged:this._onShowCameraLocationsChanged,onShowMapFeaturesChanged:this._onShowMapFeaturesChanged}):null}get _imageOverlayMessages(){return{...this.messages,...this.messagesSketch}}get _imageSketchToolsMessages(){return{...this.messagesSketch,...this.messagesCommon}}get _imageOverlaysPanel(){const{imageOverlaysOpened:e,viewModel:{state:t}}=this;if(e&&"image-loaded"===t)return this._imageOverlaysContext}get _imageOverlaysContext(){return j("div",{class:T.imageOverlaysContainer,key:this.messages.imageOverlays},this._imageOverlaysComponent)}_imageOverlaysToggle(){const{viewModel:{state:e},imageOverlaysOpened:t,invalidCameraHeading:i,visibleElements:{imageOverlays:a}}=this;return a?j("calcite-action",{active:t,...this._commonActionProperties,disabled:"image-loaded"!==e||i,icon:"layers",onclick:this._toggleImageOverlays,text:this.messages.imageOverlays}):null}get _imageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i}=this.viewModel,a=null!=e||"default"!==i,o=this.classes({[T.viewer]:!a,[T.viewerHidden]:a});return j("calcite-panel",{afterCreate:t,bind:this,class:o},this._renderSketch())}get _locationToggle(){const{viewModel:{state:e,groundCoordinates:t},imageLocationToolActive:i,messages:{groundLocation:a}}=this;if("image-loaded"===e&&t&&i)return j("calcite-dialog",{bind:this,dragEnabled:!0,escapeDisabled:!0,heading:a,id:a,open:!0,placement:"bottom-start",resizable:!0,scale:"s",slot:"dialogs",width:"s",onCalciteDialogBeforeClose:this._clearImageLocation},j(V,{groundCoordinates:t,messages:this.messages}))}_mapImageConversionToggle(){const{mapImageConversionToolState:e,viewModel:{state:t},invalidCameraHeading:i,visibleElements:{mapImageConversionTool:a}}=this;return a?j("calcite-action",{active:e,...this._commonActionProperties,disabled:"image-loaded"!==t||i,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool}):null}_measurementToolsToggle(){const{_activeMeasurementIcon:e,measureType:t,viewModel:i,accuracyParametersMissing:a,messages:o,visibleElements:{measurementTools:s}}=this,{state:r,mode:n}=i,{measurementTools:l,groundDistance:c,groundArea:d,heightAboveGround:g,groundLocation:m}=o;return s?j("calcite-dropdown",{disabled:a,key:"measurement-tools",width:"m"},j("calcite-action",{...this._commonActionProperties,icon:e,slot:"trigger",text:l}),j("calcite-dropdown-group",null,j("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-line",key:"distance-measurement",onclick:e=>this._toggleMeasurementSketch(e,"distance"),selected:"distance"===t},c),j("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"measure-area",key:"area-measurement",onclick:e=>this._toggleMeasurementSketch(e,"area"),selected:"area"===t},d),j("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r||"panoramic"===n,iconStart:"measure-building-height-top-base",key:"height-dropdown",onclick:e=>this._toggleMeasurementSketch(e,"height"),selected:"height"===t},g),j("calcite-dropdown-item",{bind:this,disabled:"image-loaded"!==r,iconStart:"pin-tear",key:"surface-location",onclick:e=>this._toggleLocationTool(e),selected:this.imageLocationToolActive},m))):null}get _messageBox(){const{messages:e,viewModel:{displayMessage:t}}=this;if(!t)return null;const{data:i,key:a,map:o}=t,s=`${o?G(e[a],o):e[a]}`;return j("span",{class:T.messageBox},i?`${s} ${i}`:s)}_navigationToolToggle(){const{state:e}=this.viewModel,{visibleElements:{navigationTool:t}}=this;return t?j("calcite-action",{active:this.navigationToolActive,...this._commonActionProperties,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool}):null}_openPopupAction(){const{showPopupsAction:e}=this.visibleElements;return e?j("calcite-action",{...this._commonActionProperties,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups}):null}get _panoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i}=this.viewModel,a=null!=e||"panoramic"!==i,o=this.classes({[T.viewer]:!a,[T.viewerHidden]:a});return j("calcite-panel",{afterCreate:t,bind:this,class:o})}_closeAllImageTools(){this.imageEnhancementToolActive=!1,this.navigationToolActive=!1,this.imageOverlaysOpened=!1,this.galleryOpened=!1,this.measureType=null,this.imageLocationToolActive=!1}_handleBrightnessChange(e){this.viewModel.brightness=e.currentTarget.value??0}_handleContrastChange(e){this.viewModel.contrast=e.currentTarget.value??0}_handleSharpnessChange(e){this.viewModel.sharpness=e.currentTarget.value??0}_lazyLoadImage(e,t){e.forEach((async e=>{if(e.isIntersecting){const a=e.target,o=a.getAttribute("data-src"),n=a.getAttribute("data-rotation"),l=a.getAttribute("data-objectid"),c=n?parseFloat(n)%360:0,{layer:d,_galleryController:{signal:g}}=this;if(!o||!d||!l)return;let m;try{m=I(o)?await L(d,l,{signal:g}):await k(o,{signal:g})}catch(i){r(i)||s.getLogger("esri.widgets.OrientedImageryViewer").error("#lazyLoadImage()",i)}finally{t.unobserve(a)}if(!m)return;E(m,a,c)}}))}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_loadImageMeasurementResources(){this._imageMeasurementToolsLoaderTask=i((async()=>{const{default:e}=await import("./OrientedImageryViewer/components/ImageMeasurementWidget.js");return e}))}_loadSketchResources(){this._sketchLoaderTask=i((async()=>(await import("./OrientedImageryViewer/components/SketchTools.js")).default))}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderWarning(e){const{invalidCameraHeading:t,viewModel:{state:i}}=this;return t&&"image-loaded"===i?[j("calcite-notice",{class:T.alert,closable:!0,icon:"exclamation-mark-triangle-f",iconFlipRtl:!0,kind:"warning",open:!0,scale:"s"},j("div",{afterCreate:e=>this._storeWarningTitleElement(e),slot:"title"},e))]:null}_renderWarningTooltip(e){const{_warningTitleElement:t}=this;if(e?.length&&t)return j("calcite-tooltip",{closeOnClick:!0,referenceElement:t},e)}get _renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:a,state:o}}=this;if(!this.container||!a)return null;let s,r,n,l,c;if(i){const{x:e,y:t,direction:a}=i,[o,d,g,m]=y[a];s=`M ${e} ${t} L ${o} ${d} A ${_[2]} ${_[2]} 0 0 1 ${g} ${m} Z`,r=e,l=t,n=y[a][4],c=y[a][5]}const d=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},g=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:a}=t;i&&a&&this.viewModel.handleFeatureClick({sector:a,featureIndexInSector:+i})},m=e=>{e.removeEventListener("click",g)},h=a.attributes.objectId,p=e?.map((e=>e?.items)).filter(Boolean).flatMap((e=>e?.map((({x:e,y:t,objectID:i,featureIndexInSector:a,sector:o})=>j("circle",{afterRemoved:m,class:this.classes(T.feature,{selected:h===i}),cx:e,cy:t,"data-feature-index-in-sector":a,"data-sector":o,key:`${T.feature}-${i}`,onclick:g,r:w}))))),u=e=>{e.removeEventListener("click",d)},M=this.classes({[T.navigationWrapper]:!0,[T.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&"image-loaded"===o?j("div",{bind:this,class:M,key:this.messages.navigationTool},j("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?C:T.rotateWithAnimation,focusable:"false",height:b,role:"img",width:b,xmlns:"http://www.w3.org/2000/svg"},j("defs",null,j("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:r,x2:n,y1:l,y2:c},j("stop",{class:T.navigationPathOffset0,offset:0}),j("stop",{class:T.navigationPathOffset1,offset:1}))),j("g",null,j("circle",{class:this.classes(T.sector,T.outerSector),cx:_[3],cy:_[3],onclick:this._scaleNavigationTool,r:_[3]}),j("circle",{class:T.sector,cx:_[3],cy:_[3],r:_[2]}),j("circle",{class:T.sector,cx:_[3],cy:_[3],r:_[1]}),j("circle",{class:T.sector,cx:_[3],cy:_[3],r:_[0]}),j("path",{class:T.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${T.pointer}-west`}),j("path",{class:this.classes(T.pointer,T.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${T.pointer}-north`}),j("path",{class:T.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${T.pointer}-east`}),j("path",{class:T.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${T.pointer}-south`}),j("path",{class:this.classes(T.sector,T.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:T.sectorSeparator}),v([_[2],_[1],_[0]],_[3],_[3]).map(((t,i)=>j("path",{afterRemoved:u,class:this.classes(T.sector,e?.[i]?.length?T.sectorEnabled:T.sectorDisabled),d:t,"data-sector":`${i}`,key:`${T.sector}-${i}`,onclick:d}))),j("path",{class:this.classes(T.sector,T.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:T.sectorCross}),p,a.attributes.cameraPitch>=5&&s?j("path",{class:T.selectedFeaturePath,d:s,fill:`url(#${this.id}-coverage-fill)`,key:T.selectedFeaturePath}):null))):null}_renderSketch(){const{digitizationLayer:e,imageOverlaysOpened:t}=this;if(!e||t)return null;if(this._sketchLoaderTask||this._loadSketchResources(),!this._sketchLoaderTask?.value)return null;const{geometryType:i}=e,a="point"===i?"pin":"polyline"===i?"line":"polygon",o=this._sketchLoaderTask.value;return j("div",{class:T.sketchTools},j(o,{icon:a,messages:this._imageSketchToolsMessages,type:i,onAction:this._onAction}))}get _renderThumbnails(){const{currentBestFeature:e,thumbnails:t}=this.viewModel;return e?j("div",{class:T.carouselContent},t?.items.map((({url:t,objectId:i,rotation:a},o)=>j("div",{class:`${T.carouselItemWrapper}${e.attributes.objectId===i?"--selected":""}`,key:`${T.carouselItemWrapper}-${o}`},j("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:T.carouselItem,"data-objectid":`${i}`,"data-rotation":`${a}`,"data-src":t,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight}))))):null}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_storeActionElement(e){this._actionItems.set(e.text,e)}_storeNavigationToolReference(e){this._navigationTool=e}_storeWarningTitleElement(e){this._warningTitleElement=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation(),this.imageEnhancementToolActive=!this.imageEnhancementToolActive,this.imageEnhancementToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleImageOverlays(e){e.stopPropagation(),this.imageOverlaysOpened=!this.imageOverlaysOpened,this.imageOverlaysOpened&&(this.galleryOpened&&(this.galleryOpened=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1))}_toggleImageGallery(e){e.stopPropagation(),this.galleryOpened=!!this.imageGalleryEnabled&&!this.galleryOpened,this.galleryOpened&&(this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleLocationTool(e){const t=this.imageLocationToolActive;this._closeAllImageTools(),this.imageLocationToolActive=!t,e.stopPropagation()}_toggleMeasurementSketch(e,t){e.stopPropagation();const i=this.measureType;this._closeAllImageTools(),this.measureType=i===t?null:t,this.measureType===t&&(this.viewModel.displayNewMeasurementButton=!0)}_toggleNavigationTool(){this.navigationToolActive=!this.navigationToolActive,this.navigationToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,a=(i-t+540)%360-180;e.style.setProperty(O,`${t}deg`),e.style.setProperty(f,`${t+a}deg`)}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async overlayMapFeatures(e,t){return this.removeHandles(`${H.overlayed}-${e.id}`),this.addHandles(l((()=>e.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(e.id,e.visible)})),`${H.overlayed}-${e.id}`),this._overlayedLayers.add(e),this.viewModel.overlayMapFeatures(e,t&&this.showMapFeatures)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}removeOverlayedGraphicsOnImage(e){this.removeHandles(`${H.overlayed}-${e}`),this._overlayedLayers.remove(this._overlayedLayers.find((t=>t.id===e))),this.viewModel.removeOverlayedGraphicsOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){return j("div",{class:this.classes(x.widget,A)},this._renderRoot())}async startDigitization(e){return this.viewModel.startDigitization(e)}stopDigitization(e){this.viewModel.stopDigitization(e)}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([m({readOnly:!0})],D.prototype,"accuracyParametersMissing",null),e([m()],D.prototype,"activeLayer",null),e([m()],D.prototype,"currentBestFeature",null),e([m()],D.prototype,"currentCoverageVisible",null),e([m()],D.prototype,"digitizationEnabled",void 0),e([m()],D.prototype,"digitizationLayer",null),e([m()],D.prototype,"disabled",null),e([m()],D.prototype,"features",null),e([m()],D.prototype,"imagePointsInView",null),e([m()],D.prototype,"galleryOpened",void 0),e([m()],D.prototype,"icon",null),e([m()],D.prototype,"imageEnhancementToolActive",void 0),e([m({readOnly:!0})],D.prototype,"imageGalleryEnabled",null),e([m()],D.prototype,"imageLocationToolActive",null),e([m()],D.prototype,"imageOverlaysOpened",void 0),e([m({readOnly:!0})],D.prototype,"invalidCameraHeading",null),e([m()],D.prototype,"isAdditionalCoverageVisible",null),e([m()],D.prototype,"isAdditionalPointSourcesVisible",null),e([m()],D.prototype,"mapImageConversionToolState",null),e([m()],D.prototype,"measureType",null),e([m()],D.prototype,"layer",null),e([m()],D.prototype,"navigationToolActive",void 0),e([$(M()),m({type:S})],D.prototype,"viewModel",void 0),e([m(),z("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],D.prototype,"messages",void 0),e([m(),z("esri/core/t9n/Units")],D.prototype,"measurementUnitMessages",void 0),e([m(),z("esri/t9n/common")],D.prototype,"messagesCommon",void 0),e([m(),z("esri/widgets/Sketch/t9n/Sketch")],D.prototype,"messagesSketch",void 0),e([m()],D.prototype,"pixelMeasurementUnit",void 0),e([m()],D.prototype,"pixelAreaMeasurementUnit",void 0),e([m({readOnly:!0})],D.prototype,"popupEnabled",null),e([m()],D.prototype,"referencePoint",null),e([m()],D.prototype,"showCameraLocations",void 0),e([m()],D.prototype,"showMapFeatures",void 0),e([$(["create","delete","redo","undo","update"]),m({readOnly:!0})],D.prototype,"sketchViewModel",null),e([m()],D.prototype,"view",null),e([m({type:F,nonNullable:!0})],D.prototype,"visibleElements",void 0),e([m()],D.prototype,"determineWorkflowForFeature",null),e([m()],D.prototype,"updateFootprint",null),e([m()],D.prototype,"_actionItems",void 0),e([m()],D.prototype,"_activeMeasurementIcon",null),e([m()],D.prototype,"_activeMeasurementHeading",null),e([m()],D.prototype,"_imageOverlaysLoaderTask",void 0),e([m()],D.prototype,"_imageMeasurementToolsLoaderTask",void 0),e([m()],D.prototype,"_measurementToggle",null),e([m()],D.prototype,"_commonActionProperties",null),e([m()],D.prototype,"_imageEnhancementTools",null),e([m()],D.prototype,"_imageGalleryPanel",null),e([m()],D.prototype,"_imageGalleryContext",null),e([m()],D.prototype,"_imageOverlaysComponent",null),e([m()],D.prototype,"_imageOverlayMessages",null),e([m()],D.prototype,"_imageSketchToolsMessages",null),e([m()],D.prototype,"_imageOverlaysPanel",null),e([m()],D.prototype,"_imageOverlaysContext",null),e([m()],D.prototype,"_imageViewer",null),e([m()],D.prototype,"_locationToggle",null),e([m()],D.prototype,"_messageBox",null),e([m()],D.prototype,"_navigationToolExpanded",void 0),e([m()],D.prototype,"_navigationTool",void 0),e([m()],D.prototype,"_panoramicViewer",null),e([m()],D.prototype,"_warningTitleElement",void 0),e([m()],D.prototype,"_renderNavigation",null),e([m()],D.prototype,"_renderThumbnails",null),e([m()],D.prototype,"_sketchLoaderTask",void 0),D=e([h("esri.widgets.OrientedImageryViewer")],D);const B=D;export{B as default};
|
package/widgets/Print.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{JSONMap as i}from"../core/jsonMap.js";import{watch as a,whenOnce as l}from"../core/reactiveUtils.js";import{unitName as o}from"../core/unitFormatUtils.js";import{addProxy as n,hasSameOrigin as s}from"../core/urlUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{ensureInteger as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import d from"../geometry/SpatialReference.js";import{isValid as m}from"../geometry/support/spatialReferenceUtils.js";import{reArcGISOnlineDomain as u}from"../portal/support/urlUtils.js";import{getToken as h}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import _ from"./Widget.js";import v from"./Print/FileLink.js";import g from"./Print/PrintViewModel.js";import{loadCalciteComponents as y}from"./support/componentsUtils.js";import{globalCss as f}from"./support/globalCss.js";import{Heading as w}from"./support/Heading.js";import{legacyIcon as T}from"./support/legacyIcon.js";import{isRTL as x,isActivationKey as k}from"./support/widgetUtils.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{tsx as S}from"./support/jsxFactory.js";import{formatNumber as O}from"../intl/number.js";const $=t.ofType(v),I="map-only";var E;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab",e.export="exportTab"}(E||(E={}));const L="esri-print",F=`${L}__advanced-options-button`,M={base:L,headerTitle:`${L}__header-title`,layoutTabList:`${L}__layout-tab-list`,layoutTab:`${L}__layout-tab`,layoutSection:`${L}__layout-section`,mapOnlySection:`${L}__map-only-section`,panelItemsCentered:`${L}__panel-items--centered`,loader:`${L}__loader`,advancedOptionsButton:F,advancedOptionsButtonContainer:`${F}-container`,advancedOptionsButtonTitle:`${F}-title`,advancedOptionsButtonIconOpened:`${F}-icon--opened`,advancedOptionsButtonIconClosed:`${F}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${F}-icon--closed-rtl`,swapButton:`${L}__swap-button`,printButton:`${L}__export-button`,printButtonSection:`${L}__export-button-section`,printButtonSectionDivider:`${L}__export-button-section--divider`,templateSelectContainer:`${L}__template-select-container`,templateSelectBlock:`${L}__template-select-block`,templateSelectIcon:`${L}__template-select-icon`,templateSelectError:`${L}__template-select-error`,templateSelectArrow:`${L}__template-select-arrow`,formSectionContainer:`${L}__form-section-container`,formCheckboxLabel:`${L}__form-checkbox-label`,advancedOptionsSection:`${L}__advanced-options-section`,advancedOptionsContainer:`${L}__advanced-options-container`,browseTemplateButtonContainer:`${L}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${L}__browse-template-button-container-filter`,exportedFilesContainer:`${L}__export-panel-container`,exportedFilesTitle:`${L}__export-title`,exportedFile:`${L}__exported-file`,exportedFileLink:`${L}__exported-file-link`,exportedFileLinkTitle:`${L}__exported-file-link-title`,exportedFileLinkDescription:`${L}__exported-file-link-description`,exportedFilesEmpty:`${L}__exported-files-empty`,printWidgetContainer:`${L}__container`,content:`${L}__content`,panelContainer:`${L}__panel-container`,scaleInfoContainer:`${L}__scale-info-container`,scaleInputContainer:`${L}__scale-input-container`,scaleInput:`${L}__scale-input`,sizeContainer:`${L}__size-container`,panelError:`${L}__panel--error`,exportedFileError:`${L}__exported-file--error`,exportedFileLoader:`${L}__exported-file--loader`,exportSection:`${L}__export-section`,exportSectionCentered:`${L}__export-section--centered`,templateButtonContainer:`${L}__template-button-container`,templateDoneButton:`${L}__template-done-button`,templateSelectFlowItemContainer:`${L}__template-select-flow-item-container`,templateSelectFlowItemContent:`${L}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${L}__template-select-flow-item-list-heading`,srLabel:`${L}__sr-label`,invalidWkidText:`${L}__invalid-wkid-text`};function P(e,t,i,a){const l=i/t,o=a/t;return{width:Math.round(e*l),height:Math.round(e*o)}}function B(e){return!isNaN(e)&&e>0}function A(e){return e?.toLowerCase()===I}function R(e){const{state:t,extension:i}=e;switch(t){case"pending":return"spinner";case"error":return"exclamation-mark-circle";default:return i?.toLowerCase()?.includes("pdf")?"file-pdf":"file"}}const N=new i({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"}),D=new Map([["a3-landscape","a3-landscape"],["a3-portrait","a3-portrait"],["a4-landscape","a4-landscape"],["a4-portrait","a4-portrait"],["letter-ansi-a-landscape","ansi-a-landscape"],["letter-ansi-a-portrait","ansi-a-portrait"],["tabloid-ansi-b-landscape","ansi-b-landscape"],["tabloid-ansi-b-portrait","ansi-b-portrait"]]);let j=class extends _{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._selectedTab=E.layout,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.exportedLinks=new $,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportEnabled=!1,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new g,this._onInput=e=>{this._selectedTab===E.layout?this.templateOptions.title=e.currentTarget.value:this._selectedTab===E.mapOnly&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{const t=e.currentTarget["data-item"];if(!t||"ready"!==t.state||!t.url)return;const i=h(this.viewModel.effectivePrintServiceUrl),a=t.url,l=document.createElement("a");if(l.target="_blank",l.href=a,l.rel="noreferrer",l.download=t.formattedName??"",!i)return l.click(),void e.stopPropagation();e.preventDefault();const o=new URL(a);o.searchParams.set("token",i),l.href=o.href,l.click(),l.href=a},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([a((()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format]),(()=>{const{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){const t=b.apiValues;this._formats=e.format.choiceList.map((e=>{const i=t.find((t=>new RegExp(`\\b${t}\\b`,"i").test(e)))??e;return{value:i,label:e===i?e.toUpperCase():e}})).sort(((e,t)=>e.label.localeCompare(t.label)))}const t=this._formats.some((({value:e})=>new RegExp(`\\b${e}\\b`,"i").test(this.templateOptions.format)));if(!e.format.defaultValue||t);else{const t=this._formats.find((({value:t})=>new RegExp(`\\b${t}\\b`,"i").test(e.format.defaultValue)))?.value;t&&(this.templateOptions.format=t)}})),a((()=>[this.templateOptions.id,this.viewModel.loaded]),(async()=>{const{layout:e}=this.templateOptions;this._selectedTab=A(e)?E.mapOnly:E.layout,this._selectedTab===E.layout&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))})),a((()=>this.templateOptions.dpi),(e=>{e<=0&&(this.templateOptions.dpi=1)})),a((()=>this.viewModel.view?.scale),(e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}))]);for(const{name:a,extension:l}of this.exportedLinks)a&&l&&this._updateExportedFileNameMap(`${a}${l}`);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const i=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>{clearTimeout(i),this._awaitingServerResponse=!1}))}loadDependencies(){return y({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),link:()=>import("@esri/calcite-components/dist/components/calcite-link")})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return"print"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{messages:e,templateOptions:t,viewModel:i,view:a}=this,{attributionEnabled:l,author:o,copyright:n,dpi:s,format:r,height:p,layout:u,layoutItem:h,legendEnabled:b,northArrowEnabled:_,scaleBarEnabled:v,scaleEnabled:g,scale:y,width:k}=t,C="ready"!==i.state||this._awaitingServerResponse||!(u||h),O=this._renderTitleOrFileNameSection(),$=S("div",{class:M.formSectionContainer},S("calcite-label",null,e.fileFormatTitle,S("calcite-combobox",{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:"single-persist",onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??"pdf"}},this._formats.map((({value:e,label:t},i)=>S("calcite-combobox-item",{key:`file-format-${i}`,selected:e===this.templateOptions.format,textLabel:t,value:e})))))),I=S("calcite-label",{layout:"inline"},S("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),L=S("div",null,S("div",{class:M.formSectionContainer},S("calcite-label",null,e.template,S("calcite-block",{class:M.templateSelectContainer,collapsible:!1,description:this._getPageSizeLabel(this._selectedTemplate),heading:this._getTemplateLabel(this._selectedTemplate,!0),key:"template-select-block",loading:"loading"===this._selectedTemplate?.state,onclick:()=>this._showTemplates=!0,onkeydown:e=>{"Enter"!==e.key&&" "!==e.key||(this._showTemplates=!0)},tabIndex:0},S("calcite-icon",{class:M.templateSelectIcon,icon:(this._selectedTemplate?.layout?D.get(this._selectedTemplate.layout):null)||"custom-print",key:"template-select-icon",scale:"l",slot:"content-start"}),"error"===this._selectedTemplate?.state?S("calcite-icon",{class:M.templateSelectError,icon:"exclamation-mark-circle",key:"template-select-error",scale:"s",slot:"actions-end"}):null,S("calcite-icon",{class:M.templateSelectArrow,icon:x()?"chevron-left":"chevron-right",key:"template-select-arrow",scale:"s",slot:"actions-end"})))),I),F=S("div",{class:M.formSectionContainer},S("calcite-label",null,e.dpi,S("calcite-input-number",{bind:this,"data-input-name":"dpi",min:1,value:`${s}`,onCalciteInputNumberInput:this._handleDPIChange}))),P=S("div",{class:M.formSectionContainer},S("calcite-label",null,S("div",{class:M.srLabel},e.outSpatialReference,S("calcite-link",{href:"https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/",target:"_blank"},"(WKID)")),S("calcite-input-number",{bind:this,"data-input-name":"outSpatialReference",integer:!0,numberButtonType:"none",value:i.outSpatialReference?.wkid?.toString()??"",onCalciteInputNumberInput:({currentTarget:e})=>{const t=c(e.value);i.outSpatialReference=Number.isNaN(t)||null==t?null:new d({wkid:t}),this._isValidSpatialReference=!i.outSpatialReference||m(i.outSpatialReference)}}),this._isValidSpatialReference?null:S("div",{class:M.invalidWkidText,key:`out-sr-${i.outSpatialReference?.wkid}`},e.invalidWkid))),B=S("div",{class:this.classes(M.scaleInfoContainer,M.formSectionContainer)},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:g,"data-option-name":"scaleEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scale),S("div",{class:M.scaleInputContainer},S("calcite-input-number",{"aria-label":e.scaleLabel,"aria-valuenow":`${y}`,bind:this,class:M.scaleInput,"data-input-name":"scale",disabled:!g,value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue}),S("calcite-button",{appearance:"outline","aria-label":e.reset,bind:this,disabled:!g,iconStart:"refresh",kind:"neutral",onclick:this._resetToCurrentScale}))),A=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:M.advancedOptionsContainer,key:"advanced-section-for-layout"},B,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?S("div",{class:M.formSectionContainer,key:"author-info"},S("calcite-label",null,e.author,S("calcite-input",{bind:this,"data-input-name":"author",value:o??"",onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??1?S("div",{class:M.formSectionContainer,key:"copyright-text"},S("calcite-label",null,e.copyright,S("calcite-input",{bind:this,"data-input-name":"copyright",value:n??"",onCalciteInputInput:this._updateInputValue}))):null,F,P,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??1?S("div",{class:M.formSectionContainer,key:"legend-info"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:b,"data-option-name":"legendEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?S("div",{class:M.formSectionContainer,key:"north-arrow"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:_,"data-option-name":"northArrowEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?S("div",{class:M.formSectionContainer,key:"scale-bar"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:v,"data-option-name":"scaleBarEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),R=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:M.advancedOptionsContainer},B,F,P,S("div",{class:M.formSectionContainer},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:l,"data-option-name":"attributionEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),N=this.exportedLinks.toArray(),j=this._renderExportedLink(N),V={[M.exportSectionCentered]:!N.length},U=this._selectedTab===E.layout?S("section",{"aria-labelledby":`${this.id}__layoutTab`,class:M.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},S("div",{class:M.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?O:null,L,this._selectedTab===E.layout?$:null,S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(M.panelContainer,M.advancedOptionsSection),collapsible:!0,disabled:!(u||h?.id),heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},A))):this._selectedTab===E.mapOnly?S("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:M.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},S("div",{class:M.panelContainer},O,$,S("div",null,S("div",{class:this.classes(M.sizeContainer,M.formSectionContainer)},S("calcite-label",null,e.width,S("calcite-input-number",{bind:this,"data-input-name":"width",value:`${k}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("calcite-label",null,e.height,S("calcite-input-number",{bind:this,"data-input-name":"height",value:`${p}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("button",{"aria-label":e.swap,bind:this,class:this.classes(f.widgetButton,M.swapButton,T.swap),onclick:this._switchInput,type:"button"})),I),S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(M.panelContainer,M.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},R))):S("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(M.exportSection,V),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},S("div",{class:M.panelContainer},S("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:M.exportedFilesContainer},0===N.length?S("div",{class:M.exportedFilesEmpty},S("calcite-icon",{icon:"file",scale:"l"}),S("div",null,S(w,{class:M.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),S("div",null,e.exportHint))):j))),H="2d"!==a?.type,z=S("div",{class:M.panelError},a?H?e.sceneViewError:e.serviceError:e.noViewError),W=N.some((({state:e})=>"pending"===e)),q=S("div",{class:M.content,key:"panel"},S("div",null,S("ul",{bind:this,class:M.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===E.layout}`,class:M.layoutTab,"data-tab-id":E.layout,id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===E.mapOnly}`,class:M.layoutTab,"data-tab-id":E.mapOnly,id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===E.export}`,class:M.layoutTab,"data-tab-id":E.export,id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},W?S("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),U),this._selectedTab!==E.export?S("div",{class:this.classes(M.printButtonSection,!this.saveExportHidden&&this.portal?M.printButtonSectionDivider:null),key:"export-button-section"},!this.saveExportHidden&&this.portal?S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,S("calcite-button",{"aria-label":e.exportDescription,bind:this,class:this.classes(M.printButton),disabled:C||!(u||h?.id)&&!r,onclick:this._handlePrintMap,scale:"l",width:"full"},e.export)):null),K=S("calcite-flow",{key:"root-flow"},S("calcite-flow-item",{bind:this,key:"root-flow-item",selected:!this._showTemplates},S("div",{class:M.printWidgetContainer},this.headerVisible?S("header",{class:M.headerTitle},e.export):null,this.error||H||!a?z:q)),this._renderChooseTemplateFlowItem()),G="initializing"===i.state,J=G?this._renderLoader():K,Q={[M.panelItemsCentered]:G};return S("div",{bind:this,class:this.classes(M.base,f.widget,f.panel,Q)},J)}_getPageSizeLabel(e){if(!e)return;const t=e.layoutTemplateInfo;if(!t)return;const i=N.fromJSON(t.pageUnits.toLowerCase());return`${O(t.pageSize[0])} × ${O(t.pageSize[1])} ${o(this.messagesUnits,i,"abbr")}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;const{label:i,layout:a,layoutItem:l,type:o}=e;if("print-service-template"===o)return this.messages[a];const n=i??a??l?.id;return n?.replaceAll("_"," ")??this.messages.untitled}_getPortalTemplates(){const{portalTemplateIds:e}=this.viewModel;return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter((({layout:t,layoutItem:i})=>!A(t)&&!!i?.id&&e.includes(i.id))):[]}_getDefaultTemplates(){const{portalTemplateIds:e}=this.viewModel;return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter((({layout:t,layoutItem:i})=>!(A(t)||i?.id&&e.includes(i.id)))):[]}_getPrintServiceTemplates(){return this.includeDefaultTemplates&&this._getDefaultTemplates().length?[]:this.viewModel.printServiceTemplates.toArray().filter((({layout:e})=>!A(e)))}_renderLayoutTemplates(e,t=!1,i=!1){return t&&e.sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)),e.map((e=>S("calcite-list-item",{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??"",value:e},S("calcite-icon",{icon:(e.layout?D.get(e.layout):null)||"custom-print",slot:"content-start"}),"loading"===e.state?S("calcite-loader",{inline:!0,key:`template-loader-${e.id}`,label:"loading",scale:"s",slot:"content-end"}):null,"error"===e?.state?S("calcite-icon",{class:M.templateSelectError,icon:"exclamation-mark-circle",key:`template-error-${e.id}`,scale:"s",slot:"content-end"}):null,i?S("calcite-action",{icon:"trash",onclick:()=>this.viewModel.removePortalTemplate(e),slot:"actions-end",text:"delete"}):null)))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;const{messages:e}=this,t=u.test(this.portal?.url),i=this.viewModel.browseTemplates.toArray(),a=this._getPortalTemplates(),l=this._getDefaultTemplates(),o=this._getPrintServiceTemplates(),n=i.length+a.length+l.length+o.length>15,s=this.browseTemplateButtonOnClick?S("calcite-button",{appearance:"outline",class:n?M.browseTemplateButtonContainerFilter:M.browseTemplateButtonContainer,iconStart:"folder",key:"browse-template-button",onclick:this.browseTemplateButtonOnClick,slot:n?"filter-actions-end":"default"},n?null:e.browseTemplates):null;return S("calcite-flow-item",{bind:this,closable:!1,heading:e.chooseTemplate,key:"template-flow-item",selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},S("div",{class:M.templateSelectFlowItemContainer},S("div",{class:M.templateSelectFlowItemContent},n?null:s,S("calcite-list",{filterEnabled:n,filterProps:["label"],key:"template-list",label:e.templateList,selectionMode:"single-persist",onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},n?s:null,i.length?S("div",{key:"my-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.myTemplates,S("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta)),this._renderLayoutTemplates(i,!0,!0)):null,a.length?S("div",{key:"org-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.organizationTemplates,t?S("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta):null),this._renderLayoutTemplates(a)):null,i.length||a.length?l.length?S("div",{key:"default-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(l,!0)):null:this._renderLayoutTemplates(l,!0),i.length||a.length?o.length?S("div",{key:"service-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(o)):null:this._renderLayoutTemplates(o))),S("div",{class:M.templateButtonContainer},S("calcite-button",{class:M.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?S("div",{class:M.formSectionContainer,key:"custom-text-elements"},e.map(((e,t)=>{const[i,a]=Object.entries(e)[0];return"date"===i?null:S("calcite-label",{key:`custom-text-elements-${i}-${t}`},i,S("calcite-input",{bind:this,"data-input-custom":!0,"data-input-name":i,value:a??"",onCalciteInputInput:this._updateInputValue}))}))):null}_renderTitleOrFileNameSection(){const{title:e,fileName:t,titlePlaceHolder:i,fileNamePlaceHolder:a}=this.messages,l=this._selectedTab===E.layout?e:t,o=this._selectedTab===E.layout?i:a,n=this._selectedTab===E.layout?this.templateOptions.title:this.templateOptions.fileName;return S("div",{class:M.formSectionContainer,key:l},S("calcite-label",null,l,S("calcite-input",{placeholder:o,value:n??"",onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._selectedTab===E.layout||"mapOnlyTab"===t&&this._selectedTab===E.mapOnly||"exportTab"===t&&this._selectedTab===E.export)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[M.loader]:this._awaitingServerResponse};return S("div",{class:this.classes(e),key:"loader"})}_updateExportedFileNameMap(e){void 0!==this._exportedFileNameMap[e]?this._exportedFileNameMap[e]++:this._exportedFileNameMap[e]=0}_createFileLink(e,t){const i=t||this.messages.untitled,a=e.format.toLowerCase(),l=a.includes("png")?"png":a,o=i+l;return this._updateExportedFileNameMap(o),new v({name:i,extension:l,count:this._exportedFileNameMap[o]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,i){e.find((e=>{const[i]=Object.entries(e)[0];return i===t}))[t]=i}_updateInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),a=!!t["data-input-custom"],{templateOptions:l}=this;a?this._updateCustomTextElementValue(l.customTextElements,i,t.value):l[i]=t.value}_updateNumberInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),{templateOptions:a}=this,l=Number(t.value);if(B(l))a[i]=l;else{const e=a[i];t.value=`${e}`}}_handleDPIChange(e){const{templateOptions:t}=this,i=t.dpi;this._updateNumberInputValue(e);const a=t.dpi,{height:l,width:o}=P(a,i,t.width,t.height);t.height=l,t.width=o}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e,saveExportEnabled:t}=this,i=this.viewModel.toPrintTemplate(e),a=this._selectedTab===E.layout?i.layoutOptions?.titleText:e.fileName,l=this._createFileLink(i,a);this.exportedLinks.add(l),this.emit("submit",{link:l,saveExportEnabled:t}),this._selectedTab=E.export,this.viewModel.print(i).then((e=>{l.set({url:e&&e.url,state:"ready"})})).catch((e=>{l.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:l,saveExportEnabled:t}),this.scheduleRender()}))}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:i}=e,a=i-t;a>0&&(e.scrollTop=a)}_toggleInputValue(e){const t=e.target,i=t.getAttribute("data-option-name");this.templateOptions[i]=t.checked,"scaleEnabled"===i&&this._resetToCurrentScale()}_renderExportedLink(e){const t=this.messages,i=e.map((e=>{const{error:i,url:a,state:o}=e,r=e.formattedName??"",c="error"===o,p="pending"===o,d="ready"===o;let m=a||null;m&&(m=n(m));const u=s(a,location.href);let h;h=p?t.pending:d?t.ready:t.errorMessage;const b=c?"print-task:cim-symbol-unsupported"===i?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return S("calcite-list-item",{"aria-label":h,key:r,title:b},S("div",{class:M.exportedFile,"data-item":e,onclick:this._handleLinkClick,slot:"content"},S("div",null,S("div",{class:M.exportedFileLinkTitle},r),S("div",{class:M.exportedFileLinkDescription},p?t.generatingExport:b||(u?t.ready:t.linkReady))),d?S("calcite-icon",{"aria-label":`${r}. ${t.linkReady}`,icon:u?"download-to":"launch",key:`${r}-end-icon`,scale:"s",slot:"content-end"}):null),p?S("calcite-loader",{class:M.exportedFileLoader,inline:!0,key:`${r}-loader`,label:t.generatingExport,scale:"m",slot:"content-start"}):S("calcite-icon",{icon:R(e),key:`${r}-start-icon`,scale:"s",slot:"content-start"}),p?null:this.saveAsButtonCallback&&!c&&this._isFormatAllowedForSaving(e.extension)?S("calcite-action",{"aria-label":`${b}`,icon:"ellipsis",id:`${r}-popover-button`,key:`${r}-action`,slot:"actions-end",text:`${b}`},S("calcite-popover",{autoClose:!0,key:`${r}-popover`,label:"Popover",offsetDistance:1,overlayPositioning:"fixed",pointerDisabled:!0,referenceElement:`${r}-popover-button`,scale:"s"},S("calcite-list",{label:""},e.portalItem?S("calcite-list-item",{label:t.openItem,onCalciteListItemSelect:()=>{const t=e.portalItem;if(!t||!t.itemPageUrl)return;const i=document.createElement("a");i.target="_blank",i.href=t.itemPageUrl,i.rel="noreferrer",i.click()}},S("calcite-icon",{icon:"launch2",key:`${r}-launch-icon`,scale:"s",slot:"content-start"})):S("calcite-list-item",{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(l((()=>e.portalItem)).then((e=>{e.itemPageUrl&&this.scheduleRender()})),await this.saveAsButtonCallback(e))}},S("calcite-icon",{icon:"save",key:`${r}-save-icon`,scale:"s",slot:"content-start"})),S("calcite-list-item",{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},S("calcite-icon",{icon:"trash",key:`${r}-delete-icon`,scale:"s",slot:"content-start"}))))):S("calcite-action",{"aria-label":`${b}`,icon:"x",key:`${r}-action`,onclick:()=>{this.exportedLinks.remove(e)},slot:"actions-end",text:`${b}`}))}));return S("calcite-list",{filterEnabled:e?.length>10,label:t.exportedLinksList},i)}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||"all"===this.allowedFormatsForSaving||!(!e||!this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===E.mapOnly)this.templateOptions.reset(),this.templateOptions.layout=I;else if(this._selectedTab===E.layout){const e=this._selectedTemplate??this.viewModel.defaultTemplate;e?this.viewModel.applyTemplate(e):this.templateOptions.reset()}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,i=e.target.getAttribute("data-tab-id");if(k(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(i){case E.layout:this._toggleTab("ArrowLeft"===t?E.export:E.mapOnly);break;case E.mapOnly:this._toggleTab("ArrowLeft"===t?E.layout:E.export);break;case E.export:this._toggleTab("ArrowLeft"===t?E.mapOnly:E.layout)}e.preventDefault(),e.stopPropagation()}}};e([r()],j.prototype,"_showTemplates",void 0),e([r()],j.prototype,"_isValidSpatialReference",void 0),e([r()],j.prototype,"allowedFormats",null),e([r()],j.prototype,"allowedFormatsForSaving",void 0),e([r()],j.prototype,"allowedLayouts",null),e([r()],j.prototype,"browseTemplateButtonOnClick",void 0),e([r()],j.prototype,"error",null),e([r({type:$})],j.prototype,"exportedLinks",void 0),e([r()],j.prototype,"extraParameters",null),e([r()],j.prototype,"headerVisible",void 0),e([r()],j.prototype,"headingLevel",void 0),e([r()],j.prototype,"icon",null),e([r()],j.prototype,"includeDefaultTemplates",null),e([r()],j.prototype,"includeOrganizationTemplates",void 0),e([r()],j.prototype,"label",null),e([r(),C("esri/widgets/Print/t9n/Print")],j.prototype,"messages",void 0),e([r(),C("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([r(),C("esri/core/t9n/Units")],j.prototype,"messagesUnits",void 0),e([r({type:d})],j.prototype,"outSpatialReference",null),e([r()],j.prototype,"portal",null),e([r()],j.prototype,"saveExportEnabled",void 0),e([r()],j.prototype,"saveExportHidden",void 0),e([r()],j.prototype,"showPrintAreaEnabled",null),e([r()],j.prototype,"printServiceUrl",null),e([r()],j.prototype,"saveAsButtonCallback",void 0),e([r()],j.prototype,"templateCustomTextElements",null),e([r()],j.prototype,"templateOptions",null),e([r()],j.prototype,"view",null),e([r({type:g})],j.prototype,"viewModel",void 0),j=e([p("esri.widgets.Print")],j);const V=j;export{V as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{JSONMap as i}from"../core/jsonMap.js";import{watch as a,whenOnce as l}from"../core/reactiveUtils.js";import{unitName as o}from"../core/unitFormatUtils.js";import{addProxy as n,hasSameOrigin as s}from"../core/urlUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{ensureInteger as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import d from"../geometry/SpatialReference.js";import{isValid as m}from"../geometry/support/spatialReferenceUtils.js";import{reArcGISOnlineDomain as u}from"../portal/support/urlUtils.js";import{getToken as h}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import _ from"./Widget.js";import v from"./Print/FileLink.js";import g from"./Print/PrintViewModel.js";import{loadCalciteComponents as y}from"./support/componentsUtils.js";import{globalCss as f}from"./support/globalCss.js";import{Heading as w}from"./support/Heading.js";import{legacyIcon as T}from"./support/legacyIcon.js";import{isRTL as x,isActivationKey as k}from"./support/widgetUtils.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{tsx as S}from"./support/jsxFactory.js";import{formatNumber as O}from"../intl/number.js";const $=t.ofType(v),I="map-only";var E;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab",e.export="exportTab"}(E||(E={}));const L="esri-print",F=`${L}__advanced-options-button`,M={base:L,headerTitle:`${L}__header-title`,layoutTabList:`${L}__layout-tab-list`,layoutTab:`${L}__layout-tab`,layoutSection:`${L}__layout-section`,mapOnlySection:`${L}__map-only-section`,panelItemsCentered:`${L}__panel-items--centered`,loader:`${L}__loader`,advancedOptionsButton:F,advancedOptionsButtonContainer:`${F}-container`,advancedOptionsButtonTitle:`${F}-title`,advancedOptionsButtonIconOpened:`${F}-icon--opened`,advancedOptionsButtonIconClosed:`${F}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${F}-icon--closed-rtl`,swapButton:`${L}__swap-button`,printButton:`${L}__export-button`,printButtonSection:`${L}__export-button-section`,printButtonSectionDivider:`${L}__export-button-section--divider`,templateSelectContainer:`${L}__template-select-container`,templateSelectBlock:`${L}__template-select-block`,templateSelectIcon:`${L}__template-select-icon`,templateSelectError:`${L}__template-select-error`,templateSelectArrow:`${L}__template-select-arrow`,formSectionContainer:`${L}__form-section-container`,formCheckboxLabel:`${L}__form-checkbox-label`,advancedOptionsSection:`${L}__advanced-options-section`,advancedOptionsContainer:`${L}__advanced-options-container`,browseTemplateButtonContainer:`${L}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${L}__browse-template-button-container-filter`,exportedFilesContainer:`${L}__export-panel-container`,exportedFilesTitle:`${L}__export-title`,exportedFile:`${L}__exported-file`,exportedFileLink:`${L}__exported-file-link`,exportedFileLinkTitle:`${L}__exported-file-link-title`,exportedFileLinkDescription:`${L}__exported-file-link-description`,exportedFilesEmpty:`${L}__exported-files-empty`,printWidgetContainer:`${L}__container`,content:`${L}__content`,panelContainer:`${L}__panel-container`,scaleInfoContainer:`${L}__scale-info-container`,scaleInputContainer:`${L}__scale-input-container`,scaleInput:`${L}__scale-input`,sizeContainer:`${L}__size-container`,panelError:`${L}__panel--error`,exportedFileError:`${L}__exported-file--error`,exportedFileLoader:`${L}__exported-file--loader`,exportSection:`${L}__export-section`,exportSectionCentered:`${L}__export-section--centered`,templateButtonContainer:`${L}__template-button-container`,templateDoneButton:`${L}__template-done-button`,templateSelectFlowItemContainer:`${L}__template-select-flow-item-container`,templateSelectFlowItemContent:`${L}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${L}__template-select-flow-item-list-heading`,srLabel:`${L}__sr-label`,invalidWkidText:`${L}__invalid-wkid-text`};function P(e,t,i,a){const l=i/t,o=a/t;return{width:Math.round(e*l),height:Math.round(e*o)}}function B(e){return!isNaN(e)&&e>0}function A(e){return e?.toLowerCase()===I}function R(e){const{state:t,extension:i}=e;switch(t){case"pending":return"spinner";case"error":return"exclamation-mark-circle";default:return i?.toLowerCase()?.includes("pdf")?"file-pdf":"file"}}const N=new i({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"}),D=new Map([["a3-landscape","a3-landscape"],["a3-portrait","a3-portrait"],["a4-landscape","a4-landscape"],["a4-portrait","a4-portrait"],["letter-ansi-a-landscape","ansi-a-landscape"],["letter-ansi-a-portrait","ansi-a-portrait"],["tabloid-ansi-b-landscape","ansi-b-landscape"],["tabloid-ansi-b-portrait","ansi-b-portrait"]]);let j=class extends _{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._selectedTab=E.layout,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.exportedLinks=new $,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportEnabled=!1,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new g,this._onInput=e=>{this._selectedTab===E.layout?this.templateOptions.title=e.currentTarget.value:this._selectedTab===E.mapOnly&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{const t=e.currentTarget["data-item"];if(!t||"ready"!==t.state||!t.url)return;const i=h(this.viewModel.effectivePrintServiceUrl),a=t.url,l=document.createElement("a");if(l.target="_blank",l.href=a,l.rel="noreferrer",l.download=t.formattedName??"",!i)return l.click(),void e.stopPropagation();e.preventDefault();const o=new URL(a);o.searchParams.set("token",i),l.href=o.href,l.click(),l.href=a},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([a((()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format]),(()=>{const{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){const t=b.apiValues;this._formats=e.format.choiceList.map((e=>{const i=t.find((t=>new RegExp(`\\b${t}\\b`,"i").test(e)))??e;return{value:i,label:e===i?e.toUpperCase():e}})).sort(((e,t)=>e.label.localeCompare(t.label)))}const t=this._formats.some((({value:e})=>new RegExp(`\\b${e}\\b`,"i").test(this.templateOptions.format)));if(!e.format.defaultValue||t);else{const t=this._formats.find((({value:t})=>new RegExp(`\\b${t}\\b`,"i").test(e.format.defaultValue)))?.value;t&&(this.templateOptions.format=t)}})),a((()=>[this.templateOptions.id,this.viewModel.loaded]),(async()=>{const{layout:e}=this.templateOptions;this._selectedTab=A(e)?E.mapOnly:E.layout,this._selectedTab===E.layout&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))})),a((()=>this.templateOptions.dpi),(e=>{e<=0&&(this.templateOptions.dpi=1)})),a((()=>this.viewModel.view?.scale),(e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}))]);for(const{name:a,extension:l}of this.exportedLinks)a&&l&&this._updateExportedFileNameMap(`${a}${l}`);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const i=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>{clearTimeout(i),this._awaitingServerResponse=!1}))}loadDependencies(){return y({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),link:()=>import("@esri/calcite-components/dist/components/calcite-link")})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return"print"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{messages:e,templateOptions:t,viewModel:i,view:a}=this,{attributionEnabled:l,author:o,copyright:n,dpi:s,format:r,height:p,layout:u,layoutItem:h,legendEnabled:b,northArrowEnabled:_,scaleBarEnabled:v,scaleEnabled:g,scale:y,width:k}=t,C="ready"!==i.state||this._awaitingServerResponse||!(u||h),O=this._renderTitleOrFileNameSection(),$=S("div",{class:M.formSectionContainer},S("calcite-label",null,e.fileFormatTitle,S("calcite-combobox",{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:"single-persist",onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??"pdf"}},this._formats.map((({value:e,label:t},i)=>S("calcite-combobox-item",{key:`file-format-${i}`,selected:e===this.templateOptions.format,textLabel:t,value:e})))))),I=S("calcite-label",{layout:"inline"},S("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),L=S("div",null,S("div",{class:M.formSectionContainer},S("calcite-label",null,e.template,S("calcite-block",{class:M.templateSelectContainer,collapsible:!1,description:this._getPageSizeLabel(this._selectedTemplate),heading:this._getTemplateLabel(this._selectedTemplate,!0),key:"template-select-block",loading:"loading"===this._selectedTemplate?.state,onclick:()=>this._showTemplates=!0,onkeydown:e=>{"Enter"!==e.key&&" "!==e.key||(this._showTemplates=!0)},tabIndex:0},S("calcite-icon",{class:M.templateSelectIcon,icon:(this._selectedTemplate?.layout?D.get(this._selectedTemplate.layout):null)||"custom-print",key:"template-select-icon",scale:"l",slot:"content-start"}),"error"===this._selectedTemplate?.state?S("calcite-icon",{class:M.templateSelectError,icon:"exclamation-mark-circle",key:"template-select-error",scale:"s",slot:"actions-end"}):null,S("calcite-icon",{class:M.templateSelectArrow,icon:x()?"chevron-left":"chevron-right",key:"template-select-arrow",scale:"s",slot:"actions-end"})))),I),F=S("div",{class:M.formSectionContainer},S("calcite-label",null,e.dpi,S("calcite-input-number",{bind:this,"data-input-name":"dpi",min:1,value:`${s}`,onCalciteInputNumberInput:this._handleDPIChange}))),P=S("div",{class:M.formSectionContainer},S("calcite-label",null,S("div",{class:M.srLabel},e.outSpatialReference,S("calcite-link",{href:"https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/",target:"_blank"},"(WKID)")),S("calcite-input-number",{bind:this,"data-input-name":"outSpatialReference",integer:!0,numberButtonType:"none",value:i.outSpatialReference?.wkid?.toString()??"",onCalciteInputNumberInput:({currentTarget:e})=>{const t=c(e.value);i.outSpatialReference=Number.isNaN(t)||null==t?null:new d({wkid:t}),this._isValidSpatialReference=!i.outSpatialReference||m(i.outSpatialReference)}}),this._isValidSpatialReference?null:S("div",{class:M.invalidWkidText,key:`out-sr-${i.outSpatialReference?.wkid}`},e.invalidWkid))),B=S("div",{class:this.classes(M.scaleInfoContainer,M.formSectionContainer)},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:g,"data-option-name":"scaleEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scale),S("div",{class:M.scaleInputContainer},S("calcite-input-number",{"aria-label":e.scaleLabel,"aria-valuenow":`${y}`,bind:this,class:M.scaleInput,"data-input-name":"scale",disabled:!g,value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue}),S("calcite-button",{appearance:"outline","aria-label":e.reset,bind:this,disabled:!g,iconStart:"refresh",kind:"neutral",onclick:this._resetToCurrentScale}))),A=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:M.advancedOptionsContainer,key:"advanced-section-for-layout"},B,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?S("div",{class:M.formSectionContainer,key:"author-info"},S("calcite-label",null,e.author,S("calcite-input",{bind:this,"data-input-name":"author",value:o??"",onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??1?S("div",{class:M.formSectionContainer,key:"copyright-text"},S("calcite-label",null,e.copyright,S("calcite-input",{bind:this,"data-input-name":"copyright",value:n??"",onCalciteInputInput:this._updateInputValue}))):null,F,P,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??1?S("div",{class:M.formSectionContainer,key:"legend-info"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:b,"data-option-name":"legendEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?S("div",{class:M.formSectionContainer,key:"north-arrow"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:_,"data-option-name":"northArrowEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?S("div",{class:M.formSectionContainer,key:"scale-bar"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:v,"data-option-name":"scaleBarEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),R=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:M.advancedOptionsContainer},B,F,P,S("div",{class:M.formSectionContainer},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:l,"data-option-name":"attributionEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),N=this.exportedLinks.toArray(),j=this._renderExportedLink(N),V={[M.exportSectionCentered]:!N.length},U=this._selectedTab===E.layout?S("section",{"aria-labelledby":`${this.id}__layoutTab`,class:M.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},S("div",{class:M.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?O:null,L,this._selectedTab===E.layout?$:null,S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(M.panelContainer,M.advancedOptionsSection),collapsible:!0,disabled:!(u||h?.id),heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},A))):this._selectedTab===E.mapOnly?S("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:M.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},S("div",{class:M.panelContainer},O,$,S("div",null,S("div",{class:this.classes(M.sizeContainer,M.formSectionContainer)},S("calcite-label",null,e.width,S("calcite-input-number",{bind:this,"data-input-name":"width",value:`${k}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("calcite-label",null,e.height,S("calcite-input-number",{bind:this,"data-input-name":"height",value:`${p}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("button",{"aria-label":e.swap,bind:this,class:this.classes(f.widgetButton,M.swapButton,T.swap),onclick:this._switchInput,type:"button"})),I),S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(M.panelContainer,M.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},R))):S("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(M.exportSection,V),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},S("div",{class:M.panelContainer},S("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:M.exportedFilesContainer},0===N.length?S("div",{class:M.exportedFilesEmpty},S("calcite-icon",{icon:"file",scale:"l"}),S("div",null,S(w,{class:M.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),S("div",null,e.exportHint))):j))),H="2d"!==a?.type,z=S("div",{class:M.panelError},a?H?e.sceneViewError:e.serviceError:e.noViewError),W=N.some((({state:e})=>"pending"===e)),q=S("div",{class:M.content,key:"panel"},S("div",null,S("ul",{bind:this,class:M.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===E.layout}`,class:M.layoutTab,"data-tab-id":E.layout,id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===E.mapOnly}`,class:M.layoutTab,"data-tab-id":E.mapOnly,id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===E.export}`,class:M.layoutTab,"data-tab-id":E.export,id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},W?S("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),U),this._selectedTab!==E.export?S("div",{class:this.classes(M.printButtonSection,!this.saveExportHidden&&this.portal?M.printButtonSectionDivider:null),key:"export-button-section"},!this.saveExportHidden&&this.portal?S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,S("calcite-button",{"aria-label":e.exportDescription,bind:this,class:this.classes(M.printButton),disabled:C||!(u||h?.id)&&!r,onclick:this._handlePrintMap,scale:"l",width:"full"},e.export)):null),K=S("calcite-flow",{key:"root-flow"},S("calcite-flow-item",{bind:this,key:"root-flow-item",selected:!this._showTemplates},S("div",{class:M.printWidgetContainer},this.headerVisible?S("header",{class:M.headerTitle},e.export):null,this.error||H||!a?z:q)),this._renderChooseTemplateFlowItem()),G="initializing"===i.state,J=G?this._renderLoader():K,Q={[M.panelItemsCentered]:G};return S("div",{bind:this,class:this.classes(M.base,f.widget,f.panel,Q)},J)}_getPageSizeLabel(e){if(!e)return;const t=e.layoutTemplateInfo;if(!t)return;const i=N.fromJSON(t.pageUnits.toLowerCase());return`${O(t.pageSize[0])} × ${O(t.pageSize[1])} ${o(this.messagesUnits,i,"abbr")}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;const{label:i,layout:a,layoutItem:l,type:o}=e;if("print-service-template"===o&&this.messages[a])return this.messages[a];const n=i??a??l?.id;return n?.replaceAll("_"," ")??this.messages.untitled}_getPortalTemplates(){const{portalTemplateIds:e}=this.viewModel;return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter((({layout:t,layoutItem:i})=>!A(t)&&!!i?.id&&e.includes(i.id))):[]}_getDefaultTemplates(){const{portalTemplateIds:e}=this.viewModel;return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter((({layout:t,layoutItem:i})=>!(A(t)||i?.id&&e.includes(i.id)))):[]}_getPrintServiceTemplates(){return this.includeDefaultTemplates&&this._getDefaultTemplates().length?[]:this.viewModel.printServiceTemplates.toArray().filter((({layout:e})=>!A(e)))}_renderLayoutTemplates(e,t=!1,i=!1){return t&&e.sort(((e,t)=>(e.label??"")>(t.label??"")?1:-1)),e.map((e=>S("calcite-list-item",{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??"",value:e},S("calcite-icon",{icon:(e.layout?D.get(e.layout):null)||"custom-print",slot:"content-start"}),"loading"===e.state?S("calcite-loader",{inline:!0,key:`template-loader-${e.id}`,label:"loading",scale:"s",slot:"content-end"}):null,"error"===e?.state?S("calcite-icon",{class:M.templateSelectError,icon:"exclamation-mark-circle",key:`template-error-${e.id}`,scale:"s",slot:"content-end"}):null,i?S("calcite-action",{icon:"trash",onclick:()=>this.viewModel.removePortalTemplate(e),slot:"actions-end",text:"delete"}):null)))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;const{messages:e}=this,t=u.test(this.portal?.url),i=this.viewModel.browseTemplates.toArray(),a=this._getPortalTemplates(),l=this._getDefaultTemplates(),o=this._getPrintServiceTemplates(),n=i.length+a.length+l.length+o.length>15,s=this.browseTemplateButtonOnClick?S("calcite-button",{appearance:"outline",class:n?M.browseTemplateButtonContainerFilter:M.browseTemplateButtonContainer,iconStart:"folder",key:"browse-template-button",onclick:this.browseTemplateButtonOnClick,slot:n?"filter-actions-end":"default"},n?null:e.browseTemplates):null;return S("calcite-flow-item",{bind:this,closable:!1,heading:e.chooseTemplate,key:"template-flow-item",selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},S("div",{class:M.templateSelectFlowItemContainer},S("div",{class:M.templateSelectFlowItemContent},n?null:s,S("calcite-list",{filterEnabled:n,filterProps:["label"],key:"template-list",label:e.templateList,selectionMode:"single-persist",onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},n?s:null,i.length?S("div",{key:"my-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.myTemplates,S("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta)),this._renderLayoutTemplates(i,!0,!0)):null,a.length?S("div",{key:"org-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.organizationTemplates,t?S("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta):null),this._renderLayoutTemplates(a)):null,i.length||a.length?l.length?S("div",{key:"default-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(l,!0)):null:this._renderLayoutTemplates(l,!0),i.length||a.length?o.length?S("div",{key:"service-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(o)):null:this._renderLayoutTemplates(o))),S("div",{class:M.templateButtonContainer},S("calcite-button",{class:M.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?S("div",{class:M.formSectionContainer,key:"custom-text-elements"},e.map(((e,t)=>{const[i,a]=Object.entries(e)[0];return"date"===i?null:S("calcite-label",{key:`custom-text-elements-${i}-${t}`},i,S("calcite-input",{bind:this,"data-input-custom":!0,"data-input-name":i,value:a??"",onCalciteInputInput:this._updateInputValue}))}))):null}_renderTitleOrFileNameSection(){const{title:e,fileName:t,titlePlaceHolder:i,fileNamePlaceHolder:a}=this.messages,l=this._selectedTab===E.layout?e:t,o=this._selectedTab===E.layout?i:a,n=this._selectedTab===E.layout?this.templateOptions.title:this.templateOptions.fileName;return S("div",{class:M.formSectionContainer,key:l},S("calcite-label",null,l,S("calcite-input",{placeholder:o,value:n??"",onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._selectedTab===E.layout||"mapOnlyTab"===t&&this._selectedTab===E.mapOnly||"exportTab"===t&&this._selectedTab===E.export)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[M.loader]:this._awaitingServerResponse};return S("div",{class:this.classes(e),key:"loader"})}_updateExportedFileNameMap(e){void 0!==this._exportedFileNameMap[e]?this._exportedFileNameMap[e]++:this._exportedFileNameMap[e]=0}_createFileLink(e,t){const i=t||this.messages.untitled,a=e.format.toLowerCase(),l=a.includes("png")?"png":a,o=i+l;return this._updateExportedFileNameMap(o),new v({name:i,extension:l,count:this._exportedFileNameMap[o]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,i){e.find((e=>{const[i]=Object.entries(e)[0];return i===t}))[t]=i}_updateInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),a=!!t["data-input-custom"],{templateOptions:l}=this;a?this._updateCustomTextElementValue(l.customTextElements,i,t.value):l[i]=t.value}_updateNumberInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),{templateOptions:a}=this,l=Number(t.value);if(B(l))a[i]=l;else{const e=a[i];t.value=`${e}`}}_handleDPIChange(e){const{templateOptions:t}=this,i=t.dpi;this._updateNumberInputValue(e);const a=t.dpi,{height:l,width:o}=P(a,i,t.width,t.height);t.height=l,t.width=o}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e,saveExportEnabled:t}=this,i=this.viewModel.toPrintTemplate(e),a=this._selectedTab===E.layout?i.layoutOptions?.titleText:e.fileName,l=this._createFileLink(i,a);this.exportedLinks.add(l),this.emit("submit",{link:l,saveExportEnabled:t}),this._selectedTab=E.export,this.viewModel.print(i).then((e=>{l.set({url:e&&e.url,state:"ready"})})).catch((e=>{l.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:l,saveExportEnabled:t}),this.scheduleRender()}))}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:i}=e,a=i-t;a>0&&(e.scrollTop=a)}_toggleInputValue(e){const t=e.target,i=t.getAttribute("data-option-name");this.templateOptions[i]=t.checked,"scaleEnabled"===i&&this._resetToCurrentScale()}_renderExportedLink(e){const t=this.messages,i=e.map((e=>{const{error:i,url:a,state:o}=e,r=e.formattedName??"",c="error"===o,p="pending"===o,d="ready"===o;let m=a||null;m&&(m=n(m));const u=s(a,location.href);let h;h=p?t.pending:d?t.ready:t.errorMessage;const b=c?"print-task:cim-symbol-unsupported"===i?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return S("calcite-list-item",{"aria-label":h,key:r,title:b},S("div",{class:M.exportedFile,"data-item":e,onclick:this._handleLinkClick,slot:"content"},S("div",null,S("div",{class:M.exportedFileLinkTitle},r),S("div",{class:M.exportedFileLinkDescription},p?t.generatingExport:b||(u?t.ready:t.linkReady))),d?S("calcite-icon",{"aria-label":`${r}. ${t.linkReady}`,icon:u?"download-to":"launch",key:`${r}-end-icon`,scale:"s",slot:"content-end"}):null),p?S("calcite-loader",{class:M.exportedFileLoader,inline:!0,key:`${r}-loader`,label:t.generatingExport,scale:"m",slot:"content-start"}):S("calcite-icon",{icon:R(e),key:`${r}-start-icon`,scale:"s",slot:"content-start"}),p?null:this.saveAsButtonCallback&&!c&&this._isFormatAllowedForSaving(e.extension)?S("calcite-action",{"aria-label":`${b}`,icon:"ellipsis",id:`${r}-popover-button`,key:`${r}-action`,slot:"actions-end",text:`${b}`},S("calcite-popover",{autoClose:!0,key:`${r}-popover`,label:"Popover",offsetDistance:1,overlayPositioning:"fixed",pointerDisabled:!0,referenceElement:`${r}-popover-button`,scale:"s"},S("calcite-list",{label:""},e.portalItem?S("calcite-list-item",{label:t.openItem,onCalciteListItemSelect:()=>{const t=e.portalItem;if(!t||!t.itemPageUrl)return;const i=document.createElement("a");i.target="_blank",i.href=t.itemPageUrl,i.rel="noreferrer",i.click()}},S("calcite-icon",{icon:"launch2",key:`${r}-launch-icon`,scale:"s",slot:"content-start"})):S("calcite-list-item",{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(l((()=>e.portalItem)).then((e=>{e.itemPageUrl&&this.scheduleRender()})),await this.saveAsButtonCallback(e))}},S("calcite-icon",{icon:"save",key:`${r}-save-icon`,scale:"s",slot:"content-start"})),S("calcite-list-item",{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},S("calcite-icon",{icon:"trash",key:`${r}-delete-icon`,scale:"s",slot:"content-start"}))))):S("calcite-action",{"aria-label":`${b}`,icon:"x",key:`${r}-action`,onclick:()=>{this.exportedLinks.remove(e)},slot:"actions-end",text:`${b}`}))}));return S("calcite-list",{filterEnabled:e?.length>10,label:t.exportedLinksList},i)}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||"all"===this.allowedFormatsForSaving||!(!e||!this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===E.mapOnly)this.templateOptions.reset(),this.templateOptions.layout=I;else if(this._selectedTab===E.layout){const e=this._selectedTemplate??this.viewModel.defaultTemplate;e?this.viewModel.applyTemplate(e):this.templateOptions.reset()}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,i=e.target.getAttribute("data-tab-id");if(k(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(i){case E.layout:this._toggleTab("ArrowLeft"===t?E.export:E.mapOnly);break;case E.mapOnly:this._toggleTab("ArrowLeft"===t?E.layout:E.export);break;case E.export:this._toggleTab("ArrowLeft"===t?E.mapOnly:E.layout)}e.preventDefault(),e.stopPropagation()}}};e([r()],j.prototype,"_showTemplates",void 0),e([r()],j.prototype,"_isValidSpatialReference",void 0),e([r()],j.prototype,"allowedFormats",null),e([r()],j.prototype,"allowedFormatsForSaving",void 0),e([r()],j.prototype,"allowedLayouts",null),e([r()],j.prototype,"browseTemplateButtonOnClick",void 0),e([r()],j.prototype,"error",null),e([r({type:$})],j.prototype,"exportedLinks",void 0),e([r()],j.prototype,"extraParameters",null),e([r()],j.prototype,"headerVisible",void 0),e([r()],j.prototype,"headingLevel",void 0),e([r()],j.prototype,"icon",null),e([r()],j.prototype,"includeDefaultTemplates",null),e([r()],j.prototype,"includeOrganizationTemplates",void 0),e([r()],j.prototype,"label",null),e([r(),C("esri/widgets/Print/t9n/Print")],j.prototype,"messages",void 0),e([r(),C("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([r(),C("esri/core/t9n/Units")],j.prototype,"messagesUnits",void 0),e([r({type:d})],j.prototype,"outSpatialReference",null),e([r()],j.prototype,"portal",null),e([r()],j.prototype,"saveExportEnabled",void 0),e([r()],j.prototype,"saveExportHidden",void 0),e([r()],j.prototype,"showPrintAreaEnabled",null),e([r()],j.prototype,"printServiceUrl",null),e([r()],j.prototype,"saveAsButtonCallback",void 0),e([r()],j.prototype,"templateCustomTextElements",null),e([r()],j.prototype,"templateOptions",null),e([r()],j.prototype,"view",null),e([r({type:g})],j.prototype,"viewModel",void 0),j=e([p("esri.widgets.Print")],j);const V=j;export{V as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import r from"../../core/Identifiable.js";import{watch as o,initial as l}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{cast as a}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{get as d}from"../../core/accessorSupport/get.js";import c from"../../support/actions/ActionBase.js";import p from"../../support/actions/ActionButton.js";import u from"../../support/actions/ActionToggle.js";import{canDisplayLayer as y,findLayerListMode as m,getNormalizedChildLayerProperty as b}from"../LayerList/support/layerListUtils.js";import f from"./ListItemPanel.js";var C;const _="layer",v="child-list-mode",g="hide",I=s.ofType({key:"type",defaultKeyValue:"button",base:c,typeMap:{button:p,toggle:u}}),P=s.ofType(I);let S=C=class extends(r.IdentifiableMixin(e)){constructor(t){super(t),this.actionsSections=new P,this.actionsOpen=!1,this.checkPublishStatusEnabled=!1,this.children=new(s.ofType(C)),this.hidden=!1,this.layer=null,this.listItemCreatedFunction=null,this.listModeDisabled=!1,this.open=!1,this.panel=null,this.parent=null,this.sortable=!0}initialize(){if(this.addHandles([o((()=>[this.layer?.listMode,this.listModeDisabled]),(()=>this._watchLayerProperties(this.layer)),l),o((()=>this.checkPublishStatusEnabled),(t=>this._updateChildrenPublishing(t)),l),o((()=>this.panel),(t=>this._setListItemOnPanel(t)),l)]),"function"==typeof this.listItemCreatedFunction){const t={item:this};this.listItemCreatedFunction.call(null,t)}}destroy(){this.panel?.destroy(),this.children.destroyAll()}get error(){return this.layer?.loadError}castPanel(t){return this.panel?.open&&!t.hasOwnProperty("open")&&(t.open=!0),t?new f(t):null}get publishing(){const{layer:t,checkPublishStatusEnabled:e}=this;return(e&&t&&"publishingInfo"in t&&"publishing"===t.publishingInfo?.status)??!1}get title(){const t=d(this,"layer.layer");return(!t||t&&d(this,"layer.layer.loaded")?this.layer?.title:null)??""}set title(t){this._overrideIfSome("title",t)}clone(){return new C({actionsSections:this.actionsSections.clone(),actionsOpen:this.actionsOpen,checkPublishStatusEnabled:this.checkPublishStatusEnabled,children:this.children.clone(),hidden:this.hidden,layer:this.layer,listItemCreatedFunction:this.listItemCreatedFunction,listModeDisabled:this.listModeDisabled,open:this.open,panel:this.panel,parent:this.parent,sortable:this.sortable,title:this.title})}_updateChildrenPublishing(t){this.children?.forEach((e=>e.checkPublishStatusEnabled=t))}_setListItemOnPanel(t){t&&(t.listItem=this)}_createChildItems(t,e){return t.reverse().map((t=>e||y(t)?new C({layer:t,checkPublishStatusEnabled:this.checkPublishStatusEnabled,listItemCreatedFunction:this.listItemCreatedFunction,listModeDisabled:this.listModeDisabled,parent:this}):null)).filter(i)}_createChildren(t){const{listModeDisabled:e,children:i}=this,s=t.reverse().filter((t=>!i.some((e=>e.layer===t))));i.addMany(this._createChildItems(s,e))}_destroyChildren(t){const{children:e}=this,i=e.filter((e=>!!e.layer&&!t.includes(e.layer)));e.destroyMany(i)}_sortChildren(t){this.children.sort(((e,i)=>t.indexOf(i.layer)-t.indexOf(e.layer)))}_destroyAllChildren(){this.removeHandles(v),this.children.destroyAll()}_compileChildren(t){const e=this.listModeDisabled?t:t?.filter((t=>m(t)!==g));t?.length?(this._createChildren(e),this._destroyChildren(e),this._sortChildren(e),this._watchChildLayerListMode(t)):this._destroyAllChildren()}_watchChildLayerListMode(t){this.removeHandles(v),this.listModeDisabled||this.addHandles(t.toArray().map((e=>o((()=>e.listMode),(()=>this._compileChildren(t))))),v)}_watchSublayerChanges(t){t&&this.addHandles(t.on("change",(()=>this._compileChildren(t))),_)}_initializeChildLayers(t){this._compileChildren(t),this._watchSublayerChanges(t)}_watchLayerProperties(t){if(this.removeHandles(_),this.removeHandles(v),!t)return;t.load();if("hide-children"===(!this.listModeDisabled&&m(t)))return void this.children.destroyAll();const e=b(t);e&&this.addHandles(o((()=>t[e]),(i=>{t.hasOwnProperty(e)&&this._initializeChildLayers(i)}),l),_)}};t([n({type:P})],S.prototype,"actionsSections",void 0),t([n()],S.prototype,"actionsOpen",void 0),t([n()],S.prototype,"checkPublishStatusEnabled",void 0),t([n({type:s.ofType(S)})],S.prototype,"children",void 0),t([n({readOnly:!0})],S.prototype,"error",null),t([n()],S.prototype,"hidden",void 0),t([n()],S.prototype,"layer",void 0),t([n()],S.prototype,"listItemCreatedFunction",void 0),t([n({nonNullable:!0})],S.prototype,"listModeDisabled",void 0),t([n()],S.prototype,"open",void 0),t([n({type:f})],S.prototype,"panel",void 0),t([a("panel")],S.prototype,"castPanel",null),t([n()],S.prototype,"parent",void 0),t([n({readOnly:!0})],S.prototype,"publishing",null),t([n()],S.prototype,"sortable",void 0),t([n()],S.prototype,"title",null),S=C=t([h("esri.widgets.TableList.ListItem")],S);const M=S;export{M as default};
|
package/widgets/TableList.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import i from"../core/Identifiable.js";import{on as o,watch as s,initial as l}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import d from"./LayerList/LayerListItem.js";import{minDragEnabledItems as c,minFilterItems as m,getLayerType as p,removeDestroyedListItems as h,setFilterPredicate as u}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{globalCss as f}from"./support/globalCss.js";import{calciteListFilterProps as I}from"./support/listUtils.js";import{setFocus as b}from"./support/widgetUtils.js";import{messageBundle as _}from"./support/decorators/messageBundle.js";import{vmEvent as v}from"./support/decorators/vmEvent.js";import{tsx as y}from"./support/jsxFactory.js";import{css as w}from"./TableList/css.js";import L from"./TableList/ListItem.js";import E from"./TableList/TableListViewModel.js";import C from"./TableList/TableListVisibleElements.js";import{getItem as F,sortTablesToIds as M}from"./TableList/support/tableListUtils.js";const P="
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import i from"../core/Identifiable.js";import{on as o,watch as s,initial as l}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import d from"./LayerList/LayerListItem.js";import{minDragEnabledItems as c,minFilterItems as m,getLayerType as p,removeDestroyedListItems as h,setFilterPredicate as u}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{globalCss as f}from"./support/globalCss.js";import{calciteListFilterProps as I}from"./support/listUtils.js";import{setFocus as b}from"./support/widgetUtils.js";import{messageBundle as _}from"./support/decorators/messageBundle.js";import{vmEvent as v}from"./support/decorators/vmEvent.js";import{tsx as y}from"./support/jsxFactory.js";import{css as w}from"./TableList/css.js";import L from"./TableList/ListItem.js";import E from"./TableList/TableListViewModel.js";import C from"./TableList/TableListVisibleElements.js";import{getItem as F,sortTablesToIds as M}from"./TableList/support/tableListUtils.js";const P="nested",j=t.ofType(L);let D=class extends(i.IdentifiableMixin(a)){constructor(e,t){super(e,t),this._rootListEl=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`table-${this.uid}`,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=c,this.minFilterItems=m,this.selectedItems=new j,this.selectionMode="none",this.viewModel=new E,this.visibleElements=new C,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=F(e);if(!l?.sortable)return!1;const r=F(t),n=p(t),a=F(i),d=p(i),c=!!n&&!!d&&n===d,m={selected:l,from:r,to:a},h=t.group,u=i.group;return h&&u&&"function"==typeof s?s.call(null,m):c},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(!o||!i||t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=s.value;const r=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));M(this.map?.tables,r)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0}}initialize(){this.addHandles([o((()=>this.viewModel.tableItems),"change",(()=>h(this.selectedItems)),l),s((()=>[this.filterPredicate,this._rootListEl]),(()=>u(this._rootListEl,this.filterPredicate)))])}loadDependencies(){return g({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}get _dragEnabled(){return this.viewModel.totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get _visibleItems(){return this.tableItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleItems.filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get icon(){return"table"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get tableItems(){return this.viewModel.tableItems}get tables(){return this.viewModel.tables}set tables(e){this.viewModel.tables=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,{_visibleItems:t}=this,i={[f.hidden]:"loading"===e,[f.disabled]:"disabled"===e};return y("div",{class:this.classes(w.base,f.widget,f.panel,i)},t?.length?this._renderItems():this._renderNoItems())}_renderNoItemsMessage(){return y("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return y("div",{class:w.itemMessage,key:"esri-layer-list__no-items"},y("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(){const{_openedPanelItems:e}=this;return e.toArray().map((({title:t,panel:i},o)=>{const s=()=>this._handlePanelFlowItemBack(i);return y("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:t,heading:i.title,headingLevel:this.headingLevel,key:`flow-panel-${i.uid}`,selected:o===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),s()}},i.render(),y("calcite-button",{appearance:"transparent",onclick:s,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,b(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,b(e))}_renderItems(){const{visible:e,collapsed:t,visibleElements:{closeButton:i,collapseButton:o,heading:s,flow:l},_dragEnabled:r,_visibleItems:n,_filterEnabled:a,_rootGroupUid:d,_openedPanelItems:c,selectionMode:m,messages:p,filterPlaceholder:h,filterText:u}=this,g=[y("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!e,collapsed:t,collapsible:o,heading:s?p.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!c.length,onCalciteFlowItemClose:()=>this.visible=!1},y("calcite-list",{afterCreate:e=>{this._rootListEl=e},afterRemoved:()=>{this._rootListEl=null},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":d,displayMode:P,dragEnabled:r,filterEnabled:a,filterPlaceholder:h,filterProps:I,filterText:a?u:"",group:d,key:"root-list",label:p.widgetLabel,selectionAppearance:"border",selectionMode:m,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},n?.toArray().map((e=>this._renderItem(e))),n?.length&&a?y("div",{class:w.filterNoResults,slot:"filter-no-results"},y("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems()];return e?l?y("calcite-flow",{key:"root-flow"},g):g:null}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_renderItem(e){return y(d,{canMove:this._canMove,css:w,displayMode:P,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer.uid}`,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange})}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>F(e))).filter(Boolean);i.removeAll(),i.addMany(o)}};e([r()],D.prototype,"_rootListEl",void 0),e([r()],D.prototype,"_focusRootFlowItem",void 0),e([r()],D.prototype,"_focusPanelFlowItem",void 0),e([r()],D.prototype,"_dragEnabled",null),e([r()],D.prototype,"_filterEnabled",null),e([r()],D.prototype,"_visibleItems",null),e([r()],D.prototype,"_openedPanelItems",null),e([r()],D.prototype,"collapsed",void 0),e([r()],D.prototype,"dragEnabled",void 0),e([r()],D.prototype,"filterPlaceholder",void 0),e([r()],D.prototype,"filterPredicate",void 0),e([r()],D.prototype,"filterText",void 0),e([r()],D.prototype,"headingLevel",void 0),e([r()],D.prototype,"icon",null),e([r()],D.prototype,"label",null),e([r()],D.prototype,"listItemCanGiveFunction",void 0),e([r()],D.prototype,"listItemCanReceiveFunction",void 0),e([r()],D.prototype,"listItemCreatedFunction",null),e([r()],D.prototype,"map",null),e([r(),_("esri/widgets/TableList/t9n/TableList")],D.prototype,"messages",void 0),e([r(),_("esri/t9n/common")],D.prototype,"messagesCommon",void 0),e([r()],D.prototype,"minDragEnabledItems",void 0),e([r()],D.prototype,"minFilterItems",void 0),e([r({type:j})],D.prototype,"selectedItems",void 0),e([r()],D.prototype,"selectionMode",void 0),e([r({readOnly:!0})],D.prototype,"tableItems",null),e([r()],D.prototype,"tables",null),e([v("trigger-action"),r({type:E})],D.prototype,"viewModel",void 0),e([r({type:C,nonNullable:!0})],D.prototype,"visibleElements",void 0),D=e([n("esri.widgets.TableList")],D);const T=D;export{T as default};
|