1 |
- import{aY as J,i$ as nt,t as z,e1 as Ve,_ as a,$ as u,cK as M,gX as pe,co as at,a7 as X,a0 as E,cp as k,dN as V,aL as oe,cL as Ue,a as I,dy as ee,dQ as ce,dR as me,U as O,dP as je,cA as fe,dK as Ge,c1 as Be,dL as Me,as as Ae,cz as ot,gB as se,iW as lt,eH as ut,ca as pt,bP as ct,s as Le,g as L,dM as ne,k as mt,cV as we,j0 as dt,ar as ht,R as yt,cJ as gt,j1 as ft,iz as Rt,i5 as bt,iQ as vt,ih as wt,eC as St,eD as xt,iG as It,iN as Ft,eB as Tt,eE as Dt,aM as Nt,i9 as Pt,j2 as Ct,iI as _t,ib as Ot,dc as Vt,cu as jt}from"./index.6c049565.js";import{w as x,o as Y,i as ye,c as Mt,l as At,a as $t,u as Jt,m as Et,k as Lt,L as zt,j as qt,$ as Ht,f as kt,n as Qt}from"./fetchRasterInfo.4a5e5120.js";import{p as Fe,m as ze,d as Ut,c as Gt}from"./multidimensionalUtils.6150b3b3.js";import{_ as We,h as Ke,n as Bt,f as Wt,k as Kt,b as Zt,e as Ze,T as Xt,S as qe,P as Yt}from"./RasterSymbolizer.04994a43.js";import{g as Se}from"./pixelUtils.f4eba4af.js";import{f as ei,b as ti}from"./dataUtils.97a7b38c.js";import{s as ii,n as ri}from"./executeForIds.4e97b9d4.js";import"./generateRendererUtils.03b1f269.js";import"./colorUtils.bb6424b7.js";const si={StretchFunction:{arguments:{ComputeGamma:{isDataset:!1,isPublic:!1,name:"ComputeGamma",type:"RasterFunctionVariable",value:!1},DRA:{isDataset:!1,isPublic:!1,name:"DRA",type:"RasterFunctionVariable",value:!1},EstimateStatsHistogram:{isDataset:!1,isPublic:!1,name:"EstimateStatsHistogram",type:"RasterFunctionVariable",value:!1},Gamma:{displayName:"Gamma",isDataset:!1,isPublic:!1,name:"Gamma",type:"RasterFunctionVariable"},Histograms:{isDataset:!1,isPublic:!1,name:"Histograms",type:"RasterFunctionVariable"},Max:{isDataset:!1,isPublic:!1,name:"Max",type:"RasterFunctionVariable",value:255},MaxPercent:{isDataset:!1,isPublic:!1,name:"MaxPercent",type:"RasterFunctionVariable",value:.5},Min:{isDataset:!1,isPublic:!1,name:"Min",type:"RasterFunctionVariable",value:0},MinPercent:{isDataset:!1,isPublic:!1,name:"MinPercent",type:"RasterFunctionVariable",value:.25},NumberOfStandardDeviations:{isDataset:!1,isPublic:!1,name:"NumberOfStandardDeviation",type:"RasterFunctionVariable",value:2},Raster:{isDataset:!0,isPublic:!1,name:"Raster",type:"RasterFunctionVariable"},SigmoidStrengthLevel:{isDataset:!1,isPublic:!1,name:"SigmoidStrengthLevel",type:"RasterFunctionVariable",value:2},Statistics:{isDataset:!1,isPublic:!1,name:"Statistics",type:"RasterFunctionVariable"},StretchType:{isDataset:!1,isPublic:!1,name:"StretchType",type:"RasterFunctionVariable",value:0},type:"StretchFunctionArguments",UseGamma:{isDataset:!1,isPublic:!1,name:"UseGamma",type:"RasterFunctionVariable",value:!1}},description:"Enhances an image by adjusting the range of values displayed. This does not alter the underlying pixel values. If a pixel has a value outside of the specified range, it will appear as either the minimum or maximum value.",function:{description:"Enhances an image by adjusting the range of values displayed. This does not alter the underlying pixel values. If a pixel has a value outside of the specified range, it will appear as either the minimum or maximum value.",name:"Stretch",pixelType:"UNKNOWN",type:"StretchFunction"},functionType:0,name:"Stretch",thumbnail:""},RemapFunction:{name:"Remap",description:"Changes pixel values by assigning new values to ranges of pixel values or using an external table.",function:{type:"RemapFunction",pixelType:"UNKNOWN",name:"Remap",description:"Changes pixel values by assigning new values to ranges of pixel values or using an external table."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},UseTable:{name:"UseTable",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},InputRanges:{name:"InputRanges",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"Input Ranges"},OutputValues:{name:"OutputValues",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"Output Values"},NoDataRanges:{name:"NoDataRanges",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"NoData Ranges"},Table:{name:"Table",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},InputField:{name:"InputField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},OutputField:{name:"OutputField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},InputMaxField:{name:"InputMaxField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},RemapTableType:{name:"RemapTableType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},AllowUnmatched:{name:"AllowUnmatched",isPublic:!1,isDataset:!1,value:!0,type:"RasterFunctionVariable"},type:"RemapFunctionArguments"},functionType:0,thumbnail:""},ColormapFunction:{name:"Colormap",description:"Changes pixel values to display the raster data as either a grayscale or a red, green, blue (RGB) image, based on a colormap or a color ramp.",function:{type:"ColormapFunction",pixelType:"UNKNOWN",name:"Colormap",description:"Changes pixel values to display the raster data as either a grayscale or a red, green, blue (RGB) image, based on a colormap or a color ramp."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ColorSchemeType:{name:"ColorSchemeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},Colormap:{name:"Colormap",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},ColormapName:{name:"ColormapName",isPublic:!1,isDataset:!1,value:"Gray",type:"RasterFunctionVariable"},ColorRamp:{name:"ColorRamp",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},type:"ColormapFunctionArguments"},functionType:0,thumbnail:""},ShadedReliefFunction:{name:"Shaded Relief",description:"Creates a multiband, color coded, 3D representation of the surface, with the sun's relative position taken into account for shading the image.",function:{type:"ShadedReliefFunction",pixelType:"UNKNOWN",name:"Shaded Relief",description:"Creates a multiband, color coded, 3D representation of the surface, with the sun's relative position taken into account for shading the image."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ColorSchemeType:{name:"ColorSchemeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ColorRamp:{name:"ColorRamp",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},HillshadeType:{name:"HillshadeType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},Colormap:{name:"Colormap",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},Azimuth:{name:"Azimuth",isPublic:!1,isDataset:!1,value:315,type:"RasterFunctionVariable"},Altitude:{name:"Altitude",isPublic:!1,isDataset:!1,value:45,type:"RasterFunctionVariable"},SlopeType:{name:"SlopeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ZFactor:{name:"ZFactor",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},PSPower:{name:"PSPower",isPublic:!1,isDataset:!1,value:.664,type:"RasterFunctionVariable"},PSZFactor:{name:"PSZFactor",isPublic:!1,isDataset:!1,value:.024,type:"RasterFunctionVariable"},RemoveEdgeEffect:{name:"RemoveEdgeEffect",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},type:"ShadedReliefFunctionArguments"},functionType:0,thumbnail:""},HillshadeFunction:{name:"Hillshade",description:"Creates a 3D representation of the surface, with the sun's relative position taken into account for shading the image",function:{type:"HillshadeFunction",pixelType:"UNKNOWN",name:"Hillshade",description:"Creates a 3D representation of the surface, with the sun's relative position taken into account for shading the image"},arguments:{DEM:{name:"DEM",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},HillshadeType:{name:"HillshadeType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},Azimuth:{name:"Azimuth",isPublic:!1,isDataset:!1,value:315,type:"RasterFunctionVariable"},Altitude:{name:"Altitude",isPublic:!1,isDataset:!1,value:45,type:"RasterFunctionVariable"},SlopeType:{name:"SlopeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ZFactor:{name:"ZFactor",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},PSPower:{name:"PSPower",isPublic:!1,isDataset:!1,value:.664,type:"RasterFunctionVariable"},PSZFactor:{name:"PSZFactor",isPublic:!1,isDataset:!1,value:.024,type:"RasterFunctionVariable"},RemoveEdgeEffect:{name:"RemoveEdgeEffect",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},type:"HillshadeFunctionArguments"},functionType:0,thumbnail:""},ResampleFunction:{name:"Resample",description:"Changes the cell size of a raster.",function:{type:"ResampleFunction",pixelType:"UNKNOWN",name:"Resample",description:"Changes the cell size of a raster."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ResamplingType:{name:"ResamplingType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},InputCellSize:{name:"InputCellsize",isPublic:!1,isDataset:!1,value:{x:0,y:0},type:"RasterFunctionVariable"},OutputCellSize:{name:"OutputCellsize",isPublic:!1,isDataset:!1,value:{x:0,y:0},type:"RasterFunctionVariable"},type:"ResampleFunctionArguments"},functionType:0,thumbnail:""}},ni={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767]},ai={simple_scalar:"Simple Scalar",wind_barb:"Wind Barb",single_arrow:"Single Arrow",beaufort_kn:"Beaufort Wind (Knots)",beaufort_m:"Beaufort Wind (MetersPerSecond)",ocean_current_m:"Ocean Current (MetersPerSecond)",ocean_current_kn:"Ocean Current (Knots)"},oi=new Set(["raster-stretch","unique-value","class-breaks","raster-shaded-relief","vector-field","raster-colormap"]);function Xe(r){return oi.has(r.type)}function xe(r,i){if(!r||!i)return J(r||i);const o=J(r);if(i.rasterFunctionDefinition){const e=i.rasterFunctionDefinition;(e.thumbnail||e.thumbnailEx)&&(e.thumbnail=e.thumbnailEx=null),Ye(o.rasterFunctionDefinition.arguments,i)}else i.functionName.toLowerCase()!=="none"&&(et(o.functionArguments).Raster=i);return o}function Ye(r,i){for(const o in r)o.toLowerCase()==="raster"&&(r[o].type==="RasterFunctionVariable"?(r[o]=i.rasterFunctionDefinition,r[o].type="RasterFunctionTemplate"):r[o].type==="RasterFunctionTemplate"&&Ye(r[o].arguments,i))}function W(r){const i=J(si[r.functionName+"Function"]),o=r.functionArguments;for(const e in o)e.toLowerCase()==="raster"?(i.arguments[e]=W(o[e]),i.arguments[e].type="RasterFunctionTemplate"):e.toLowerCase()==="colormap"?(i.arguments[e].value=gi(o[e]),i.arguments.ColorSchemeType.value=0):i.arguments[e].value=o[e];return i}function li(r,i){switch(i=i||{},r.type){case"raster-stretch":return ci(r,i);case"class-breaks":return mi(r,i);case"unique-value":return di(r,i);case"raster-colormap":return hi(r,i);case"vector-field":return ui(r,i);case"raster-shaded-relief":return pi(r,i);case"flow":throw new Error("Unsupported rendering rule.")}}function et(r){const i=r==null?void 0:r.Raster;return i&&i.declaredClass==="esri.layers.support.RasterFunction"?et(i.functionArguments):r}const he={none:0,standardDeviation:3,histogramEqualization:4,minMax:5,percentClip:6,sigmoid:9};function ui(r,i){const o=new x;o.functionName="VectorFieldRenderer";const{dataType:e,bandProperties:t}=i,s=e==="vector-uv";let n,l;t&&t.length===2&&(n=t.map(h=>h.BandName.toLowerCase()).indexOf("magnitude"),l=t.map(h=>h.BandName.toLowerCase()).indexOf("direction")),n!==-1&&n!==null||(n=0,l=1);const p=r.rotationType==="arithmetic"?1:2,m=r.flowRepresentation==="flow-from"?0:1,c=r.visualVariables?r.visualVariables.find(h=>h.field==="Magnitude"):new nt,d={magnitudeBandID:n,directionBandID:l,isUVComponents:s,referenceSystem:p,massFlowAngleRepresentation:m,symbolTileSize:50,symbolTileSizeUnits:100,calculationMethod:"Vector Average",symbologyName:ai[r.style.toLowerCase().replace("-","_")],minimumMagnitude:c.minDataValue,maximumMagnitude:c.maxDataValue,minimumSymbolSize:c.minSize,maximumSymbolSize:c.maxSize};return o.functionArguments=d,i.convertToRFT?new x({rasterFunctionDefinition:W(o)}):o}function pi(r,i){const o=i.convertToRFT;if(i.dataType!=="elevation"&&(i.dataType!=="generic"||i.bandCount!==1||i.pixelType!=="s16"&&i.pixelType!=="s32"&&i.pixelType!=="f32"&&i.pixelType!=="f64"))return new x;const e=new x;e.functionName="Hillshade";const t=r.hillshadeType==="traditional"?0:1,s=r.scalingType==="none"?1:3,n={HillshadeType:t,SlopeType:s,ZFactor:r.zFactor};return t===0&&(n.Azimuth=r.azimuth,n.Altitude=r.altitude),s===3&&(n.PSPower=r.pixelSizePower,n.PSZFactor=r.pixelSizeFactor),e.functionArguments=n,e.variableName="Raster",r.colorRamp&&(e.functionName="ShadedRelief",o?n.ColorRamp=We(r.colorRamp):n.Colormap=Ke(r.colorRamp,256)),o?new x({rasterFunctionDefinition:W(e)}):e}function ci(r,i){var l;const o=i.convertToRFT,e=new x;e.functionName="Stretch";const t=he[Bt.toJSON(r.stretchType)],s="u8",n={StretchType:t,Statistics:yi(r.statistics),DRA:r.dynamicRangeAdjustment,UseGamma:r.useGamma,Gamma:r.gamma,ComputeGamma:r.computeGamma};if(r.outputMin!=null&&(n.Min=r.outputMin),r.outputMax!=null&&(n.Max=r.outputMax),t===he.standardDeviation?(n.NumberOfStandardDeviations=r.numberOfStandardDeviations,e.outputPixelType=s):t===he.percentClip?(n.MinPercent=r.minPercent,n.MaxPercent=r.maxPercent,e.outputPixelType=s):t===he.minMax?e.outputPixelType=s:t===he.sigmoid&&(n.SigmoidStrengthLevel=r.sigmoidStrengthLevel),e.functionArguments=n,e.variableName="Raster",r.colorRamp){const p=r.colorRamp,m=new x;if(o)m.functionArguments={ColorRamp:We(p)};else{const c=Wt(p);if(c)m.functionArguments={colorRamp:c};else if(!i.convertColorRampToColormap||p.type!=="algorithmic"&&p.type!=="multipart"){const d=r.colorRamp.toJSON();d.type==="algorithmic"?d.algorithm=d.algorithm||"esriCIELabAlgorithm":d.type==="multipart"&&((l=d.colorRamps)==null?void 0:l.length)&&d.colorRamps.forEach(h=>h.algorithm=h.algorithm||"esriCIELabAlgorithm"),m.functionArguments={colorRamp:d}}else m.functionArguments={Colormap:Ke(p,256)}}return m.variableName="Raster",m.functionName="Colormap",m.functionArguments.Raster=e,o?new x({rasterFunctionDefinition:W(m)}):m}return o?new x({rasterFunctionDefinition:W(e)}):e}function mi(r,i){const o=[],e=[],t=[],s=[],{pixelType:l,rasterAttributeTable:p}=i,m=z(p)?null:p.features,c=tt(p);if(m&&Array.isArray(m)&&r.classBreakInfos){r.classBreakInfos.forEach((g,F)=>{const T=g.symbol.color;let P;T.a&&m.forEach(f=>{P=f.attributes[r.field],(P>=g.minValue&&P<g.maxValue||F===r.classBreakInfos.length-1&&P>=g.minValue)&&s.push([f.attributes[c],T.r,T.g,T.b])})});const b=l?ve(s,l):s,y=new x;return y.functionName="Colormap",y.functionArguments={},y.functionArguments.Colormap=b,y.variableName="Raster",i.convertToRFT?new x({rasterFunctionDefinition:W(y)}):y}r.classBreakInfos.forEach((b,y)=>{const g=b.symbol&&b.symbol.color;g.a?(y===0?o.push(b.minValue,b.maxValue+1e-6):o.push(b.minValue+1e-6,b.maxValue+1e-6),e.push(y),s.push([y,g.r,g.g,g.b])):t.push(b.minValue,b.maxValue)});const d=l?ve(s,l):s,h=new x;h.functionName="Remap",h.functionArguments={InputRanges:o,OutputValues:e,NoDataRanges:t},h.variableName="Raster";const R=new x;return R.functionName="Colormap",R.functionArguments={Colormap:d,Raster:h},i.convertToRFT?new x({rasterFunctionDefinition:W(R)}):R}function ve(r,i){const o=ni[String(i).toLowerCase()];return o&&r.push([Math.floor(o[0]-1),0,0,0],[Math.ceil(o[1]+1),0,0,0]),r}function tt(r){if(z(r))return;const{fields:i}=r,o=i&&i.find(e=>e&&e.name&&e.name.toLowerCase()==="value");return o&&o.name}function di(r,i){var d,h;const o=[],{pixelType:e,rasterAttributeTable:t}=i,s=z(t)?null:t.features,n=tt(t),l=(h=(d=r.defaultSymbol)==null?void 0:d.color)==null?void 0:h.toRgb(),p=r.uniqueValueInfos;if(p)if(s){const R=new Map;p.forEach(y=>{const g=y.value,F=y.symbol.color;g!=null&&F&&F.a&&R.set(String(g),F.toRgb())});const b=r.field;s.forEach(({attributes:y})=>{const g=String(y[b]),F=y[n];if(R.has(g)){const T=R.get(g);o.push([F,...T])}else l&&o.push([F,...l])})}else for(let R=0;R<p.length;R++){const b=p[R],y=b.symbol.color,g=+b.value;if(y!=null&&y.a){if(isNaN(g))return null;o.push([g,y.r,y.g,y.b])}}const m=e&&o.length>0?ve(o,e):o,c=new x;return c.functionName="Colormap",c.functionArguments={},c.functionArguments.Colormap=m,c.variableName="Raster",i.convertToRFT?new x({rasterFunctionDefinition:W(c)}):c}function hi(r,i){const o=r.extractColormap();if(!o||o.length===0)return;const{pixelType:e}=i,t=e?ve(o,e):o,s=new x;return s.functionName="Colormap",s.functionArguments={},s.functionArguments.Colormap=t,i.convertToRFT?new x({rasterFunctionDefinition:W(s)}):s}function yi(r){const i=[];return r.forEach(o=>{const e=o;if(Array.isArray(e))i.push(e);else{if(e.min==null||e.max==null)return;const t=[e.min,e.max,e.avg||0,e.stddev||0];i.push(t)}}),i}function gi(r){const i=[],o=[];return r.forEach(e=>{i.push(e[0]),o.push(Kt([...e.slice(1),255]))}),{type:"RasterColormap",values:i,colors:o}}var Te;const ge=Ve()({MT_FIRST:"first",MT_LAST:"last",MT_MIN:"min",MT_MAX:"max",MT_MEAN:"mean",MT_BLEND:"blend",MT_SUM:"sum"}),De=Ve()({esriMosaicNone:"none",esriMosaicCenter:"center",esriMosaicNadir:"nadir",esriMosaicViewpoint:"viewpoint",esriMosaicAttribute:"attribute",esriMosaicLockRaster:"lock-raster",esriMosaicNorthwest:"northwest",esriMosaicSeamline:"seamline"});function fi(r){let i;switch(r?r.toLowerCase().replace("esrimosaic",""):""){case"byattribute":case"attribute":i="esriMosaicAttribute";break;case"lockraster":i="esriMosaicLockRaster";break;case"center":i="esriMosaicCenter";break;case"northwest":i="esriMosaicNorthwest";break;case"nadir":i="esriMosaicNadir";break;case"viewpoint":i="esriMosaicViewpoint";break;case"seamline":i="esriMosaicSeamline";break;default:i="esriMosaicNone"}return De.fromJSON(i)}let j=Te=class extends k{constructor(r){super(r),this.ascending=!0,this.itemRenderingRule=null,this.lockRasterIds=null,this.method=null,this.multidimensionalDefinition=null,this.objectIds=null,this.operation=null,this.sortField=null,this.sortValue=null,this.viewpoint=null,this.where=null}readAscending(r,i){return i.ascending!=null?i.ascending:i.sortAscending==null||i.sortAscending}readMethod(r,i){return fi(i.mosaicMethod||i.defaultMosaicMethod)}readOperation(r,i){const o=i.mosaicOperation,e=i.mosaicOperator&&i.mosaicOperator.toLowerCase(),t=o||(e?ge.toJSON(e):null);return ge.fromJSON(t)||"first"}castSortValue(r){return r==null||typeof r=="string"||typeof r=="number"?r:`${r}`}clone(){return new Te({ascending:this.ascending,itemRenderingRule:J(this.itemRenderingRule),lockRasterIds:J(this.lockRasterIds),method:this.method,multidimensionalDefinition:J(this.multidimensionalDefinition),objectIds:J(this.objectIds),operation:this.operation,sortField:this.sortField,sortValue:this.sortValue,viewpoint:J(this.viewpoint),where:this.where})}};a([u({type:Boolean,json:{write:!0}})],j.prototype,"ascending",void 0),a([M("ascending",["ascending","sortAscending"])],j.prototype,"readAscending",null),a([u({type:x,json:{write:!0}})],j.prototype,"itemRenderingRule",void 0),a([u({type:[pe],json:{write:{overridePolicy(){return{enabled:this.method==="lock-raster"}}}}})],j.prototype,"lockRasterIds",void 0),a([u({type:String,json:{type:De.jsonValues,write:{target:"mosaicMethod",writer:De.write}}})],j.prototype,"method",void 0),a([M("method",["mosaicMethod","defaultMosaicMethod"])],j.prototype,"readMethod",null),a([u({type:[Fe],json:{write:!0}})],j.prototype,"multidimensionalDefinition",void 0),a([u({type:[pe],json:{name:"fids",write:!0}})],j.prototype,"objectIds",void 0),a([u({json:{type:ge.jsonValues,read:{reader:ge.read},write:{target:"mosaicOperation",writer:ge.write}}})],j.prototype,"operation",void 0),a([M("operation",["mosaicOperation","mosaicOperator"])],j.prototype,"readOperation",null),a([u({type:String,json:{write:{overridePolicy(){return{enabled:this.method==="attribute"}}}}})],j.prototype,"sortField",void 0),a([u({type:[String,Number],json:{write:{allowNull:!0,overridePolicy(){return{enabled:this.method==="attribute",allowNull:!0}}}}})],j.prototype,"sortValue",void 0),a([at("sortValue")],j.prototype,"castSortValue",null),a([u({type:X,json:{write:!0}})],j.prototype,"viewpoint",void 0),a([u({type:String,json:{write:!0}})],j.prototype,"where",void 0),j=Te=a([E("esri.layers.support.MosaicRule")],j);const H=j;let C=class extends k{constructor(){super(...arguments),this.layer=null,this.adjustAspectRatio=void 0,this.compression=void 0,this.pixelType=void 0,this.lercVersion=2}writeAdjustAspectRatio(r,i,o){this.layer.version<10.3||(i[o]=r)}get bandIds(){return this.layer.bandIds}set bandIds(r){this.layer&&(this.layer.bandIds=r)}get compressionQuality(){var r;return(r=this.layer)==null?void 0:r.compressionQuality}set compressionQuality(r){this.layer&&(this.layer.compressionQuality=r)}writeCompressionQuality(r,i,o){this.format&&this.format.toLowerCase().includes("jpg")&&r!=null&&(i[o]=r)}get compressionTolerance(){var r;return(r=this.layer)==null?void 0:r.compressionTolerance}set compressionTolerance(r){this.layer&&(this.layer.compressionTolerance=r)}writeCompressionTolerance(r,i,o){this.format==="lerc"&&r!=null&&(i[o]=r)}get format(){var r;return((r=this.layer.renderer)==null?void 0:r.type)==="vector-field"?"lerc":this.layer.format}get interpolation(){var r;return(r=this.layer)==null?void 0:r.interpolation}set interpolation(r){this.layer&&(this.layer.interpolation=r)}get noData(){var r;return(r=this.layer)==null?void 0:r.noData}set noData(r){this.layer&&(this.layer.noData=r)}get noDataInterpretation(){var r;return(r=this.layer)==null?void 0:r.noDataInterpretation}set noDataInterpretation(r){this.layer&&(this.layer.noDataInterpretation=r)}writeLercVersion(r,i,o){this.format==="lerc"&&this.layer.version>=10.5&&(i[o]=r)}get version(){const r=this.layer;return r.commitProperty("bandIds"),r.commitProperty("format"),r.commitProperty("compressionQuality"),r.commitProperty("compressionTolerance"),r.commitProperty("interpolation"),r.commitProperty("noData"),r.commitProperty("noDataInterpretation"),r.commitProperty("mosaicRule"),r.commitProperty("renderingRule"),r.commitProperty("adjustAspectRatio"),r.commitProperty("pixelFilter"),r.commitProperty("definitionExpression"),r.commitProperty("multidimensionalSubset"),(this._get("version")||0)+1}set version(r){this._set("version",r)}get mosaicRule(){const r=this.layer;let i=r.mosaicRule;const o=r.definitionExpression;return i?o&&o!==i.where&&(i=i.clone(),i.where=o):o&&(i=new H({where:o})),i}get renderingRule(){var s,n;const r=this.layer;let i=r.renderingRule;const o=r.pixelFilter,e=!r.format||r.format.includes("jpg")||r.format.includes("png");i=this._addResampleRasterFunction(i);const t=(s=r.multidimensionalSubset)==null?void 0:s.areaOfInterest;return t&&(i=this._addClipFunction(i,t)),e&&!o&&((n=r.renderer)==null?void 0:n.type)!=="vector-field"&&(i=this.combineRendererWithRenderingRule(i)),i}combineRendererWithRenderingRule(r){var t;const i=this.layer,{rasterInfo:o,renderer:e}=i;return r=r||i.renderingRule,!e||!Xe(e)?r:xe(li(e,{rasterAttributeTable:o.attributeTable,pixelType:o.pixelType,dataType:o.dataType,bandProperties:(t=o.keyProperties)==null?void 0:t.BandProperties,convertColorRampToColormap:i.version<10.6,convertToRFT:!!(r!=null&&r.rasterFunctionDefinition),bandCount:o.bandCount}),r)}_addResampleRasterFunction(r){var t;if(((t=this.layer.renderer)==null?void 0:t.type)!=="vector-field"||(r==null?void 0:r.functionName)==="Resample")return r;const i=this.layer.serviceDataType==="esriImageServiceDataTypeVector-UV"?7:10,o=this.layer.serviceRasterInfo.pixelSize;let e=new x({functionName:"Resample",functionArguments:{ResamplingType:i,InputCellSize:o}});return e=r!=null&&r.rasterFunctionDefinition?new x({rasterFunctionDefinition:W(e)}):e,xe(e,r)}_addClipFunction(r,i){const o=new x({functionName:"Clip",functionArguments:{ClippingGeometry:i.toJSON(),ClippingType:1}});return xe(o,r)}};a([u()],C.prototype,"layer",void 0),a([u({json:{write:!0}})],C.prototype,"adjustAspectRatio",void 0),a([V("adjustAspectRatio")],C.prototype,"writeAdjustAspectRatio",null),a([u({json:{write:!0}})],C.prototype,"bandIds",null),a([u({json:{write:!0}})],C.prototype,"compression",void 0),a([u({json:{write:!0}})],C.prototype,"compressionQuality",null),a([V("compressionQuality")],C.prototype,"writeCompressionQuality",null),a([u({json:{write:!0}})],C.prototype,"compressionTolerance",null),a([V("compressionTolerance")],C.prototype,"writeCompressionTolerance",null),a([u({json:{write:!0}})],C.prototype,"format",null),a([u({type:String,json:{read:{reader:Y.read},write:{writer:Y.write}}})],C.prototype,"interpolation",null),a([u({json:{write:!0}})],C.prototype,"noData",null),a([u({type:String,json:{read:{reader:ye.read},write:{writer:ye.write}}})],C.prototype,"noDataInterpretation",null),a([u({json:{write:!0}})],C.prototype,"pixelType",void 0),a([u({json:{write:!0}})],C.prototype,"lercVersion",void 0),a([V("lercVersion")],C.prototype,"writeLercVersion",null),a([u({type:Number})],C.prototype,"version",null),a([u({json:{write:!0}})],C.prototype,"mosaicRule",null),a([u({json:{write:!0}})],C.prototype,"renderingRule",null),C=a([E("esri.layers.mixins.ExportImageServiceParameters")],C);let le=class extends k{constructor(){super(...arguments),this.north=null,this.up=null,this.spatialReference=null}};a([u({type:Number,json:{write:!0}})],le.prototype,"north",void 0),a([u({type:Number,json:{write:!0}})],le.prototype,"up",void 0),a([u({type:oe,json:{write:!0}})],le.prototype,"spatialReference",void 0),le=a([E("esri.rest.support.ImageAngleResult")],le);const Ri=le;let Q=class extends k{constructor(){super(...arguments),this.catalogItemVisibilities=null,this.catalogItems=null,this.location=null,this.name=null,this.objectId=null,this.processedValues=null,this.properties=null,this.value=null}};a([u({json:{write:!0}})],Q.prototype,"catalogItemVisibilities",void 0),a([u({type:Ue,json:{write:!0}})],Q.prototype,"catalogItems",void 0),a([u({type:X,json:{write:!0}})],Q.prototype,"location",void 0),a([u({json:{write:!0}})],Q.prototype,"name",void 0),a([u({json:{write:!0}})],Q.prototype,"objectId",void 0),a([u({json:{write:!0}})],Q.prototype,"processedValues",void 0),a([u({json:{write:!0}})],Q.prototype,"properties",void 0),a([u({json:{write:!0}})],Q.prototype,"value",void 0),Q=a([E("esri.rest.support.ImageIdentifyResult")],Q);const bi=Q;let Re=class extends k{constructor(){super(...arguments),this.geometries=null}};a([u({json:{write:!0}})],Re.prototype,"geometries",void 0),Re=a([E("esri.rest.support.ImagePixelLocationResult")],Re);const vi=Re;let Z=class extends k{constructor(){super(...arguments),this.attributes=null,this.location=null,this.locationId=null,this.rasterId=null,this.resolution=null,this.pixelValue=null}};a([u({json:{write:!0}})],Z.prototype,"attributes",void 0),a([u({type:X,json:{write:!0}})],Z.prototype,"location",void 0),a([u({json:{write:!0}})],Z.prototype,"locationId",void 0),a([u({json:{write:!0}})],Z.prototype,"rasterId",void 0),a([u({json:{write:!0}})],Z.prototype,"resolution",void 0),a([u({json:{write:!0}})],Z.prototype,"pixelValue",void 0),Z=a([E("esri.rest.support.ImageSample")],Z);const wi=Z;let be=class extends k{constructor(){super(...arguments),this.samples=null}};a([u({type:[wi],json:{write:!0}})],be.prototype,"samples",void 0),be=a([E("esri.rest.support.ImageSampleResult")],be);const Si=be;function it(r){const i=r==null?void 0:r.time;if(i&&(i.start!=null||i.end!=null)){const o=[];i.start!=null&&o.push(i.start),i.end==null||o.includes(i.end)||o.push(i.end),r.time=o.join(",")}}async function rt(r,i,o){const e=ee(r),t=i.geometry?[i.geometry]:[],s=await je(t),n=i.toJSON();it(n);const l=s&&s[0];I(l)&&(n.geometry=l.toJSON());const p=ce({...e.query,f:"json",...n});return me(p,o)}async function xi(r,i,o){var p;const e=i.toJSON();I(e.angleName)&&(e.angleName=e.angleName.join(",")),I(i.point)&&((p=i.point.spatialReference)==null?void 0:p.imageCoordinateSystem)&&(e.point.spatialReference=$e(i.point.spatialReference)),I(i.spatialReference)&&i.spatialReference.imageCoordinateSystem&&(e.spatialReference=st(i.spatialReference));const t=ee(r),s=ce({...t.query,f:"json",...e}),n=me(s,o),{data:l}=await O(`${t.path}/computeAngles`,n);return l.spatialReference=l.spatialReference?l.spatialReference.geodataXform!=null?new oe({wkid:0,imageCoordinateSystem:l.spatialReference}):oe.fromJSON(l.spatialReference):null,l.north==="NaN"&&(l.north=null),l.up==="NaN"&&(l.up=null),new Ri(l)}async function Ii(r,i,o){var m;const e=i.toJSON(),{geometries:t}=i;if(t)for(let c=0;c<t.length;c++)(m=t[c].spatialReference)!=null&&m.imageCoordinateSystem&&(e.geometries.geometries[c].spatialReference=$e(t[c].spatialReference));const s=ee(r),n=ce({...s.query,f:"json",...e}),l=me(n,o),{data:p}=await O(`${s.path}/computePixelLocation`,l);return vi.fromJSON(p)}async function Fi(r,i,o){const e=await rt(r,i,o),t=ee(r),{data:s}=await O(`${t.path}/computeStatisticsHistograms`,e),{statistics:n}=s;return n!=null&&n.length&&n.forEach(l=>{l.avg=l.mean,l.stddev=l.standardDeviation}),{statistics:n,histograms:s.histograms}}async function Ti(r,i,o){const e=await rt(r,i,o),t=ee(r),{data:s}=await O(`${t.path}/computeHistograms`,e);return{histograms:s.histograms}}async function Di(r,i,o){var c,d,h;const e=i.toJSON();it(e),(c=e.outFields)!=null&&c.length&&(e.outFields=e.outFields.join(","));const t=(d=await je(i.geometry))==null?void 0:d[0];I(t)&&(e.geometry=t.toJSON());const s=ee(r),n=ce({...s.query,f:"json",...e}),l=me(n,o),{data:p}=await O(`${s.path}/getSamples`,l),m=(h=p==null?void 0:p.samples)==null?void 0:h.map(R=>{const b=R.value==="NaN"||R.value===""?null:R.value.split(" ").map(y=>Number(y));return{...R,pixelValue:b}});return Si.fromJSON({samples:m})}async function He(r,i,o){const e=ee(r),t=i.geometry?[i.geometry]:[];return je(t).then(s=>{const n=i.toJSON(),l=s&&s[0];I(l)&&(n.geometry=JSON.stringify(l.toJSON()));const p=ce({...e.query,f:"json",...n}),m=me(p,o);return O(e.path+"/identify",m)}).then(s=>bi.fromJSON(s.data))}function $e(r){const{imageCoordinateSystem:i}=r;if(i){const{id:o,referenceServiceName:e}=i;return o!=null?e?{icsid:o,icsns:e}:{icsid:o}:{ics:i}}return r.toJSON()}function st(r,i){const o=$e(r),{icsid:e,icsns:t,wkid:s}=o;return e!=null?t==null||(i==null?void 0:i.toLowerCase().includes("/"+t.toLowerCase()+"/"))?`0:${e}`:JSON.stringify(o):s?s.toString():JSON.stringify(o)}async function Ni(r,i,o){var f,w;const e=ee(r),t=ce({...e==null?void 0:e.query,f:"json"}),s=me(t,o),n=`${e==null?void 0:e.path}/${i}/info`,l=O(`${n}`,s),p=O(`${n}/keyProperties`,s),m=await Promise.allSettled([l,p]),c=m[0].status==="fulfilled"?m[0].value.data:null,d=m[1].status==="fulfilled"?m[1].value.data:null;let h=null;(f=c.statistics)!=null&&f.length&&(h=c.statistics.map(v=>({min:v[0],max:v[1],avg:v[2],stddev:v[3]})));const R=fe.fromJSON(c.extent),b=Math.ceil(R.width/c.pixelSizeX-.1),y=Math.ceil(R.height/c.pixelSizeY-.1),g=R.spatialReference,F=new X({x:c.pixelSizeX,y:c.pixelSizeY,spatialReference:g}),T=(w=c.histograms)!=null&&w.length?c.histograms:null,P=new Zt({origin:c.origin,blockWidth:c.blockWidth,blockHeight:c.blockHeight,firstPyramidLevel:c.firstPyramidLevel,maximumPyramidLevel:c.maxPyramidLevel});return new Ze({width:b,height:y,bandCount:c.bandCount,extent:R,spatialReference:g,pixelSize:F,pixelType:c.pixelType.toLowerCase(),statistics:h,histograms:T,keyProperties:d,storageInfo:P})}var Ne;let ae=Ne=class extends k{constructor(){super(...arguments),this.angleNames=null,this.point=null,this.spatialReference=null,this.rasterId=null}clone(){return new Ne(J({angleNames:this.angleNames,point:this.point,spatialReference:this.spatialReference,rasterId:this.rasterId}))}};a([u({type:[String],json:{name:"angleName",write:!0}})],ae.prototype,"angleNames",void 0),a([u({type:X,json:{write:!0}})],ae.prototype,"point",void 0),a([u({type:oe,json:{write:!0}})],ae.prototype,"spatialReference",void 0),a([u({type:pe,json:{write:!0}})],ae.prototype,"rasterId",void 0),ae=Ne=a([E("esri.rest.support.ImageAngleParameters")],ae);const Pi=ae;var Pe;let B=Pe=class extends k{constructor(){super(...arguments),this.geometry=null,this.mosaicRule=null,this.renderingRule=null,this.pixelSize=null,this.raster=void 0,this.timeExtent=null}writeGeometry(r,i,o){r!=null&&(i.geometryType=Ae(r),i[o]=r.toJSON())}clone(){return new Pe(J({geometry:this.geometry,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,raster:this.raster,timeExtent:this.timeExtent}))}};a([u({types:Ge,json:{read:Be}})],B.prototype,"geometry",void 0),a([V("geometry")],B.prototype,"writeGeometry",null),a([u({type:H,json:{write:!0}})],B.prototype,"mosaicRule",void 0),a([u({type:x,json:{write:!0}})],B.prototype,"renderingRule",void 0),a([u({type:X,json:{write:!0}})],B.prototype,"pixelSize",void 0),a([u({json:{write:!0}})],B.prototype,"raster",void 0),a([u({type:Me,json:{read:{source:"time"},write:{target:"time"}}})],B.prototype,"timeExtent",void 0),B=Pe=a([E("esri.rest.support.ImageHistogramParameters")],B);const ke=B;var Ce;let _=Ce=class extends k{constructor(){super(...arguments),this.geometry=null,this.renderingRules=null,this.pixelSize=null,this.returnGeometry=!0,this.returnCatalogItems=!0,this.returnPixelValues=!0,this.maxItemCount=null,this.timeExtent=null,this.raster=void 0,this.viewId=void 0,this.processAsMultidimensional=!1}writeGeometry(r,i,o){r!=null&&(i.geometryType=Ae(r),i[o]=JSON.stringify(r.toJSON()))}set mosaicRule(r){let i=r;i&&i.mosaicMethod&&(i=H.fromJSON({...i.toJSON(),mosaicMethod:i.mosaicMethod,mosaicOperation:i.mosaicOperation})),this._set("mosaicRule",i)}writeMosaicRule(r,i,o){r!=null&&(i[o]=JSON.stringify(r.toJSON()))}set renderingRule(r){let i=r;i&&i.rasterFunction&&(i=x.fromJSON({...i.toJSON(),rasterFunction:i.rasterFunction,rasterFunctionArguments:i.rasterFunctionArguments})),this._set("renderingRule",i)}writeRenderingRule(r,i,o){r!=null&&(i[o]=JSON.stringify(r.toJSON())),r.rasterFunctionDefinition&&(i[o]=JSON.stringify(r.rasterFunctionDefinition))}writeRenderingRules(r,i,o){r!=null&&(i[o]=JSON.stringify(r.map(e=>e.rasterFunctionDefinition||e.toJSON())))}writePixelSize(r,i,o){r!=null&&(i[o]=JSON.stringify(r))}writeTimeExtent(r,i,o){if(r!=null){const e=I(r.start)?r.start.getTime():null,t=I(r.end)?r.end.getTime():null;i[o]=e!=null?t!=null?`${e},${t}`:`${e}`:null}}clone(){return new Ce(J({geometry:this.geometry,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,returnGeometry:this.returnGeometry,returnCatalogItems:this.returnCatalogItems,returnPixelValues:this.returnPixelValues,maxItemCount:this.maxItemCount,processAsMultidimensional:this.processAsMultidimensional,raster:this.raster,viewId:this.viewId,timeExtent:this.timeExtent}))}};a([u({json:{write:!0}})],_.prototype,"geometry",void 0),a([V("geometry")],_.prototype,"writeGeometry",null),a([u({type:H,json:{write:!0}})],_.prototype,"mosaicRule",null),a([V("mosaicRule")],_.prototype,"writeMosaicRule",null),a([u({type:x,json:{write:!0}})],_.prototype,"renderingRule",null),a([V("renderingRule")],_.prototype,"writeRenderingRule",null),a([u({type:[x],json:{write:!0}})],_.prototype,"renderingRules",void 0),a([V("renderingRules")],_.prototype,"writeRenderingRules",null),a([u({type:X,json:{write:!0}})],_.prototype,"pixelSize",void 0),a([V("pixelSize")],_.prototype,"writePixelSize",null),a([u({type:Boolean,json:{write:!0}})],_.prototype,"returnGeometry",void 0),a([u({type:Boolean,json:{write:!0}})],_.prototype,"returnCatalogItems",void 0),a([u({type:Boolean,json:{write:!0}})],_.prototype,"returnPixelValues",void 0),a([u({type:Number,json:{write:!0}})],_.prototype,"maxItemCount",void 0),a([u({type:Me,json:{write:{target:"time"}}})],_.prototype,"timeExtent",void 0),a([V("timeExtent")],_.prototype,"writeTimeExtent",null),a([u({json:{write:!0}})],_.prototype,"raster",void 0),a([u({json:{write:!0}})],_.prototype,"viewId",void 0),a([u({type:Boolean,json:{write:!0}})],_.prototype,"processAsMultidimensional",void 0),_=Ce=a([E("esri.rest.support.ImageIdentifyParameters")],_);const Qe=_;var _e;let ue=_e=class extends k{constructor(){super(...arguments),this.geometries=null,this.rasterId=null}writeGeometry(r,i,o){i.geometries={geometryType:"esriGeometryPoint",geometries:r.map(e=>e.toJSON())}}clone(){var r,i;return new _e({geometries:(i=(r=this.geometries)==null?void 0:r.map(o=>o.clone()))!=null?i:[],rasterId:this.rasterId})}};a([u({type:[X],json:{write:!0}})],ue.prototype,"geometries",void 0),a([V("geometries")],ue.prototype,"writeGeometry",null),a([u({type:pe,json:{write:!0}})],ue.prototype,"rasterId",void 0),ue=_e=a([E("esri.rest.support.ImagePixelLocationParameters")],ue);const Ci=ue;var Oe;let $=Oe=class extends k{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(r,i,o){r!=null&&(i.geometryType=Ae(r),i[o]=r.toJSON())}set locations(r){if(r!=null&&r.length){const i=new ot({spatialReference:r[0].spatialReference});i.points=r.map(o=>[o.x,o.y]),this._set("locations",r),this.geometry=i}}clone(){return new Oe(J({geometry:this.geometry,locations:this.locations,interpolation:this.interpolation,mosaicRule:this.mosaicRule,outFields:this.outFields,raster:this.raster,returnFirstValueOnly:this.returnFirstValueOnly,sampleDistance:this.sampleDistance,sampleCount:this.sampleCount,sliceId:this.sliceId,pixelSize:this.pixelSize,timeExtent:this.timeExtent}))}};a([u({types:Ge,json:{read:Be}})],$.prototype,"geometry",void 0),a([V("geometry")],$.prototype,"writeGeometry",null),a([u()],$.prototype,"locations",null),a([u({type:String,json:{type:Y.jsonValues,read:Y.read,write:Y.write}})],$.prototype,"interpolation",void 0),a([u({type:H,json:{write:!0}})],$.prototype,"mosaicRule",void 0),a([u({type:[String],json:{write:!0}})],$.prototype,"outFields",void 0),a([u({type:X,json:{write:!0}})],$.prototype,"pixelSize",void 0),a([u({type:String,json:{write:!0}})],$.prototype,"raster",void 0),a([u({type:Boolean,json:{write:!0}})],$.prototype,"returnFirstValueOnly",void 0),a([u({type:Number,json:{write:!0}})],$.prototype,"sampleDistance",void 0),a([u({type:Number,json:{write:!0}})],$.prototype,"sampleCount",void 0),a([u({type:Number,json:{write:!0}})],$.prototype,"sliceId",void 0),a([u({type:Me,json:{read:{source:"time"},write:{target:"time"}}})],$.prototype,"timeExtent",void 0),$=Oe=a([E("esri.rest.support.ImageSampleParameters")],$);const _i=$,Ie=Ve()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Oi=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Vi=ft(Rt,{min:0,max:255});function ji(r){var o;if(!r)return null;const i=(o=JSON.stringify(r).match(/"rasterFunction":"(.*?")/gi))==null?void 0:o.map(e=>e.replace('"rasterFunction":"',"").replace('"',""));return i?i.join("/"):null}const Mi=r=>{let i=class extends r{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new C({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||I(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||I(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach(t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)}),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every(s=>typeof s=="number"))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,s){e!=null&&this.format!=="lerc"&&(t[s]=e)}writeCompressionTolerance(e,t,s){this.format==="lerc"&&e!=null&&(t[s]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?H.fromJSON(t):null}get fieldsIndex(){return this.fields?new pt(this.fields):null}set format(e){e&&Oi.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return t.serviceDataType==="esriImageServiceDataTypeVector-UV"||t.serviceDataType==="esriImageServiceDataTypeVector-MagDir"||this.pixelFilter!=null?"lerc":"jpgpng"}readMinScale(e,t){return t.minLOD!=null&&t.maxLOD!=null?e:0}readMaxScale(e,t){return t.minLOD!=null&&t.maxLOD!=null?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=H.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const s=e||t.mosaicRule;return s?H.fromJSON(s):this._isMosaicRuleSupported(t)?H.fromJSON(t):null}writeMosaicRule(e,t,s){let n=this.mosaicRule;const l=this.definitionExpression;n?l&&l!==n.where&&(n=n.clone(),n.where=l):l&&(n=new H({where:l})),this._isValidCustomizedMosaicRule(n)&&(t[s]=n.toJSON())}get multidimensionalInfo(){return I(this.serviceRasterInfo)?this.serviceRasterInfo.multidimensionalInfo:null}writeNoData(e,t,s){e!=null&&typeof e=="number"&&(t[s]=Vi(e))}readObjectIdField(e,t){if(!e){const s=t.fields.filter(n=>n.type==="esriFieldTypeOID"||n.type==="oid");e=s&&s[0]&&s[0].name}return e}get parsedUrl(){return ct(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,s){var p,m;const n=(m=(p=t==null?void 0:t.layerDefinition)==null?void 0:p.drawingInfo)==null?void 0:m.renderer,l=Jt(n,s);return l==null?null:(l.type==="vector-field"&&t.symbolTileSize&&!n.symbolTileSize&&(l.symbolTileSize=t.symbolTileSize),Xe(l)||Le.getLogger(this.declaredClass).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),l)}writeRenderer(e,t,s){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),e.type==="vector-field"&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){var m,c;const e=this._rasterAttributeTableFieldPrefix||"Raster.",t=new se({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),s=new se({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),n=new se({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let l=this.fields?J(this.fields):[];l.push(s),((m=this.capabilities)==null?void 0:m.operations.supportsQuery)&&this.fields&&this.fields.length>0&&l.push(t),this.version>=10.4&&I(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some(d=>d.name.toLowerCase()==="none")&&l.push(n),I(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter(d=>d.name.toLowerCase()!=="none").forEach(d=>{l.push(new se({name:"Raster.ServicePixelValue."+d.name,alias:d.name,domain:null,editable:!1,length:50,type:"string"}))}),this._isVectorDataSet()&&(l.push(new se({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),l.push(new se({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:p}=(c=this.rasterInfo)!=null?c:{};if(I(p)){const d=p.fields.filter(h=>h.type!=="esriFieldTypeOID"&&h.name.toLowerCase()!=="value").map(h=>{const R=J(h);return R.name=e+h.name,R});l=l.concat(d)}return l}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=x.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const s=t.rasterFunctionInfos;return t.renderingRule||s&&s.length&&s[0].name!=="None"?this._isRFTJson(t.renderingRule)?x.fromJSON({rasterFunctionDefinition:t.renderingRule}):x.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,s){const n=e.toJSON();n.rasterFunctionDefinition?t[s]=n.rasterFunctionDefinition:t[s]=n}readSpatialReference(e,t){const s=e||t.extent.spatialReference;return s?oe.fromJSON(s):null}readPixelType(e){return Ie.fromJSON(e)||e}writePixelType(e,t,s){(z(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[s]=Ie.toJSON(e))}readVersion(e,t){let s=t.currentVersion;return s||(s=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),s}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let s=e;const{renderer:n,symbolizer:l,pixelFilter:p,bandIds:m}=this;if(!this._isPicture()&&n&&l&&!p){const c=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(n.toJSON()),d=this._rasterJobHandler.instance;if(d){c&&(l.bind(),await d.updateSymbolizer(l,t),this._cachedRendererJson=n.toJSON());const h=await d.symbolize({bandIds:m,...e},t);s={extent:e.extent,pixelBlock:h}}else s={extent:e.extent,pixelBlock:l.symbolize({bandIds:m,...e})}}return s}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputeAngles)throw new L("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=ne(Pi,e).clone(),xi(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputePixelLocation)throw new L("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=ne(Ci,e).clone(),Ii(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputeHistograms)throw new L("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=ne(ke,e).clone();const{raster:s,mosaicRule:n,renderingRule:l}=this;return l&&e.renderingRule==null&&(e.renderingRule=l),n&&e.mosaicRule==null&&(e.mosaicRule=n),s&&e.raster==null&&(e.raster=s),Ti(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputeStatisticsHistograms)throw new L("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=ne(ke,e).clone();const{raster:s,mosaicRule:n,renderingRule:l}=this;return l&&e.renderingRule==null&&(e.renderingRule=l),n&&e.mosaicRule==null&&(e.mosaicRule=n),s&&e.raster==null&&(e.raster=s),Fi(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return I(t)?t.get(e):void 0}getFieldDomain(e,t){const s=this.getField(e);return s?s.domain:null}async fetchImage(e,t,s,n={}){var m,c,d,h,R;if(e==null||t==null||s==null)throw new L("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const b=await this.generateRasterInfo(this.renderingRule,{signal:n.signal});b&&(this.rasterInfo=b)}const l=this.getExportImageServiceParameters(e,t,s,n.timeExtent);if(l==null){if(n.requestAsImageElement&&this._canRequestImageElement(this.format)){const T=document.createElement("canvas");return T.width=t,T.height=s,{imageOrCanvasElement:T}}const b=(d=((m=this.bandIds)==null?void 0:m.length)||((c=this.rasterInfo)==null?void 0:c.bandCount))!=null?d:0,y=t*s,g=(R=(h=this.rasterInfo)==null?void 0:h.pixelType)!=null?R:"unknown",F=[];for(let T=0;T<b;T++)F.push(Se.createEmptyBand(g,y));return{pixelData:{pixelBlock:new Se({width:t,height:s,pixels:F,mask:new Uint8Array(y),pixelType:g}),extent:e}}}const p={imageServiceParameters:l,imageProps:{extent:e,width:t,height:s,format:this.format},requestAsImageElement:n.requestAsImageElement&&!this.pixelFilter||!1,signal:n.signal};return this._requestArrayBuffer(p)}fetchKeyProperties(e){return O(o(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e==null?void 0:e.renderingRule:null})}).then(t=>t.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new L("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):O(o(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e==null?void 0:e.renderingRule:null})}).then(t=>Ue.fromJSON(t.data))}getCatalogItemRasterInfo(e,t){const s={...t,query:this._getQueryParams()};return Ni(o(this.parsedUrl),e,s)}async getCatalogItemICSInfo(e,t){var K,Je,Ee;const{data:s}=await O(o(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),n=s&&s.ics;if(!n)return;let l=null;try{l=(await O(o(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!l||!l.spatialReference)return{ics:n,icsToPixelTransform:null,icsExtent:null,northDirection:null};const p=this.version>=10.7?O(o(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then(S=>S.data).catch(()=>({})):{},m=l.spatialReference,c={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[l]}),inSR:m.wkid||JSON.stringify(m),outSR:"0:"+e},d=O(o(this.parsedUrl)+"/project",{query:this._getQueryParams(c),...t}).then(S=>S.data).catch(()=>({})),h=5,R=(l.xmin+l.xmax)/2,b=(l.ymax-l.ymin)/(h+1),y=l.ymin+b,g=[];for(let S=0;S<h;S++)g.push({x:R,y:y+b*S});const F={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:g}),inSR:m.wkid||JSON.stringify(m),outSR:"0:"+e},T=O(o(this.parsedUrl)+"/project",{query:this._getQueryParams(F),...t}).then(S=>S.data).catch(()=>({})),P=await Promise.all([p,d,T]);let f=P[0].ipxf;if(f==null){const S=(K=n.geodataXform)==null?void 0:K.xf_0;((Je=S==null?void 0:S.name)==null?void 0:Je.toLowerCase())==="topup"&&((Ee=S==null?void 0:S.coefficients)==null?void 0:Ee.length)===6&&(f={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:S.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const w=fe.fromJSON(P[1]&&P[1].geometries&&P[1].geometries[0]);w&&(w.spatialReference=new oe({wkid:0,imageCoordinateSystem:n}));const v=P[2].geometries?P[2].geometries.filter(S=>S!=null&&S.x!=null&&S.y!=null&&S.x!=="NaN"&&S.y!=="NaN"):[],D=v.length;if(D<3)return{ics:n,icsToPixelTransform:f,icsExtent:w,northDirection:null};let N=0,A=0,U=0,de=0;for(let S=0;S<D;S++)N+=v[S].x,A+=v[S].y,U+=v[S].x*v[S].x,de+=v[S].x*v[S].y;const G=(D*de-N*A)/(D*U-N*N);let te=0;const ie=v[h-1].x>v[0].x,re=v[h-1].y>v[0].y;return G===1/0?te=re?90:270:G===0?te=ie?0:180:G>0?te=ie?180*Math.atan(G)/Math.PI:180*Math.atan(G)/Math.PI+180:G<0&&(te=re?180+180*Math.atan(G)/Math.PI:360+180*Math.atan(G)/Math.PI),{ics:n,icsToPixelTransform:f,icsExtent:w,northDirection:te}}async generateRasterInfo(e,t){var l;if(this.serviceRasterInfo&&(!e||((l=e.functionName)==null?void 0:l.toLowerCase())==="none"||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const s=ji(e);if(!s)return null;if(this._functionRasterInfos[s])return this._functionRasterInfos[s];const n=this._generateRasterInfo(e,t);this._functionRasterInfos[s]=n;try{return await n}catch{return this._functionRasterInfos[s]=null,null}}getExportImageServiceParameters(e,t,s,n){var F,T,P;e=e.clone().shiftCentralMeridian();const l=st(e.spatialReference,o(this.parsedUrl));this.pixelType!==((F=this.serviceRasterInfo)==null?void 0:F.pixelType)&&(this.exportImageServiceParameters.pixelType=this.pixelType);const p=this.exportImageServiceParameters.toJSON(),{bandIds:m,noData:c}=p;let{renderingRule:d}=p;const h=(T=this.renderingRule)==null?void 0:T.rasterFunctionDefinition,R=!this.renderer||this.renderer.type==="raster-stretch";if((m==null?void 0:m.length)&&this._hasRenderingRule(this.renderingRule)&&!h&&R){const f={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:m}};if(d.rasterFunction==="Stretch")f.rasterFunctionArguments.Raster=d.rasterFunctionArguments.Raster,d.rasterFunctionArguments.Raster=f;else if(d.rasterFunction==="Colormap"){const w=d.rasterFunctionArguments.Raster;(w==null?void 0:w.rasterFunction)==="Stretch"?(f.rasterFunctionArguments.Raster=w.rasterFunctionArguments.Raster,w.rasterFunctionArguments.Raster=f):(f.rasterFunctionArguments.Raster=w,d.rasterFunctionArguments.Raster=f)}else f.rasterFunctionArguments.Raster=d,d=f;p.bandIds=void 0}else p.bandIds=m==null?void 0:m.join(",");c instanceof Array&&c.length>0&&(p.noData=c.join(","));const b=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,n):null;p.mosaicRule=I(b)?JSON.stringify(b):null;const{multidimensionalSubset:y}=this;if(y&&I(b)&&b.multidimensionalDefinition&&ze(b.multidimensionalDefinition,y,!0))return null;p.renderingRule=this._getRenderingRuleString(x.fromJSON(d));const g={};if(n){const{start:f,end:w}=n.toJSON();let v;if(f&&w&&f===w?(g.time=""+f,v=[f]):f==null&&w==null||(g.time=`${f!=null?f:"null"},${w!=null?w:"null"}`,v=f!=null&&w!=null?[f,w]:[f!=null?f:w]),v&&y){const D=y.dimensions.find(({name:A})=>A==="StdTime");if(v.length===2&&D.extent.length){if(v[0]=Math.max(v[0],D.extent[0]),v[1]=Math.min(v[1],(P=D.extent[1])!=null?P:D.extent[0]),v[1]<v[0])return null;g.time=v.join()}const N=new Fe({variableName:"",dimensionName:"StdTime",isSlice:v.length===1,values:v});if(ze([N],y,!0))return null}}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:l,imageSR:l,size:t+","+s,...p,...g}}async getSamples(e,t){var n;if(!((n=await this._fetchCapabilities(t==null?void 0:t.signal))!=null&&n.operations.supportsGetSamples))throw new L("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=ne(_i,e).clone();const{raster:s}=this;return s&&e.raster==null&&(e.raster=s),Di(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsIdentify)throw new L("imagery-layer:query-rasters","query operation is not supported on the input image service");e=ne(Qe,e).clone();const{raster:s,mosaicRule:n,renderingRule:l}=this;if(l&&e.renderingRule==null&&(e.renderingRule=l),n&&e.mosaicRule==null){const p=this._combineMosaicRuleWithTimeExtent(n,e.timeExtent);e.mosaicRule=mt(p)}return s&&e.raster==null&&(e.raster=s),He(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new we;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),dt(this.url,e,t)}async queryObjectIds(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),ii(this.url,e,t)}async queryRasterCount(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),ri(this.url,e,t)}async queryVisibleRasters(e,t){var P,f,w,v;if(!e)throw new L("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:s,returnDomainValues:n,returnTopmostRaster:l,showNoDataRecords:p}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let m=!1,c=null,d=null;const h="raster.servicepixelvalue",R=this._rasterFunctionNamesIndex;if(I(e.outFields)&&(m=e.outFields.some(D=>!D.toLowerCase().includes(h)),this.version>=10.4)){const D=e.outFields.filter(A=>A.toLowerCase().includes(h)&&A.length>h.length).map(A=>{const U=A.slice(h.length+1);return[this._updateRenderingRulesFunctionName(U,R),U]});c=D.map(A=>new x({functionName:A[0]})),d=D.map(A=>A[1]);const{renderingRule:N}=this;c.length===0?N!=null&&N.functionName?(c.push(N),d.push(N.functionName)):c=null:(N==null?void 0:N.functionName)&&!c.some(A=>A.functionName===N.functionName)&&(c.push(N),d.push(N.functionName))}const b=z(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),y=e.timeExtent||this.timeExtent,g=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,y),F=this._getQueryParams({geometry:e.geometry,timeExtent:y,mosaicRule:g,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:c,pixelSize:s,returnCatalogItems:m,returnGeometry:b,raster:this.raster,maxItemCount:l?1:null});delete F.f;const T=new Qe(F);try{await this.generateRasterInfo(this.renderingRule);const D=await He(this.url,T,{signal:t==null?void 0:t.signal,query:{...this.customParameters}}),N=e.outFields,A=D.value!=null&&D.value.toLowerCase().includes("nodata");if(!(m&&!b&&((P=D==null?void 0:D.catalogItems)==null?void 0:P.features.length)&&(p||!A)))return this._processVisibleRastersResponse(D,{returnDomainValues:n,templateRRFunctionNames:d,showNoDataRecords:p,templateFields:N});const U=this.objectIdField||"ObjectId",de=(w=(f=D.catalogItems)==null?void 0:f.features)!=null?w:[],G=de.map(re=>{var K;return(K=re.attributes)==null?void 0:K[U]}),te=new we({objectIds:G,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[U]}),ie=await this.queryRasters(te);return(v=ie==null?void 0:ie.features)!=null&&v.length&&ie.features.forEach(re=>{de.forEach(K=>{K.attributes[U]===re.attributes[U]&&(K.geometry=new ht(re.geometry),I(e.outSpatialReference)&&(K.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(D,{returnDomainValues:n,templateRRFunctionNames:d,showNoDataRecords:p,templateFields:N})}catch{throw new L("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const s=O(o(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then(p=>{var m;return(m=p.data)==null?void 0:m.statistics}),n=O(o(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then(p=>{var m;return(m=p.data)==null?void 0:m.histograms}),l=await Promise.all([s,n]);return l[0]&&l[0].forEach(p=>{p.avg=p.mean,p.stddev=p.standardDeviation}),{statistics:l[0]||null,histograms:l[1]||null}}async createFlowMesh(e,t){const s=this._rasterJobHandler.instance;return s?s.createFlowMesh(e,t):ei(e.meshType,e.simulationSettings,e.flowData,I(t.signal)?t.signal:new AbortController().signal)}getMultidimensionalSubsetVariables(e){const t=e!=null?e:this.multidimensionalInfo;return Ut(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,s=I(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):Et(o(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(p=>(this._set("serviceRasterInfo",p),p)),n=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,l=this._getRasterFunctionInfos();return Promise.all([s,n,l]).then(p=>{p[1]?this._set("rasterInfo",p[1]):this._set("rasterInfo",p[0]),p[2]&&this._set("rasterFunctionInfos",p[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),Le.getLogger(this.declaredClass).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([yt(()=>this.renderingRule,c=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(c).then(d=>{d&&(this.rasterInfo=d)})})]);const{serviceRasterInfo:m}=this;m&&I(m.multidimensionalInfo)&&this._updateMultidimensionalDefinition(m)})}_combineMosaicRuleWithTimeExtent(e,t){var b;const s=this.timeInfo;if(z(e)||z(this.multidimensionalInfo)||z(t)||z(s==null?void 0:s.startField))return e;const{startField:n}=s,l=this.multidimensionalInfo.variables.some(y=>y.dimensions.some(g=>g.name===n))?n:"StdTime";if(e=e.clone(),this.sourceType==="mosaic-dataset")return e.multidimensionalDefinition=(b=e.multidimensionalDefinition)==null?void 0:b.filter(y=>y.dimensionName!==l),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const p=e.multidimensionalDefinition.filter(y=>y.dimensionName===l),m=I(t.start)?t.start.getTime():null,c=I(t.end)?t.end.getTime():null,d=m==null||c==null||m===c,h=d?[m||c]:[[m,c]],R=this.version>=10.8;if(p.length)p.forEach(y=>{y.dimensionName===l&&(R?(y.dimensionName=null,y.isSlice=!1,y.values=[]):(y.isSlice=d,y.values=h))});else if(!R){const y=e.multidimensionalDefinition.filter(g=>g.variableName!=null&&g.dimensionName==null);y.length?y.forEach(g=>{g.dimensionName=l,g.isSlice=d,g.values=h}):e.multidimensionalDefinition.push(new Fe({variableName:"",dimensionName:l,isSlice:d,values:h}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return z(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(t=>!(!t.variableName&&!t.dimensionName)),e.multidimensionalDefinition.length===0&&(e.multidimensionalDefinition=null)),this.sourceType!=="mosaic-dataset"&&e.multidimensionalDefinition==null?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsQuery)throw new L("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=I(e)?ne(we,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(this._rasterJobHandler.connectionPromise!=null)return this._rasterJobHandler.connectionPromise;const e=new Qt;this._rasterJobHandler.connectionPromise=e.initialize().then(()=>{this._rasterJobHandler.instance=e},()=>{}),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:s}=this;return e.type==="unique-value"&&this._hasRenderingRule(s)&&(t==null?void 0:t.bandCount)===1&&["u8","s8"].includes(t.pixelType)||t!=null&&e!=null&&Lt(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){var s;let t=this.sourceJSON;if(!t){const{data:n,ssl:l}=await O(o(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=n,this.sourceJSON=t,l&&(this.url=this.url.replace(/^http:/i,"https:"))}if(((s=t.capabilities)==null?void 0:s.toLowerCase().split(",").map(n=>n.trim()).indexOf("tilesonly"))>-1)throw new L("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){var t;return e.serviceSourceType?e.serviceSourceType==="esriImageServiceSourceTypeMosaicDataset":((t=e.fields)==null?void 0:t.length)>0}_isMosaicRuleSupported(e){var n;if(!e)return!1;const t=this._isMosaicDataset(e),s=e.currentVersion>=10.71&&e.hasMultidimensions&&!(((n=e.fields)==null?void 0:n.length)>1);return t||s}_isVectorFieldResampleFunction(e){if(z(e))return!1;const{functionName:t,functionArguments:s}=e,n=(t==null?void 0:t.toLowerCase())==="resample",l=(s==null?void 0:s.ResampleType)||(s==null?void 0:s.resampleType);return n&&(l===7||l===10)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){var t,s;if(!this._isPicture()&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&this.rasterInfo&&this.rasterInfo.bandCount>=3){const l=zt(this.rasterInfo);!l||this.rasterInfo.bandCount===3&&l[0]===0&&l[1]===1&&l[2]===2||(this.bandIds=l)}e||(e=qt(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:(s=(t=this.mosaicRule)==null?void 0:t.multidimensionalDefinition)==null?void 0:s[0].variableName}));const n=Ht(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=n,this.symbolizer.rasterInfo=this.rasterInfo):this.symbolizer=new Xt({rendererJSON:n,rasterInfo:this.rasterInfo}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return e==null?e:{extent:e.extent&&e.extent.clone(),pixelBlock:I(e.pixelBlock)?e.pixelBlock.clone():null}}_getQueryParams(e){e&&I(e.renderingRule)&&typeof e.renderingRule!="string"&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:s}=this;return{raster:t,viewId:s,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e==null?void 0:e.query,...this.customParameters}}}_decodePixelBlock(e,t,s){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):qe(e,t,s)}async _getRasterFunctionInfos(e){var s;const t=this.sourceJSON.rasterFunctionInfos;return this.loaded?t:t&&this.version>=10.3?t.length===1&&t[0].name.toLowerCase()==="none"?t:(s=(await O(o(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data)==null?void 0:s.rasterFunctionInfos:null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:s,signal:n}=e;if(s&&this._canRequestImageElement(t.format))return{imageOrCanvasElement:(await O(o(this.parsedUrl)+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:n})).data,params:t};const l=this._initJobHandler(),p=O(o(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:n}),m=(await Promise.all([p,l]))[0].data,c=t.format||"jpgpng";let d=c;if(d!=="bsq"&&d!=="bip"&&(d=Yt(m)),!d)throw new L("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(m)));const h={signal:n};return{pixelData:{pixelBlock:await(c==="gif"||c==="bmp"||c.includes("png")&&(d==="png"||d==="jpg")?qe(m,{useCanvas:!0,...t},h):this._decodePixelBlock(m,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:c},h)),extent:t.extent},params:t}}_generateRasterInfo(e,t){const s={...t,query:this._getQueryParams()};return kt(o(this.parsedUrl),e,s)}_isValidCustomizedMosaicRule(e){var t;return e&&JSON.stringify(e.toJSON())!==JSON.stringify((t=this.defaultMosaicRule)==null?void 0:t.toJSON())}_updateMultidimensionalDefinition(e){var s;if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=Gt(e,{multidimensionalSubset:this.multidimensionalSubset});if(I(t)&&t.length>0){this.mosaicRule=this.mosaicRule||new H;const n=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.renderingRule&&((s=this.renderingRule.functionName)==null?void 0:s.toLowerCase())!=="none"&&t.forEach(l=>l.variableName=""),(!n||n&&n.length<=0)&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,t){var P;t=t||{};const s=e.value,{templateRRFunctionNames:n,showNoDataRecords:l,returnDomainValues:p,templateFields:m}=t,c=e.processedValues;let d=e.catalogItems&&e.catalogItems.features,h=e.properties&&e.properties.Values&&e.properties.Values.map(f=>f.replace(/ /gi,", "))||[];const R=this.objectIdField||"ObjectId",b=typeof s=="string"&&s.toLowerCase().includes("nodata"),y=[];if(s&&!d&&!b){const f={};f[R]=0,h=[s],d=[new gt(this.fullExtent,null,f)]}if(!d)return[];let g,F,T;this._updateResponseFieldNames(d,m),b&&!l&&(d=[]);for(let f=0;f<d.length;f++){if(g=d[f],s!=null){if(F=h[f],T=this.renderingRule&&c&&c.length>0&&n&&n.length>0&&n.includes(this.renderingRule.functionName)?c[n.indexOf(this.renderingRule.functionName)]:s,F.toLowerCase()==="nodata"&&!l)continue;const w="Raster.ItemPixelValue",v="Raster.ServicePixelValue";g.attributes[w]=F,g.attributes[v]=T,this._updateFeatureWithMagDirValues(g,F);const D=this.fields&&this.fields.length>0;let N=this.renderingRule&&I((P=this.serviceRasterInfo)==null?void 0:P.attributeTable)?D?F:s:T;this.renderingRule||(N=D?F:s),this._updateFeatureWithRasterAttributeTableValues(g,N)}if(g.sourceLayer=g.layer=this,p&&this._updateFeatureWithDomainValues(g),n&&c&&n.length===c.length)for(let w=0;w<n.length;w++){const v="Raster.ServicePixelValue."+n[w];g.attributes[v]=c[w]}y.push(d[f])}return y}_updateFeatureWithRasterAttributeTableValues(e,t){var d;const s=this.rasterInfo&&this.rasterInfo.attributeTable||((d=this.serviceRasterInfo)==null?void 0:d.attributeTable);if(z(s))return;const{features:n,fields:l}=s,p=l.map(h=>h.name).filter(h=>h.toLowerCase()==="value"),m=p&&p[0];if(!m)return;const c=n.filter(h=>h.attributes[m]===(t!=null?parseInt(t,10):null));c&&c[0]&&l.forEach(h=>{const R=this._rasterAttributeTableFieldPrefix+h.name;e.attributes[R]=c[0].attributes[h.name]})}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const s=t.split(/,\s*/).map(c=>parseFloat(c)),n=s.map(c=>[c]),l=s.map(c=>({minValue:c,maxValue:c,noDataValue:null})),p=new Se({height:1,width:1,pixelType:"f32",pixels:n,statistics:l});this.pixelFilter!=null&&this.pixelFilter({pixelBlock:p,extent:new fe(0,0,0,0,this.spatialReference)});const m=this.serviceDataType==="esriImageServiceDataTypeVector-MagDir"?[p.pixels[0][0],p.pixels[1][0]]:ti([p.pixels[0][0],p.pixels[1][0]]);e.attributes["Raster.Magnitude"]=m[0],e.attributes["Raster.Direction"]=m[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter(s=>s.domain&&s.domain.type==="coded-value");t!=null&&t.forEach(s=>{const n=e.attributes[s.name];if(n!=null){const l=s.domain.codedValues.find(p=>p.code===n);l&&(e.attributes[s.name]=l.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const s=this.fieldsIndex;z(s)||e.forEach(n=>{var l;if(n&&n.attributes)for(const p of t){const m=(l=s.get(p))==null?void 0:l.name;m&&m!==p&&(n.attributes[p]=n.attributes[m],delete n.attributes[m])}})}_getRenderingRuleString(e){var t;if(this._hasRenderingRule(e)){let s=e.toJSON();return s=(t=s.rasterFunctionDefinition)!=null?t:s,(s.thumbnail||s.thumbnailEx)&&(s.thumbnail=s.thumbnailEx=null),JSON.stringify(s)}return null}_hasRenderingRule(e){return e!=null&&e.functionName!=null&&e.functionName.toLowerCase()!=="none"}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if(e==="Raw")return e.replace("Raw","None");const s=e.toLowerCase().replace(/ /gi,"_");return t.has(s)?t.get(s):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return this.serviceDataType==="esriImageServiceDataTypeVector-UV"||this.serviceDataType==="esriImageServiceDataTypeVector-MagDir"}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map(h=>h.trim()):["image","catalog"],{currentVersion:s,advancedQueryCapabilities:n,maxRecordCount:l}=e,p=t.includes("image"),m=e.serviceDataType==="esriImageServiceDataTypeElevation",c=!!(e.spatialReference||e.extent&&e.extent.spatialReference),d=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:p,supportsExportImage:p,supportsIdentify:p,supportsMeasure:t.includes("mensuration")&&c,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:s>=10.2&&p,supportsProject:s>=10.3&&p,supportsComputeStatisticsHistograms:s>=10.4&&p,supportsQueryBoundary:s>=10.6&&p,supportsCalculateVolume:s>=10.7&&m,supportsComputePixelLocation:s>=10.7&&t.includes("catalog"),supportsComputeAngles:s>=10.91,supportsAdd:d,supportsDelete:d,supportsEditing:d,supportsUpdate:d,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:l,maxRecordCountFactor:void 0,supportsStatistics:!!(n!=null&&n.supportsStatistics),supportsOrderBy:!!(n!=null&&n.supportsOrderBy),supportsDistinct:!!(n!=null&&n.supportsDistinct),supportsPagination:!!(n!=null&&n.supportsPagination),supportsStandardizedQueriesOnly:!!(n!=null&&n.useStandardizedQueries),supportsPercentileStatistics:!!(n!=null&&n.supportsPercentileStatistics),supportsCentroid:!!(n!=null&&n.supportsReturningGeometryCentroid),supportsDistance:!!(n!=null&&n.supportsQueryWithDistance),supportsExtent:!!(n!=null&&n.supportsReturningQueryExtent),supportsGeometryProperties:!!(n!=null&&n.supportsReturningGeometryProperties),supportsHavingClause:!!(n!=null&&n.supportsHavingClause),supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!(n!=null&&n.supportsDefaultSR),supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};function o(e){var t;return(t=e==null?void 0:e.path)!=null?t:""}return a([u()],i.prototype,"_functionRasterInfos",void 0),a([u()],i.prototype,"_rasterJobHandler",void 0),a([u()],i.prototype,"_cachedRendererJson",void 0),a([u({readOnly:!0})],i.prototype,"_serviceSupportsMosaicRule",void 0),a([M("_serviceSupportsMosaicRule",["currentVersion","fields"])],i.prototype,"readServiceSupportsMosaicRule",null),a([u()],i.prototype,"_rasterAttributeTableFieldPrefix",void 0),a([u({readOnly:!0})],i.prototype,"_rasterFunctionNamesIndex",null),a([u()],i.prototype,"adjustAspectRatio",void 0),a([u({type:[pe],json:{write:!0}})],i.prototype,"bandIds",void 0),a([M("bandIds")],i.prototype,"readBandIds",null),a([u({readOnly:!0,json:{read:!1}})],i.prototype,"capabilities",void 0),a([M("service","capabilities",["capabilities","currentVersion","serviceDataType"])],i.prototype,"readCapabilities",null),a([u({type:Number})],i.prototype,"compressionQuality",void 0),a([V("compressionQuality")],i.prototype,"writeCompressionQuality",null),a([u({type:Number})],i.prototype,"compressionTolerance",void 0),a([V("compressionTolerance")],i.prototype,"writeCompressionTolerance",null),a([u({json:{read:{source:"copyrightText"}}})],i.prototype,"copyright",void 0),a([u({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],i.prototype,"defaultMosaicRule",void 0),a([M("defaultMosaicRule",["defaultMosaicMethod"])],i.prototype,"readDefaultMosaicRule",null),a([u({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],i.prototype,"definitionExpression",void 0),a([u({readOnly:!0,constructOnly:!0})],i.prototype,"exportImageServiceParameters",void 0),a([u()],i.prototype,"rasterInfo",void 0),a([u({readOnly:!0,type:[se]})],i.prototype,"fields",void 0),a([u({readOnly:!0})],i.prototype,"fieldsIndex",null),a([u({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],i.prototype,"format",null),a([M("service","format",["serviceDataType"])],i.prototype,"readFormat",null),a([u({type:fe})],i.prototype,"fullExtent",void 0),a([u({readOnly:!0})],i.prototype,"hasMultidimensions",void 0),a([u({json:{read:{source:"maxImageHeight"}}})],i.prototype,"imageMaxHeight",void 0),a([u({json:{read:{source:"maxImageWidth"}}})],i.prototype,"imageMaxWidth",void 0),a([u({type:String,json:{type:Y.jsonValues,read:Y.read,write:Y.write}})],i.prototype,"interpolation",void 0),a([u()],i.prototype,"minScale",void 0),a([M("service","minScale")],i.prototype,"readMinScale",null),a([u()],i.prototype,"maxScale",void 0),a([M("service","maxScale")],i.prototype,"readMaxScale",null),a([u({type:H})],i.prototype,"mosaicRule",null),a([M("mosaicRule",["mosaicRule","defaultMosaicMethod"])],i.prototype,"readMosaicRule",null),a([V("mosaicRule")],i.prototype,"writeMosaicRule",null),a([u()],i.prototype,"multidimensionalInfo",null),a([u({type:Mt,json:{write:!0}})],i.prototype,"multidimensionalSubset",void 0),a([u({json:{type:pe}})],i.prototype,"noData",void 0),a([V("noData")],i.prototype,"writeNoData",null),a([u({type:String,json:{type:ye.jsonValues,read:ye.read,write:ye.write}})],i.prototype,"noDataInterpretation",void 0),a([u({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],i.prototype,"objectIdField",void 0),a([M("objectIdField")],i.prototype,"readObjectIdField",null),a([u({})],i.prototype,"geometryType",void 0),a([u({})],i.prototype,"typeIdField",void 0),a([u({})],i.prototype,"types",void 0),a([u({readOnly:!0})],i.prototype,"parsedUrl",null),a([u({type:Function})],i.prototype,"pixelFilter",void 0),a([u()],i.prototype,"raster",void 0),a([u({readOnly:!0})],i.prototype,"sourceType",void 0),a([M("sourceType",["serviceSourceType","fields"])],i.prototype,"readSourceType",null),a([u()],i.prototype,"viewId",void 0),a([u({types:At,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:$t,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&e.type!=="vector-field"&&e.type!=="flow"})}}}}})],i.prototype,"renderer",null),a([M("renderer")],i.prototype,"readRenderer",null),a([V("renderer")],i.prototype,"writeRenderer",null),a([u()],i.prototype,"symbolizer",void 0),a([u(lt)],i.prototype,"opacity",void 0),a([u({readOnly:!0})],i.prototype,"rasterFields",null),a([u({constructOnly:!0})],i.prototype,"rasterFunctionInfos",void 0),a([u({type:x})],i.prototype,"renderingRule",null),a([M("renderingRule",["renderingRule","rasterFunctionInfos"])],i.prototype,"readRenderingRule",null),a([V("renderingRule")],i.prototype,"writeRenderingRule",null),a([u()],i.prototype,"serviceDataType",void 0),a([u({readOnly:!0,type:oe})],i.prototype,"spatialReference",void 0),a([M("spatialReference",["spatialReference","extent"])],i.prototype,"readSpatialReference",null),a([u({json:{type:Ie.jsonValues}})],i.prototype,"pixelType",void 0),a([M("pixelType")],i.prototype,"readPixelType",null),a([V("pixelType")],i.prototype,"writePixelType",null),a([u({constructOnly:!0,type:Ze})],i.prototype,"serviceRasterInfo",void 0),a([u()],i.prototype,"sourceJSON",void 0),a([u(ut)],i.prototype,"url",void 0),a([u({readOnly:!0})],i.prototype,"version",void 0),a([M("version",["currentVersion","fields","timeInfo"])],i.prototype,"readVersion",null),i=a([E("esri.layers.mixins.ArcGISImageService")],i),i};let q=class extends bt(vt(wt(St(xt(Mi(It(Ft(Tt(Dt(jt)))))))))){constructor(...r){super(...r),this.legendEnabled=!0,this.isReference=null,this.operationalLayerType="ArcGISImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.type="imagery"}normalizeCtorArgs(r,i){return typeof r=="string"?{url:r,...i}:r}load(r){const i=I(r)?r.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},r).catch(Nt).then(()=>this._fetchService(i))),Promise.resolve(this)}writeOperationalLayerType(r,i,o){var t;const e=((t=this.renderer)==null?void 0:t.type)==="vector-field";i[o]=e?"ArcGISImageServiceVectorLayer":"ArcGISImageServiceLayer"}get defaultPopupTemplate(){return this.createPopupTemplate()}createPopupTemplate(r){const i=this.rasterFields,o=this.title,e=new Set;let t=!1,s=!1;this.capabilities&&(t=this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0,s=this.serviceDataType==="esriImageServiceDataTypeVector-UV"||this.serviceDataType==="esriImageServiceDataTypeVector-MagDir");const n=new Set;t&&n.add("raster.itempixelvalue");for(const l of i){const p=l.name.toLowerCase();n.has(p)||p.includes("raster.servicepixelvalue.")||e.add(l.name)}return s&&e.add("raster.magnitude").add("raster.direction"),Pt({fields:i,title:o},{...r,visibleFieldNames:e})}queryFeatures(r,i){return this.queryRasters(r,i).then(o=>{if(o!=null&&o.features)for(const e of o.features)e.layer=e.sourceLayer=this;return o})}queryFeatureCount(r,i){return this.queryRasterCount(r,i)}redraw(){this.emit("redraw")}serviceSupportsSpatialReference(r){return Ct(this,r)}};a([u(_t)],q.prototype,"legendEnabled",void 0),a([u({type:["show","hide"]})],q.prototype,"listMode",void 0),a([u({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],q.prototype,"isReference",void 0),a([u({type:["ArcGISImageServiceLayer"],json:{origins:{"web-map":{type:["ArcGISImageServiceLayer","ArcGISImageServiceVectorLayer"],read:!1,write:{target:"layerType",ignoreOrigin:!0}}}}})],q.prototype,"operationalLayerType",void 0),a([V("web-map","operationalLayerType")],q.prototype,"writeOperationalLayerType",null),a([u(Ot)],q.prototype,"popupEnabled",void 0),a([u({type:Vt,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],q.prototype,"popupTemplate",void 0),a([u({readOnly:!0})],q.prototype,"defaultPopupTemplate",null),a([u({readOnly:!0,json:{read:!1}})],q.prototype,"type",void 0),q=a([E("esri.layers.ImageryLayer")],q);const Qi=q;export{Qi as default};
|