// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
require({cache:{"esri/layers/ImageServiceLayerMixin":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/Deferred dojo/_base/array dojo/_base/json dojo/_base/config dojo/_base/connect dojo/has dojo/io-query dojo/DeferredList ../kernel ../config ../lang ../request ../deferredUtils ../urlUtils ../geometry/Extent ../geometry/Point ../geometry/Polygon ./MosaicRule ./RasterFunction ./DimensionalDefinition ./Raster ./PixelBlock ./pixelFilters/VectorFieldPixelFilter ./rasterFormats/ImageCanvasDecoder ./TimeInfo ./Field ../graphic ../tasks/ImageServiceIdentifyTask ../tasks/ImageServiceIdentifyParameters".split(" "),
function(r,p,u,g,b,d,f,a,e,k,m,q,h,n,l,t,K,D,x,y,z,w,C,E,v,B,M,A,G,F,N){r=r(null,{declaredClass:"esri.layers.ImageServiceLayerMixin",_rasterFieldPrefix:"Raster.",_renderingRuleFieldSubPrefix:"ServicePixelValue.",_rasterFunctionServiceInfoProps:"bandCount pixelType hasRasterAttributeTable hasHistograms minValues maxValues meanValues stdvValues".split(" "),_rasterFunctionTemplateInfos:{},_pixelTypeRanges:{U1:[0,1],U2:[0,3],U4:[0,15],U8:[0,255],S8:[-128,127],U16:[0,65535],S16:[-32768,32767]},_eventMap:{"rendering-change":!0,
"mosaic-rule-change":!0,"spatial-reference-change":!0,"renderer-change":!0},constructor:function(c,b){this.useMapTime=b&&b.hasOwnProperty("useMapTime")?!!b.useMapTime:!0},_initialize:function(c,b){this._url=t.urlToObject(c);this.raster=new C(this._url.path);this.infoTemplate=b&&b.infoTemplate;var a=b&&b.imageServiceParameters;this.format=a&&a.format;this.compressionTolerance=a&&a.compressionTolerance?a.compressionTolerance:.01;this.interpolation=a?a.interpolation:null;this.compressionQuality=a?a.compressionQuality:
null;this.bandIds=a?a.bandIds:null;this.mosaicRule=a?a.mosaicRule:null;this.renderingRule=a?a.renderingRule:null;this.renderer=a?a.renderer:null;this.useMapDimensionValue=b&&b.hasOwnProperty("useMapDimensionValue")?!!b.useMapDimensionValue:!0;this.activeMapDimensions=b&&b.activeMapDimensions;this._params=p.mixin({},this._url.query,{f:"image",interpolation:this.interpolation,format:this.format,compressionQuality:this.compressionQuality,bandIds:this.bandIds?this.bandIds.join(","):null},a?a.toJson():
{});this.pixelFilter=b&&b.pixelFilter;this.originalPixelData=this.pixelData=null;this.hasDataChanged=!0;this._requestDataHandler=p.hitch(this,this._requestDataHandler);this._requestDataErrorHandler=p.hitch(this,this._requestDataErrorHandler);this._rasterReadPromise=null;this._initLayer=p.hitch(this,this._initLayer);this._queryVisibleRastersHandler=p.hitch(this,this._queryVisibleRastersHandler);this._visibleRasters=[];this._rasterAttributeTableFields=[];this._rasterAttributeTableFeatures=[];this._renderingRuleAttributeTable=
{};this._useRenderingRuleAttributeTable=!1;this._loadCallback=b&&b.loadCallback;(a=b&&b.resourceInfo)?this._initLayer(a):n({url:this._url.path,content:p.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:this._initLayer,error:this._errorHandler});this.registerConnectEvents()},disableClientCaching:!1,_initLayer:function(c,b){if(null!==c&&void 0!==c){this._findCredential();(this.credential&&this.credential.ssl||c&&c._ssl)&&this._useSSL();var a=this.minScale,e=this.maxScale;p.mixin(this,
c);this.minScale=a;this.maxScale=e;this.initialExtent=this.fullExtent=this.extent=new K(c.extent);this.spatialReference=this.initialExtent.spatialReference;this.pixelSizeX=parseFloat(this.pixelSizeX);this.pixelSizeY=parseFloat(this.pixelSizeY);for(var d=this.minValues,J=this.maxValues,f=this.meanValues,g=this.stdvValues,k=this.bands=[],a=0,e=this.bandCount;a<e;a++)k[a]={min:d[a],max:J[a],mean:f[a],stddev:g[a]};this.timeInfo=(a=this.timeInfo)&&a.timeExtent?new M(a):null;e=this.fields=[];if(d=c.fields)for(a=
0;a<d.length;a++)e.push(new A(d[a]));this.version=c.currentVersion;this.version||(this.version="fields"in c||"objectIdField"in c||"timeInfo"in c?10:9.3);h.isDefined(c.minScale)&&!this._hasMin&&this.setMinScale(c.minScale);h.isDefined(c.maxScale)&&!this._hasMax&&this.setMaxScale(c.maxScale);a={};c.defaultMosaicMethod?(a.method=c.defaultMosaicMethod,a.operation=c.mosaicOperator,a.sortField=c.sortField,a.sortValue=c.sortValue):a.method=y.METHOD_NONE;this.defaultMosaicRule=new y(a);this.defaultMosaicRule.ascending=
!0;this._useRenderingRuleAttributeTable=10<this.version&&"esriImageServiceDataTypeThematic"===this.serviceDataType&&!this.hasRasterAttributeTable;this._setDefaultRenderingRule(!0);this._isScientificData()&&(!this.mosaicRule||this.mosaicRule&&!this.mosaicRule.multidimensionalDefinition)&&this._setDefaultMultidimensionalDefinition(!0);10<this.version&&this.hasRasterAttributeTable&&this.getRasterAttributeTable().then(p.hitch(this,function(c){c&&(c.features&&c.fields&&(this.rasterAttributeTable=p.clone(c)),
c.features&&0<c.features.length&&(this._rasterAttributeTableFeatures=p.clone(c.features)),c.fields&&0<c.fields.length&&(this._rasterAttributeTableFields=p.clone(c.fields)),!this.renderer||"esri.renderer.ClassBreaksRenderer"!==this.renderer.declaredClass&&"esri.renderer.UniqueValueRenderer"!==this.renderer.declaredClass||this.refresh())}));this._isVectorData()&&!h.isDefined(this.pixelFilter)&&(this.vectorFieldPixelFilter=new v,this.vectorFieldPixelFilter.isDataUV="esriImageServiceDataTypeVector-UV"===
this.serviceDataType,this.pixelFilter=this.vectorFieldPixelFilter.computeMagnitudeAndDirection,this.getKeyProperties().then(p.hitch(this,this._setFlowRepresentation)));this.loaded=!0;this._setDefaultFilter();this.onLoad(this);if(a=this._loadCallback)delete this._loadCallback,a(this)}},getKeyProperties:function(c){var a=this._url.path+"/keyProperties",e=new u(l._dfdCanceller),f={f:"json"};c&&c.renderingRule&&(f.renderingRule=b.toJson(c.renderingRule.toJson()));10<this.version?(e._pendingDfd=n({url:a,
content:f,handleAs:"json",callbackParamName:"callback"}),e._pendingDfd.then(function(c){e.callback(c)},function(c){e.errback(c)})):(c=Error("Layer does not have key properties"),c.log=!!d.isDebug,e.errback(c));return e},getRasterAttributeTable:function(c){var a=this._url.path+"/rasterAttributeTable",e=new u(l._dfdCanceller),f={f:"json"},g=this.hasRasterAttributeTable;c&&c.renderingRule&&(f.renderingRule=b.toJson(c.renderingRule.toJson()),g=!0);10<this.version&&g?(e._pendingDfd=n({url:a,content:f,
handleAs:"json",callbackParamName:"callback"}),e._pendingDfd.then(function(c){e.callback(c)},function(c){e.errback(c)})):(c=Error("Layer does not support raster attribute table"),c.log=!!d.isDebug,e.errback(c));return e},getRenderingRuleAttributeTable:function(c){var b=new u(l._dfdCanceller);if(!c||!c.renderingRule)return b.errback(Error("Rendering rule is not specified")),b;c=c.renderingRule;var a=c.functionName;this._renderingRuleAttributeTable&&a&&this._renderingRuleAttributeTable.hasOwnProperty(a)?
b.resolve(this._renderingRuleAttributeTable[a]):b=this.getRasterAttributeTable({renderingRule:c}).then(p.hitch(this,function(c){var b;c&&c.features&&c.features.length&&c.fields&&c.fields.length&&(b={features:p.clone(c.features),fields:p.clone(c.fields)},a&&(this._renderingRuleAttributeTable[a]=b));return b}));return b},_getRasterAttributeTableFeatures:function(){var c=new u;if(this._rasterAttributeTableFeatures&&0<this._rasterAttributeTableFeatures.length)return c.resolve(this._rasterAttributeTableFeatures),
c;if(10<this.version&&this.hasRasterAttributeTable)return c=this.getRasterAttributeTable(),c.then(p.hitch(this,function(c){c&&c.features&&0<c.features.length&&(this._rasterAttributeTableFeatures=p.clone(c.features))})),c;c.resolve(this._rasterAttributeTableFeatures);return c},_getRenderingRuleAttributeTableFeatures:function(c){c=c&&c.renderingRule;return c?this.getRenderingRuleAttributeTable({renderingRule:c}).then(function(c){return c&&c.features}):(c=new u,c.errback(Error("Rendering rule is not specified")),
c)},getCustomRasterFields:function(c){var b=c?c.rasterAttributeTableFieldPrefix:this._rasterFieldPrefix;c=10.3<=this.version?"esriFieldTypeDouble":"esriFieldTypeString";var a={name:this._rasterFieldPrefix+"ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:c},e={name:this._rasterFieldPrefix+"ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:c},d={name:this._rasterFieldPrefix+"ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,
editable:!1,length:50,type:"esriFieldTypeDouble"},f=this.fields?p.clone(this.fields):[];c=f.length;f[c]=e;10.4<=this.version&&"esri.layers.ArcGISImageServiceLayer"===this.declaredClass&&(!this.rasterFunctionInfos||!this.rasterFunctionInfos.length||this._isRasterFunctionInfoAvailable("none"))&&(c++,f[c]=d);if(this.capabilities&&-1<this.capabilities.toLowerCase().indexOf("catalog")||this.fields&&0<this.fields.length)c++,f[c]=a;!h.isDefined(this.pixelFilter)||"esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&
"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType||(a={name:this._rasterFieldPrefix+"Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"esriFieldTypeDouble"},e={name:this._rasterFieldPrefix+"Direction",alias:"Direction",domain:null,editable:!1,type:"esriFieldTypeDouble"},c++,f[c]=a,c++,f[c]=e);c=this._rasterAttributeTableFields;(a=this.renderingRule&&this.renderingRule.functionName)&&this._renderingRuleAttributeTable&&this._renderingRuleAttributeTable.hasOwnProperty(a)&&(c=this._renderingRuleAttributeTable[a].fields);
c&&0<c.length&&(c=g.filter(c,function(c){return"esriFieldTypeOID"!==c.type&&"value"!==c.name.toLowerCase()}),c=g.map(c,function(c){var a=p.clone(c);a.name=b+c.name;return a}),f=f.concat(c));var k=this._rasterFieldPrefix+this._renderingRuleFieldSubPrefix;10.4<=this.version&&this.rasterFunctionInfos&&g.forEach(this.rasterFunctionInfos,function(c){c&&c.name&&"none"!==c.name.toLowerCase()&&(c={name:k+c.name.replace(/ /gi,"_"),alias:c.name,domain:null,editable:!1,type:"esriFieldTypeDouble"},f.push(c))});
return f},_prepareGetImageParameters:function(c,a,e,d){d=h.isDefined(d)?d:this._params;if(this.renderer){var f=this.getExportImageRenderingRule();d.renderingRule=f?b.toJson(f.toJson()):null}f=c.spatialReference.wkid||b.toJson(c.spatialReference.toJson(!1));delete d._ts;p.mixin(d,{bbox:c.xmin+","+c.ymin+","+c.xmax+","+c.ymax,imageSR:f,bboxSR:f,size:a+","+e},this.disableClientCaching?{_ts:(new Date).getTime()}:{});delete d.compressionTolerance;d.format&&"LERC"===d.format.toUpperCase()&&(d.compressionTolerance=
this.compressionTolerance);d.token=this._getToken()},getImageUrl:function(c,a,b,d,f){f=h.isDefined(f)?f:this._params;this._prepareGetImageParameters(c,a,b,f);c=p.clone(f);this._cleanupRequestParams(c);a=this._url.path+"/exportImage?";b=t.addProxy(a+e.objectToQuery(p.mixin(c,{f:"image"})));var g=c.token;b.length>q.defaults.io.postLength||this.useMapImage?this._jsonRequest=n({url:a,content:p.mixin(c,{f:"json"}),callbackParamName:"callback",load:function(c,a){var b=c.href;g&&(b+=-1===b.indexOf("?")?
"?token\x3d"+g:"\x26token\x3d"+g);d(t.addProxy(b))},error:this._errorHandler}):d(b)},onRenderingChange:function(){},onMosaicRuleChange:function(){},onRendererChange:function(){},setInterpolation:function(c,b){this.interpolation=this._params.interpolation=c;b||this.refresh(!0)},setCompressionQuality:function(c,b){this.compressionQuality=this._params.compressionQuality=c;b||this.refresh(!0)},setCompressionTolerance:function(c,b){this.compressionTolerance=c;b||this.refresh(!0)},setBandIds:function(c,
b){var a=!1;this.bandIds!==c&&(a=!0);this.bandIds=c;this._params.bandIds=c.join(",");if(a&&!b)this.onRenderingChange();b||this.refresh(!0)},setDefaultBandIds:function(c){this.bandIds=this._params.bandIds=null;c||this.refresh(!0)},setDisableClientCaching:function(c){this.disableClientCaching=c},setMosaicRule:function(c,a){var e=!1;this.mosaicRule!==c&&(e=!0);this.mosaicRule=c;this._params.mosaicRule=b.toJson(c.toJson());if(e&&!a)this.onMosaicRuleChange();a||this.refresh(!0)},setRenderingRule:function(c,
a){var e=!1;this.renderingRule!==c&&(e=!0);this.renderingRule=c;this._params.renderingRule=c?b.toJson(c.toJson()):null;this._useRenderingRuleAttributeTable&&this.getRenderingRuleAttributeTable({renderingRule:c});if(e)this.onRenderingChange();this._setDefaultFilter();a||this.refresh(!0)},setImageFormat:function(c,b){this.format=this._params.format=c;this._setDefaultFilter();b||this.refresh(!0)},setInfoTemplate:function(c){this.infoTemplate=c},setDefinitionExpression:function(c,b){var a=this.mosaicRule?
this.mosaicRule.toJson():{};this.mosaicRule||(this.defaultMosaicRule?a=this.defaultMosaicRule.toJson():a.method=y.METHOD_NONE);a.where=c;a=new y(a);this.setMosaicRule(a,b);return this},getDefinitionExpression:function(){return this.mosaicRule?this.mosaicRule.where:null},setPixelFilter:function(c){this.pixelFilter=c;this._isDefaultPixelFilter=!1},getPixelData:function(c){return c?(this._useBrowserDecoding()&&(this.originalPixelData={pixelBlock:this._getPixelBlockFromCanvas(this._context,this._map.width,
this._map.height),extent:this._map.extent}),this.originalPixelData):this.pixelData},getExportImageRenderingRule:function(){return this._combineRenderingRule(this._convertRendererToRenderingRule(this.renderer),this.renderingRule)},redraw:function(){this.hasDataChanged=!1;this._setPixelData(this.originalPixelData)},getHistograms:function(){var c=new u(l._dfdCanceller);if(this.hasHistograms)c._pendingDfd=n({url:this._url.path+"/histograms",content:{f:"json"},handleAs:"json",callbackParamName:"callback"}),
c._pendingDfd.then(function(a){c.callback(a)},function(a){c.errback(a)});else{var a=Error("Layer does not have histograms.");a.log=!!d.isDebug;c.errback(a)}return c},computeHistograms:function(c){var a=new u(l._dfdCanceller);if(10.1<=this.currentVersion){c=c||{};var b=c.geometry||this.fullExtent,e=(c.geometry||this.fullExtent).toJson(),b="extent"===b.type?"esriGeometryEnvelope":"esriGeometryPolygon",f=c.renderingRule||this.renderingRule||this.defaultRenderingRule,f=f?f.toJson():null,g=c.mosaicRule||
this.mosaicRule||this.defaultMosaicRule,g=g?g.toJson():null;c=c.pixelSize||{x:this.pixelSizeX,y:this.pixelSizeY};a._pendingDfd=n({url:this._url.path+"/computeHistograms",content:p.mixin({f:"json",geometry:JSON.stringify(e),geometryType:b,renderingRule:JSON.stringify(f),mosaicRule:JSON.stringify(g),pixelSize:JSON.stringify(c),callbackParamName:"callback"}),handleAs:"json"});a._pendingDfd.then(function(c){a.callback(c)},function(c){a.errback(c)})}else e=Error("Layer doesn't support computeHistograms."),
e.log=!!d.isDebug,a.errback(e);return a},getRenderingRuleServiceInfo:function(c){var a=new l._fixDfd(new u(l._dfdCanceller));if(!c)return a.errback(Error("Rendering rule is not specified")),a;var b=c&&c.functionName&&!c.functionArguments?c.functionName:null;return b&&this._rasterFunctionTemplateInfos[b]?(a.resolve(this._rasterFunctionTemplateInfos[b]),a):n({url:this._url.path,content:p.mixin(p.mixin({f:"json",renderingRule:JSON.stringify(c.toJson())},this._url.query)),callbackParamName:"callback",
load:p.hitch(this,function(c){var a={};g.forEach(this._rasterFunctionServiceInfoProps,function(b){a[b]=c[b]});return this._rasterFunctionTemplateInfos[b]=a}),error:this._errorHandler})},queryVisibleRasters:function(c,a,b,e){var d=this._map,f=l._fixDfd(new u(l._dfdCanceller));this._visibleRasters=[];var k,h,J=!0,n=this.infoTemplate?this.infoTemplate.info:null,m=n?p.clone(this.infoTemplate.info.fieldInfos):null;a=a||{};if(n&&this.infoTemplate.info.mediaInfos&&this.infoTemplate.info.mediaInfos.length){var q=
[];g.forEach(this.infoTemplate.info.mediaInfos,function(c){q=q.concat(c&&c.value&&c.value.fields||[])});q.length&&g.forEach(m,function(c){c&&-1<q.indexOf(c.fieldName)&&(c.visible=!0)})}if(m&&0<m.length)for(J=!1,k=0;k<m.length;k++)if((h=m[k])&&h.fieldName.toLowerCase()!==this._rasterFieldPrefix.toLowerCase()+"servicepixelvalue"&&(h.visible||n.title&&-1<n.title.toLowerCase().indexOf(h.fieldName.toLowerCase()))){J=!0;break}var A=(h=this._removeVisualizationStretchFunction(this.renderingRule))&&h.functionName,
G=[];if(10.4<=this.version){var t=!1;if(this.rasterFunctionInfos&&m){var I=this._rasterFieldPrefix+this._renderingRuleFieldSubPrefix;g.forEach(this.rasterFunctionInfos,function(c){var a=I+c.name.replace(/ /gi,"_");g.some(m,function(c){return c.visible&&c.fieldName===a})&&(t=t||A&&A===c.name,G.push(new z({rasterFunction:c.name})))})}h&&!t&&G.push(h)}k=new N;k.geometry=c.geometry;k.returnGeometry=this._map.spatialReference.equals(this.spatialReference);k.returnCatalogItems=J;k.timeExtent=c.timeExtent;
this._params.time&&this.mosaicRule?(c=p.clone(this.mosaicRule),c=this._filterOutTimeDimension(c),k.mosaicRule=c):k.mosaicRule=this.mosaicRule||null;k.renderingRule=10.4>this.version&&h||null;k.renderingRules=G||null;d&&(d=new D((d.extent.xmax-d.extent.xmin)/d.width,(d.extent.ymax-d.extent.ymin)/d.height,d.extent.spatialReference),k.pixelSize=d);a.requestParams=k;var K=this,d=new F(this.url);(f._pendingDfd=d.execute(k)).addCallbacks(function(c){K._queryVisibleRastersHandler(c,a,b,e,f)},function(c){K._resolve([c],
null,e,f,!0)});return f},_queryVisibleRastersHandler:function(c,a,e,d,f){function k(){var c=this.getCustomRasterFields(a),b=this._getDomainFields(c),d=a?a.returnDomainValues:!1,k=a&&a.rasterAttributeTableFieldPrefix,n,A,G,t,I,F,v,u,w,N;this._useRenderingRuleAttributeTable&&this.renderingRule?(c=this._getRenderingRuleAttributeTableFeatures({renderingRule:this.renderingRule}),N=J):c=this._getRasterAttributeTableFeatures();c.then(p.hitch(this,function(c){for(n=0;n<q.length;n++){H=q[n];H.setInfoTemplate(this.infoTemplate);
H._layer=this;if(J){w=J.replace(/ /gi,"").split(",");A=J;G=w;m&&m.length>=n&&(A=m[n].replace(/ /gi,", "),G=m[n].split(" "));H.attributes[this._rasterFieldPrefix+"ItemPixelValue"]=G;H.attributes[this._rasterFieldPrefix+"ServicePixelValue"]=w;l&&(H.attributes[this._rasterFieldPrefix+"ServicePixelValue.Raw"]=l.replace(/ /gi,"").split(","));if(this.pixelFilter){var a=new E({height:1,width:1,pixelType:"F32",pixels:[],statistics:[]});g.forEach(G,function(c){a.addData({pixels:[c],statistics:{minValue:c,
maxValue:c,noDataValue:null}})});this.pixelFilter({pixelBlock:a,extent:new K(0,0,0,0,this._map.spatialReference)});if("esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType)H.attributes[this._rasterFieldPrefix+"Magnitude"]=a.pixels[0][0],H.attributes[this._rasterFieldPrefix+"Direction"]=a.pixels[1][0]}g.forEach(r,function(c){H.attributes[c.name]=c.value});var D=N||A;if(c&&0<c.length&&(t=g.filter(c,function(c){if(c&&c.attributes)return c.attributes.hasOwnProperty("Value")?
c.attributes.Value==D:c.attributes.VALUE==D}),0<t.length&&(I=p.clone(t[0]),k&&I))){u={};for(F in I.attributes)I.attributes.hasOwnProperty(F)&&(v=k+F,u[v]=I.attributes[F]);I.attributes=u;H.attributes=p.mixin(H.attributes,I.attributes)}}d&&b&&0<b.length&&g.forEach(b,function(c){if(c){var a=H.attributes[c.name];h.isDefined(a)&&(a=this._getDomainValue(c.domain,a),h.isDefined(a)&&(H.attributes[c.name]=a))}},this);z.push(H);this._visibleRasters.push(H)}this._resolve([z,null,!0],null,e,f)}))}var J=c.value,
l=c.value,m,q,A=0,t=0,I=this,F=this.objectIdField,v,u,r=[];d=a.requestParams.renderingRules;var w=c.processedValues,N=this.renderingRule&&b.toJson(this._removeVisualizationStretchFunction(this.renderingRule).toJson());if(d&&w&&d.length===w.length){var D=this._rasterFieldPrefix+this._renderingRuleFieldSubPrefix;g.forEach(d,function(c,a){if(c.functionName){var e={name:D+c.functionName.replace(/ /gi,"_"),value:w[a].replace(/ /gi,"").split(",")};r.push(e);N&&N===b.toJson(c.toJson())&&(J=w[a])}})}d=this.infoTemplate&&
this.infoTemplate.info&&this.infoTemplate.info.layerOptions&&this.infoTemplate.info.layerOptions.hasOwnProperty("showNoDataRecords")?this.infoTemplate.info.layerOptions.showNoDataRecords:!0;if(c.catalogItems){var C=0,B,y,L=c.catalogItems.features.length;u=0;q=Array(L);m=Array(L);v=Array(L);for(A=0;A<L;A++)-1<c.properties.Values[A].toLowerCase().indexOf("nodata")&&u++;B=L-u;for(A=0;A<L;A++)u=!0,-1<c.properties.Values[A].toLowerCase().indexOf("nodata")?(y=B++,d||(u=!1,q.length--,m.length--,v.length--)):
y=C++,u&&(q[y]=c.catalogItems.features[A],m[y]=c.properties.Values[A],v[y]=q[y].attributes[F])}this._visibleRasters=[];var H;(c=-1<J.toLowerCase().indexOf("nodata"))&&!d&&(q=[],m=[],v=[]);!J||q||c||(F="ObjectId",q=[],H=new G(new K(this.fullExtent),null,{ObjectId:0}),q.push(H));var z=[];q?!this._map.spatialReference.equals(this.spatialReference)&&v&&0<v.length?n({url:this._url.path+"/query",content:{f:"json",objectIds:v.join(","),returnGeometry:!0,outSR:b.toJson(I._map.spatialReference.toJson()),outFields:F},
handleAs:"json",callbackParamName:"callback",load:function(c){if(0===c.features.length)I._resolve([z,null,null],null,e,f);else{for(A=0;A<c.features.length;A++)for(t=0;t<q.length;t++)q[t].attributes[F]==c.features[A].attributes[F]&&(q[t].geometry=new x(c.features[A].geometry),q[t].geometry.setSpatialReference(I._map.spatialReference));k.call(I)}},error:function(c){I._resolve([z,null,null],null,e,f)}}):k.call(this):this._resolve([z,null,null],null,e,f)},getVisibleRasters:function(){var c=this._visibleRasters,
a=[],b;for(b in c)c.hasOwnProperty(b)&&a.push(c[b]);return a},_getDomainFields:function(c){if(c){var a=[];g.forEach(c,function(c){if(c.domain){var b={};b.name=c.name;b.domain=c.domain;a.push(b)}});return a}},_getDomainValue:function(c,a){if(c&&c.codedValues){var b;g.some(c.codedValues,function(c){return c.code===a?(b=c.name,!0):!1});return b}},_requestData:function(c,a,b){this._rasterReadPromise&&this._rasterReadPromise.cancel();c=p.clone(c);var e=c._normalize(!0);this._prepareGetImageParameters(e,
a,b);a=p.clone(this._params);this._cleanupRequestParams(a);a.extent=c;a.format=a.format||(10.3<=this.version?"lerc":"jpgpng");"lerc"===a.format.toLowerCase()&&!a.lercVersion&&10.5<=this.version&&(a.lercVersion=2);b=null;this._useBrowserDecoding()&&(b=new B({ctx:this._context}));a={imageServiceParameters:a,nBands:Math.min(this.bandCount,3),pixelType:this.pixelType,decodeFunc:b?p.hitch(b,"decode"):null};this._rasterReadPromise=this.raster.read(a,this._requestDataHandler,this._requestDataErrorHandler)},
_requestDataHandler:function(c){this._rasterReadPromise&&this._rasterReadPromise.isCanceled()||(this.originalPixelData=c,this.hasDataChanged=!0,this._setPixelData(c))},_setPixelData:function(c){c=this._clonePixelData(c);this.pixelFilter&&this.pixelFilter(c);this.pixelData=c;this._rasterReadPromise&&this._rasterReadPromise.isCanceled()||(this._drawPixelData(),this._rasterReadPromise=null)},_clonePixelData:function(c){if(null===c||void 0===c)return c;var a={};c.extent&&(a.extent=p.clone(c.extent));
c=c.pixelBlock;if(null===c||void 0===c)return a;a.pixelBlock=c.clone();return a},_setDefaultFilter:function(){},_getPixelBlockFromCanvas:function(c,a,b){c=c.getImageData(0,0,a,b).data;for(var e=a*b,d=0,f=0,g=new Uint8Array(e),k=new Uint8Array(e),h=new Uint8Array(e),n=new Uint8Array(e),l=Infinity,q=Infinity,m=Infinity,A=-Infinity,J=-Infinity,G=-Infinity,t,F,I,d=0;d<e;d++)t=c[f++],F=c[f++],I=c[f++],l=l<t?l:t,A=A>t?A:t,q=q<F?q:F,J=J>F?J:F,m=m<I?m:I,G=G>I?G:I,g[d]=t,k[d]=F,h[d]=I,n[d]=c[f++]&1;return new E({width:a,
height:b,pixels:[g,k,h],pixelType:"U8",mask:n,statistics:[{minValue:l,maxValue:A},{minValue:q,maxValue:J},{minValue:m,maxValue:G}]})},_useBrowserDecoding:function(){return(void 0===this.pixelFilter||null===this.pixelFilter)&&("jpeg"===this.format.toLowerCase()||"jpg"===this.format.toLowerCase()||-1<this.format.toLowerCase().indexOf("png"))},getMultidimensionalInfo:function(){var c=this._url.path+"/multiDimensionalInfo",a=new u(l._dfdCanceller);if(this._multidimensionalInfo)return a.resolve(this._multidimensionalInfo),
a;10.3<=this.version&&this.hasMultidimensions?(a._pendingDfd=n({url:c,content:{f:"json"},handleAs:"json",callbackParamName:"callback"}),a._pendingDfd.then(p.hitch(this,function(c){this._multidimensionalInfo=c.multidimensionalInfo;a.callback(c.multidimensionalInfo)}),function(c){a.errback(c)})):(c=Error("Layer does not support multidimensional info"),c.log=!!d.isDebug,a.errback(c));return a},getDefaultMultidimensionalDefinition:function(){var c,a,b,e=[],d=new u(l._dfdCanceller),f;if(this._defaultMultidimensionalDefinition)return d.resolve(this._defaultMultidimensionalDefinition),
d;d._pendingDfd=this.getMultidimensionalInfo();d._pendingDfd.then(p.hitch(this,function(g){c=g;a=c.variables[0].dimensions;for(b in a)a.hasOwnProperty(b)&&"StdTime"!==a[b].name&&(f=a[b],e.push(new w({variableName:"",dimensionName:f.name,isSlice:!f.hasRanges,values:[this._getDefaultDimensionValue(f)]})));this._defaultMultidimensionalDefinition=e;d.callback(e)}),function(c){d.errback(c)});return d},_getDefaultDimensionValue:function(c){if(c&&c.values&&c.values.length){var a,b,d=Infinity,e,f;if(c.hasRanges)return c.values[0];
if(c.name&&"stdz"===c.name.toLowerCase()){for(f=0;f<c.values.length&&(e=c.values[f],b=Math.abs(e-0),b<d&&(d=b,a=e),0!==b);f++);return a}return c.extent[0]}},_setDefaultMultidimensionalDefinition:function(c){var a,b={};this.getDefaultMultidimensionalDefinition().then(p.hitch(this,function(e){a=e;0<a.length&&(this.mosaicRule?(b=p.clone(this.mosaicRule),b.multidimensionalDefinition=a):this.defaultMosaicRule?(b=p.clone(this.defaultMosaicRule),b.multidimensionalDefinition=a):b=new y({multidimensionalDefinition:a}),
this.setMosaicRule(b,c))}))},_setDefaultRenderingRule:function(c){var a={};if(!this.renderingRule&&"esri.layers.ArcGISImageServiceVectorLayer"!==this.declaredClass&&!this.bandIds&&this.rasterFunctionInfos&&this.rasterFunctionInfos.length&&"none"!==this.rasterFunctionInfos[0].name.toLowerCase())a.rasterFunction=this.rasterFunctionInfos[0].name;else if(!this.renderingRule&&"esri.layers.ArcGISImageServiceVectorLayer"===this.declaredClass&&10.3<this.version){var b="esriImageServiceDataTypeVector-UV"===
this.serviceDataType?7:10;a.rasterFunction="Resample";a.rasterFunctionArguments={ResamplingType:b,InputCellSize:{x:this.pixelSizeX,y:this.pixelSizeY}}}a.hasOwnProperty("rasterFunction")&&(this.defaultRenderingRule=new z(a),this.setRenderingRule(this.defaultRenderingRule,c))},_cleanupRequestParams:function(c){if(!c)return c;if(c.time&&c.mosaicRule){var a=new y(b.fromJson(c.mosaicRule)),a=this._filterOutTimeDimension(a);c.mosaicRule=b.toJson(a.toJson())}var a="displayOnPan drawMode styling id opacity visible resourceInfo useMapDimensionValue extent renderer".split(" "),
e;for(e in a)c.hasOwnProperty(a[e])&&delete c[a[e]];return c},_filterOutTimeDimension:function(c){if(c&&c.multidimensionalDefinition&&0<c.multidimensionalDefinition.length){var a=g.filter(c.multidimensionalDefinition,function(c){return"StdTime"!==c.dimensionName});c.multidimensionalDefinition=a}return c},_removeVisualizationStretchFunction:function(c){var a=c&&c.functionName;if(!a||"stretch"!==a.toLowerCase())return c;var b=c.functionArguments.Raster;return b&&b.functionName&&g.some(this.rasterFunctionInfos,
function(c){return b.functionName===c.name})?b:c},_isScientificData:function(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType||"esriImageServiceDataTypeScientific"===this.serviceDataType},_isVectorData:function(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType},_isRasterFunctionInfoAvailable:function(c){return g.some(c&&(this.rasterFunctionInfos||
[]),function(a){return a&&a.name&&a.name.toLowerCase()===c.toLowerCase()})},_createPixelData:function(c){c=new E({width:2,height:2,pixels:c,pixelType:this.pixelType,statistics:c});var a=this.fullExtent.getCenter(),a=new K(a.x,a.y,a.x+this.pixelSizeX,a.y+this.pixelSizeY,this.spatialReference);return{pixelBlock:c,extent:a}},_convertRendererToRenderingRule:function(a){var c=a&&a.declaredClass;if(!c||"esri.renderer.UniqueValueRenderer"!==c&&"esri.renderer.ClassBreaksRenderer"!==c&&"esri.renderer.StretchRenderer"!==
c)return null;var b=null;"esri.renderer.StretchRenderer"===c?b=a.toRenderingRule({convertToColormap:10.6>this.version}):"esri.renderer.ClassBreaksRenderer"===c?b=this._convertClassifyRenderer(a):"esri.renderer.UniqueValueRenderer"===c&&(b=this._convertUniqueValueRenderer(a));return b},_getValueField:function(a){if(a&&a.length){var c,b;g.some(a,function(a){if((b=a.name)&&"value"===b.toLowerCase())return c=b,!0});return c}},_convertClassifyRenderer:function(a){var c,b=[],e=[],d=[],f=[],k;c=this.renderingRule&&
this.renderingRule.functionName;var h,l,n=this.hasRasterAttributeTable,q,m;c&&(n=this._rasterFunctionTemplateInfos[c]?this._rasterFunctionTemplateInfos[c].hasRasterAttributeTable:this.hasRasterAttributeTable,l=this._renderingRuleAttributeTable[c],m=this._rasterFunctionTemplateInfos[c]);h=l&&l.features?l.features:this._rasterAttributeTableFeatures;q=this._getValueField(l&&l.fields?l.fields:this._rasterAttributeTableFields);n&&h?(g.forEach(a.infos,function(c,b){var e,d=c.symbol.color;d.a&&g.forEach(h,
function(g){e=g.attributes[a.attributeField];(e>=c.minValue&&e<c.maxValue||b===a.infos.length-1&&e>=c.minValue)&&f.push([g.attributes[q],d.r,d.g,d.b])},this)},this),c=m&&m.pixelType||this.pixelType,this._adjustColormapToPixelTypeRange(f,c),c=new z,c.functionName="Colormap",c.functionArguments={},c.functionArguments.Colormap=f,c.variableName="Raster"):(g.forEach(a.infos,function(a,c){k=a.symbol&&a.symbol.color;k.a?(b.push.call(b,a.minValue,a.maxValue),e.push(c),f.push([c,k.r,k.g,k.b])):d.push(a.minValue,
a.maxValue)}),c=new z,c.functionName="Remap",c.functionArguments={InputRanges:b,OutputValues:e,NoDataRanges:d},c.variableName="Raster",l=new z,l.functionName="Colormap",l.functionArguments={Colormap:f,Raster:c},c=l);return c},_convertUniqueValueRenderer:function(a){var c=[],b=this.renderingRule&&this.renderingRule.functionName,e,d,f,k;b&&(d=this._renderingRuleAttributeTable[b],k=this._rasterFunctionTemplateInfos[b]);e=d&&d.features?d.features:this._rasterAttributeTableFeatures;f=this._getValueField(d&&
d.fields?d.fields:this._rasterAttributeTableFields);g.forEach(a.infos,function(b){var d=b.symbol.color;d.a&&(a.attributeField!==f&&e?g.forEach(e,function(e){e.attributes[a.attributeField]==b.value&&c.push([e.attributes[f],d.r,d.g,d.b])},this):c.push([b.value,d.r,d.g,d.b]))},this);this._adjustColormapToPixelTypeRange(c,k&&k.pixelType||this.pixelType);b=new z;b.functionName="Colormap";b.functionArguments={};b.functionArguments.Colormap=c;b.variableName="Raster";return b},_adjustColormapToPixelTypeRange:function(a,
b){var c=this._pixelTypeRanges[b];c&&a.push([Math.floor(c[0]-1),0,0,0],[Math.ceil(c[1]+1),0,0,0]);return a},_combineRenderingRule:function(a,b){if(!a||!b)return a||b;var c=function(a){var b=a.Raster;return b=b&&"esri.layers.RasterFunction"===b.declaredClass?c(b.functionArguments):a},d=p.clone(a);c(d.functionArguments).Raster=b;return d},_resolve:function(a,b,d,e,f){b&&this[b].apply(this,a);d&&d.apply(null,a);e&&l._resDfd(e,a,f)},_toggleTime:function(){var a=this._map;this.timeInfo&&this.useMapTime&&
a&&!this.suspended?(this._timeConnect||(this._timeConnect=f.connect(a,"onTimeExtentChange",this,this._onTimeExtentChangeHandler)),this._setTime(a.timeExtent)):(f.disconnect(this._timeConnect),this._timeConnect=null,this._setTime(null))},setUseMapTime:function(a,b){this.useMapTime=a;this._toggleTime();!b&&this._map&&this.refresh(!0)},_setTime:function(a){this._params&&(this._params.time=a?a.toJson().join(","):null)},_onTimeExtentChangeHandler:function(a){this.suspended||(this._setTime(a),this.refresh(!0))},
handleSpatialReferenceChange:function(){this.onSpatialReferenceChange()}});a("extend-esri")&&p.setObject("layers.ImageServiceLayerMixin",r,m);return r})},"dojo/DeferredList":function(){define(["./_base/kernel","./_base/Deferred","./_base/array"],function(r,p,u){r.DeferredList=function(g,b,d,f,a){var e=[];p.call(this);var k=this;0!==g.length||b||this.resolve([0,[]]);var m=0;u.forEach(g,function(a,h){function n(a,b){e[h]=[a,b];m++;m===g.length&&k.resolve(e)}a.then(function(a){b?k.resolve([h,a]):n(!0,
a)},function(a){d?k.reject(a):n(!1,a);if(f)return null;throw a;})})};r.DeferredList.prototype=new p;r.DeferredList.prototype.gatherResults=function(g){g=new r.DeferredList(g,!1,!0,!1);g.addCallback(function(b){var d=[];u.forEach(b,function(b){d.push(b[1])});return d});return g};return r.DeferredList})},"esri/layers/MosaicRule":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../lang ../geometry/Point".split(" "),function(r,p,u,g,b,d){var f=r(null,{declaredClass:"esri.layers.MosaicRule",
method:null,where:null,sortField:null,sortValue:null,ascending:!1,lockRasterIds:null,viewpoint:null,objectIds:null,operation:null,multidimensionalDefinition:[],constructor:function(a){p.isObject(a)&&(p.mixin(this,a),a.mosaicMethod&&(this.method=a.mosaicMethod),this.method&&"esri"!==this.method.toLowerCase().substring(0,4)&&(this.method=this._getMethodEnum(this.method)),a.mosaicOperation&&(this.operation=a.mosaicOperation),this.operation&&"MT_"!==this.operation.toUpperCase().substring(0,3)&&(this.operation=
this._getOperatorEnum(this.operation)),a.fids&&(this.objectIds=a.fids),a.viewpoint&&(this.viewpoint=new d(a.viewpoint)),this.multidimensionalDefinition=a.multidimensionalDefinition||[])},toJson:function(){var a=null,d=this.multidimensionalDefinition?this.multidimensionalDefinition.length:0;if(d)for(var a=[],f=0;f<d;f++)a.push("esri.layers.DimensionalDefinition"===this.multidimensionalDefinition[f].declaredClass?this.multidimensionalDefinition[f].toJson():this.multidimensionalDefinition[f]);a={mosaicMethod:this.method,
where:this.where,sortField:this.sortField,sortValue:this.sortValue,ascending:this.ascending,lockRasterIds:this.lockRasterIds,viewpoint:this.viewpoint?this.viewpoint.toJson():null,fids:this.objectIds,mosaicOperation:this.operation,multidimensionalDefinition:a};return b.filter(a,function(a){if(null!==a)return!0})},_getMethodEnum:function(a){if(a){var b=f.METHOD_NONE;switch(a.toLowerCase()){case "byattribute":b=f.METHOD_ATTRIBUTE;break;case "center":b=f.METHOD_CENTER;break;case "lockraster":b=f.METHOD_LOCKRASTER;
break;case "nadir":b=f.METHOD_NADIR;break;case "northwest":b=f.METHOD_NORTHWEST;break;case "seamline":b=f.METHOD_SEAMLINE;break;case "viewpoint":b=f.METHOD_VIEWPOINT}return b}},_getOperatorEnum:function(a){if(a)switch(a.toLowerCase()){case "first":return f.OPERATION_FIRST;case "last":return f.OPERATION_LAST;case "max":return f.OPERATION_MAX;case "min":return f.OPERATION_MIN;case "blend":return f.OPERATION_BLEND;case "mean":return f.OPERATION_MEAN;case "sum":return f.OPERATION_SUM}}});p.mixin(f,{METHOD_NONE:"esriMosaicNone",
METHOD_CENTER:"esriMosaicCenter",METHOD_NADIR:"esriMosaicNadir",METHOD_VIEWPOINT:"esriMosaicViewpoint",METHOD_ATTRIBUTE:"esriMosaicAttribute",METHOD_LOCKRASTER:"esriMosaicLockRaster",METHOD_NORTHWEST:"esriMosaicNorthwest",METHOD_SEAMLINE:"esriMosaicSeamline",OPERATION_FIRST:"MT_FIRST",OPERATION_LAST:"MT_LAST",OPERATION_MIN:"MT_MIN",OPERATION_MAX:"MT_MAX",OPERATION_MEAN:"MT_MEAN",OPERATION_BLEND:"MT_BLEND",OPERATION_SUM:"MT_SUM"});u("extend-esri")&&p.setObject("layers.MosaicRule",f,g);return f})},
"esri/layers/DimensionalDefinition":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel","../lang"],function(r,p,u,g,b){r=r(null,{declaredClass:"esri.layers.DimensionalDefinition",variableName:null,dimensionName:null,values:[],isSlice:!1,constructor:function(b){p.isObject(b)&&p.mixin(this,b)},toJson:function(){return b.filter({variableName:this.variableName,dimensionName:this.dimensionName,values:this.values,isSlice:this.isSlice},function(b){return null!==b})}});u("extend-esri")&&
p.setObject("layers.DimensionalDefinition",r,g);return r})},"esri/layers/Raster":function(){define("require dojo/_base/declare dojo/_base/lang dojo/_base/Deferred dojo/_base/array dojo/_base/config dojo/json dojo/sniff ../kernel ../Evented ../request ../geometry/Extent ../SpatialReference ../deferredUtils ./PixelBlock ./rasterFormats/LercCodec ./rasterFormats/Lerc2Codec".split(" "),function(r,p,u,g,b,d,f,a,e,k,m,q,h,n,l,t,K){var D,x,y,z,w,C;p=p(k,{declaredClass:"esri.layers.Raster",imageServiceUrl:null,
validPixelTypes:"U1 U2 U4 U8 U16 U32 S8 S16 S32 F32".split(" "),validFormats:"lerc jpeg jpg jpgpng png png8 png24 png32 bip bsq tiff".split(" "),_eventMap:{"raster-read-complete":["pixelData","params"]},constructor:function(a){this.imageServiceUrl=a;this.registerConnectEvents();this._loadRasterFormatModules()},read:function(d,e,f){var k=this,c=new g(n._dfdCanceller);if(10>a("ie"))throw"This browser is not supported.";if(!d.imageServiceParameters)throw"Insufficient parameters to read data";var h=u.clone(d.imageServiceParameters),
l=d.pixelType;b.some(this.validPixelTypes,function(a){return a===l})||(h.pixelType="F32");b.some(this.validFormats,function(a){return a.toLowerCase()===h.format.toLowerCase()})||(h.format="lerc");var q=d.decodeFunc,A;this._prepareGetImageParameters(h);var G=h.width,t=h.height,F=h.extent;delete h.width;delete h.height;delete h.extent;c._pendingDfd=m({url:this.imageServiceUrl+"/exportImage",handleAs:"arraybuffer",content:u.mixin(h,{f:"image"}),load:function(a){k.decode(a,{width:G,height:t,planes:null,
pixelType:l,noDataValue:h.noData,format:h.format,decodeFunc:q}).then(function(a){A={pixelBlock:a,extent:F};k._resolve([A,h],"onRasterReadComplete",e,c)},function(a){k._resolve([a],null,f,c,!0)})},error:function(a){k._resolve([a],null,f,c,!0)}});return c.promise},decode:function(a,b){if(void 0===b||null===b)throw"missing decode options";var d,e;b.format&&(d=b.format.toUpperCase());"BSQ"!==d&&"BIP"!==d&&(d=this._getFormat(a));e=b.decodeFunc;if(void 0===e||null===e)e=this._getFormatDecoderDfd(d);return e(a,
b)},onRasterReadComplete:function(){},_prepareGetImageParameters:function(a){if(a.size&&a.bbox){var b=a.size.split(",");a.width=parseFloat(b[0]);a.height=parseFloat(b[1]);a.extent||(b=a.bbox.split(","),a.extent=new q(parseFloat(b[0]),parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3]),new h(a.bboxSR)))}else{if(!a.width||Math.floor(a.width)!==a.width||!a.height||Math.floor(a.height)!==a.height)throw"Incorrect Image Dimensions";if(!a.extent||"esri.geometry.Extent"!==a.extent.declaredClass)throw"Incorrect extent";
var b=a.extent,d=b.spatialReference.wkid||f.toJson(b.spatialReference.toJson());delete a._ts;u.mixin(a,{bbox:b.xmin+","+b.ymin+","+b.xmax+","+b.ymax,imageSR:d,bboxSR:d,size:a.width+","+a.height},a.disableClientCaching?{_ts:(new Date).getTime()}:{})}},_adjustExtent:function(a,b,d){var e=a.ymax-a.ymin,c=a.xmax-a.xmin;d>=b?a.ymax=a.ymin+c*b/d:a.xmax=a.xmin+e*d/b;return a},_resolve:function(a,b,d,e,c){b&&this[b].apply(this,a);d&&d.apply(null,a);e&&n._resDfd(e,a,c)},_getFormatDecoderDfd:function(a){var b=
null;switch(a){case "LERC":b=this._decodeLerc;break;case "LERC2":b=this._decodeLerc2;break;case "JPEG":b=this._decodeJpeg;break;case "PNG":b=this._decodePng;break;case "BSQ":b=this._decodeBsq;break;case "BIP":b=this._decodeBip;break;case "TIFF":b=this._decodeTiff;break;default:b=function(a,b){throw"The raster format is not supported";}}b=u.hitch(this,b);return function(d,e){var c=new g;try{var f;"LERC"===a||!0===w?(f=b(d,e),c.resolve(f)):C.then(function(){f=b(d,e);c.resolve(f)})}catch(I){c.reject(I)}return c}},
_getFormat:function(a){a=new Uint8Array(a,0,10);var b="";if(255===a[0]&&216===a[1])b="JPEG";else if(137===a[0]&&80===a[1]&&78===a[2]&&71===a[3])b="PNG";else if(67===a[0]&&110===a[1]&&116===a[2]&&90===a[3]&&73===a[4]&&109===a[5]&&97===a[6]&&103===a[7]&&101===a[8]&&32===a[9])b="LERC";else if(76===a[0]&&101===a[1]&&114===a[2]&&99===a[3]&&50===a[4]&&32===a[5])b="LERC2";else if(-1<String.fromCharCode.apply(null,a).toLowerCase().indexOf("error"))b="ERROR";else if(73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||
77===a[0]&&77===a[1]&&0===a[2]&&42===a[3])b="TIFF";return b},_validateDecodeParams:function(a){if(!a.height||Math.floor(a.height)!==a.height)throw"Height not provided.";if(!a.width||Math.floor(a.width)!==a.width)throw"Width not provided.";},_decodeJpeg:function(a,b){if(!D)throw"The jpeg decoder module is not loaded.";this._validateDecodeParams(b);var d=(new D).decode(a);if(!M(d,b))throw"The decoded image dimensions are incorrect.";var e=[],c,f;for(c=0;c<d.pixels.length;c++)f=d.pixels[c],e.push(this._calculateBandStatistics(f));
return new l({width:d.width,height:d.height,pixels:d.pixels,pixelType:"U8",mask:d.mask,statistics:e})},_decodePng:function(a,b){if(!x)throw"The png decoder module is not loaded.";this._validateDecodeParams(b);var d=new Uint8Array(a),e=new x(d),d=new Uint8Array(b.width*b.height*4);e.copyToImageData(d,e.decodePixels());for(var c=e=0,f,c=new Uint8Array(b.width*b.height),e=0;e<b.width*b.height;e++)c[e]=d[4*e+3];for(var g=new l({width:b.width,height:b.height,pixels:[],pixelType:"U8",mask:c,statistics:[]}),
e=0;3>e;e++){f=new Uint8Array(b.width*b.height);for(c=0;c<b.width*b.height;c++)f[c]=d[4*c+e];g.addData({pixels:f,statistics:this._calculateBandStatistics(f)})}return g},_decodeBsq:function(a,b){if(!y)throw"The bsq decoder module is not loaded.";this._validateDecodeParams(b);v=b.noDataValue;b.pixelType=B(b.pixelType);var d=y.decodeBSQ(a,{bandCount:b.planes,width:b.width,height:b.height,pixelType:E,noDataValue:v}),e=[],c,f=null;for(c=0;c<d.pixels.length;c++)f=d.pixels[c],e.push(this._calculateBandStatistics(f));
return new l({width:b.width,height:b.height,pixels:d.pixels,pixelType:b.pixelType,mask:d.maskData,statistics:e})},_decodeBip:function(a,b){this._validateDecodeParams(b);v=b.noDataValue;b.pixelType=B(b.pixelType);var d=y.decodeBIP(a,{bandCount:b.planes,width:b.width,height:b.height,pixelType:E,noDataValue:v}),e=[],c,f=null;for(c=0;c<d.pixels.length;c++)f=d.pixels[c],e.push(this._calculateBandStatistics(f));return new l({width:b.width,height:b.height,pixels:d.pixels,pixelType:b.pixelType,mask:d.maskData,
statistics:e})},_decodeTiff:function(a,b){this._validateDecodeParams(b);v=b.noDataValue;b.pixelType=B(b.pixelType);var d=z.decode(a),e=[],c,f=null;for(c=0;c<d.pixels.length;c++)f=d.pixels[c],e.push(this._calculateBandStatistics(f,d.maskData));return new l({width:d.width,height:d.height,pixels:d.pixels,pixelType:d.pixelType,mask:d.maskData,statistics:e})},_decodeLerc:function(a,b){this._validateDecodeParams(b);v=b.noDataValue;b.pixelType=B(b.pixelType);for(var d=0,e,c=0,f,g=a.byteLength-10;c<g;){var k=
t.decode(a,{inputOffset:c,encodedMaskData:e,returnMask:0===d?!0:!1,returnEncodedMask:0===d?!0:!1,returnFileInfo:!0,pixelType:E,noDataValue:v}),c=k.fileInfo.eofOffset;0===d&&(e=k.encodedMaskData,f=new l({width:b.width,height:b.height,pixels:[],pixelType:b.pixelType,mask:k.maskData,statistics:[]}));d++;if(!M(k,b))throw"The decoded image dimensions are incorrect";f.addData({pixels:k.pixelData,statistics:{minValue:k.minValue,maxValue:k.maxValue,noDataValue:k.noDataValue}})}return f},_decodeLerc2:function(a,
b){this._validateDecodeParams(b);v=b.noDataValue;b.pixelType=B(b.pixelType);for(var d=0,e,c,f=0,g,k=a.byteLength-10;f<k;){c=K.decode(a,{inputOffset:f,maskData:e,returnFileInfo:!0});f=c.fileInfo.eofOffset;0===d&&(e=c.maskData,g=new l({width:b.width,height:b.height,pixels:[],pixelType:c.fileInfo.pixelType,mask:c.maskData,statistics:[]}));d++;if(!M(c,b))throw"The decoded image dimensions are incorrect";g.addData({pixels:c.pixelData,statistics:{minValue:c.minValue,maxValue:c.maxValue,noDataValue:c.noDataValue}})}return g},
_calculateBandStatistics:function(a,b){var d=Infinity,e=-Infinity,c=a.length,f,g=0;if(b)for(f=0;f<c;f++)b[f]&&(g=a[f],d=g<d?g:d,e=g>e?g:e);else for(f=0;f<c;f++)g=a[f],d=g<d?g:d,e=g>e?g:e;return{minValue:d,maxValue:e}},_loadRasterFormatModules:function(){w||(C||(C=new g),10>a("ie")?C.isRejected()||C.reject("unsupported browser version"):r(["./rasterFormats/JpgPlus","./rasterFormats/Png","./rasterFormats/Raw","./rasterFormats/TiffDecoder","./rasterFormats/Zlib"],function(a,b,d,e){D=a;x=b;y=d;z=e;w=
!0;C.isResolved()||C.resolve(!0)}))}});var E=null,v=null,B=function(a){if("U1"===a||"U2"===a||"U4"===a||"U8"===a)return v=Math.pow(2,8)-1,E=Uint8Array,"U8";"U16"===a?(v=v||Math.pow(2,16)-1,E=Uint16Array):"U32"===a?(v=v||Math.pow(2,32)-1,E=Uint32Array):"S8"===a?(v=v||0-Math.pow(2,7),E=Int8Array):"S16"===a?(v=v||0-Math.pow(2,15),E=Int16Array):"S32"===a?(v=v||0-Math.pow(2,31),E=Int32Array):E=Float32Array;return a},M=function(a,b){return a.height!==b.height||a.width!==b.width?!1:!0};a("extend-esri")&&
u.setObject("layers.Raster",p,e);return p})},"esri/layers/PixelBlock":function(){define(["dojo/_base/declare","dojo/_base/lang","dojo/has","../kernel"],function(r,p,u,g){r=r([],{declaredClass:"esri.layers.PixelBlock",planes:null,width:null,height:null,pixelType:null,pixels:[],statistics:[],constructor:function(b){if(b){if(!b.width||Math.floor(b.width)!==b.width)throw"PixelBlock: incorrect width";if(!b.height||Math.floor(b.height)!==b.height)throw"PixelBlock: incorrect height";if(!b.pixels||!b.statistics)throw"PixelBlock: pixel data or statistics not present";
this.width=b.width;this.height=b.height;this.pixels=b.pixels;this.pixelType=b.pixelType||null;this.statistics=b.statistics;this.mask=b.mask||null}},getPlaneCount:function(){return this.pixels.length!==this.statistics.length?console.error("Inconsistent pixel data and statistics"):this.statistics.length},addData:function(b){if(!b.pixels||!b.statistics)throw"Pixel data or statistics are not present";if(b.pixels.length!==this.width*this.height)throw"Inconsistent pixel data size";this.statistics.push(b.statistics);
this.pixels.push(b.pixels)},getAsRGBA:function(){var b=new ArrayBuffer(this.width*this.height*4);switch(this.pixelType){case "S8":case "S16":case "U16":case "S32":case "U32":case "F32":case "F64":this._fillFromNon8Bit(b);break;default:this._fillFrom8Bit(b)}return new Uint8ClampedArray(b)},getAsRGBAFloat:function(){var b=new Float32Array(this.width*this.height*4);this._fillFrom32Bit(b);return b},clone:function(){var b=new this.constructor;b.width=this.width;b.height=this.height;b.pixelType=this.pixelType;
this.mask&&(b.mask=new Uint8Array(this.mask));var d,f;if(this.pixels)for(b.pixels=[],f=this.pixels.length,d=0;d<f;d++)b.pixels[d]=new Float32Array(this.pixels[d]);if(this.statistics)for(b.statistics=[],f=this.statistics.length,d=0;d<f;d++)b.statistics[d]=p.clone(this.statistics[d]);return b},_fillFrom8Bit:function(b){var d=this.pixels,f=this.mask;if(!b||!d||!d.length)return console.error("Unable to convert to RGBA. The input pixel block is empty.");var a,e,g;a=e=g=d[0];3<=d.length&&(e=d[1],g=d[2]);
var d=new Uint32Array(b),m=this.width*this.height;if(a.length!==m)return console.error("Unable to convert to RGBA. The pixelblock is invalid.");if(f&&f.length===m)for(b=0;b<m;b++)f[b]&&(d[b]=-16777216|g[b]<<16|e[b]<<8|a[b]);else for(b=0;b<m;b++)d[b]=-16777216|g[b]<<16|e[b]<<8|a[b]},_fillFromNon8Bit:function(b){var d=this.pixels,f=this.mask,a=this.statistics;if(!b||!d||!d.length)return console.error("Unable to convert to RGBA. The input pixel block is empty.");var e=1,g=0;a&&0<a.length?(g=a[0].minValue,
e=255/(a[0].maxValue-a[0].minValue)):(e=255,"S8"===this.pixelType?(g=-128,e=127):"U16"===this.pixelType?e=65535:"S16"===this.pixelType?(g=-32768,e=32767):"U32"===this.pixelType?e=4294967295:"S32"===this.pixelType?(g=-2147483648,e=2147483647):"F32"===this.pixelType?(g=-3.4*1E39,e=3.4*1E39):"F64"===this.pixelType&&(g=-Number.MAX_VALUE,e=Number.MAX_VALUE),e=255/(e-g));b=new Uint32Array(b);var a=this.width*this.height,m,q,h;m=d[0];if(m.length!==a)return console.error("Unable to convert to RGBA. The pixelblock is invalid.");
if(3<=d.length)if(q=d[1],h=d[2],f&&f.length===a)for(d=0;d<a;d++)f[d]&&(b[d]=-16777216|(h[d]-g)*e<<16|(q[d]-g)*e<<8|(m[d]-g)*e);else for(d=0;d<a;d++)b[d]=-16777216|(h[d]-g)*e<<16|(q[d]-g)*e<<8|(m[d]-g)*e;else if(f&&f.length===a)for(d=0;d<a;d++)q=(m[d]-g)*e,f[d]&&(b[d]=-16777216|q<<16|q<<8|q);else for(d=0;d<a;d++)q=(m[d]-g)*e,b[d]=-16777216|q<<16|q<<8|q},_fillFrom32Bit:function(b){var d=this.pixels,f=this.mask;if(!b||!d||!d.length)return console.error("Unable to convert to RGBA. The input pixel block is empty.");
var a,e,g;a=e=g=d[0];3<=d.length&&(e=d[1],g=d[2]);var m=this.width*this.height;if(a.length!==m)return console.error("Unable to convert to RGBA. The pixelblock is invalid.");var q=0;if(f&&f.length===m)for(d=0;d<m;d++)b[q++]=a[d],b[q++]=e[d],b[q++]=g[d],b[q++]=f[d];else for(d=0;d<m;d++)b[q++]=a[d],b[q++]=e[d],b[q++]=g[d],b[q++]=255}});u("extend-esri")&&p.setObject("layers.PixelBlock",r,g);return r})},"esri/layers/rasterFormats/LercCodec":function(){define([],function(){var r={defaultNoDataValue:-3.4027999387901484E38,
decode:function(u,g){var b;g=g||{};var d=g.inputOffset||0,f=g.encodedMaskData||null===g.encodedMaskData,a={},e=new Uint8Array(u,d,10);a.fileIdentifierString=String.fromCharCode.apply(null,e);if("CntZImage"!=a.fileIdentifierString.trim())throw"Unexpected file identifier string: "+a.fileIdentifierString;d+=10;e=new DataView(u,d,24);a.fileVersion=e.getInt32(0,!0);a.imageType=e.getInt32(4,!0);a.height=e.getUint32(8,!0);a.width=e.getUint32(12,!0);a.maxZError=e.getFloat64(16,!0);d+=24;if(!f)if(e=new DataView(u,
d,16),a.mask={},a.mask.numBlocksY=e.getUint32(0,!0),a.mask.numBlocksX=e.getUint32(4,!0),a.mask.numBytes=e.getUint32(8,!0),a.mask.maxValue=e.getFloat32(12,!0),d+=16,0<a.mask.numBytes){var f=new Uint8Array(Math.ceil(a.width*a.height/8)),e=new DataView(u,d,a.mask.numBytes),k=e.getInt16(0,!0),m=2,q=0;do{if(0<k)for(;k--;)f[q++]=e.getUint8(m++);else for(var h=e.getUint8(m++),k=-k;k--;)f[q++]=h;k=e.getInt16(m,!0);m+=2}while(m<a.mask.numBytes);if(-32768!==k||q<f.length)throw"Unexpected end of mask RLE encoding";
a.mask.bitset=f;d+=a.mask.numBytes}else 0===(a.mask.numBytes|a.mask.numBlocksY|a.mask.maxValue)&&(f=new Uint8Array(Math.ceil(a.width*a.height/8)),a.mask.bitset=f);e=new DataView(u,d,16);a.pixels={};a.pixels.numBlocksY=e.getUint32(0,!0);a.pixels.numBlocksX=e.getUint32(4,!0);a.pixels.numBytes=e.getUint32(8,!0);a.pixels.maxValue=e.getFloat32(12,!0);d+=16;f=a.pixels.numBlocksX;e=a.pixels.numBlocksY;f+=0<a.width%f?1:0;k=e+(0<a.height%e?1:0);a.pixels.blocks=Array(f*k);for(q=m=0;q<k;q++)for(h=0;h<f;h++){var n=
0,e=new DataView(u,d,Math.min(10,u.byteLength-d)),l={};a.pixels.blocks[m++]=l;var t=e.getUint8(0);n++;l.encoding=t&63;if(3<l.encoding)throw"Invalid block encoding ("+l.encoding+")";if(2===l.encoding)d++;else{if(0!==t&&2!==t){t>>=6;l.offsetType=t;if(2===t)l.offset=e.getInt8(1),n++;else if(1===t)l.offset=e.getInt16(1,!0),n+=2;else if(0===t)l.offset=e.getFloat32(1,!0),n+=4;else throw"Invalid block offset type";if(1===l.encoding)if(t=e.getUint8(n),n++,l.bitsPerPixel=t&63,t>>=6,l.numValidPixelsType=t,
2===t)l.numValidPixels=e.getUint8(n),n++;else if(1===t)l.numValidPixels=e.getUint16(n,!0),n+=2;else if(0===t)l.numValidPixels=e.getUint32(n,!0),n+=4;else throw"Invalid valid pixel count type";}d+=n;if(3!=l.encoding)if(0===l.encoding){t=(a.pixels.numBytes-1)/4;if(t!==Math.floor(t))throw"uncompressed block has invalid length";e=new ArrayBuffer(4*t);n=new Uint8Array(e);n.set(new Uint8Array(u,d,4*t));e=new Float32Array(e);l.rawData=e;d+=4*t}else 1===l.encoding&&(t=Math.ceil(l.numValidPixels*l.bitsPerPixel/
8),e=new ArrayBuffer(4*Math.ceil(t/4)),n=new Uint8Array(e),n.set(new Uint8Array(u,d,t)),l.stuffedData=new Uint32Array(e),d+=t)}}a.eofOffset=d;var d=null!=g.noDataValue?g.noDataValue:r.defaultNoDataValue,k=g.encodedMaskData,K=g.returnMask,m=0,q=a.pixels.numBlocksX,h=a.pixels.numBlocksY,l=Math.floor(a.width/q),n=Math.floor(a.height/h),t=2*a.maxZError,e=Number.MAX_VALUE,D,k=k||(a.mask?a.mask.bitset:null),x,f=new (g.pixelType||Float32Array)(a.width*a.height);K&&k&&(x=new Uint8Array(a.width*a.height));
for(var K=new Float32Array(l*n),y,z,w=0;w<=h;w++){var C=w!==h?n:a.height%h;if(0!==C)for(var E=0;E<=q;E++){var v=E!==q?l:a.width%q;if(0!==v){var B=w*a.width*n+E*l,M=a.width-v,A=a.pixels.blocks[m],G,F;if(2>A.encoding){if(0===A.encoding)G=A.rawData;else{G=A.stuffedData;F=A.bitsPerPixel;D=A.numValidPixels;y=A.offset;z=t;var N=K,c=a.pixels.maxValue,J=(1<<F)-1,I=0,L=void 0,H=0,P=void 0,Q=void 0,R=Math.ceil((c-y)/z);G[G.length-1]<<=8*(4*G.length-Math.ceil(F*D/8));for(L=0;L<D;L++)0===H&&(Q=G[I++],H=32),H>=
F?(P=Q>>>H-F&J,H-=F):(H=F-H,P=(Q&J)<<H&J,Q=G[I++],H=32-H,P+=Q>>>H),N[L]=P<R?y+P*z:c;G=K}F=0}else b=2===A.encoding?0:A.offset;var O;if(k)for(z=0;z<C;z++){B&7&&(O=k[B>>3],O<<=B&7);for(y=0;y<v;y++)B&7||(O=k[B>>3]),O&128?(x&&(x[B]=1),D=2>A.encoding?G[F++]:b,e=e>D?D:e,f[B++]=D):(x&&(x[B]=0),f[B++]=d),O<<=1;B+=M}else if(2>A.encoding)for(z=0;z<C;z++){for(y=0;y<v;y++)D=G[F++],e=e>D?D:e,f[B++]=D;B+=M}else for(e=e>b?b:e,z=0;z<C;z++){for(y=0;y<v;y++)f[B++]=b;B+=M}if(1===A.encoding&&F!==A.numValidPixels)throw"Block and Mask do not match";
m++}}}b=x;x={width:a.width,height:a.height,pixelData:f,minValue:e,maxValue:a.pixels.maxValue,noDataValue:d};b&&(x.maskData=b);g.returnEncodedMask&&a.mask&&(x.encodedMaskData=a.mask.bitset?a.mask.bitset:null);if(g.returnFileInfo&&(x.fileInfo=p(a),g.computeUsedBitDepths)){b=x.fileInfo;O=a.pixels.numBlocksX*a.pixels.numBlocksY;G={};for(F=0;F<O;F++)d=a.pixels.blocks[F],0===d.encoding?G.float32=!0:1===d.encoding?G[d.bitsPerPixel]=!0:G[0]=!0;a=Object.keys(G);b.bitDepths=a}return x}},p=function(p){return{fileIdentifierString:p.fileIdentifierString,
fileVersion:p.fileVersion,imageType:p.imageType,height:p.height,width:p.width,maxZError:p.maxZError,eofOffset:p.eofOffset,mask:p.mask?{numBlocksX:p.mask.numBlocksX,numBlocksY:p.mask.numBlocksY,numBytes:p.mask.numBytes,maxValue:p.mask.maxValue}:null,pixels:{numBlocksX:p.pixels.numBlocksX,numBlocksY:p.pixels.numBlocksY,numBytes:p.pixels.numBytes,maxValue:p.pixels.maxValue,noDataValue:this.noDataValue}}};return r})},"esri/layers/rasterFormats/Lerc2Codec":function(){define([],function(){var r={unstuff:function(g,
b,d,f,a,e,k,m){var q=(1<<d)-1,h=0,n,l=0,t,p;g[g.length-1]<<=8*(4*g.length-Math.ceil(d*f/8));if(a)for(n=0;n<f;n++)0===l&&(p=g[h++],l=32),l>=d?(t=p>>>l-d&q,l-=d):(l=d-l,t=(p&q)<<l&q,p=g[h++],l=32-l,t+=p>>>l),b[n]=a[t];else for(a=Math.ceil((m-e)/k),n=0;n<f;n++)0===l&&(p=g[h++],l=32),l>=d?(t=p>>>l-d&q,l-=d):(l=d-l,t=(p&q)<<l&q,p=g[h++],l=32-l,t+=p>>>l),b[n]=t<a?e+t*k:m},unstuffLUT:function(g,b,d,f,a,e){var k=(1<<b)-1,m=0,q=0,h=0,n=h=0,l,t=[];g[g.length-1]<<=8*(4*g.length-Math.ceil(b*d/8));for(var p=Math.ceil((e-
f)/a),q=0;q<d;q++)0===h&&(l=g[m++],h=32),h>=b?(n=l>>>h-b&k,h-=b):(h=b-h,n=(l&k)<<h&k,l=g[m++],h=32-h,n+=l>>>h),t[q]=n<p?f+n*a:e;t.unshift(f);return t},unstuff2:function(g,b,d,f,a,e,k,m){var q=(1<<d)-1,h=0,n,l=0,t=0,p,r,u;if(a)for(n=0;n<f;n++)0===l&&(r=g[h++],l=32,t=0),l>=d?(p=r>>>t&q,l-=d,t+=d):(u=d-l,p=r>>>t&q,r=g[h++],l=32-u,p|=(r&(1<<u)-1)<<d-u,t=u),b[n]=a[p];else for(a=Math.ceil((m-e)/k),n=0;n<f;n++)0===l&&(r=g[h++],l=32,t=0),l>=d?(p=r>>>t&q,l-=d,t+=d):(u=d-l,p=r>>>t&q,r=g[h++],l=32-u,p|=(r&(1<<
u)-1)<<d-u,t=u),b[n]=p<a?e+p*k:m;return b},unstuffLUT2:function(g,b,d,f,a,e){for(var k=(1<<b)-1,m=0,q=0,h=0,n=0,l=0,p=0,r,u=[],x=Math.ceil((e-f)/a),q=0;q<d;q++)0===n&&(r=g[m++],n=32,p=0),n>=b?(l=r>>>p&k,n-=b,p+=b):(h=b-n,l=r>>>p&k,r=g[m++],n=32-h,l|=(r&(1<<h)-1)<<b-h,p=h),u[q]=l<x?f+l*a:e;u.unshift(f);return u},originalUnstuff:function(g,b,d,f){var a=(1<<d)-1,e=0,k,m=0,q,h;g[g.length-1]<<=8*(4*g.length-Math.ceil(d*f/8));for(k=0;k<f;k++)0===m&&(h=g[e++],m=32),m>=d?(q=h>>>m-d&a,m-=d):(m=d-m,q=(h&a)<<
m&a,h=g[e++],m=32-m,q+=h>>>m),b[k]=q;return b},originalUnstuff2:function(g,b,d,f){var a=(1<<d)-1,e=0,k,m=0,q=0,h,n,l;for(k=0;k<f;k++)0===m&&(n=g[e++],m=32,q=0),m>=d?(h=n>>>q&a,m-=d,q+=d):(l=d-m,h=n>>>q&a,n=g[e++],m=32-l,h|=(n&(1<<l)-1)<<d-l,q=l),b[k]=h;return b}},p={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(g){for(var b=65535,d=65535,f=g.length,a=Math.floor(f/2),e=0;a;){var k=359<=a?359:a,a=a-k;do b+=g[e++]<<8,d+=b+=g[e++];while(--k);b=(b&65535)+(b>>>16);d=(d&65535)+(d>>>16)}f&1&&
(d+=b+=g[e]<<8);return((d&65535)+(d>>>16)<<16|(b&65535)+(b>>>16))>>>0},readHeaderInfo:function(g,b){var d=b.ptr,f=new Uint8Array(g,d,6),a={};a.fileIdentifierString=String.fromCharCode.apply(null,f);if(0!==a.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+a.fileIdentifierString;d+=6;f=new DataView(g,d,52);a.fileVersion=f.getInt32(0,!0);d+=4;3<=a.fileVersion&&(a.checksum=f.getUint32(4,!0),d+=4);f=new DataView(g,d,48);a.height=f.getUint32(0,!0);
a.width=f.getUint32(4,!0);a.numValidPixel=f.getUint32(8,!0);a.microBlockSize=f.getInt32(12,!0);a.blobSize=f.getInt32(16,!0);a.imageType=f.getInt32(20,!0);a.maxZError=f.getFloat64(24,!0);a.zMin=f.getFloat64(32,!0);a.zMax=f.getFloat64(40,!0);d+=48;b.headerInfo=a;b.ptr=d;if(3<=a.fileVersion&&(d=this.computeChecksumFletcher32(new Uint8Array(g,d-48,a.blobSize-14)),d!==a.checksum))throw"Checksum failed.";return!0},readMask:function(g,b){var d=b.ptr,f=b.headerInfo,a=f.width*f.height,e=f.numValidPixel,k=
new DataView(g,d,4),f={};f.numBytes=k.getUint32(0,!0);d+=4;if((0===e||a===e)&&0!==f.numBytes)throw"invalid mask";if(0===e)e=new Uint8Array(Math.ceil(a/8)),f.bitset=e,k=new Uint8Array(a),b.pixels.resultMask=k,d+=f.numBytes;else if(0<f.numBytes){var e=new Uint8Array(Math.ceil(a/8)),k=new DataView(g,d,f.numBytes),m=k.getInt16(0,!0),q=2,h=0,n=0;do{if(0<m)for(;m--;)e[h++]=k.getUint8(q++);else for(n=k.getUint8(q++),m=-m;m--;)e[h++]=n;m=k.getInt16(q,!0);q+=2}while(q<f.numBytes);if(-32768!==m||h<e.length)throw"Unexpected end of mask RLE encoding";
k=new Uint8Array(a);for(q=q=m=0;q<a;q++)q&7?(m=e[q>>3],m<<=q&7):m=e[q>>3],m&128&&(k[q]=1);b.pixels.resultMask=k;f.bitset=e;d+=f.numBytes}b.ptr=d;b.mask=f;return!0},readDataOneSweep:function(g,b,d){var f=b.ptr,a=b.headerInfo,e=a.width*a.height,a=a.numValidPixel*p.getDateTypeSize(a.imageType);if(d===Uint8Array)g=new Uint8Array(g,f,a);else{var k=new ArrayBuffer(a);(new Uint8Array(k)).set(new Uint8Array(g,f,a));g=new d(k)}if(g.length===e)b.pixels.resultPixels=g;else for(b.pixels.resultPixels=new d(e),
k=k=d=0;k<e;k++)b.pixels.resultMask[k]&&(b.pixels.resultPixels[k]=g[d++]);b.ptr=f+a;return!0},readHuffman:function(g,b,d){var f=b.headerInfo,a=f.width*f.height,e=this.HUFFMAN_LUT_BITS_MAX,f=new DataView(g,b.ptr,16);b.ptr+=16;if(2>f.getInt32(0,!0))throw"unsupported Huffman version";var k=f.getInt32(4,!0),m=f.getInt32(8,!0),q=f.getInt32(12,!0);if(m>=q)return!1;var h=new Uint32Array(q-m);p.decodeBits(g,b,h);for(var n=[],l,t,f=m;f<q;f++)l=f-(f<k?0:k),n[l]={first:h[f-m],second:null};f=g.byteLength-b.ptr;
h=new ArrayBuffer(4*Math.ceil(f/4));(new Uint8Array(h)).set(new Uint8Array(g,b.ptr,f));g=new Uint32Array(h);var h=0,r,D=0;r=g[0];for(f=m;f<q;f++)l=f-(f<k?0:k),t=n[l].first,0<t&&(n[l].second=r<<h>>>32-t,32-h>=t?(h+=t,32===h&&(h=0,D++,r=g[D])):(h+=t-32,D++,r=g[D],n[l].second|=r>>>32-h));for(var x=0===b.headerInfo.imageType?128:0,y=b.headerInfo.height,z=b.headerInfo.width,w=0,C=0,E=new u,f=0;f<n.length;f++)void 0!==n[f]&&(w=Math.max(w,n[f].first));C=w>=e?e:w;30<=w&&console.log("WARning, large NUM LUT BITS IS "+
w);for(var e=[],v,f=m;f<q;f++)if(l=f-(f<k?0:k),t=n[l].first,0<t)if(r=[t,l],t<=C)for(l=n[l].second<<C-t,v=1<<C-t,m=0;m<v;m++)e[l|m]=r;else for(l=n[l].second,v=E,m=t-1;0<=m;m--)(t=l>>>m&1)?(v.right||(v.right=new u),v=v.right):(v.left||(v.left=new u),v=v.left),0!==m||v.val||(v.val=r[1]);var k=b.pixels.resultMask,B,n=q=0;0<h&&(D++,h=0);r=g[D];d=new d(a);if(b.headerInfo.numValidPixel===z*y)for(f=m=0;f<y;f++)for(l=0;l<z;l++,m++){a=0;n=B=r<<h>>>32-C;32-h<C&&(n=B|=g[D+1]>>>64-h-C);if(e[n])a=e[n][1],h+=e[n][0];
else for(n=B=r<<h>>>32-w,32-h<w&&(n=B|=g[D+1]>>>64-h-w),v=E,n=0;n<w;n++)if(v=(t=B>>>w-n-1&1)?v.right:v.left,!v.left&&!v.right){a=v.val;h=h+n+1;break}32<=h&&(h-=32,D++,r=g[D]);a-=x;a=0<l?a+q:0<f?a+d[m-z]:a+q;a&=255;q=d[m]=a}else for(f=m=0;f<y;f++)for(l=0;l<z;l++,m++)if(k[m]){a=0;n=B=r<<h>>>32-C;32-h<C&&(n=B|=g[D+1]>>>64-h-C);if(e[n])a=e[n][1],h+=e[n][0];else for(n=B=r<<h>>>32-w,32-h<w&&(n=B|=g[D+1]>>>64-h-w),v=E,n=0;n<w;n++)if(v=(t=B>>>w-n-1&1)?v.right:v.left,!v.left&&!v.right){a=v.val;h=h+n+1;break}32<=
h&&(h-=32,D++,r=g[D]);a-=x;a=0<l&&k[m-1]?a+q:0<f&&k[m-z]?a+d[m-z]:a+q;a&=255;q=d[m]=a}b.pixels.resultPixels=d;b.ptr=b.ptr+4*(D+1)+(0<h?4:0)},decodeBits:function(g,b,d,f){var a=b.headerInfo.fileVersion,e=0,k=new DataView(g,b.ptr,5),m=k.getUint8(0);e++;var q=m>>6,h=0===q?4:3-q,n=0<(m&32)?!0:!1,q=m&31,m=0;if(1===h)m=k.getUint8(e),e++;else if(2===h)m=k.getUint16(e,!0),e+=2;else if(4===h)m=k.getUint32(e,!0),e+=4;else throw"Invalid valid pixel count type";var h=2*b.headerInfo.maxZError,l,p,u;if(n){b.counter.lut++;
u=k.getUint8(e);e++;n=Math.ceil((u-1)*q/8);l=Math.ceil(n/4);l=new ArrayBuffer(4*l);p=new Uint8Array(l);b.ptr+=e;p.set(new Uint8Array(g,b.ptr,n));e=new Uint32Array(l);b.ptr+=n;for(k=0;u-1>>>k;)k++;n=Math.ceil(m*k/8);l=Math.ceil(n/4);l=new ArrayBuffer(4*l);p=new Uint8Array(l);p.set(new Uint8Array(g,b.ptr,n));g=new Uint32Array(l);b.ptr+=n;b=3<=a?r.unstuffLUT2(e,q,u-1,f,h,b.headerInfo.zMax):r.unstuffLUT(e,q,u-1,f,h,b.headerInfo.zMax);3<=a?r.unstuff2(g,d,k,m,b):r.unstuff(g,d,k,m,b)}else b.counter.bitstuffer++,
k=q,b.ptr+=e,0<k&&(n=Math.ceil(m*k/8),l=Math.ceil(n/4),l=new ArrayBuffer(4*l),p=new Uint8Array(l),p.set(new Uint8Array(g,b.ptr,n)),g=new Uint32Array(l),b.ptr+=n,3<=a?null==f?r.originalUnstuff2(g,d,k,m):r.unstuff2(g,d,k,m,!1,f,h,b.headerInfo.zMax):null==f?r.originalUnstuff(g,d,k,m):r.unstuff(g,d,k,m,!1,f,h,b.headerInfo.zMax))},readTiles:function(g,b,d){var f=b.headerInfo,a=f.width,e=f.height,k=f.microBlockSize,f=f.imageType,m=Math.ceil(a/k),q=Math.ceil(e/k);b.pixels.numBlocksY=q;b.pixels.numBlocksX=
m;for(var h=b.pixels.ptr=0,n=0,l=0,t=0,r=0,u=0,x=0,y=0,z=h=0,w=0,C=0,x=x=h=x=0,E,v=new d(k*k),e=e%k||k,B=a%k||k,l=0;l<q;l++)for(r=l!==q-1?k:e,t=0;t<m;t++){u=t!==m-1?k:B;w=l*a*k+t*k;C=a-u;x=g.byteLength-b.ptr;n=new DataView(g,b.ptr,Math.min(10,x));E={};x=0;y=n.getUint8(0);x++;h=y>>6&255;z=y>>2&15;if(z!==(t*k>>3&15))throw"integrity issue";y&=3;if(3<y)throw b.ptr+=x,"Invalid block encoding ("+y+")";if(2===y)b.counter.constant++,b.ptr+=x;else if(0===y){b.counter.uncompressed++;b.ptr+=x;x=r*u*p.getDateTypeSize(f);
h=g.byteLength-b.ptr;x=x<h?x:h;h=new ArrayBuffer(x);n=new Uint8Array(h);n.set(new Uint8Array(g,b.ptr,x));E=new d(h);x=0;if(b.pixels.resultMask)for(h=0;h<r;h++){for(n=0;n<u;n++)b.pixels.resultMask[w]&&(b.pixels.resultPixels[w]=E[x++]),w++;w+=C}else for(h=0;h<r;h++){for(n=0;n<u;n++)b.pixels.resultPixels[w++]=E[x++];w+=C}b.ptr+=x*p.getDateTypeSize(f)}else if(h=p.getDataTypeUsed(f,h),E=p.getOnePixel(E,x,h,n),x+=p.getDateTypeSize(h),3===y)if(b.ptr+=x,b.counter.constantoffset++,b.pixels.resultMask)for(h=
0;h<r;h++){for(n=0;n<u;n++)b.pixels.resultMask[w]&&(b.pixels.resultPixels[w]=E),w++;w+=C}else for(h=0;h<r;h++){for(n=0;n<u;n++)b.pixels.resultPixels[w++]=E;w+=C}else if(b.ptr+=x,p.decodeBits(g,b,v,E),x=0,b.pixels.resultMask)for(h=0;h<r;h++){for(n=0;n<u;n++)b.pixels.resultMask[w]&&(b.pixels.resultPixels[w]=v[x++]),w++;w+=C}else for(h=0;h<r;h++){for(n=0;n<u;n++)b.pixels.resultPixels[w++]=v[x++];w+=C}}},formatFileInfo:function(g){return{fileIdentifierString:g.headerInfo.fileIdentifierString,fileVersion:g.headerInfo.fileVersion,
imageType:g.headerInfo.imageType,height:g.headerInfo.height,width:g.headerInfo.width,numValidPixel:g.headerInfo.numValidPixel,microBlockSize:g.headerInfo.microBlockSize,blobSize:g.headerInfo.blobSize,maxZError:g.headerInfo.maxZError,pixelType:p.getPixelType(g.headerInfo.imageType),eofOffset:g.eofOffset,mask:g.mask?{numBytes:g.mask.numBytes}:null,pixels:{numBlocksX:g.pixels.numBlocksX,numBlocksY:g.pixels.numBlocksY,maxValue:g.headerInfo.zMax,minValue:g.headerInfo.zMin,noDataValue:g.noDataValue}}},
constructConstantSurface:function(g){var b=g.headerInfo.zMax,d=g.headerInfo.height*g.headerInfo.width,f=0;if(g.pixels.resultMask)for(f=0;f<d;f++)g.pixels.resultMask[f]&&(g.pixels.resultPixels[f]=b);else for(f=0;f<d;f++)g.pixels.resultPixels[f]=b},getDataTypeArray:function(g){switch(g){case 0:g=Int8Array;break;case 1:g=Uint8Array;break;case 2:g=Int16Array;break;case 3:g=Uint16Array;break;case 4:g=Int32Array;break;case 5:g=Uint32Array;break;case 6:g=Float32Array;break;case 7:g=Float64Array;break;default:g=
Float32Array}return g},getPixelType:function(g){switch(g){case 0:g="S8";break;case 1:g="U8";break;case 2:g="S16";break;case 3:g="U16";break;case 4:g="S32";break;case 5:g="U32";break;case 6:g="F32";break;case 7:g="F64";break;default:g="F32"}return g},isValidPixelValue:function(g,b){if(null===b||void 0===b)return!1;var d;switch(g){case 0:d=-128<=b&&127>=b;break;case 1:d=0<=b&&255>=b;break;case 2:d=-32768<=b&&32767>=b;break;case 3:d=0<=b&&65536>=b;break;case 4:d=-2147483648<=b&&2147483647>=b;break;case 5:d=
0<=b&&4294967296>=b;break;case 6:d=-3.4027999387901484E38<=b&&3.4027999387901484E38>=b;break;case 7:d=4.9E-324<=b&&1.7976931348623157E308>=b;break;default:d=!1}return d},getDateTypeSize:function(g){var b=0;switch(g){case 0:case 1:b=1;break;case 2:case 3:b=2;break;case 4:case 5:case 6:b=4;break;case 7:b=8;break;default:b=g}return b},getDataTypeUsed:function(g,b){var d=g;switch(g){case 2:case 4:d=g-b;break;case 3:case 5:d=g-2*b;break;case 6:d=0===b?g:1===b?2:1;break;case 7:d=0===b?g:g-2*b+1;break;default:d=
g}return d},getOnePixel:function(g,b,d,f){g=0;switch(d){case 0:g=f.getInt8(b);break;case 1:g=f.getUint8(b);break;case 2:g=f.getInt16(b,!0);break;case 3:g=f.getUint16(b,!0);break;case 4:g=f.getInt32(b,!0);break;case 5:g=f.getUInt32(b,!0);break;case 6:g=f.getFloat32(b,!0);break;case 7:g=f.getFloat64(b,!0);break;default:throw"the decoder does not understand this pixel type";}return g}},u=function(g,b,d){this.val=g;this.left=b;this.right=d};return{decode:function(g,b){b=b||{};var d=b.maskData||null===
b.maskData,f=b.noDataValue,a=0,e={};e.ptr=b.inputOffset||0;e.pixels={};if(p.readHeaderInfo(g,e)){var a=e.headerInfo,k=p.getDataTypeArray(a.imageType);if(d)e.pixels.resultMask=b.maskData,e.ptr+=4;else if(!p.readMask(g,e))return;d=a.width*a.height;e.pixels.resultPixels=new k(d);e.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};if(0!==a.numValidPixel)if(a.zMax===a.zMin)p.constructConstantSurface(e);else{var m=new DataView(g,e.ptr,2),q=m.getUint8(0,!0);e.ptr++;q?p.readDataOneSweep(g,
e,k):1<a.fileVersion&&1>=a.imageType&&1E-5>Math.abs(a.maxZError-.5)?(m=m.getUint8(1,!0),e.ptr++,m?p.readHuffman(g,e,k):p.readTiles(g,e,k)):p.readTiles(g,e,k)}e.eofOffset=e.ptr;b.inputOffset?(k=e.headerInfo.blobSize+b.inputOffset-e.ptr,1<=Math.abs(k)&&(e.eofOffset=b.inputOffset+e.headerInfo.blobSize)):(k=e.headerInfo.blobSize-e.ptr,1<=Math.abs(k)&&(e.eofOffset=e.headerInfo.blobSize));k={width:a.width,height:a.height,pixelData:e.pixels.resultPixels,minValue:a.zMin,maxValue:a.zMax,maskData:e.pixels.resultMask};
if(e.pixels.resultMask&&p.isValidPixelValue(a.imageType,f)){m=e.pixels.resultMask;for(a=0;a<d;a++)m[a]||(k.pixelData[a]=f);k.noDataValue=f}e.noDataValue=f;b.returnFileInfo&&(k.fileInfo=p.formatFileInfo(e));return k}},getBandCount:function(g){for(var b=0,d=0,f={ptr:0,pixels:{}};d<g.byteLength-58;)p.readHeaderInfo(g,f),d+=f.headerInfo.blobSize,b++,f.ptr=d;return b}}})},"esri/layers/pixelFilters/VectorFieldPixelFilter":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../../kernel ../../lang dojo/_base/array".split(" "),
function(r,p,u,g,b,d){r=r(null,{declaredClass:"esri.layers.pixelFilters.VectorFieldPixelFilter",speedUnits:["esriMetersPerSecond","esriKilometersPerHour","esriKnots","esriFeetPerSecond","esriMilesPerHour"],constructor:function(b){p.mixin(this,b);this.isDataUV=b&&b.isDataUV?b.isDataUV:!1;this.computeMagnitudeAndDirection=p.hitch(this,this.computeMagnitudeAndDirection);this.unitConversionFactor=1;this._updateUnitConvFactor()},setUnits:function(b,a){this.inputUnit=b;this.outputUnit=a;this.unitConversionFactor=
1;this._updateUnitConvFactor()},_updateUnitConvFactor:function(){var b=d.indexOf(this.speedUnits,this.inputUnit),a=d.indexOf(this.speedUnits,this.outputUnit);if(this.inputUnit&&this.outputUnit&&0<=b&&0<=a){var e=[1,.277778,.514444,.3048,.44704,0];this.unitConversionFactor=e[b]/e[a]}},computeMagnitudeAndDirection:function(d){if(!b.isDefined(d))throw"Could not compute magnitude and direction. No pixel data is available.";var a=d.pixelBlock;if(!b.isDefined(a)||2!==a.getPlaneCount())throw"Could not compute magnitude and direction. Pixel data does not contain two bands.";
var e=d.extent,f=(e.xmax-e.xmin)/a.width,g=(e.ymax-e.ymin)/a.height,q=e.xmin+f/2,e=e.ymax-g/2;a.statistics[0].minValue=0;a.statistics[0].maxValue=0;var h=180/Math.PI,n=[],l=0,p=0,r=0,u=!b.isDefined(a.mask),x,y,z,w,C,E,v,B;C=v=Infinity;E=B=-Infinity;for(l=0;l<a.height;l++)for(p=0;p<a.width;p++,r++)if(n.push([q+f*p,e-g*l]),u||a.mask[r])z=x=a.pixels[0][r]*this.unitConversionFactor,w=y=a.pixels[1][r],this.isDataUV&&(z=Math.sqrt(x*x+y*y),w=90-h*Math.atan2(y,x),a.pixels[0][r]=z*this.unitConversionFactor,
a.pixels[1][r]=w),z>E&&(E=z),z<C&&(C=z),w>B&&(B=w),w<v&&(v=w);a.statistics[0].maxValue=E;a.statistics[0].minValue=C;a.statistics[1].maxValue=B;a.statistics[1].minValue=v;d.locations=n;return d}});u("extend-esri")&&p.setObject("layers.pixelFilters.VectorFieldPixelFilter",r,g);return r})},"esri/layers/rasterFormats/ImageCanvasDecoder":function(){define(["require","dojo/_base/declare","dojo/Deferred","dojo/sniff"],function(r,p,u,g){var b;return p(null,{constructor:function(b){this.ctx=b.ctx;this._loadRasterFormatModule()},
decode:function(b,f){if(!f.width||!f.height)throw"Native decoding requires the image format, width and height";var a=new u,d,g=new Uint8Array(b),m=this._getFormat(b);if("error"===m)throw"invalid format";"jpeg"===m&&(d=this._getMask(g,f));var q="",h,n;for(h=0;h<g.length;h+=65535)n=g.subarray(h,h+65535>g.length-1?g.length-1:h+65535),q+=String.fromCharCode.apply(null,n);var g="data:image/"+m+";base64,"+window.btoa(q),l=new Image,p;l.src=g;var r=this;l.onload=function(){r.ctx.clearRect(0,0,f.width,f.height);
r.ctx.drawImage(l,0,0);var b=r.ctx.getImageData(0,0,l.width,l.height);p=b.data;if(d)for(h=0;h<d.length;h++)p[4*h+3]=d[h]?255:0;r.ctx.putImageData(b,0,0);a.resolve(null)};l.onerror=function(){a.reject("cannot load image")};return a},_getFormat:function(b){b=new Uint8Array(b,0,10);var d="error";255===b[0]&&216===b[1]?d="jpeg":137===b[0]&&80===b[1]&&78===b[2]&&71===b[3]&&(d="png");return d},_getMask:function(d,f){var a;try{if(!b)throw"The zlib decoder module is not loaded.";var e=0,g=0,m=Math.round(d.length/
2);1===m%2&&(m+=1);for(var q=d.length-2,e=m;e<q&&(255!==d[e]||217!==d[e+1]);e++);m=e+=2;if(m<d.length-1){var h=(new b(d.subarray(m))).getBytes();a=new Uint8Array(f.width*f.height);for(e=m=0;e<h.length;e++)for(g=7;0<=g;g--)a[m++]=h[e]>>g&1}}catch(n){}return a},_loadRasterFormatModule:function(){10>g("ie")||r(["./Zlib"],function(d){b=d})}})})},"esri/tasks/ImageServiceIdentifyTask":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../request ../geometry/normalizeUtils ./Task ./ImageServiceIdentifyResult".split(" "),
function(r,p,u,g,b,d,f,a){r=r(f,{declaredClass:"esri.tasks.ImageServiceIdentifyTask",constructor:function(a){this._url.path+="/identify";this._handler=p.hitch(this,this._handler)},__msigns:[{n:"execute",c:3,a:[{i:0,p:["geometry"]}],e:2}],_handler:function(b,d,f,g,h){try{var e=new a(b);this._successHandler([e],"onComplete",f,h)}catch(l){this._errorHandler(l,g,h)}},execute:function(a,d,f,g){var e=g.assembly;a=this._encode(p.mixin({},this._url.query,{f:"json"},a.toJson(e&&e[0])));var k=this._handler,
l=this._errorHandler;return b({url:this._url.path,content:a,callbackParamName:"callback",load:function(a,b){k(a,b,d,f,g.dfd)},error:function(a){l(a,f,g.dfd)}})},onComplete:function(){}});d._createWrappers(r);u("extend-esri")&&p.setObject("tasks.ImageServiceIdentifyTask",r,g);return r})},"esri/tasks/Task":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/has ../kernel ../deferredUtils ../urlUtils ../Evented".split(" "),function(r,p,u,g,b,d,f,a){r=r(a,{declaredClass:"esri.tasks._Task",
_eventMap:{error:["error"],complete:["result"]},constructor:function(a,b){a&&p.isString(a)&&(this._url=f.urlToObject(this.url=a));b&&b.requestOptions&&(this.requestOptions=b.requestOptions);this.normalization=!0;this._errorHandler=p.hitch(this,this._errorHandler);this.registerConnectEvents()},_useSSL:function(){var a=this._url,b=/^http:/i;this.url&&(this.url=this.url.replace(b,"https:"));a&&a.path&&(a.path=a.path.replace(b,"https:"))},_encode:function(a,b,d){var e,f,g={},k,m;for(k in a)if("declaredClass"!==
k&&(e=a[k],f=typeof e,null!==e&&void 0!==e&&"function"!==f))if(p.isArray(e))for(g[k]=[],m=e.length,f=0;f<m;f++)g[k][f]=this._encode(e[f]);else"object"===f?e.toJson&&(f=e.toJson(d&&d[k]),"esri.tasks.FeatureSet"===e.declaredClass&&f.spatialReference&&(f.sr=f.spatialReference,delete f.spatialReference),g[k]=b?f:u.toJson(f)):g[k]=e;return g},_successHandler:function(a,b,f,g){b&&this[b].apply(this,a);f&&f.apply(null,a);g&&d._resDfd(g,a)},_errorHandler:function(a,b,d){this.onError(a);b&&b(a);d&&d.errback(a)},
setNormalization:function(a){this.normalization=a},onError:function(){}});g("extend-esri")&&(b.Task=r);return r})},"esri/tasks/ImageServiceIdentifyResult":function(){define("dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../geometry/jsonUtils ./FeatureSet".split(" "),function(r,p,u,g,b,d){r=r(null,{declaredClass:"esri.tasks.ImageServiceIdentifyResult",constructor:function(f){f.catalogItems&&(this.catalogItems=new d(f.catalogItems));f.location&&(this.location=b.fromJson(f.location));this.catalogItemVisibilities=
f.catalogItemVisibilities;this.name=f.name;this.objectId=f.objectId;this.value=f.value;this.processedValues=f.processedValues;this.properties=f.properties}});u("extend-esri")&&p.setObject("tasks.ImageServiceIdentifyResult",r,g);return r})},"esri/tasks/FeatureSet":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/has ../kernel ../lang ../graphic ../SpatialReference ../graphicsUtils ../geometry/jsonUtils ../symbols/jsonUtils".split(" "),function(r,p,u,g,b,d,f,a,e,k,m){r=r(null,
{declaredClass:"esri.tasks.FeatureSet",constructor:function(b){if(b){p.mixin(this,b);var d=this.features,e=b.spatialReference,g=k.getGeometryType(b.geometryType),e=this.spatialReference=new a(e);this.geometryType=b.geometryType;b.fields&&(this.fields=b.fields);u.forEach(d,function(a,b){var h=a.geometry&&a.geometry.spatialReference;d[b]=new f(g&&a.geometry?new g(a.geometry):null,a.symbol&&m.fromJson(a.symbol),a.attributes);d[b].geometry&&!h&&d[b].geometry.setSpatialReference(e)});this._hydrate()}else this.features=
[]},displayFieldName:null,geometryType:null,spatialReference:null,fieldAliases:null,toJson:function(a){var b={};this.displayFieldName&&(b.displayFieldName=this.displayFieldName);this.fields&&(b.fields=this.fields);this.spatialReference?b.spatialReference=this.spatialReference.toJson():this.features[0]&&this.features[0].geometry&&(b.spatialReference=this.features[0].geometry.spatialReference.toJson());this.features[0]&&(this.features[0].geometry&&(b.geometryType=k.getJsonType(this.features[0].geometry)),
b.features=e._encodeGraphics(this.features,a));b.geometryType=b.geometryType||this.geometryType;b.exceededTransferLimit=this.exceededTransferLimit;b.transform=this.transform;return d.fixJson(b)},_hydrate:function(){var a=this.transform,b=this.geometryType;if(a&&b)for(var d=this.features,e=a.translate[0],f=a.translate[1],g=a.scale[0],k=a.scale[1],m=function(a,b,d){if("esriGeometryPoint"===a)return function(a){a.x=b(a.x);a.y=d(a.y)};if("esriGeometryPolyline"===a||"esriGeometryPolygon"===a)return function(a){a=
a.rings||a.paths;var e,f,g,k,h,l,m,n;e=0;for(f=a.length;e<f;e++)for(h=a[e],g=0,k=h.length;g<k;g++)l=h[g],0<g?(m+=l[0],n+=l[1]):(m=l[0],n=l[1]),l[0]=b(m),l[1]=d(n)};if("esriGeometryEnvelope"===a)return function(a){a.xmin=b(a.xmin);a.ymin=d(a.ymin);a.xmax=b(a.xmax);a.ymax=d(a.ymax)};if("esriGeometryMultipoint"===a)return function(a){a=a.points;var e,f,g,k,h;e=0;for(f=a.length;e<f;e++)g=a[e],0<e?(k+=g[0],h+=g[1]):(k=g[0],h=g[1]),g[0]=b(k),g[1]=d(h)}}(b,function(a){return a*g+e},function(a){return f-
a*k}),a=0,b=d.length;a<b;a++)d[a].geometry&&m(d[a].geometry);this.transform=null},quantize:function(a){if(!this.geometryType)return this.transform=null,this;var b=a.translate[0],d=a.translate[1],e=a.scale[0],f=a.scale[1],g=this.features,k=function(a,b,d){var e,f,g,k,h,l,m=[];e=0;for(f=a.length;e<f;e++)if(g=a[e],0<e){if(l=b(g[0]),g=d(g[1]),l!==k||g!==h)m.push([l-k,g-h]),k=l,h=g}else k=b(g[0]),h=d(g[1]),m.push([k,h]);return 0<m.length?m:null},m=function(a,b,d){if("esriGeometryPoint"===a)return function(a){a.x=
b(a.x);a.y=d(a.y);return a};if("esriGeometryPolyline"===a||"esriGeometryPolygon"===a)return function(a){var e,f,g,h,l;g=a.rings||a.paths;l=[];e=0;for(f=g.length;e<f;e++)h=g[e],(h=k(h,b,d))&&l.push(h);return 0<l.length?(a.rings?a.rings=l:a.paths=l,a):null};if("esriGeometryMultipoint"===a)return function(a){var e;e=k(a.points,b,d);return 0<e.length?(a.points=e,a):null};if("esriGeometryEnvelope"===a)return function(a){return a}}(this.geometryType,function(a){return Math.round((a-b)/e)},function(a){return Math.round((d-
a)/f)}),p,q;p=0;for(q=g.length;p<q;p++)g[p].geometry&&(m(g[p].geometry)||g[p].setGeometry(null));this.transform=a;return this}});g("extend-esri")&&p.setObject("tasks.FeatureSet",r,b);return r})},"esri/tasks/ImageServiceIdentifyParameters":function(){define("dojo/_base/declare dojo/_base/lang dojo/_base/json dojo/_base/array dojo/has ../kernel ../lang ../geometry/jsonUtils".split(" "),function(r,p,u,g,b,d,f,a){r=r(null,{declaredClass:"esri.tasks.ImageServiceIdentifyParameters",geometry:null,mosaicRule:null,
renderingRule:null,renderingRules:null,pixelSizeX:null,pixelSizeY:null,pixelSize:null,returnGeometry:!1,returnCatalogItems:!0,timeExtent:null,toJson:function(b){var d=b&&b.geometry||this.geometry;b={geometry:d,returnGeometry:this.returnGeometry,returnCatalogItems:this.returnCatalogItems,mosaicRule:this.mosaicRule?u.toJson(this.mosaicRule.toJson()):null,renderingRule:this.renderingRule?u.toJson(this.renderingRule.toJson()):null};d&&(b.geometryType=a.getJsonType(d));d=this.timeExtent;b.time=d?d.toJson().join(","):
null;f.isDefined(this.pixelSizeX)&&f.isDefined(this.pixelSizeY)?b.pixelSize=u.toJson({x:parseFloat(this.pixelSizeX),y:parseFloat(this.pixelSizeY)}):this.pixelSize&&(b.pixelSize=this.pixelSize?u.toJson(this.pixelSize.toJson()):null);this.renderingRules&&(b.renderingRules=u.toJson(g.map(this.renderingRules,function(a){return a.toJson()})));return b}});b("extend-esri")&&p.setObject("tasks.ImageServiceIdentifyParameters",r,d);return r})},"*noref":1}});
define("esri/layers/ArcGISImageServiceLayer","dojo/_base/declare dojo/_base/lang dojo/has ../kernel ../config ./DynamicMapServiceLayer ./ImageServiceLayerMixin".split(" "),function(r,p,u,g,b,d,f){r=r([d,f],{declaredClass:"esri.layers.ArcGISImageServiceLayer",constructor:function(a,b){this._initialize(a,b);this.useMapImage=b&&b.useMapImage||!1},refresh:function(a){if(a)this.inherited(arguments);else{var b=this.disableClientCaching;this.disableClientCaching=!0;this.inherited(arguments);this.disableClientCaching=
b}},setRenderer:function(a,b){this.renderer=a;this.onRendererChange();b||this.refresh(!0)},exportMapImage:function(a,d){var e=b.defaults.map,e=p.mixin({size:e.width+","+e.height},this._params,a?a.toJson(this.normalization):{},{f:"json"});delete e._ts;this._exportMapImage(this._url.path+"/exportImage",e,d)}});u("extend-esri")&&p.setObject("layers.ArcGISImageServiceLayer",r,g);return r});