/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{destroyMaybe as r}from"../../core/maybe.js";import{throwIfAborted as o}from"../../core/promiseUtils.js";import{property as s,subclass as i}from"../../core/accessorSupport/decorators.js";import{ExportWMSImageParameters as a}from"../../layers/support/ExportWMSImageParameters.js";import{combineTimeExtent as p}from"../../layers/support/timeSupport.js";const m=m=>{const n=m;let h=class extends n{initialize(){this.exportImageParameters=new a({layer:this.layer})}destroy(){this.exportImageParameters=r(this.exportImageParameters)}get exportImageVersion(){return this.exportImageParameters?.commitProperty("version"),this.commitProperty("timeExtent"),(this._get("exportImageVersion")||0)+1}get timeExtent(){return p(this.layer,this.view?.timeExtent,this._get("timeExtent"))}async fetchPopupFeaturesAtLocation(e,r){const{layer:s}=this;if(!e)throw new t("wmslayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const{popupEnabled:i}=s;if(!i)throw new t("wmslayerview:fetchPopupFeatures","popupEnabled should be true",{popupEnabled:i});const a=this.createFetchPopupFeaturesQuery(e);if(!a)return[];const{extent:p,width:m,height:n,x:h,y:u}=a;if(!(p&&m&&n))throw new t("wmslayerview:fetchPopupFeatures","WMSLayer does not support fetching features.",{extent:p,width:m,height:n});const c=await s.fetchFeatureInfo(p,m,n,h,u);return o(r),c}};return e([s()],h.prototype,"exportImageParameters",void 0),e([s({readOnly:!0})],h.prototype,"exportImageVersion",null),e([s()],h.prototype,"layer",void 0),e([s({readOnly:!0})],h.prototype,"timeExtent",null),h=e([i("esri.views.layers.WMSLayerView")],h),h};export{m as WMSLayerView};
